From da28829b6451655bfc0145aec5df8d42c71f34f0 Mon Sep 17 00:00:00 2001 From: Immo Birnbaum Date: Fri, 21 Jan 2022 12:38:30 +0100 Subject: [PATCH] kernel: zero the bss section of OCM memory at boot time If a chosen entry exists for a memory area of type OCM, zero the OCM memory's bss section at boot-time. Signed-off-by: Immo Birnbaum --- kernel/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/init.c b/kernel/init.c index 6d0b005963d..a395baa0556 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -92,6 +92,10 @@ void z_bss_zero(void) (void)memset(&__dtcm_bss_start, 0, ((uint32_t) &__dtcm_bss_end - (uint32_t) &__dtcm_bss_start)); #endif +#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay) + (void)memset(&__ocm_bss_start, 0, + ((uint32_t) &__ocm_bss_end - (uint32_t) &__ocm_bss_start)); +#endif #ifdef CONFIG_CODE_DATA_RELOCATION extern void bss_zeroing_relocation(void);