cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Dual Core MCU CM4 FLASH 0x081E0000

snnzdmr1
Associate III

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.b.pnga.png

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);
  }
}
​

CM7 Main  Code :
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);
  }
}
1 ACCEPTED SOLUTION

Accepted Solutions

Ok,

Please try this simple blink LED example in attachment (I used NUCLEO-H745):

- I used SMPS as power configuration

- Yellow LED (PE1) toggling with CM4

- Green LED (PB0) toggling with CM7

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

13 REPLIES 13
SofLit
ST Employee

Hello,

First in next time, please use </> button to paste your code.

Second,

Don't modify option bytes. Keep the default boot address:

SofLit_0-1733148758284.png

Just use the linker file as you did:

FLASH (rx) : ORIGIN = 0x081E0000, LENGTH = 128K

 I'm editing your post then. 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Okay, I'll use this for the code area now.(</>)
As you said, I only changed the CM4 .ld file. The code 0x081e0000 is loaded to this address. I can verify this with cube programer. I do not change the Option bytes. Default boot address(0x08100000 ). But still CM4 is not working.



@snnzdmr1 wrote:

 I do not change the Option bytes. Default boot address(0x08100000 ). But still CM4 is not working.


Sorry, this is not the default option byte value for boot address and I think 'e' in 0x081E0000 came from your configuration:

SofLit_0-1733215235055.png

From the RM. The factory value is 0x0810 while you have 0x081e.

SofLit_1-1733215476143.png

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Yes. The default address for M4 is 0x081E0000. My goal is to allocate more flash for M7. 1024 kbytes is not enough for me. I want to decrease the flash of M4 and increase the flash of M7. For this, I want to start m4 from this address 0x081E0000.

This is what I want to tell you from my first post. You don't have to manage that in option bytes just do it in the linker file.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I do what you say.M4 still not working.I did not change the options bytes. 
My settings are exactly as follows.
M4 core not working.

FLASH (rx) : ORIGIN = 0x081E0000, LENGTH = 128

c.png

Ok,

Please try this simple blink LED example in attachment (I used NUCLEO-H745):

- I used SMPS as power configuration

- Yellow LED (PE1) toggling with CM4

- Green LED (PB0) toggling with CM7

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Project upated with an updated CM7 linker file:

  FLASH   (rx)   : ORIGIN = 0x08000000, LENGTH = 1920K

2048K - 128K = 1920K

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Unfortunately I don't have  to NUCLEO-H745 try this code.

You tried it and if it works I will focus on finding my own mistake.  Thank you very much for your detailed help.