Linker Script Question

For the sample linker script below I have two questions....

1) How can I make sure the image between the end of output1 and the beginning of output2 is filled with 0xff - or a value of my chosing?

2) Even though output2 is only small, how can I force the image to extend up to the end of bootsec and be padded with 0xff - or a value of my chosing?

All day I've been trying various things from the ld manual but have nothing to show for it :-(

MEMORY { bootsec (wx) : ORIGIN =0x00000000, LENGTH = 16k }

SECTIONS { output1 0x0000 : { bootstrap.o(.text) } >bootsec =0xffffffff

output2 0x3e00 : { version_string.o(.data) } >bootsec =0xffffffff }

Reply to
Alfie Noakes
Loading thread data ...

Did you try adding, inside output*, something like: .=3Dlast_address long(0xffffffff)

Hope that helps, Best Regards, Dave

Reply to
Dave Nadler

I did try bumping the current address as you suggest but that didn't work. I finally got the answer from a reply in comp.sys.arm

It turns out objcopy has the options --gap-fill and --pad-to which do exactly what I want.

So doing the objcopy post-link fits the bill.

Reply to
Alfie Noakes

Did you follow bumping the address with something like LONG(..) so that there is an actual gap in the area ?

Anyway, glad you got objcopy to do it ! Best Regards, Dave

Reply to
Dave Nadler

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.