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

problem with debugger start address

Hello,
I have Cortex-M3 and encountered problems when using scatter file: (I just want to keep space 4kb at the beginning of the code space)

LR_IROM1 0x08000000 0x01000{ ER_IROM1 0x08000000 ABSOLUTE EMPTY 0x1000 { ;0x1000 empty space }
}

LR_IROM2 0x08001000 0x3F000{ ER_IROM2 0x08001000 ABSOLUTE 0x3F000{ STM32F10x.o(RESET, +First) ; vector table *.o(+RO) *(InRoot$$Sections) }

RW_IRAM2 0x20000000 0x0000C000 { ; RW data *.o(+RW +ZI) }
}

After I compile the project and download the image into target, debugger puts its pointer at address 0x00000000 which is complete nonsence. Disassemly window looks like this:

***************************************************************************************** 151: 152: /* Get status to se if WIP (write in progress) clear */
0x00000000 5700 LDRSB r0,[r0,r4] 153: sr = Fls_RDSR();
0x00000002 2000 MOVS r0,#0x00
0x00000004 8799 STRH r1,[r3,#0x3C]
0x00000006 0800 LSRS r0,r0,#0
******************************************************************************************
There should be main at address somewhere in 0x0800xxxx. The same happens when I don't use scatter file but set the R/O Base to 0x08001000 in the Linker Tab. If I put in the default value 0x08000000 everything works fine. I use ST-Link.

Does anybody have an idea what's wrong? How could I force the debugger to show propper entry point?

Thank you in advance for any hint.

Parents
  • Here is a simple uVision initialization file for code that is loaded to 0x40000:

    FUNC void Setup (void)
    {
        SP = _RDWORD(0x00040000);           // Setup Stack Pointer
        PC = _RDWORD(0x00040004);           // Setup Program Counter
        _WDWORD(0xE000ED08, 0x00040000);    // Setup Vector Table Offset Register
    }
    
    LOAD _OBJ\lpc1788_rtx_blinky.axf INCREMENTAL    // Download
    Setup();                                        // Setup for Running
    

    Note: put this in a XXX.ini text file and under "Target Option -> Debug" select this file as the initialization file.

Reply
  • Here is a simple uVision initialization file for code that is loaded to 0x40000:

    FUNC void Setup (void)
    {
        SP = _RDWORD(0x00040000);           // Setup Stack Pointer
        PC = _RDWORD(0x00040004);           // Setup Program Counter
        _WDWORD(0xE000ED08, 0x00040000);    // Setup Vector Table Offset Register
    }
    
    LOAD _OBJ\lpc1788_rtx_blinky.axf INCREMENTAL    // Download
    Setup();                                        // Setup for Running
    

    Note: put this in a XXX.ini text file and under "Target Option -> Debug" select this file as the initialization file.

Children