Skip to main content
This topic has been closed for replies.
Best answer by Kamil Duljas

Try this:

MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 319K
 NOINIT(xrw) 	 : ORIGIN = 0x2004FC00, LENGTH = 1K
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}

Then create section:

 .noinit :
 {
 KEEP(*(.noinitdata))
 } >NOINIT

and create variable:

uint32_t __attribute__(( section(".noinitdata") )) first_run;
 

7 replies

Pavel A.
April 4, 2023

The default GCC startup code is much simpler than IAR, it initializes only one array of data and one BSS.

The easiest is to use one of SRAM blocks of stm32h743 that are not used for .data, .bss or stack/heap in your linker script. For example if your script uses the AXI SRAM for the "main" data, use SRAM2 or TCM RAM.

Kamil DuljasBest answer
Senior III
April 4, 2023

Try this:

MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 319K
 NOINIT(xrw) 	 : ORIGIN = 0x2004FC00, LENGTH = 1K
 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}

Then create section:

 .noinit :
 {
 KEEP(*(.noinitdata))
 } >NOINIT

and create variable:

uint32_t __attribute__(( section(".noinitdata") )) first_run;
 

Dudo
ikassma
ikassmaAuthor
Associate III
April 4, 2023

it is not working.

Couriously, depending on the location of the function that puts a value in the variable, it either keeps or does not retain the value after the reset.​

Senior III
April 4, 2023

Someone had simillar problem here:

https://stackoverflow.com/questions/65577391/stm32-create-ram-section

Try use this instruction.

Dudo
ikassma
ikassmaAuthor
Associate III
April 4, 2023

i had set up to use I Cache and D Cache. It didn't work normally at this time. Each cahe is diabled, so it works normally. but i don't know why.

Senior III
April 20, 2023

@ikassma​ Do You resolve your problem?

Dudo
ikassma
ikassmaAuthor
Associate III
April 21, 2023

yes! I Cache and D Cache Disable. it is works.

Thanks to your advice.