Re: [arm-gnu] Image size reduction with linker optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Image size reduction with linker optimization



On Thu, 2009-02-05 at 16:55 -0500, Daniel Jacobowitz wrote:
> Normally this means you did not tell the linker about the entry point
> of your program.  Try adding a -Wl,-e,SYMBOLNAME if the entry point is
> not named _start, or using KEEP in the linker script to ensure the
> reset vector is not discarded.

Thanks Daniel, for your help.

I added both.  The Reset_Handler function (not named _start) is in the
linked file as reported by nm.  The objdump shows a reset vector at the
beginning.

For some reason, openocd seems to not flash the device correctly unless
the code is built without optimisation or -gc-sections!  As yet I have
no idea what the difference is to openocd, because I pass it the binary,
why should it care?  It seems very coincidental that if I use -O2
instead of -O0, or -ffunction-sections -fdata-sections -Wl,-gc-sections,
I get this while trying to flash the device, otherwise openocd works a
treat.

> flash write_bank 0 ./obj/ct_in.bin 0
BUG: keep_alive() was not invoked in the 1000ms timelimit. GDB alive
packet not sent! (1079)
timed out while waiting for target halted
error executing stm32x flash write algorithm
flash writing failed with error code: 0xfffffc7a
error writing to flash at address 0x08000000 at offset 0x00000000 (-902)

called at file "command.c", line 456
called at file "embedded:startup.tcl", line 89
called at file "embedded:startup.tcl", line 93

This may be better asked of the openocd people?

Regards,
James.