Relocating ResetHandler() to different location in FLASH

Status
Not open for further replies.

Jian

Member
My simple blinker application runs fine with default linker script. The default scrip will put ResetHandler() in "startup.c" at 0x60001034. If I move it to different location, it will not boot. Don't understand why.

[ main.cpp file ]
Code:
#include <Arduino.h>
extern "C" int main(void){
    pinMode(13, OUTPUT);
    while (1) {
        digitalWriteFast(13, HIGH);
        delay(500);
        digitalWriteFast(13, LOW);
        delay(500);
    }
}
--------------------------

[ linker.ld ]
Code:
...
SECTIONS
{
	.text.progmem : {
		KEEP(*(.flashconfig))
		FILL(0xFF)
		. = ORIGIN(FLASH) + 0x1000;   
		KEEP(*(.ivt))
		KEEP(*(.bootdata))
		KEEP(*(.vectors))
     /*	FILL(0xFF) 
		. = ORIGIN(FLASH) + 0x1100;    */     /* put ResetHandler() to 0x60001100 instead of the default 0x60001035.  Will NOT boot. */
		KEEP(*(.startup))   
...
 
Status
Not open for further replies.
Back
Top