This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is it possible to use the content of a file in binary format in C and assembly file? thanks


"Qiang Huang" <jameshq at liverpool dot ac dot uk> writes:

>    Is it possible to use the content of another file in pure binary
> format in C file?(ARM target)

Objcopy is your friend. Example session:

~ $ echo "hello, world" > file.bin
~ $ arm-elf-objcopy -B arm -I binary -O elf32-littlearm file.bin file.o
~ $ arm-elf-objdump -x file.o

file.o:     file format elf32-littlearm
file.o
architecture: arm, flags 0x00000010:
HAS_SYMS
start address 0x00000000
private flags = 0: [APCS-32] [FPA float format]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         0000000c  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
00000000 l    d  .data	00000000 
00000000 g       .data	00000000 _binary_file_bin_start
0000000c g       .data	00000000 _binary_file_bin_end
0000000c g       *ABS*	00000000 _binary_file_bin_size



Regards,
   --Daniel


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]