2024-12-02 05:33 AM - last edited on 2024-12-02 06:14 AM by SofLit
Hello ,
I am working with stm32h747.
M4 .ld File
FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K
M7 .ld File
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
With the above settings I can run Core M7 and M4 properly.
I need more flash on the m7 side and I want to separate the flash as follows
M4 .ld File
FLASH (rx) : ORIGIN = 0x081E0000, LENGTH = 128K
M7 .ld File
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1896K
I also make adjustments with cube programer as in the picture.
Core m7 works but m4 doesn't seem to work.I think I'm missing something or doing something wrong. Can you help me?
Codes are as follows
CM4 Main Code :
int main(void)
{
MPU_Config();
__HAL_RCC_HSEM_CLK_ENABLE();
HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
HAL_PWREx_ClearPendingEvent();
HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
__HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
HAL_Init();
MX_MDMA_Init();
MX_DMA_Init();
MX_GPIO_Init();
MX_SPI1_Init();
while (1)
{
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
HAL_Delay(100);
}
}
int main(void)
{
int32_t timeout;
MPU_Config();
SCB_EnableICache();
SCB_EnableDCache();
timeout = 0xFFFF;
while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
HAL_Init();
SystemClock_Config();
PeriphCommonClock_Config();
__HAL_RCC_HSEM_CLK_ENABLE();
HAL_HSEM_FastTake(HSEM_ID_0);
HAL_HSEM_Release(HSEM_ID_0,0);
timeout = 0xFFFF;
while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) == RESET) && (timeout-- > 0));
if ( timeout < 0 )
{
Error_Handler();
}
MX_GPIO_Init();
while (1)
{
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_1);
HAL_Delay(100);
}
}
Solved! Go to Solution.
2024-12-04 10:03 AM
I think you can also get the CM7 to start the CM4 side.
Or create a unified image, where say the startup code can detect which core it's running on, and fork to the code/vector space each uses, with the SystemInit() code then establishing where the SCB->VTOR lives.
ST has an annoying habit of using #defines for this independently of the Linker Script, but you can use symbols, ie g_pfnVectors to establish this on-the-fly. Look at your SystemInit() code in system_stm32xyz.c
2024-12-04 10:45 AM
You can use the project as is ... you need just to check the power config SMPS or LDO.
2024-12-04 10:56 AM
My configs
- 400 MHz M7
- 200 MHz M4
HSE : Crystal/Ceramic Resonator.
Supply source : PWR_DIRECT_SMPS_SUPPLY
Power Regulator Voltage Scale : Power Regulator Voltage Scale 1. (Scale 2 and 3 inactive )
2024-12-04 11:10 AM - edited 2024-12-05 12:29 AM
No matter your clock config is the example I shared should work as I used the internal clock. The only think to take care of is the power config. As your project is setting SMPS power config you can use the project as is without any modification. The idea is to check two things: your MCU is OK and also to confim what I've explained previously from linker standpoint.