The G4's stm32_registry.h defines the number of flash banks on the G431/G441 as 2 -- these are single bank parts.
Would be great to get this fixed on the stable-21.11.x branch as well as trunk.
STM32G431/441 flash bank count incorrect
- alex31
- Posts: 405
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 46 times
- Been thanked: 77 times
- Contact:
Re: STM32G431/441 flash bank count incorrect
And G491 is also a one bank device (2 in registry also)
A.
A.
- alex31
- Posts: 405
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 46 times
- Been thanked: 77 times
- Contact:
Re: STM32G431/441 flash bank count incorrect
Hello,
In order to use EFL+MFS on a G491, I had to fix the registry, I post here a G4 registry with bank number fixes for all lines, and I also add missing entries for G471 line.
I also had to fix minor forbidden arithmetic on void pointer, which is not allowed by the standard, and is catched by gcc 14.
Finally, I had to write a linker script for the G491, which has not the same memory layout than the G474.
Alexandre
In order to use EFL+MFS on a G491, I had to fix the registry, I post here a G4 registry with bank number fixes for all lines, and I also add missing entries for G471 line.
I also had to fix minor forbidden arithmetic on void pointer, which is not allowed by the standard, and is catched by gcc 14.
Code: Select all
iff --git a/os/hal/ports/STM32/STM32G4xx/hal_efl_lld.c b/os/hal/ports/STM32/STM32G4xx/hal_efl_lld.c
index 82ff9e8a0..4644224d6 100644
--- a/os/hal/ports/STM32/STM32G4xx/hal_efl_lld.c
+++ b/os/hal/ports/STM32/STM32G4xx/hal_efl_lld.c
@@ -116,6 +116,7 @@ static inline bool stm32_flash_dual_bank(EFlashDriver *eflp) {
#if STM32_FLASH_NUMBER_OF_BANKS > 1
return ((eflp->flash->OPTR & (FLASH_OPTR_DBANK)) != 0U);
#endif
+ (void) eflp;
return false;
}
@@ -241,8 +242,10 @@ flash_error_t efl_lld_read(void *instance, flash_offset_t offset,
stm32_flash_clear_status(devp);
/* Actual read implementation.*/
- memcpy((void *)rp, (const void *)efl_lld_get_descriptor(instance)->address
- + offset, n);
+ memcpy((void *)rp,
+ (const void *) ((uint32_t) efl_lld_get_descriptor(instance)->address
+ + offset),
+ n);
/* Checking for errors after reading.*/
if ((devp->flash->SR & FLASH_SR_RDERR) != 0U) {
Finally, I had to write a linker script for the G491, which has not the same memory layout than the G474.
Alexandre
- Attachments
-
- fix_flash_g4_registry.diff.zip
- (1.66 KiB) Downloaded 34 times
-
- g4_linker_script.zip
- (1.25 KiB) Downloaded 32 times
Who is online
Users browsing this forum: No registered users and 13 guests