Skip to main content
DZhih.1
Associate
September 27, 2021
Question

How to store code into two discontinuous flash area automatically in CubeIDE?

  • September 27, 2021
  • 3 replies
  • 1828 views

STM32G474RC,flash size is 256kB,default dual bank,so the flash size is 0x08000000~0x08020000, 0x080400000~0x08060000.

If the code size is larger than 128kB, but the address is non-contiguous.

How to store the exceeded programs into Bank2 automatically?

Is there any method to configure the link file in CubeIDE?

I know i can specify some function to certain address, but it's inconvenient at all.

This topic has been closed for replies.

3 replies

TDK
September 27, 2021

The GCC linker isn't set up to do this, unfortunately.

It was a bizarre choice to have a discontinuous flash.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DZhih.1
DZhih.1Author
Associate
September 28, 2021

Yes, the dual bank is discontinuous unless single bank is set.

MM..1
Chief III
September 27, 2021

I mean you can in linker script define .o files for specific areas, or you need add this to source code.

alister
Senior III
September 27, 2021

Is 0x08000000 or 0x08040000 mirrored at 0x08020000?

Otherwise declare two memory regions per https://sourceware.org/binutils/docs/ld/MEMORY.html and manually place your .text and/or .rodata in them. There are several ways. Per function atribute like __attribute__((section(".myOtherbank")) void MyFunction(void) {}, individually listing the objects of the input sections of the linker command file, etc. It's all in the docs. https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/, https://sourceware.org/binutils/docs/ld/index.html.

DZhih.1
DZhih.1Author
Associate
September 28, 2021

It seems that manually place my function in this two memory is the only solution now. IAR and TI CCS both support this operation. CubeIDE can not support it.

alister
Senior III
September 28, 2021

It's using GCC. Read the links I posted. CubeIDE has nothing to do with it.