Skip to main content
Associate II
April 16, 2025
Solved

OpenAMP issue on STM32H745

  • April 16, 2025
  • 4 replies
  • 2340 views

Software: CUBEIDE:1.18.0
Firmware: STM32Cube_FW_H7_V1.12.1

Board: NUCLEO-H745ZI-Q

The problem is as follows: when using this chip for dual core communication, reproducing according to the example given by ST, communication cannot be carried out no matter what.

Through debugging, it was found that the problem lies in the OPENAMP_create_endpoint() function in the M4 core. The return value is -2005, but as a beginner, I am unable to pinpoint where the problem lies. I will attach my project at the end of the article.

My original goal was for the M7 core to send data to the M4 core, which would then print the data while the M7 core's LED would flash.

I have reviewed the corresponding routines in ST's AN5617 and firmware, and watched the corresponding videos, but still cannot solve the problem. I request your help

MECHO_0-1744812753218.png

 

Best answer by mƎALLEm

Hello @MECHO ,

In fact the issue has been already reported in this post.

In fact in your non-working project, you have this warning:

<command-line>: warning: "RPMSG_BUFFER_SIZE" redefined
<command-line>: note: this is the location of the previous definition

So in conclusion:

You have two issues from the beginning:

- You didn't update the linker files to allocate memory for OpenAMP.

- An issue with the generated code with STM32CuebIDE 1.18.0 (a regression from older versions)

4 replies

mƎALLEm
Technical Moderator
April 16, 2025

Hello @MECHO and welcome to the community,

OpenAMP needs a shared memory between both cores and accessible by both cores.

You need to declare a memory section where the message will be stored.

Looking at your project there is no declaration of that shared memory for OpenAMP in the linker file and the openamp conf file.

Look for example at the linker files in the example: Projects\STM32H747I-EVAL\Applications\OpenAMP\OpenAMP_PingPong\

CM4:

MEMORY
{
FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 288K
OPENAMP_RSC_TAB (xrw) 	: ORIGIN = 0x38000000, LENGTH = 1K
OPEN_AMP_SHMEM (xrw) 	: ORIGIN = 0x38000400, LENGTH = 63K
}
 __OPENAMP_region_start__ = ORIGIN(OPEN_AMP_SHMEM);
 __OPENAMP_region_end__ = ORIGIN(OPEN_AMP_SHMEM) + LENGTH(OPEN_AMP_SHMEM);

CM7:

MEMORY
{
FLASH (rx)	 		: ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) 	 		: ORIGIN = 0x20000000, LENGTH = 128K
ITCMRAM (xrw) 		: ORIGIN = 0x00000000, LENGTH = 64K
OPENAMP_RSC_TAB (xrw) 	: ORIGIN = 0x38000000, LENGTH = 1K
OPEN_AMP_SHMEM (xrw) 	: ORIGIN = 0x38000400, LENGTH = 63K
}
 __OPENAMP_region_start__ = ORIGIN(OPEN_AMP_SHMEM);
 __OPENAMP_region_end__ = ORIGIN(OPEN_AMP_SHMEM) + LENGTH(OPEN_AMP_SHMEM);

This memory sections are used by the Common\Inc\openamp_conf.h:

#else
/*
 * for GCC add the following content to the .ld file:
 * MEMORY
 * {
 * ...
 * OPEN_AMP_SHMEM (xrw) : ORIGIN = 0x38000400, LENGTH = 63K
 * }
 * __OPENAMP_region_start__ = ORIGIN(OPEN_AMP_SHMEM);
 * __OPENAMP_region_end__ = ORIGIN(OPEN_AMP_SHMEM) + LENGTH(OPEN_AMP_SHMEM);
 *
 * using the LENGTH(OPEN_AMP_SHMEM) to set the SHM_SIZE lead to a crash thus we
 * use the start and end address.
 */

extern int __OPENAMP_region_start__[]; /* defined by linker script */
extern int __OPENAMP_region_end__[]; /* defined by linker script */

#define SHM_START_ADDRESS ((metal_phys_addr_t)__OPENAMP_region_start__)
#define SHM_SIZE (size_t)((void *)__OPENAMP_region_end__ - (void *) __OPENAMP_region_start__)

#endif

As you didn't declare this shared memory it seems that OpenAMP library can't find a memory where to store the shared messages.

Hope that helps.

 

 

"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."
MECHOAuthor
Associate II
April 16, 2025

Thank you for your reply. May I ask how to declare this shared memory? I compared the contents of my files and did not see any abnormal situations.

MECHO_0-1744816426309.png

If you feel that my operation is incorrect, please help me modify it in my project so that I can clearly see what I did wrong. I once again request your assistance.

mƎALLEm
Technical Moderator
April 16, 2025

Please review the linker files OpenAMP_ttest\CM7\STM32H745ZITX_RAM.ld and OpenAMP_ttest\CM4\STM32H745ZITX_RAM.ld

This is what you have in your linker files:

For CM7:

MEMORY
{
 RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* Memory is divided. Actual start is 0x8000000 and actual length is 2048K */
 DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
 RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
 RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
 ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
}

For CM4:

MEMORY
{
RAM_EXEC (rx) : ORIGIN = 0x10000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x10020000, LENGTH = 160K
}

 And look at what I shared previously as linker files content.

You have this is missing:

OPENAMP_RSC_TAB (xrw) 	: ORIGIN = 0x38000000, LENGTH = 1K
OPEN_AMP_SHMEM (xrw) 	: ORIGIN = 0x38000400, LENGTH = 63K
}
 __OPENAMP_region_start__ = ORIGIN(OPEN_AMP_SHMEM);
 __OPENAMP_region_end__ = ORIGIN(OPEN_AMP_SHMEM) + LENGTH(OPEN_AMP_SHMEM)

And forget about the files location as they are not the source of the issue.

"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."
mƎALLEm
Technical Moderator
April 16, 2025
"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."
MECHOAuthor
Associate II
April 16, 2025

感谢您提供另一个答案,但我只是复制了他的代码并遇到了异常。

Translation:

"Thanks for providing another answer but I just copied his code and got the exception"

mƎALLEm
Technical Moderator
April 16, 2025

Please kindly write in English.

And please follow step by step the article I provided. Don't just copy the code. You need also to follow the CubeMx configuration including the MPU configuration.

If you have an issue while following the steps described in that article you need to post your question in it.

"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."
mƎALLEm
Technical Moderator
April 18, 2025

Hello,

Internal ticket 208133 has been submitted for analysis.

I suggest to not accept the solution until we provide at least a preliminary analysis.

Thank you for your contribution.

"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."
MECHOAuthor
Associate II
April 18, 2025

Okay, once you provide the preliminary analysis, I will proceed with the operation according to your instructions.

mƎALLEm
mƎALLEmBest answer
Technical Moderator
April 21, 2025

Hello @MECHO ,

In fact the issue has been already reported in this post.

In fact in your non-working project, you have this warning:

<command-line>: warning: "RPMSG_BUFFER_SIZE" redefined
<command-line>: note: this is the location of the previous definition

So in conclusion:

You have two issues from the beginning:

- You didn't update the linker files to allocate memory for OpenAMP.

- An issue with the generated code with STM32CuebIDE 1.18.0 (a regression from older versions)

"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."
mƎALLEm
Technical Moderator
July 15, 2025

Hello,

Issue fixed in CubeMx 6.15.0

"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."
MECHOAuthor
Associate II
July 15, 2025

Thanks for the reminder!!!