New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stm32/flashbdev: linker script flash storage layout should override the defaults in flashbdev.c #8390
Comments
Yes. This was the intention, I just didn't get around to it. |
I can send a PR later to convert the remaining MCUs, following the others. |
@dpgeorge Is this right ? It used to be the max flash sector, now it's the entire flash cache size: #define FLASH_SECTOR_SIZE_MAX \
(&_micropy_hw_internal_flash_storage_ram_cache_end[0] - &_micropy_hw_internal_flash_storage_ram_cache_start[0]) The max sector size and flash cache size are mostly equal, except for a few MCUs, for example STM32F746: #define CACHE_MEM_START_ADDR (0x20000000) // DTCM data RAM, 64k
#define FLASH_SECTOR_SIZE_MAX (0x08000) // 32k max Also this is wrong: #if defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F446xx)
....
#define FLASH_SECTOR_SIZE_MAX (0x4000) // 16k max due to size of cache buffer
#define FLASH_MEM_SEG1_NUM_BLOCKS (128) // sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k
Sector 4 for these MCUs is 64K not 16K, which means either the cache mem size should be increased to 64K, or the number of blocks should be reduced to 96 blocks. |
Yes that looks correct, For the F746, it won't matter if this increases to 64k, it'll only ever use 32k because that's the maximum flash sector in the range used by the storage.
No, it's correct. The comment says |
But wouldn't this report the wrong FS size ? EDIT: The num of blocks will be more than what's actually usable:
|
The 128 is correct in the existing code. But I see your point, that the new scheme that computes the number of blocks from the linker symbols won't work... I think what needs to be done is the |
Exactly. |
Okay but the remainder of the sector can not be used for code, right ? The whole sector must be erased when updating the firmware. |
Correct.
Note that the filesystem is not touched when updating the firmware. So it should be enough to just shrink |
I know, I was just saying that the remainder of the sector will be unusable. |
In 8496919 flash storage layout configuration via linker script was introduced, but not all MCUs were converted to use it in 35e70c1. The MCUs that still have defaults in
flashbdev.c
, for exampleSTM32F427xx
, can't use the linker script to configure the flash storage layout. Can all MCUs be switched to use the linker script approach ? Or alternatively, can a board-level config option be added, that when enabled gives precedence to the linker script layout ?The text was updated successfully, but these errors were encountered: