Page 1 of 1

STM32G0B1 Single bank flash support

Posted: Sat Mar 15, 2025 1:25 pm
by KarlK90
Hi Giovanni,

the g0b1 series feature 128kb flash and a single bank flash memory organisation[1], which is currently missing in the registry and elf driver. I have attached a patch that adds the support. I'm not sure if you're happy with the registry #if defined switch but it is a start :-).

Cheers,
Stefan

[1]: see RM0444 Rev 6, page 70, 3.2 FLASH main features


Code: Select all

diff --git a/os/hal/ports/STM32/STM32G0xx/hal_efl_lld.h b/os/hal/ports/STM32/STM32G0xx/hal_efl_lld.h
index b31db288a7..0a796adcd9 100644
--- a/os/hal/ports/STM32/STM32G0xx/hal_efl_lld.h
+++ b/os/hal/ports/STM32/STM32G0xx/hal_efl_lld.h
@@ -52,7 +52,7 @@
 /*===========================================================================*/
 
 #if defined(STM32G070xx) || defined(STM32G071xx) ||                         \
-    defined(STM32G081xx) ||                                                 \
+    defined(STM32G081xx) || defined(STM32G0B1xx) ||                         \
     defined(__DOXYGEN__)
 
 /* Flash size register. */
diff --git a/os/hal/ports/STM32/STM32G0xx/stm32_registry.h b/os/hal/ports/STM32/STM32G0xx/stm32_registry.h
index b22320955e..06824f4e33 100644
--- a/os/hal/ports/STM32/STM32G0xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32G0xx/stm32_registry.h
@@ -712,7 +712,11 @@
 #define STM32_EXTI_IMR2_MASK                0xFFFFFFFFU
 
 /* Flash attributes.*/
+#if defined(STM32G0B1xx)
+#define STM32_FLASH_NUMBER_OF_BANKS         1
+#else
 #define STM32_FLASH_NUMBER_OF_BANKS         2
+#endif
 
 /* GPIO attributes.*/
 #define STM32_HAS_GPIOA                     TRUE

Re: STM32G0B1 Single bank flash support

Posted: Sat Mar 15, 2025 3:20 pm
by Giovanni
Thansk, moving in "bug reports" or I will forget about this :-)

Giovanni

Re: STM32G0B1 Single bank flash support

Posted: Thu May 08, 2025 10:26 am
by KarlK90
Hi Giovanni,

friendly ping on this bug/issue.

Cheers,
Stefan

Re: STM32G0B1 Single bank flash support

Posted: Thu May 15, 2025 9:19 am
by Giovanni
Hi,

Change committed, thanks.

Giovanni