Skip to main content
MFawzy
Associate III
September 2, 2022
Solved

STM32F746 Disco clear memory section

I Have STM32F746 Disco and i have a memory section that sould be initialized to zero.

and the aim behind this is to keep the memory content whenever the board is rest.

but unfortanlty, this section is being clear every time i restart the debuger.

the section is holding structure which is defined as the following:

PROBE_strExceptionInfoType objstrExceptionInfo __attribute__ ((section (".ramException")));

i tried the same criteria with STM32F3 and STM32F4 and it worked but it didn't work with STM32F7

the linker is attached.

Any idea?

Best Regards,

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
September 5, 2022

I suspect Google, or Programming Manual, might be enlightening if you feel curious..

STM32Cube_FW_H7_V1.8.0\Drivers\CMSIS\Core\Include\core_cm7.h

/**

 \brief  D-Cache Clean by address

 \details Cleans D-Cache for the given address

 \param[in]  addr  address (aligned to 32-byte boundary)

 \param[in]  dsize  size of memory block (in number of bytes)

*/

__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)

/**

 \brief  Clean D-Cache

 \details Cleans D-Cache

 */

__STATIC_INLINE void SCB_CleanDCache (void)

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

11 replies

Tesla DeLorean
Guru
September 2, 2022

You want it zero'd or you want it left uninitialized so it survives reset. Your question is poorly stated.

Code in startup.s is responsible for memory initialization and clearing.

If using the linker script make sections NOLOAD

Or use pointers, and don't tell the linker about the memory you don't want it touching.

 .ramException (NOLOAD) :
 {
 . = ALIGN(4);
 } > CRASH_DUMP_PART

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
MFawzy
MFawzyAuthor
Associate III
September 3, 2022

Thank you, this fixed the issue of the clearing for the memory. but i'm getting strange phenomna that is shown with STM32H7 and SM32F7 that the memory isn't cleared when i rest the debuger but the existance data is being distorted. Any Idea?

Tesla DeLorean
Guru
September 3, 2022

The MCU doesn't clear the memory,​ it will have undefined content in the memory cells when it first starts and may retain content whilst still powered, directly or parasitically.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Piranha
Principal III
September 4, 2022

For this purpose just move that structure to the beginning of DTCM. But generally one cannot develop code for Cortex-M7 without understanding cache maintenance and memory barriers.