From 93d6c520247d72be2ce111f3af8b791c535669c6 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Thu, 14 Sep 2017 23:41:32 -0700 Subject: [PATCH] make sure mstatus bits are set properly before entering second boot stage --- bootrom/bootrom.S | 23 +++++++++++++---------- bootrom/bootrom.img | Bin 96 -> 140 bytes 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/bootrom/bootrom.S b/bootrom/bootrom.S index e6cf0fa7..d2c28fb3 100644 --- a/bootrom/bootrom.S +++ b/bootrom/bootrom.S @@ -14,16 +14,7 @@ interrupt_loop: addi a2, a2, 4 lw a3, -4(a2) bnez a3, interrupt_loop - -boot_core: - sll a0, a0, 2 // offset for hart msip - add a0, a0, a1 - sw zero, 0(a0) // clear the interrupt - li a0, DRAM_BASE // program reset vector - csrw mepc, a0 // return from interrupt to start of user program - csrr a0, mhartid // hartid for next level bootloader - la a1, _dtb // dtb address for next level bootloader - mret + j boot_core .section .text.hang, "ax", @progbits .globl _hang @@ -40,4 +31,16 @@ wfi_loop: wfi j wfi_loop +boot_core: + sll a0, a0, 2 // offset for hart msip + add a0, a0, a1 + sw zero, 0(a0) // clear the interrupt + li a0, DRAM_BASE // program reset vector + csrw mepc, a0 // return from interrupt to start of user program + csrr a0, mhartid // hartid for next level bootloader + la a1, _dtb // dtb address for next level bootloader + li a2, 0x80 // set mstatus MPIE to 0 + csrc mstatus, a2 + mret + _dtb: diff --git a/bootrom/bootrom.img b/bootrom/bootrom.img index b2e4bf2c506a3eec5635478e28dec434e856c720..e2b53a38acb4fe504fea4a3bf1631586ffff965f 100755 GIT binary patch delta 87 zcmYf3VYJ)M%D_~t>hLj{g_R+n!GTq{&6T0mP2`XuTeI4+|4;wrGcd3)-~hO{CrEr@oL#vy}AwjlgwPXLE{+pN}$M%$|m_fl{qMZ@|K)(+d