2022-02-04 07:07 AM
Hello,
I'm currently designing a bootloader and an application for stm32g474ccu6 MCU (256kB flash). Today I wanted to implement a bootloader feature allowing the user app to take up more than one flash bank in flash memory (Im working in dual bank mode - the default configuration). It's not really clear to me how the RM0440 flash layout looks like for a 128 or 256 kB flash. Let's assume a 256 kB version:
I tested it and to my surprise, I was able to program the flash memory using bank1 setting in HAL library and addresses starting at 0x08001f800 (presumably the last page of bank 1) going for 40 kB (presumably first pages of bank 2)! This actually contradicts both of my theories - it seems my stm32g474ccu6 acts completely as a 512 kB unit (even considering the bank division). How is that possible?
I can actually read the whole 512 kB memory (its the same die across different flash versions just not tested right?), so I'm guessing the division between banks is always made at 0x0804 0000, but there's a region of discontinuity that may or may not work (depending on the manufacturing process?).
Best Regards,
Piotr Wasilewski
Solved! Go to Solution.
2022-02-05 07:26 AM
On this, the RM clearly states they're consecutive in single bank mode.
Your question is answered nicely by ST here:
The STM32CubeMX generated script is correct for single bank mode.
2022-02-04 07:35 AM
Hello @Wasilewski.Piotr
Yes it is same die, except that the manufacturing process (and so ST) doesn't guaranty that the remaining part of the FLASH is fully functional as it is not tested.
BR,
Bruno
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-02-04 08:08 AM
Ok, thank you, that's pretty clear to me, but what about the flash address space? Does it have a gap in it in case the address bonds to that part of the memory are cut at the factory or the untested block is corrupted? Where does the second flash bank start in the 128 kB and 256 kB versions?
Best Regards,
Piotr Wasilewski
2022-02-04 08:42 AM
Here is your answer in the RM0440 Table 7. Flash module - 512/256/128 KB dual bank organization (64 bits read width).
Br,
Bruno
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-02-04 08:54 AM
I'm sorry but that does not answer my question. I've seen the table and analyzed it a few times but I still cannot understand how can it be that two banks can have different sizes (in different flash size variants), yet the second one always (in all memory size variants) starts at a constant address. Does it mean there's a gap in the address space in the 128 kB and 256 kB memory variants?
Best Regards,
Piotr Wasilewski
2022-02-04 05:59 PM
> Does it mean there's a gap in the address space in the 128 kB and 256 kB memory variants?
Yes.
The table is (awkwardly) saying that each bank has half the capacity of the total. The start of bank 2 is the same in all cases.
2022-02-04 11:05 PM
@TDK thank you this is what I needed. So basically the default linker scripts (generated from cubeIDE) are incorrect (as they suggest a constant memory addresses space from 0x8000000) and can cause troubles when I surpass the 128kb boundary (in my MCU 256 kB version) since by default its in the double bank mode?
What about a single bank configuration? Is there still a gap or the addresses are mapped to a continuous space?
Best Regards,
Piotr Wasilewski
2022-02-05 07:26 AM
On this, the RM clearly states they're consecutive in single bank mode.
Your question is answered nicely by ST here:
The STM32CubeMX generated script is correct for single bank mode.
2022-02-05 07:30 AM
Ahh, thank you now this is clear! I must have missed this topic when I searched for a similar question.
Thank you!
2024-07-11 02:52 AM
Hello
For me is not clear, i use a stm32g491rct6 with 256k flash in factory dual bank mode, the project created with cubeide 1.15.1 map all flash in contiguos mode from 800000 to 803ffff, so the linker load the firmware in the "gap zone"?
Another thing is that when I use cubeprogrammer 2.17 with the same micro displays the blocks with strange index and here I try to delete a block in the second bank tries to execute and remains in infinite hang loop