Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


STM32F103C8T6 - problem with FLASH_ErasePage when variable declared in custom section

Hi All

I am trying to store variable in custom section withn FLASH.

In ld file I have the following

.flash_crc (LENGTH(FLASH) + ORIGIN(FLASH) - 1K):
{
. = ALIGN(4);
*(.flash_crc)
*(.flash_crc.*)
. = ALIGN(4);
} >FLASH = 0x00

Which (I believe) creates custom section at the last 1K page of 64K FLASH.

Then I am trying to declare a variable in my main.cpp

volatile uint32_t attribute((section(“.flash_crc”), used)) __flash_crc;
The map file gives me correct section location at 0x800fc00 and variabke fits inicely inside

.flash_crc 0x000000000800fc00 0x4
0x000000000800fc00 . = ALIGN (0x4)
*(.flash_crc)
.flash_crc 0x000000000800fc00 0x4 ./src/main.o
0x000000000800fc00 __flash_crc
*(.flash_crc.*)
0x000000000800fc04 . = ALIGN (0x4)
In the code I am trying just to erase the FLASH page where the variable is located

FLASH_PrefetchBufferCmd( FLASH_PrefetchBuffer_Enable);
FLASH_SetLatency( FLASH_Latency_0);
FLASH_Status flashStatus;
FLASH_Unlock();
flashStatus = FLASH_ErasePage((uint32_t)0x800fc00);
FLASH_Lock();

flashStatus is set to FLASH_COMPLETE, so I would expect everything is fine, and location 0x800fc00 is filled with 0xff.
In reality this does not happen, and contents of 0x800fc00 stays untouched after ERASE.
Strange enough, if I comment out variable declaration, then everything works fine and 0x800fc00 gets filled with 0xff after ERASE.
The same happens when I am trying to write something to 0x800fc00 using

FLASH_ProgramWord(0x800fc00, 0x12345678)
With variable declared inside .flash_crc section nothing is written, when variable commnted out write succesfully occures.

Any help appreciated, thanks in advance