Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootloader patches #320

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions arch/risc-v/src/mpfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ config MPFS_BOOTLOADER
---help---
This NuttX image is used as a bootloader, which will boot only on one hart, putting the others in WFI

config MPFS_CLKINIT
bool "Initialize system clocks"
depends on MPFS_BOOTLOADER
default y
---help---
This initilizes the system clocks at mpfs_start.c file. The option may be also turned off
if some other entity has already set them up.

config MPFS_BOARD_PMP
bool "Enable board specific PMP configuration"
depends on ARCH_USE_MPU && MPFS_BOOTLOADER
Expand Down
6 changes: 5 additions & 1 deletion arch/risc-v/src/mpfs/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ CMN_ASRCS += mpfs_head.S
endif

# Specify our C code within this directory to be included
CHIP_CSRCS = mpfs_allocateheap.c mpfs_clockconfig.c
CHIP_CSRCS = mpfs_allocateheap.c
CHIP_CSRCS += mpfs_irq.c mpfs_irq_dispatch.c
CHIP_CSRCS += mpfs_lowputc.c mpfs_serial.c
CHIP_CSRCS += mpfs_start.c mpfs_timerisr.c
CHIP_CSRCS += mpfs_gpio.c mpfs_systemreset.c
CHIP_CSRCS += mpfs_plic.c mpfs_dsn.c

ifeq ($(CONFIG_MPFS_CLKINIT),y)
CHIP_CSRCS += mpfs_clockconfig.c
endif

ifeq ($(CONFIG_MPFS_DMA),y)
CHIP_CSRCS += mpfs_dma.c
endif
Expand Down
8 changes: 8 additions & 0 deletions arch/risc-v/src/mpfs/mpfs_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ __start:
csrw CSR_MIE, zero
csrw CSR_MIP, zero

/* Clear all IPIs (above doesn't clear them) */

csrr a0, CSR_MHARTID
slli t1, a0, 2
li t0, MPFS_CLINT_BASE
add t1, t1, t0
sw zero, 0(t1)

/* Initialize the Machine Trap Vector */

la t0, __trap_vec
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/mpfs/mpfs_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void __mpfs_start(uint64_t mhartid)

/* Setup PLL if not already provided */

#ifdef CONFIG_MPFS_BOOTLOADER
#ifdef CONFIG_MPFS_CLKINIT
mpfs_clockconfig();
#endif

Expand Down
1 change: 1 addition & 0 deletions arch/risc-v/src/mpfs/mpfs_timerisr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <nuttx/spinlock.h>

#include "riscv_internal.h"
#include "riscv_sbi.h"

#include "mpfs.h"
#include "mpfs_clockconfig.h"
Expand Down
61 changes: 0 additions & 61 deletions boards/risc-v/mpfs/icicle/configs/standalone/defconfig

This file was deleted.

Loading