This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to fool the Linker?

Hi,

It's about the STM32F103ZE uC and Keil uVision4.

As part of trying to deeply understand the Keil ARM tools I just like to 'fool' the linker to place code in a valid random flash memory location and have it executed after reset.

I can place code in a random location just by changing the Linker option R/O Base from the default value 0x8000 0000 to 0x8000 2000 which is in the valid memory range.

But having done this, when start debugging then the program counter starts on address 0xFFFF FFFE. So probably somehow the linker is missing a reset vector and therefore does not initialize the program counter.

(I managed to run this code by partly loading flash code and partly loading only the reset-vector separately)

How can I succeed in making the uC program counter point to the reset vector (address 0x8000 0004) when code is loaded at address 0x8000 2000 to execute this code. So after a reset I can change the vector-table offset in assembler in the reset-handler at 0x8000 0004 and then jump to the reset-vector at address 0x0800 2004?

Or do I need to use/modify some scatter file for this operation?

Hope to hear from the experts... ;-)

Thanks,

Henk