Skip to main content
Visitor II
July 24, 2024
Question

Changing boot address of CM4 and CM7 in STM32H745 - Dual core

  • July 24, 2024
  • 1 reply
  • 2108 views

Hello Tesla

I need to run M4 from 0x08000000  and then M7 from 0x08100000.

Is there any example ?

 

Exactly I v'done my BOOT that runs on M4 (0x08000000) loads the Flash , then jumps into M4 (0x08040000).

Now i have to run M7 from 0x08100000, but i don't know how...

Please help :)

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    July 24, 2024

    Hello @uREG and welcome to the community.

    I moved your post from this one to a new thread as it's not the same question.

    You can manage that in the linker file:

    CM7:

     

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 2048K
    RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
    ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
    }

     

    CM4:

     

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
    RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 288K
    }

     

    In system_stm32h7xx.c, you need to modify the vector table offset address in such way you swap the addresses between CM4 and CM7 VTOR addresses.

    For CM4: (BANK1)

     

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

     

    For CM7: (BANK2)

     

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

     

     And for performance purposes, in stm32h7xx_hal.c don't forget to change the ART base address according to the BANK1 address:

     

    HAL_StatusTypeDef HAL_Init(void)
    {
    
    uint32_t common_system_clock;
    
    #if defined(DUAL_CORE) && defined(CORE_CM4)
     /* Configure Cortex-M4 Instruction cache through ART accelerator */
     __HAL_RCC_ART_CLK_ENABLE(); /* Enable the Cortex-M4 ART Clock */
     __HAL_ART_CONFIG_BASE_ADDRESS(0x08000000UL); /* Configure the Cortex-M4 ART Base address to the Flash Bank 1 : */
     __HAL_ART_ENABLE(); /* Enable the Cortex-M4 ART */
    #endif /* DUAL_CORE && CORE_CM4 */

     

    uREGAuthor
    Visitor II
    July 24, 2024

    Hello SofLit and thank You for the answer.

    The changes in linker files i've just done, also the ART relocation.

    The changes in 'system_stm32h7xx_dualcore_boot_cm4_cm7.c' file are debatable, because the file is common for CM4 and CM7 parts in STM32CubeIDE and i suppose the directives 'CORE_CM4' and 'CORE_CM7' made in Preprocessor menu [Properties-Tool Settings-MCU GCC Compiler-Preprocessor] are invisible !

    So I've done #define CORE_CM4 directly in that file, but this excludes CORE_CM7.

    All this #defines politics in Attolic/CubeIDE is unclear for me...

     

    But - what should I do in main.c files of both parts ?

     

    Thanks,

    Bartek.

    Visitor II
    September 27, 2024

    Hi Bartek,

    did you manage to solve the problem? I am trying to do the same thing, the CM4 started correctly in debug mode and wait but when I launch CM7 it runs directly without halt and addres starts with 0x801... which is not correct.

    If you got it running, can you please share your solution?

    Thank you in advance.

    Rocha