Skip to content

Commit 3269b17

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 71af753 commit 3269b17

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
@@ -233,6 +233,12 @@ static void uart_init(uint32_t baud)
233233
void hal_hardware_init(void)
234234
{
235235
uart_init(USART_BAUD);
236+
237+
/* Initialize PMP hardware with kernel memory regions */
238+
pmp_config_t *pmp_config = pmp_get_config();
239+
if (pmp_init_kernel(pmp_config) != 0)
240+
hal_panic();
241+
236242
/* Set the first timer interrupt. Subsequent interrupts are set in ISR */
237243
mtimecmp_w(mtime_r() + (F_CPU / F_TIMER));
238244
/* Install low-level I/O handlers for the C standard library */

0 commit comments

Comments
 (0)