diff --git a/arch/risc-v/src/fe310/fe310_head.S b/arch/risc-v/src/fe310/fe310_head.S index ed997bc5cc..c7169e611a 100644 --- a/arch/risc-v/src/fe310/fe310_head.S +++ b/arch/risc-v/src/fe310/fe310_head.S @@ -59,6 +59,10 @@ __start: lui sp, %hi(FE310_IDLESTACK_TOP) addi sp, sp, %lo(FE310_IDLESTACK_TOP) + /* Disable all interrupts (i.e. timer, external) in mie */ + + csrw mie, zero + /* Initialize the Machine Trap Vector */ lui t0, %hi(__trap_vec) diff --git a/arch/risc-v/src/fe310/fe310_irq.c b/arch/risc-v/src/fe310/fe310_irq.c index ca428346f7..7049599ee1 100644 --- a/arch/risc-v/src/fe310/fe310_irq.c +++ b/arch/risc-v/src/fe310/fe310_irq.c @@ -260,7 +260,7 @@ irqstate_t up_irq_enable(void) /* TODO: should move to up_enable_irq() */ - asm volatile("csrw mie, %0" : /* no output */ : "r"(MIE_MEIE)); + asm volatile ("csrrs %0, mie, %1": "=r" (oldstat) : "r"(MIE_MEIE)); #endif /* Read mstatus & set machine interrupt enable (MIE) in mstatus */ diff --git a/arch/risc-v/src/fe310/up_schedulesigaction.c b/arch/risc-v/src/fe310/up_schedulesigaction.c index 23f4a55789..10906c9b13 100644 --- a/arch/risc-v/src/fe310/up_schedulesigaction.c +++ b/arch/risc-v/src/fe310/up_schedulesigaction.c @@ -146,6 +146,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.saved_epc = g_current_regs[REG_EPC]; + tcb->xcp.saved_int_ctx = g_current_regs[REG_INT_CTX]; /* Then set up to vector to the trampoline with interrupts * disabled diff --git a/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig b/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig index 5e6b72f711..837201e2d5 100644 --- a/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig +++ b/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig @@ -34,8 +34,9 @@ CONFIG_DISABLE_MQUEUE=y CONFIG_EXAMPLES_BUTTONS=y CONFIG_EXAMPLES_BUTTONS_NAMES=y CONFIG_EXAMPLES_BUTTONS_QTD=1 -CONFIG_EXAMPLES_BUTTONS_STACKSIZE=1572 +CONFIG_EXAMPLES_BUTTONS_STACKSIZE=1024 CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_HELLO_STACKSIZE=1024 CONFIG_FS_PROCFS=y CONFIG_FS_WRITABLE=y CONFIG_IDLETHREAD_STACKSIZE=1536 @@ -76,9 +77,9 @@ CONFIG_SYSTEM_NSH=y CONFIG_TASK_NAME_SIZE=12 CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536 CONFIG_TESTING_GETPRIME=y -CONFIG_TESTING_GETPRIME_STACKSIZE=2048 CONFIG_UART0_RXBUFSIZE=8 CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART0_TXBUFSIZE=32 +CONFIG_USERMAIN_STACKSIZE=1536 CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WDOG_INTRESERVE=0