2021-09-27 01:23 AM
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.
2021-09-27 06:01 AM
The GCC linker isn't set up to do this, unfortunately.
It was a bizarre choice to have a discontinuous flash.
2021-09-27 08:26 AM
I mean you can in linker script define .o files for specific areas, or you need add this to source code.
2021-09-27 03:11 PM
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.
2021-09-27 07:01 PM
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.
2021-09-27 07:02 PM
Yes, the dual bank is discontinuous unless single bank is set.
2021-09-27 07:13 PM
It's using GCC. Read the links I posted. CubeIDE has nothing to do with it.