cancel
Showing results for 
Search instead for 
Did you mean: 

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

DZhih.1
Associate II

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.

6 REPLIES 6
TDK
Guru

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".
MM..1
Chief III

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

alister
Lead

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.

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.

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

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