On Thu, 2003-09-25 at 04:37, Øyvind Harboe wrote: > This is driving me nuts, and I can't seem to find a solution > to this on the net. > > I have a romfs image that I try to convert to a .o file using: > > > # how do I add a __attribute((aligned(4))__ to objcopy? > > arm-elf-objcopy -B arm -I binary -O elf32-littlearm --rename-section > .data=.rodata1 $*.rawdata $(OUTPUT)/$*_raw.o > > This is used to mount a ROMFS: > > extern "C" > { > extern const cyg_uint8 _binary___rom_rawdata_start[]; > } > > // this is not aligned to 4 bytes, and hence it does not work > sprintf( address, "%p", _binary___rom_rawdata_start); > err = mount( address, "rom", "romfs" ); > What I've done in the past is use GCC to get the magic right. Try looking at packages/hal/arm/edb7xxx/current/misc/long*.h These are binary data files which I then pass through GCC. I generated them using 'hexdump'. You can write a script to produce most any output you'd like. I've attached the few that I use. To use the script: % hexdump -f hex_init FILE 0x23, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000008 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000010 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000018 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000020 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000028 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000030 Be sure and use the "-v" option, or else it can end up like this: 0x23, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000008 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, // 0x000010 * 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x0a, 0x23, // 0x000050 0x0a, 0x23, 0x20, 0x20, 0x20, 0x20, 0x65, 0x63, // 0x000058 -- Gary Thomas MLB Associates