2021-10-28 07:30 AM
I am having difficulty working out the memory address range for the STM32F103RCT6, which I am using for my project. I would like to write some config data into the top page of flash, but cannot work out with certainty where this page starts and how big it is.
The reference manual, (RM0008 Rev 20, p54. Section 3.3.3) states for High Density devices (which I believe this is)
"up to 64 Kb × 64 bits divided into 256 pages of 2 Kbytes each"
These numbers would be correct for the RET6, which has 512kB of flash. There is also a table, on page 56 of the guide, which gives the addresses of the 256 pages, with page 0 starting at 0x0800 0000 and page 255 starting at 0x0807 F800.
My assumption would be that the RCT6, which I know has 256kB of flash, would start at the same base address, and would still have 2kB page size, but would end with page 127 at, I assume, 0x0803 F800.
However, my CubeMX project, which has the RCT6 selected as MCU, has generated code with the header file, stm32f103xe.h which defines FLASH_BANK1_END to be at 0x0807 FFFF. Now, it seems to me that this is the wrong header file for my project, and that there should be a header file called stm32f103xc.h, which I would expect to define FLASH_BANK1_END at 0x0803 FFFF. But I cannot find this file anywhere.
Could anyone tell me if my assumptions about the Flash structure of the RCT6 are correct? i.e. 128 pages of 2kB each, starting at 0x08000000 ?
And also, is there a header file somewhere called stm32f103xc.h, and if so, how to I force the cube to add it to my generated project?
Thanks
Tom
2021-10-28 08:09 PM
> Could anyone tell me if my assumptions about the Flash structure of the RCT6 are correct? i.e. 128 pages of 2kB each, starting at 0x08000000 ?
Yes, per the RM.
However, the extra flash is possibly available, just not tested or guaranteed to function. You can verify with STM32CubeProgrammer or a similar tool.
> And also, is there a header file somewhere called stm32f103xc.h, and if so, how to I force the cube to add it to my generated project?
There doesn't appear to be one.
The only thing that would be incorrect in the header file is FLASH_BANK1_END as far as I can see, which has limited usage
The linker file is what really stores the length of the flash you can use. You can adjust the linker script to reflect the correct flash size, or just ignore it if your program fits within the available memory.