From 76820ab534c0cf61fadf6feec2e9ede9b0150533 Mon Sep 17 00:00:00 2001 From: Alexandre Bustico Date: Wed, 29 Apr 2026 22:29:52 +0200 Subject: [PATCH] FSMCv1: add STM32G4 FMC register support Map STM32G4 devices to the existing FMC register compatibility layer and include STM32G4 in the SRAM CCLKEN handling. --- os/hal/include/hal_fsmc.h | 8 ++++++-- os/hal/ports/STM32/LLD/FSMCv1/hal_sram_lld.c | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/os/hal/include/hal_fsmc.h b/os/hal/include/hal_fsmc.h index 443e85e1fe..10d17d5428 100644 --- a/os/hal/include/hal_fsmc.h +++ b/os/hal/include/hal_fsmc.h @@ -43,7 +43,9 @@ defined(STM32F745xx) || defined(STM32F746xx) || \ defined(STM32F756xx) || defined(STM32F767xx) || \ defined(STM32F769xx) || defined(STM32F777xx) || \ - defined(STM32F779xx) || defined(STM32H743xx)) + defined(STM32F779xx) || defined(STM32H743xx) || \ + defined(STM32G473xx) || defined(STM32G483xx) || \ + defined(STM32G474xx) || defined(STM32G484xx)) #if !defined(FSMC_Bank1_R_BASE) #define FSMC_Bank1_R_BASE (FMC_R_BASE + 0x0000) #endif @@ -239,7 +241,9 @@ typedef struct { #define FSMC_BCR_CBURSTRW ((uint32_t)1 << 19) #if (defined(STM32F427xx) || defined(STM32F437xx) || \ defined(STM32F429xx) || defined(STM32F439xx) || \ - defined(STM32F7) || defined(STM32H743xx)) + defined(STM32F7) || defined(STM32H743xx) || \ + defined(STM32G473xx) || defined(STM32G483xx) || \ + defined(STM32G474xx) || defined(STM32G484xx)) #define FSMC_BCR_CCLKEN ((uint32_t)1 << 20) #endif #if (defined(STM32F7)) diff --git a/os/hal/ports/STM32/LLD/FSMCv1/hal_sram_lld.c b/os/hal/ports/STM32/LLD/FSMCv1/hal_sram_lld.c index 71ecacd62a..8164406c19 100644 --- a/os/hal/ports/STM32/LLD/FSMCv1/hal_sram_lld.c +++ b/os/hal/ports/STM32/LLD/FSMCv1/hal_sram_lld.c @@ -112,7 +112,9 @@ void sram_lld_stop(SRAMDriver *sramp) { defined(STM32F745xx) || defined(STM32F746xx) || \ defined(STM32F756xx) || defined(STM32F767xx) || \ defined(STM32F769xx) || defined(STM32F777xx) || \ - defined(STM32F779xx)) + defined(STM32F779xx) || defined(STM32G473xx) || \ + defined(STM32G483xx) || defined(STM32G474xx) || \ + defined(STM32G484xx)) mask |= FSMC_BCR_CCLKEN; #endif sramp->sram->BCR &= ~mask; @@ -121,4 +123,3 @@ void sram_lld_stop(SRAMDriver *sramp) { #endif /* STM32_SRAM_USE_SRAM */ /** @} */ -