mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
risc-v/k230: improvements to support K230 vendor u-boot
Previously we need turn off the PMP locks in K230 vendor u-boot to use NuttX, this complicates the setup process. This patch supports running NuttX with original vendor u-boot so that to reduce setup complexity. It also enables empty NSH prompt string in AMP master config as the apps side support is ready. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
634b605476
commit
a4d61dea80
@@ -127,12 +127,9 @@ static void k230_hart_cleanup(void)
|
|||||||
|
|
||||||
void k230_hart_init(void)
|
void k230_hart_init(void)
|
||||||
{
|
{
|
||||||
#define MISA_VECTOR_BIT ('V'-'A')
|
/* TODO: when called from sbi_start(), MISA is 0 somehow. */
|
||||||
#define MISA_VECTOR_MASK (1 << MISA_VECTOR_BIT)
|
|
||||||
|
|
||||||
/* When called from sbi_start(), MISA is 0 somehow. */
|
g_big = (READ_CSR(CSR_MISA) & (1 << 21));
|
||||||
|
|
||||||
g_big = (READ_CSR(CSR_MISA) & MISA_VECTOR_MASK);
|
|
||||||
|
|
||||||
k230_hart_cleanup();
|
k230_hart_cleanup();
|
||||||
|
|
||||||
@@ -146,6 +143,12 @@ void k230_hart_init(void)
|
|||||||
#ifdef RISCV_PBMT
|
#ifdef RISCV_PBMT
|
||||||
SET_CSR(CSR_MENVCFG, MENVCFG_PBMT);
|
SET_CSR(CSR_MENVCFG, MENVCFG_PBMT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NUTTSBI
|
||||||
|
/* Some PMP entries might have been locked */
|
||||||
|
|
||||||
|
k230_add_pmp(PMPCFG_A_NAPOT | PMPCFG_RWX_MASK, 0, 1024ul << 30);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -22,9 +22,20 @@
|
|||||||
#define __ARCH_RISCV_SRC_K230_K230_HART_H
|
#define __ARCH_RISCV_SRC_K230_K230_HART_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Preprocessor Macros
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* add PMP entry with (attr, base, size) */
|
||||||
|
|
||||||
|
#define k230_add_pmp(a, b, s) riscv_config_pmp_region( \
|
||||||
|
riscv_next_free_pmp_region(), a, b, s)
|
||||||
|
|
||||||
|
#define CSR_MSECCFG 0x747
|
||||||
|
#define CSR_MSECCFGH 0x757
|
||||||
|
|
||||||
|
#define MSECCFG_MML (1 << 0)
|
||||||
|
#define MSECCFG_RLB (1 << 2)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public functions
|
* Public functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "k230_userspace.h"
|
#include "k230_userspace.h"
|
||||||
#include "riscv_internal.h"
|
#include "riscv_internal.h"
|
||||||
|
#include "k230_hart.h"
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_PROTECTED
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
|
||||||
@@ -127,8 +128,8 @@ void k230_userspace(void)
|
|||||||
|
|
||||||
static void configure_mpu(void)
|
static void configure_mpu(void)
|
||||||
{
|
{
|
||||||
riscv_config_pmp_region(0, UFLASH_F, UFLASH_START, UFLASH_SIZE);
|
k230_add_pmp(UFLASH_F, UFLASH_START, UFLASH_SIZE);
|
||||||
riscv_config_pmp_region(1, USRAM_F, USRAM_START, USRAM_SIZE);
|
k230_add_pmp(USRAM_F, USRAM_START, USRAM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BUILD_PROTECTED */
|
#endif /* CONFIG_BUILD_PROTECTED */
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
|||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_FILEIOSIZE=512
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
CONFIG_NSH_FILE_APPS=y
|
CONFIG_NSH_FILE_APPS=y
|
||||||
CONFIG_NSH_PROMPT_STRING="master> "
|
CONFIG_NSH_PROMPT_STRING=""
|
||||||
CONFIG_NSH_READLINE=y
|
CONFIG_NSH_READLINE=y
|
||||||
CONFIG_NUTTSBI=y
|
CONFIG_NUTTSBI=y
|
||||||
CONFIG_NUTTSBI_MTIMECMP_BASE=0xf04004000
|
CONFIG_NUTTSBI_MTIMECMP_BASE=0xf04004000
|
||||||
|
|||||||
Reference in New Issue
Block a user