Skip to content

Commit 70be3d9

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 dc70011 commit 70be3d9

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
@@ -220,6 +220,12 @@ static void uart_init(uint32_t baud)
220220
void hal_hardware_init(void)
221221
{
222222
uart_init(USART_BAUD);
223+
224+
/* Initialize PMP hardware with kernel memory regions */
225+
pmp_config_t *pmp_config = pmp_get_config();
226+
if (pmp_init_kernel(pmp_config) != 0)
227+
hal_panic();
228+
223229
/* Set the first timer interrupt. Subsequent interrupts are set in ISR */
224230
mtimecmp_w(mtime_r() + (F_CPU / F_TIMER));
225231
/* Install low-level I/O handlers for the C standard library */

0 commit comments

Comments
 (0)