Generating data hex file with GCC
Anders Norman
kompis@online.no
Thu Dec 29 22:14:00 GMT 2005
My target system is an embedded 80186. I found that using:
gcc -c test.c
objcopy --change-address 0xE0000 -O ihex test.o test.hex
does the trick and puts the data at 0xE0000 where I want it.
Ingo Krabbe wrote:
>Am Donnerstag, 29. Dezember 2005 21:45 schrieb Anders Norman:
>
>
>>Hi,
>>
>>I need to create an Intel HEX file containing raw data for an embedded
>>solution. Source file would look something like this:
>>
>>const unsigned char myData[] =
>>{
>> 0x00, 0x00, 0x00, 0x00 ........
>>};
>>
>>I also need to locate the data at a specific location in memory.
>>
>>Can GCC handle this?
>>
>>What tools do I need in addition? objdump?
>>
>>regards,
>>Anders
>>
>>
>
>What you want is a program that writes your binary data into a specific memory
>location. In the general case the memory adresses a program sees are
>completly virtual, which is usefull cause all symbols and data will be
>relocatable when gcc generates an object file.
>
>The exact location of the data sections not under control of gcc but of the
>linker ld, which comes with the binutils package (if you don't have a system
>specific linker for your embedded system). With objdump (from binutils) you
>can control the relocation and symbol tables of an executable, a shared
>library or what ever you produce.
>
>This greatly depends on the type of data you produce finally. Is it an ELF
>executable or just an object file or a shared object library, a static libary
>archive or even a DLL. See your ld documentation.
>
>I have:
>ld: supported targets: elf32-i386 a.out-i386-linux efi-app-ia32 elf64-x86-64
>elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex binary
>ihex trad-core
>
>What you mean is possibly named as ihex target ?!
>
>As I say: See your ld documentation.
>
>
>
>
>
More information about the Gcc-help
mailing list