relocating program code STM32F103VE


1 comment

  • Avatar
    Peter Lissenburg

    This question was posted twice. A solution was found. For completeness a copy of the solution is posted here. Pete L.


    This was due to a second call to SystemInit();; As the

    SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */

    line relied upon

    #define FLASH_BASE            ((uint32_t)0x08000000) /*!< FLASH base address in the alias region */

    Which is incorrect. As I want it to be 0x08008000 This does not normally matter because the start.s file sets it correctly ;

      ldr r0, =0xE000ED08
    #ifdef VECTORS_IN_RAM
      ldr r1, =_vectors_ram
      ldr r1, =_vectors
      str r1, [r0]

    Using _vectors, AFTER the call to SystemInit();

    However a second call to SystemInit(); buried in my code was resetting it to the incorrect address again.

    Once that second call was commented out, all worked well with just the edit to the MemoryMap file. No other changes needed.

    Now I'm having "fun" making memory segments and assigning them to pages in the bottom of flash Working well.

    Still a little confused about the vectors, because if I leave the first page blank. On the memory window in the debugger I see 0xFE (?) but if I write a bunch of data there my program won't start. Well that makes sense, but why can't I see the vectors? I can live in ignorance about that while I get other work done, but it would be nice to know.

    Cheers. Pete L.

    Comment actions Permalink

Please sign in to leave a comment.