Hi,
I'm using Keil uVision. I need my application to start at address 0x08001000 and not on the flash base address 0x08000000. So I changed the R/O Base address in the Linker window to 0x08001000.
After linking and starting debugging (CTL+F5) the Disassembly Window, when stepping through shows addresses at 0x08000000 and up while the .map file shows that code is located at 0x08001000.
How can that be explained?
Thanks
Henk
Maybe because you moved the code, but not the entry point...
partly I think you are right.
I flashed the application to address 0x08000000. (A) I flashed the same application to address 0x08001000. (B)
The Utilities > Setting was set to Erase Sector, not to Erase Chip...
...so the same program resides in memory twice and I was executing the old application in (A) while the new application was flashed in (B).
But, still I don't understand why it starts in (A). As far as I know the startup file stm32f10x.s automatically configurates the Reset_Handler to grab the addres of __main (programming in C) and jumps to that address.
some additional info:
when debugging, when the application is loaded in (B) then the application does not run and the stackpointer initially points to 0xfffffffe. So what do I need more to make my application run on any other address different from the flash base address???
Thanks,
Me again...
I mean: the PROGRAM COUNTER (not the stack pointer) points to 0xFFFF FFFE.
The stack pointer points to 0xFFFF FFFC. The Link register to 0xFFFF FFFF
You don't mention what processor you are using?
Is it even possible to run the application at that address? Where is the interrupt vector table? At address 0? Or at address 0x08000000? Somewhere else?
When testing programs, it's possible to load them to just about any location in RAM, and then use an init file to the debugger to set the PC to the reset address of the program. But when testing a real program by booting the processor, you need to have the reset vector, vector table, ... at expected locations.
I'm using the STM32F103ZE uC.
The valid flash locatins are 512KB ranging from 0x0800 0000 up to 0x0807 FFFF.
The application itself I think is correctly loaded at (B).
The vectortable by default is at address 0x0800 0000 also mapped at address 0x0000 0000 and can be given any offset.
I modified the Reset_Handler so it loads the main() address in (B) but somehow the debugger does not run well. It skips executable code so I can't trace what code path really is executed.
I leave it this way and will ask a new question concerning the debugger because that's the real problem I think.