Skip to content

Commit beedc43

Browse files
committed
Enable PMP hardware at boot time
Configure memory protection for kernel text, data, BSS, heap, and stack regions during hardware initialization. Halt on setup failure.
1 parent fadc056 commit beedc43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/riscv/hal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ static void uart_init(uint32_t baud)
274274
void hal_hardware_init(void)
275275
{
276276
uart_init(USART_BAUD);
277+
278+
/* Initialize PMP hardware with kernel memory regions */
279+
pmp_config_t *pmp_config = pmp_get_config();
280+
if (pmp_init_kernel(pmp_config) != 0)
281+
hal_panic();
282+
277283
/* Set the first timer interrupt. Subsequent interrupts are set in ISR */
278284
mtimecmp_w(mtime_r() + (F_CPU / F_TIMER));
279285
/* Install low-level I/O handlers for the C standard library */

0 commit comments

Comments
 (0)