[SOLVED] possible missing code in thumb_crt0.s if using TCM

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] possible missing code in thumb_crt0.s if using TCM

    Dear all,

    I played around with TCM on a SAME70 device. After a while I get it to work. During my experiments I came across the point to copy function code from the internal flash to the TCM memory. According to the Application Note AN44047 from Atmel/Microchip this needs to be done after the GPNVM bits are set according to the size of TCM memory you are requesting and after enabling the TCM in the System Control Block register.
    If you setup a project for a SAME70 device the thumb_crt0.s contains already the part for copying code and data to the corresponding TCM memory areas. It is covered by a ifdefine (INITIALIZE_TCM_SECTIONS) so it can be activated easily. However, the part for setting the GPNVM bits and enabling TCM is missing. For me that makes not much sense. Anyone has any suggestions?

    Best Regards
  • Hi Markus,

    The crt0 is the generic memory initialization that is independent from hardware.

    Before _start is called, the Reset_Handler will call system initialization, and, if defined, memory initialization.
    This is the target-specific part where you can enable and configure TCM.

    Source Code

    1. Reset_Handler:
    2. #ifndef NO_STACK_INIT
    3. /* Initialise main stack */
    4. ldr r0, =STACK_INIT_VAL
    5. bic r0, #0x7
    6. mov sp, r0
    7. #endif
    8. #ifndef NO_SYSTEM_INIT
    9. /* Initialise system */
    10. ldr r0, =SystemInit
    11. blx r0
    12. #endif
    13. #ifdef MEMORY_INIT
    14. ldr r0, =MemoryInit
    15. blx r0
    16. #endif
    Display All