Skip to content

Commit fc8eee3

Browse files
committed
drivers: memc: stm32: FMC NOR/PSRAM add bank validation
Ensure NSBank values are validated at build time. That helps to identify and fix incorrect bank values. Signed-off-by: Georgij Černyšiov <[email protected]>
1 parent 58f7221 commit fc8eee3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/memc/memc_stm32_nor_psram.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ static int memc_stm32_nor_psram_init(const struct device *dev)
147147
} \
148148
},
149149

150+
#define BUILD_ASSERT_BANK_CONFIG(node_id) \
151+
BUILD_ASSERT(IS_FMC_NORSRAM_BANK(DT_REG_ADDR(node_id)), \
152+
"NSBank " STRINGIFY(DT_REG_ADDR(node_id)) " is not a NORSRAM bank");
153+
154+
DT_INST_FOREACH_CHILD(0, BUILD_ASSERT_BANK_CONFIG);
155+
150156
/** SRAM bank/s configuration. */
151157
static const struct memc_stm32_nor_psram_bank_config bank_config[] = {
152158
DT_INST_FOREACH_CHILD(0, BANK_CONFIG)

0 commit comments

Comments
 (0)