This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Is it possible to use the content of a file in binary format in C and assembly file? thanks
- From: daniel dot neri at sigicom dot se (Daniel Néri)
- To: ecos-discuss at sources dot redhat dot com
- Date: 26 Feb 2003 16:48:06 +0000
- Subject: [ECOS] Re: Is it possible to use the content of a file in binary format in C and assembly file? thanks
- Organization: Sigicom AB, Stockholm, Sweden
- References: <BDEPKKELILOKGOAOMONOCEKPCBAA.jameshq@liv.ac.uk>
"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