Binary file of 2G!

OP (Company: BLT Italia SRL) #1664470
Rate this post
• ▲ useful
▼ not useful
Hi to all
I am using a NXP LPC2378 with the USB interface so I have declared the 
USB RAM in the linker script file in order to allocate here buffer for 
DMA.

  USBRAM (rw) : ORIGIN = 0x7fd00000, LENGTH = (8k)

I have defined a particular location in this ram :

  .usbshare (0x7fd01FFC) :
  {
    *(.usbshare)
    *(.usbshare.*)
    . = ALIGN(4);
  } > USBRAM
  . = ALIGN(4);

and then forced the compiler to place a variable there:

BYTE  DataRun __attribute__((section(".usbshare")));

well if I compile my file, the dimension of the bin file is about 2G ! 
!.  If I place the DataRun variable elsewere in memory (without the 
_attribute_ directive) the bin file is of 167K as should be. If I 
insert in the make file the hex format as output , the dimension of the 
hex file is correct in both cases.
Did someone have an idea how to resolve  ?
Moderator #1664676
Rate this post
• ▲ useful
▼ not useful
bin files hold a "flat" image of the memory-content. Intel-hex format 
can handle "memory-holes" since the addresses are included in every 
record (line).
So far I have not used ".output-section (memory-address)" style. You may 
try to use (NOLOAD) as attribute for the output-section. The binutils 
ld-manual should provide further information.
Guest #1664702
Rate this post
• ▲ useful
▼ not useful
I once had the same problem. This resulted in the huge bin file you see:

arm-none-eabi-objcopy -O $(FORMAT) $< ./release/$@

Explicitly specifying the desired sections did it for me:

arm-none-eabi-objcopy -O $(FORMAT) -j .text -j .isr_vector -j .data $< 
./release/$@

Reply

A question of your own? This thread is over 16 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.