Update nuclei demo soc to latest version
Based on Nuclei SDK v0.3.1 Signed-off-by: linzewen <linzewen@nucleisys.com>
This commit is contained in:
parent
4170e57f18
commit
b4f5bc433c
|
@ -37,13 +37,13 @@ LITEOSTOPDIR := ../../../
|
||||||
# C sources
|
# C sources
|
||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
$(wildcard ../Src/*.c) \
|
$(wildcard ../Src/*.c) \
|
||||||
$(wildcard ../SoC/hbird/Common/Source/*.c) \
|
$(wildcard ../SoC/demosoc/Common/Source/*.c) \
|
||||||
$(wildcard ../SoC/hbird/Common/Source/Drivers/*.c) \
|
$(wildcard ../SoC/demosoc/Common/Source/Drivers/*.c) \
|
||||||
$(wildcard ../SoC/hbird/Common/Source/Stubs/*.c)
|
$(wildcard ../SoC/demosoc/Common/Source/Stubs/*.c)
|
||||||
|
|
||||||
# ASM sources
|
# ASM sources
|
||||||
ASMS_SOURCES = \
|
ASMS_SOURCES = \
|
||||||
$(wildcard ../SoC/hbird/Common/Source/GCC/*.S)
|
$(wildcard ../SoC/demosoc/Common/Source/GCC/*.S)
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
@ -84,7 +84,7 @@ BIN = $(CP) -O binary -S
|
||||||
|
|
||||||
ECHO := echo
|
ECHO := echo
|
||||||
|
|
||||||
OPENOCD_CFG := openocd_hbird.cfg
|
OPENOCD_CFG := openocd_demosoc.cfg
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# CFLAGS
|
# CFLAGS
|
||||||
|
@ -110,9 +110,9 @@ AS_INCLUDES =
|
||||||
C_INCLUDES = \
|
C_INCLUDES = \
|
||||||
-I../OS_CONFIG \
|
-I../OS_CONFIG \
|
||||||
-I../Src \
|
-I../Src \
|
||||||
-I../SoC/hbird/Board/hbird_eval/Include \
|
-I../SoC/demosoc/Board/nuclei_fpga_eval/Include \
|
||||||
-I../SoC/hbird/Common/Include \
|
-I../SoC/demosoc/Common/Include \
|
||||||
-I../SoC/hbird/Common/Source/Stubs
|
-I../SoC/demosoc/Common/Source/Stubs
|
||||||
|
|
||||||
# compile gcc flags
|
# compile gcc flags
|
||||||
ASFLAGS = $(AS_DEFS) $(OPT) $(CORE_ARCH_ABI) $(OTHER_FLAGS) $(AS_INCLUDES) -Wall -fdata-sections -ffunction-sections
|
ASFLAGS = $(AS_DEFS) $(OPT) $(CORE_ARCH_ABI) $(OTHER_FLAGS) $(AS_INCLUDES) -Wall -fdata-sections -ffunction-sections
|
||||||
|
@ -150,7 +150,7 @@ GDB_CMDS += -ex "target extended-remote localhost:$(GDB_PORT)"
|
||||||
# LDFLAGS
|
# LDFLAGS
|
||||||
#######################################
|
#######################################
|
||||||
# link script
|
# link script
|
||||||
LDSCRIPT = gcc_hbird_ilm.ld
|
LDSCRIPT = gcc_demosoc_ilm.ld
|
||||||
|
|
||||||
# libraries
|
# libraries
|
||||||
LIBS = -lm
|
LIBS = -lm
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file gcc_hbird_ilm.ld
|
* @file gcc_demosoc_ilm.ld
|
||||||
* @brief GNU Linker Script for Nuclei N/NX based device in ilm Download Mode
|
* @brief GNU Linker Script for Nuclei N/NX based device in ilm Download Mode
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 17. Dec 2019
|
* @date 17. Dec 2019
|
|
@ -2,7 +2,7 @@ adapter_khz 1000
|
||||||
|
|
||||||
interface ftdi
|
interface ftdi
|
||||||
ftdi_vid_pid 0x0403 0x6010
|
ftdi_vid_pid 0x0403 0x6010
|
||||||
ftdi_oscan1_mode on
|
ftdi_oscan1_mode off
|
||||||
|
|
||||||
## bindto 0.0.0.0 can be used to cover all available interfaces.
|
## bindto 0.0.0.0 can be used to cover all available interfaces.
|
||||||
## Uncomment bindto line to enable remote machine debug
|
## Uncomment bindto line to enable remote machine debug
|
||||||
|
@ -10,8 +10,8 @@ ftdi_oscan1_mode on
|
||||||
|
|
||||||
## If ftdi_device_desc not specified, the device description is ignored during device selection.
|
## If ftdi_device_desc not specified, the device description is ignored during device selection.
|
||||||
## So if you want to specify a dedicated FTDI device, you can select following device description:
|
## So if you want to specify a dedicated FTDI device, you can select following device description:
|
||||||
## "Dual RS232-HS" is for HummingBird Debugger V1
|
## "Dual RS232-HS" is for Nuclei HummingBird Debugger V1
|
||||||
## "USB <-> JTAG-DEBUGGER" is for HummingBird Debugger V2
|
## "USB <-> JTAG-DEBUGGER" is for Nuclei HummingBird Debugger V2
|
||||||
## Uncomment one which match your device description
|
## Uncomment one which match your device description
|
||||||
# ftdi_device_desc "Dual RS232-HS"
|
# ftdi_device_desc "Dual RS232-HS"
|
||||||
# ftdi_device_desc "USB <-> JTAG-DEBUGGER"
|
# ftdi_device_desc "USB <-> JTAG-DEBUGGER"
|
|
@ -1,6 +1,6 @@
|
||||||
// See LICENSE for license details.
|
// See LICENSE for license details.
|
||||||
#ifndef _BOARD_HBIRD_EVAL_H_
|
#ifndef _BOARD_NUCLEI_FPGA_EVAL_H_
|
||||||
#define _BOARD_HBIRD_EVAL_H_
|
#define _BOARD_NUCLEI_FPGA_EVAL_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
|
@ -6,7 +6,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "board_hbird_eval.h"
|
#include "board_nuclei_fpga_eval.h"
|
||||||
|
|
||||||
#define SOC_DEBUG_UART UART0
|
#define SOC_DEBUG_UART UART0
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file gcc_hbird_ddr.ld
|
* @file gcc_demosoc_ddr.ld
|
||||||
* @brief GNU Linker Script for Nuclei N/NX based device in ddr Download Mode
|
* @brief GNU Linker Script for Nuclei N/NX based device in ddr Download Mode
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 20. Jul 2020
|
* @date 20. Jul 2020
|
|
@ -16,8 +16,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file gcc_hbird_flash.ld
|
* @file gcc_demosoc_flash.ld
|
||||||
* @brief GNU Linker Script for Nuclei N/NX based device in Flash Download Mode
|
* @brief GNU Linker Script for Nuclei N/NX based device in flash Download Mode
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 17. Dec 2019
|
* @date 17. Dec 2019
|
||||||
******************************************************************************/
|
******************************************************************************/
|
|
@ -16,8 +16,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file gcc_hbird_flashxip.ld
|
* @file gcc_demosoc_flashxip.ld
|
||||||
* @brief GNU Linker Script for Nuclei N/NX based device in FlashXIP Download Mode
|
* @brief GNU Linker Script for Nuclei N/NX based device in flashxip Download Mode
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 17. Dec 2019
|
* @date 17. Dec 2019
|
||||||
******************************************************************************/
|
******************************************************************************/
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file gcc_hbird_ilm.ld
|
* @file gcc_demosoc_ilm.ld
|
||||||
* @brief GNU Linker Script for Nuclei N/NX based device in ilm Download Mode
|
* @brief GNU Linker Script for Nuclei N/NX based device in ilm Download Mode
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 17. Dec 2019
|
* @date 17. Dec 2019
|
||||||
|
@ -35,8 +35,7 @@ MEMORY
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
__stack_size = DEFINED(__stack_size) ? __stack_size : 10K;
|
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
||||||
__heap_size = DEFINED(__heap_size) ? __heap_size : 10K;
|
|
||||||
|
|
||||||
.init :
|
.init :
|
||||||
{
|
{
|
||||||
|
@ -180,10 +179,6 @@ SECTIONS
|
||||||
*(.srodata.cst4)
|
*(.srodata.cst4)
|
||||||
*(.srodata.cst2)
|
*(.srodata.cst2)
|
||||||
*(.srodata .srodata.*)
|
*(.srodata .srodata.*)
|
||||||
. = ALIGN(4);
|
|
||||||
__osdriv_start = .;
|
|
||||||
KEEP (*(osdriv))
|
|
||||||
__osdriv_end = .;
|
|
||||||
} >ram AT>ilm
|
} >ram AT>ilm
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
|
@ -203,20 +198,13 @@ SECTIONS
|
||||||
} >ram AT>ram
|
} >ram AT>ram
|
||||||
|
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
|
PROVIDE( _end = . );
|
||||||
PROVIDE( end = . );
|
PROVIDE( end = . );
|
||||||
|
|
||||||
.stack : ALIGN(0x10)
|
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
|
||||||
{
|
{
|
||||||
|
PROVIDE( _heap_end = . );
|
||||||
. = __stack_size;
|
. = __stack_size;
|
||||||
PROVIDE( _sp = . );
|
PROVIDE( _sp = . );
|
||||||
} >ram AT>ram
|
} >ram AT>ram
|
||||||
PROVIDE( _end = . );
|
|
||||||
.heap : ALIGN(0x10)
|
|
||||||
{
|
|
||||||
. = __heap_size;
|
|
||||||
PROVIDE( _heap_end = . );
|
|
||||||
PROVIDE( __los_heap_addr_start__ = . );
|
|
||||||
. = __heap_size == 0 ? 0 : ORIGIN(ram) + LENGTH(ram);
|
|
||||||
PROVIDE( __los_heap_addr_end__ = . );
|
|
||||||
} >ram AT>ram
|
|
||||||
}
|
}
|
|
@ -1,15 +1,20 @@
|
||||||
adapter_khz 1000
|
adapter_khz 1000
|
||||||
|
|
||||||
interface ftdi
|
interface ftdi
|
||||||
|
ftdi_vid_pid 0x0403 0x6010
|
||||||
|
ftdi_oscan1_mode off
|
||||||
|
|
||||||
|
## bindto 0.0.0.0 can be used to cover all available interfaces.
|
||||||
|
## Uncomment bindto line to enable remote machine debug
|
||||||
|
# bindto 0.0.0.0
|
||||||
|
|
||||||
## If ftdi_device_desc not specified, the device description is ignored during device selection.
|
## If ftdi_device_desc not specified, the device description is ignored during device selection.
|
||||||
## So if you want to specify a dedicated FTDI device, you can select following device description:
|
## So if you want to specify a dedicated FTDI device, you can select following device description:
|
||||||
## "Dual RS232-HS" is for HummingBird Debugger V1
|
## "Dual RS232-HS" is for Nuclei HummingBird Debugger V1
|
||||||
## "USB <-> JTAG-DEBUGGER" is for HummingBird Debugger V2
|
## "USB <-> JTAG-DEBUGGER" is for Nuclei HummingBird Debugger V2
|
||||||
## Uncomment one which match your device description
|
## Uncomment one which match your device description
|
||||||
# ftdi_device_desc "Dual RS232-HS"
|
# ftdi_device_desc "Dual RS232-HS"
|
||||||
# ftdi_device_desc "USB <-> JTAG-DEBUGGER"
|
# ftdi_device_desc "USB <-> JTAG-DEBUGGER"
|
||||||
ftdi_vid_pid 0x0403 0x6010
|
|
||||||
ftdi_oscan1_mode off
|
|
||||||
|
|
||||||
transport select jtag
|
transport select jtag
|
||||||
|
|
||||||
|
@ -33,13 +38,13 @@ flash bank $_FLASHNAME fespi 0x20000000 0 0 0 $_TARGETNAME
|
||||||
# Set the ILM space also as flash, to make sure it can be add breakpoint with hardware trigger
|
# Set the ILM space also as flash, to make sure it can be add breakpoint with hardware trigger
|
||||||
#flash bank onboard_ilm fespi 0x80000000 0 0 0 $_TARGETNAME
|
#flash bank onboard_ilm fespi 0x80000000 0 0 0 $_TARGETNAME
|
||||||
|
|
||||||
# Expose Nuclei self-defined CSRS range 770-800,835-850,1984-2032,2064-2070
|
# Expose Nuclei self-defined CSRS
|
||||||
# See https://github.com/riscv/riscv-gnu-toolchain/issues/319#issuecomment-358397306
|
# See https://github.com/riscv/riscv-gnu-toolchain/issues/319#issuecomment-358397306
|
||||||
# Then user can view the csr register value in gdb using: info reg csr775 for CSR MTVT(0x307)
|
# Then user can view the csr register value in gdb using: info reg csr775 for CSR MTVT(0x307)
|
||||||
riscv expose_csrs 770-800,835-850,1984-2032,2064-2070
|
riscv expose_csrs 416-496,770-800,835-850,1227-1231,1483-1486,1984-2032,2064-2070,2370-2380,2490-2500,4032-4040
|
||||||
|
|
||||||
init
|
init
|
||||||
#reset
|
|
||||||
if {[ info exists pulse_srst]} {
|
if {[ info exists pulse_srst]} {
|
||||||
ftdi_set_signal nSRST 0
|
ftdi_set_signal nSRST 0
|
||||||
ftdi_set_signal nSRST z
|
ftdi_set_signal nSRST z
|
|
@ -1,7 +1,7 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file hbird.h
|
* @file demosoc.h
|
||||||
* @brief NMSIS Core Peripheral Access Layer Header File for
|
* @brief NMSIS Core Peripheral Access Layer Header File for
|
||||||
* Nuclei HummingBird evaluation SoC which support Nuclei N/NX class cores
|
* Nuclei Demo SoC which support Nuclei N/NX class cores
|
||||||
* @version V1.00
|
* @version V1.00
|
||||||
* @date 22. Nov 2019
|
* @date 22. Nov 2019
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __HBIRD_H__
|
#ifndef __DEMOSOC_H__
|
||||||
#define __HBIRD_H__
|
#define __DEMOSOC_H__
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup hbird
|
/** @addtogroup demosoc
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -52,8 +52,7 @@ extern "C" {
|
||||||
/* ================ Interrupt Number Definition ================ */
|
/* ================ Interrupt Number Definition ================ */
|
||||||
/* =========================================================================================================================== */
|
/* =========================================================================================================================== */
|
||||||
|
|
||||||
typedef enum IRQn
|
typedef enum IRQn {
|
||||||
{
|
|
||||||
/* ======================================= Nuclei Core Specific Interrupt Numbers ======================================== */
|
/* ======================================= Nuclei Core Specific Interrupt Numbers ======================================== */
|
||||||
|
|
||||||
Reserved0_IRQn = 0, /*!< Internal reserved */
|
Reserved0_IRQn = 0, /*!< Internal reserved */
|
||||||
|
@ -76,7 +75,7 @@ typedef enum IRQn
|
||||||
Reserved15_IRQn = 17, /*!< Internal reserved */
|
Reserved15_IRQn = 17, /*!< Internal reserved */
|
||||||
Reserved16_IRQn = 18, /*!< Internal reserved */
|
Reserved16_IRQn = 18, /*!< Internal reserved */
|
||||||
|
|
||||||
/* =========================================== hbird Specific Interrupt Numbers ========================================= */
|
/* =========================================== demosoc Specific Interrupt Numbers ========================================= */
|
||||||
/* ToDo: add here your device specific external interrupt numbers. 19~1023 is reserved number for user. Maxmum interrupt supported
|
/* ToDo: add here your device specific external interrupt numbers. 19~1023 is reserved number for user. Maxmum interrupt supported
|
||||||
could get from clicinfo.NUM_INTERRUPT. According the interrupt handlers defined in startup_Device.s
|
could get from clicinfo.NUM_INTERRUPT. According the interrupt handlers defined in startup_Device.s
|
||||||
eg.: Interrupt for Timer#1 eclic_tim1_handler -> TIM1_IRQn */
|
eg.: Interrupt for Timer#1 eclic_tim1_handler -> TIM1_IRQn */
|
||||||
|
@ -158,7 +157,7 @@ typedef enum EXCn {
|
||||||
|
|
||||||
#endif /* __riscv_xlen == 64 */
|
#endif /* __riscv_xlen == 64 */
|
||||||
|
|
||||||
/* ToDo: define the correct core features for the hbird */
|
/* ToDo: define the correct core features for the demosoc */
|
||||||
#define __ECLIC_PRESENT 1 /*!< Set to 1 if ECLIC is present */
|
#define __ECLIC_PRESENT 1 /*!< Set to 1 if ECLIC is present */
|
||||||
#define __ECLIC_BASEADDR 0x0C000000UL /*!< Set to ECLIC baseaddr of your device */
|
#define __ECLIC_BASEADDR 0x0C000000UL /*!< Set to ECLIC baseaddr of your device */
|
||||||
|
|
||||||
|
@ -188,9 +187,9 @@ typedef enum EXCn {
|
||||||
|
|
||||||
|
|
||||||
#include <nmsis_core.h> /*!< Nuclei N/NX class processor and core peripherals */
|
#include <nmsis_core.h> /*!< Nuclei N/NX class processor and core peripherals */
|
||||||
/* ToDo: include your system_hbird.h file
|
/* ToDo: include your system_demosoc.h file
|
||||||
replace 'Device' with your device name */
|
replace 'Device' with your device name */
|
||||||
#include "system_hbird.h" /*!< hbird System */
|
#include "system_demosoc.h" /*!< demosoc System */
|
||||||
|
|
||||||
|
|
||||||
/* ======================================== Start of section using anonymous unions ======================================== */
|
/* ======================================== Start of section using anonymous unions ======================================== */
|
||||||
|
@ -359,7 +358,7 @@ typedef struct {
|
||||||
__IOM uint8_t CSR; /* CR and SR in same address */
|
__IOM uint8_t CSR; /* CR and SR in same address */
|
||||||
} I2C_TypeDef;
|
} I2C_TypeDef;
|
||||||
|
|
||||||
/*@}*/ /* end of group hbird_Peripherals */
|
/*@}*/ /* end of group demosoc_Peripherals */
|
||||||
|
|
||||||
|
|
||||||
/* ========================================= End of section using anonymous unions ========================================= */
|
/* ========================================= End of section using anonymous unions ========================================= */
|
||||||
|
@ -385,21 +384,21 @@ typedef struct {
|
||||||
#define ONCHIP_ROM_BASE (0x00001000UL) /*!< (ROM ) Base Address */
|
#define ONCHIP_ROM_BASE (0x00001000UL) /*!< (ROM ) Base Address */
|
||||||
#define ONCHIP_ILM_BASE (0x80000000UL) /*!< (ILM ) Base Address */
|
#define ONCHIP_ILM_BASE (0x80000000UL) /*!< (ILM ) Base Address */
|
||||||
#define ONCHIP_DLM_BASE (0x90000000UL) /*!< (DLM ) Base Address */
|
#define ONCHIP_DLM_BASE (0x90000000UL) /*!< (DLM ) Base Address */
|
||||||
#define HBIRD_PERIPH_BASE (0x10000000UL) /*!< (Peripheral) Base Address */
|
#define DEMOSOC_PERIPH_BASE (0x10000000UL) /*!< (Peripheral) Base Address */
|
||||||
|
|
||||||
/* Peripheral memory map */
|
/* Peripheral memory map */
|
||||||
/* Fast-IO Interfaced IP */
|
/* Fast-IO Interfaced IP */
|
||||||
#define GPIO_BASE (HBIRD_PERIPH_BASE + 0x12000) /*!< (GPIO) Base Address */
|
#define GPIO_BASE (DEMOSOC_PERIPH_BASE + 0x12000) /*!< (GPIO) Base Address */
|
||||||
/* PPI Interfaced IP */
|
/* PPI Interfaced IP */
|
||||||
#define UART0_BASE (HBIRD_PERIPH_BASE + 0x13000) /*!< (UART0) Base Address */
|
#define UART0_BASE (DEMOSOC_PERIPH_BASE + 0x13000) /*!< (UART0) Base Address */
|
||||||
#define QSPI0_BASE (HBIRD_PERIPH_BASE + 0x14000) /*!< (QSPI0) Base Address */
|
#define QSPI0_BASE (DEMOSOC_PERIPH_BASE + 0x14000) /*!< (QSPI0) Base Address */
|
||||||
#define PWM0_BASE (HBIRD_PERIPH_BASE + 0x15000) /*!< (PWM0) Base Address */
|
#define PWM0_BASE (DEMOSOC_PERIPH_BASE + 0x15000) /*!< (PWM0) Base Address */
|
||||||
#define UART1_BASE (HBIRD_PERIPH_BASE + 0x23000) /*!< (UART1) Base Address */
|
#define UART1_BASE (DEMOSOC_PERIPH_BASE + 0x23000) /*!< (UART1) Base Address */
|
||||||
#define QSPI1_BASE (HBIRD_PERIPH_BASE + 0x24000) /*!< (QSPI1) Base Address */
|
#define QSPI1_BASE (DEMOSOC_PERIPH_BASE + 0x24000) /*!< (QSPI1) Base Address */
|
||||||
#define PWM1_BASE (HBIRD_PERIPH_BASE + 0x25000) /*!< (PWM1) Base Address */
|
#define PWM1_BASE (DEMOSOC_PERIPH_BASE + 0x25000) /*!< (PWM1) Base Address */
|
||||||
#define QSPI2_BASE (HBIRD_PERIPH_BASE + 0x34000) /*!< (QSPI2) Base Address */
|
#define QSPI2_BASE (DEMOSOC_PERIPH_BASE + 0x34000) /*!< (QSPI2) Base Address */
|
||||||
#define PWM2_BASE (HBIRD_PERIPH_BASE + 0x35000) /*!< (PWM2) Base Address */
|
#define PWM2_BASE (DEMOSOC_PERIPH_BASE + 0x35000) /*!< (PWM2) Base Address */
|
||||||
#define I2C_BASE (HBIRD_PERIPH_BASE + 0x42000) /*!< (I2C Master) Base Address */
|
#define I2C_BASE (DEMOSOC_PERIPH_BASE + 0x42000) /*!< (I2C Master) Base Address */
|
||||||
|
|
||||||
/** @} */ /* End of group Device_Peripheral_peripheralAddr */
|
/** @} */ /* End of group Device_Peripheral_peripheralAddr */
|
||||||
|
|
||||||
|
@ -448,7 +447,7 @@ typedef struct {
|
||||||
uint32_t get_cpu_freq();
|
uint32_t get_cpu_freq();
|
||||||
void delay_1ms(uint32_t count);
|
void delay_1ms(uint32_t count);
|
||||||
|
|
||||||
/** @} */ /* End of group hbird */
|
/** @} */ /* End of group demosoc */
|
||||||
|
|
||||||
/** @} */ /* End of group Nuclei */
|
/** @} */ /* End of group Nuclei */
|
||||||
|
|
||||||
|
@ -456,4 +455,4 @@ void delay_1ms(uint32_t count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __HBIRD_H__ */
|
#endif /* __DEMOSOC_H__ */
|
|
@ -1,6 +1,6 @@
|
||||||
// See LICENSE for license details.
|
// See LICENSE for license details.
|
||||||
#ifndef _HBIRD_GPIO_H
|
#ifndef _DEMOSOC_GPIO_H
|
||||||
#define _HBIRD_GPIO_H
|
#define _DEMOSOC_GPIO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -53,4 +53,4 @@ int32_t gpio_clear_interrupt(GPIO_TypeDef *gpio, uint32_t mask, GPIO_INT_TYPE ty
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _HBIRD_GPIO_H */
|
#endif /* _DEMOSOC_GPIO_H */
|
|
@ -1,7 +1,7 @@
|
||||||
//See LICENSE for license details
|
//See LICENSE for license details
|
||||||
|
|
||||||
#ifndef _HBIRD_I2C_H
|
#ifndef _DEMOSOC_I2C_H
|
||||||
#define _HBIRD_I2C_H
|
#define _DEMOSOC_I2C_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -53,4 +53,4 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _HBIRD_I2C_H */
|
#endif /* _DEMOSOC_I2C_H */
|
|
@ -1,7 +1,7 @@
|
||||||
// See LICENSE for license details.
|
// See LICENSE for license details.
|
||||||
|
|
||||||
#ifndef _HBIRD_PWM_H
|
#ifndef _DEMOSOC_PWM_H
|
||||||
#define _HBIRD_PWM_H
|
#define _DEMOSOC_PWM_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -41,4 +41,4 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _HBIRD_PWM_H */
|
#endif /* _DEMOSOC_PWM_H */
|
|
@ -1,7 +1,7 @@
|
||||||
// See LICENSE for license details.
|
// See LICENSE for license details.
|
||||||
|
|
||||||
#ifndef _HBIRD_SPI_H
|
#ifndef _DEMOSOC_SPI_H
|
||||||
#define _HBIRD_SPI_H
|
#define _DEMOSOC_SPI_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -83,4 +83,4 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _HBIRD_SPI_H */
|
#endif /* _DEMOSOC_SPI_H */
|
|
@ -1,7 +1,7 @@
|
||||||
// See LICENSE for license details.
|
// See LICENSE for license details.
|
||||||
|
|
||||||
#ifndef _HBIRD_UART_H
|
#ifndef _DEMOSOC_UART_H
|
||||||
#define _HBIRD_UART_H
|
#define _DEMOSOC_UART_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -72,4 +72,4 @@ int32_t uart_disable_rxint(UART_TypeDef *uart);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* _HBIRD_UART_H */
|
#endif /* _DEMOSOC_UART_H */
|
|
@ -0,0 +1,19 @@
|
||||||
|
// See LICENSE for license details.
|
||||||
|
#ifndef _NUCLEI_SDK_SOC_H
|
||||||
|
#define _NUCLEI_SDK_SOC_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "demosoc.h"
|
||||||
|
#include "demosoc_uart.h"
|
||||||
|
#include "demosoc_gpio.h"
|
||||||
|
#include "demosoc_i2c.h"
|
||||||
|
#include "demosoc_spi.h"
|
||||||
|
#include "demosoc_pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -17,15 +17,15 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* @file system_hbird.h
|
* @file system_demosoc.h
|
||||||
* @brief NMSIS Nuclei N/NX Device Peripheral Access Layer Header File for
|
* @brief NMSIS Nuclei N/NX Device Peripheral Access Layer Header File for
|
||||||
* Device <Device>
|
* Device <Device>
|
||||||
* @version V1.00
|
* @version V1.00
|
||||||
* @date 17. Dec 2019
|
* @date 17. Dec 2019
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef __SYSTEM_HBIRD_H__ /* ToDo: replace '<Device>' with your device name */
|
#ifndef __SYSTEM_DEMOSOC_H__ /* ToDo: replace '<Device>' with your device name */
|
||||||
#define __SYSTEM_HBIRD_H__
|
#define __SYSTEM_DEMOSOC_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -76,4 +76,4 @@ extern int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Typ
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __SYSTEM_HBIRD_H__ */
|
#endif /* __SYSTEM_DEMOSOC_H__ */
|
|
@ -1,5 +1,5 @@
|
||||||
#include "hbird.h"
|
#include "demosoc.h"
|
||||||
#include "hbird_gpio.h"
|
#include "demosoc_gpio.h"
|
||||||
|
|
||||||
int32_t gpio_iof_config(GPIO_TypeDef* gpio, uint32_t mask, IOF_FUNC func)
|
int32_t gpio_iof_config(GPIO_TypeDef* gpio, uint32_t mask, IOF_FUNC func)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,8 @@ int32_t gpio_set_pue(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value)
|
||||||
if (__RARELY(gpio == NULL)) {
|
if (__RARELY(gpio == NULL)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gpio->PULLUP_EN |= (mask & value);
|
mask = gpio->PULLUP_EN & (~mask);
|
||||||
|
gpio->PULLUP_EN = (mask | value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +91,8 @@ int32_t gpio_set_ds(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value)
|
||||||
if (__RARELY(gpio == NULL)) {
|
if (__RARELY(gpio == NULL)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gpio->DRIVE |= (mask & value);
|
mask = gpio->DRIVE & (~mask);
|
||||||
|
gpio->DRIVE = (mask | value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +101,8 @@ int32_t gpio_set_outxor(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value)
|
||||||
if (__RARELY(gpio == NULL)) {
|
if (__RARELY(gpio == NULL)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gpio->OUTPUT_XOR |= (mask & value);
|
mask = gpio->OUTPUT_XOR & (~mask);
|
||||||
|
gpio->OUTPUT_XOR = (mask | value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "hbird.h"
|
#include "demosoc.h"
|
||||||
#include "hbird_uart.h"
|
#include "demosoc_uart.h"
|
||||||
|
|
||||||
int32_t uart_init(UART_TypeDef* uart, uint32_t baudrate)
|
int32_t uart_init(UART_TypeDef* uart, uint32_t baudrate)
|
||||||
{
|
{
|
||||||
|
@ -43,8 +43,7 @@ uint8_t uart_read(UART_TypeDef *uart)
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
reg = uart->RXFIFO;
|
reg = uart->RXFIFO;
|
||||||
}
|
} while (reg & UART_RXFIFO_EMPTY);
|
||||||
while (reg & UART_RXFIFO_EMPTY);
|
|
||||||
return (uint8_t)(reg & 0xFF);
|
return (uint8_t)(reg & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* \file intexc_hbird.S
|
* \file intexc_demosoc.S
|
||||||
* \brief NMSIS Interrupt and Exception Handling Template File
|
* \brief NMSIS Interrupt and Exception Handling Template File
|
||||||
* for Nuclei HummingBird evaluation SoC which support Nuclei N/NX class cores
|
* for Nuclei Demo SoC which support Nuclei N/NX class cores
|
||||||
* \version V1.00
|
* \version V1.00
|
||||||
* \date 17 Dec 2019
|
* \date 17 Dec 2019
|
||||||
*
|
*
|
||||||
|
@ -174,6 +174,7 @@ exc_entry:
|
||||||
* system_Device.c, you can adjust it as you want
|
* system_Device.c, you can adjust it as you want
|
||||||
*/
|
*/
|
||||||
call core_exception_handler
|
call core_exception_handler
|
||||||
|
|
||||||
/* Restore the necessary CSR registers */
|
/* Restore the necessary CSR registers */
|
||||||
RESTORE_CSR_CONTEXT
|
RESTORE_CSR_CONTEXT
|
||||||
/* Restore the caller saving registers (context) */
|
/* Restore the caller saving registers (context) */
|
|
@ -16,9 +16,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* \file startup_hbird.S
|
* \file startup_demosoc.S
|
||||||
* \brief NMSIS Nuclei N/NX Class Core based Core Device Startup File for
|
* \brief NMSIS Nuclei N/NX Class Core based Core Device Startup File for
|
||||||
* Nuclei HummingBird evaluation SoC which support Nuclei N/NX class cores
|
* Nuclei Demo SoC which support Nuclei N/NX class cores
|
||||||
* \version V1.00
|
* \version V1.00
|
||||||
* \date 17. Dec 2019
|
* \date 17. Dec 2019
|
||||||
*
|
*
|
||||||
|
@ -90,6 +90,7 @@
|
||||||
.weak eclic_irq50_handler
|
.weak eclic_irq50_handler
|
||||||
|
|
||||||
.globl vector_base
|
.globl vector_base
|
||||||
|
.type vector_base, @object
|
||||||
vector_base:
|
vector_base:
|
||||||
#if defined(DOWNLOAD_MODE) && (DOWNLOAD_MODE != DOWNLOAD_MODE_FLASH)
|
#if defined(DOWNLOAD_MODE) && (DOWNLOAD_MODE != DOWNLOAD_MODE_FLASH)
|
||||||
j _start /* 0: Reserved, Jump to _start when reset for ILM/FlashXIP mode.*/
|
j _start /* 0: Reserved, Jump to _start when reset for ILM/FlashXIP mode.*/
|
||||||
|
@ -212,7 +213,6 @@ _start:
|
||||||
* will share common entry.
|
* will share common entry.
|
||||||
*/
|
*/
|
||||||
la t0, exc_entry
|
la t0, exc_entry
|
||||||
// la t0, HalTrapEntry
|
|
||||||
csrw CSR_MTVEC, t0
|
csrw CSR_MTVEC, t0
|
||||||
|
|
||||||
/* Set the interrupt processing mode to ECLIC mode */
|
/* Set the interrupt processing mode to ECLIC mode */
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
/* See LICENSE of license details. */
|
/* See LICENSE of license details. */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "nuclei_sdk_hal.h"
|
#include <nuclei_sdk_hal.h>
|
||||||
|
|
||||||
#undef errno
|
#undef errno
|
||||||
extern int errno;
|
extern int errno;
|
|
@ -3,7 +3,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "nuclei_sdk_hal.h"
|
#include <nuclei_sdk_hal.h>
|
||||||
|
|
||||||
__WEAK ssize_t _write(int fd, const void* ptr, size_t len)
|
__WEAK ssize_t _write(int fd, const void* ptr, size_t len)
|
||||||
{
|
{
|
|
@ -17,17 +17,16 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @file system_hbird.c
|
* @file system_demosoc.c
|
||||||
* @brief NMSIS Nuclei Core Device Peripheral Access Layer Source File for
|
* @brief NMSIS Nuclei Core Device Peripheral Access Layer Source File for
|
||||||
* Nuclei HummingBird evaluation SoC which support Nuclei N/NX class cores
|
* Nuclei Demo SoC which support Nuclei N/NX class cores
|
||||||
* @version V1.00
|
* @version V1.00
|
||||||
* @date 22. Nov 2019
|
* @date 22. Nov 2019
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "nuclei_sdk_hal.h"
|
#include "nuclei_sdk_hal.h"
|
||||||
#include "los_arch_interrupt.h"
|
|
||||||
#include "los_debug.h"
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Define clocks
|
Define clocks
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -62,7 +61,7 @@
|
||||||
* Thus one must assure that the variable always reflects the actual system clock speed.
|
* Thus one must assure that the variable always reflects the actual system clock speed.
|
||||||
*
|
*
|
||||||
* \attention
|
* \attention
|
||||||
* Be aware that a value stored to \c SystemCoreClock during low level initializaton (i.e. \c SystemInit()) might get
|
* Be aware that a value stored to \c SystemCoreClock during low level initialization (i.e. \c SystemInit()) might get
|
||||||
* overwritten by C libray startup code and/or .bss section initialization.
|
* overwritten by C libray startup code and/or .bss section initialization.
|
||||||
* Thus its highly recommended to call \ref SystemCoreClockUpdate at the beginning of the user \c main() routine.
|
* Thus its highly recommended to call \ref SystemCoreClockUpdate at the beginning of the user \c main() routine.
|
||||||
*
|
*
|
||||||
|
@ -167,8 +166,9 @@ static void system_default_exception_handler(unsigned long mcause, unsigned long
|
||||||
{
|
{
|
||||||
/* TODO: Uncomment this if you have implement printf function */
|
/* TODO: Uncomment this if you have implement printf function */
|
||||||
printf("MCAUSE : 0x%lx\r\n", mcause);
|
printf("MCAUSE : 0x%lx\r\n", mcause);
|
||||||
|
printf("MDCAUSE: 0x%lx\r\n", __RV_CSR_READ(CSR_MDCAUSE));
|
||||||
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
||||||
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR));
|
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MTVAL));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,10 +238,6 @@ uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
||||||
uint32_t EXCn = (uint32_t)(mcause & 0X00000fff);
|
uint32_t EXCn = (uint32_t)(mcause & 0X00000fff);
|
||||||
EXC_HANDLER exc_handler;
|
EXC_HANDLER exc_handler;
|
||||||
|
|
||||||
PRINTK("----------------All Task infomation ------------\r\n");
|
|
||||||
HalDisplayTaskInfo();
|
|
||||||
PRINTK("---------------exc handler infomation -----------\r\n");
|
|
||||||
|
|
||||||
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
||||||
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
|
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
|
||||||
} else if (EXCn == NMI_EXCn) {
|
} else if (EXCn == NMI_EXCn) {
|
||||||
|
@ -338,7 +334,7 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_
|
||||||
void _premain_init(void)
|
void _premain_init(void)
|
||||||
{
|
{
|
||||||
/* TODO: Add your own initialization code here, called before main */
|
/* TODO: Add your own initialization code here, called before main */
|
||||||
/* __ICACHE_PRESENT and __DCACHE_PRESENT are defined in hbird.h */
|
/* __ICACHE_PRESENT and __DCACHE_PRESENT are defined in demosoc.h */
|
||||||
#if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1
|
#if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1
|
||||||
EnableICache();
|
EnableICache();
|
||||||
#endif
|
#endif
|
||||||
|
@ -352,7 +348,7 @@ void _premain_init(void)
|
||||||
SystemBannerPrint();
|
SystemBannerPrint();
|
||||||
/* Initialize exception default handlers */
|
/* Initialize exception default handlers */
|
||||||
Exception_Init();
|
Exception_Init();
|
||||||
/* ECLIC initilization, mainly MTH and NLBIT */
|
/* ECLIC initialization, mainly MTH and NLBIT */
|
||||||
ECLIC_Init();
|
ECLIC_Init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
// See LICENSE for license details.
|
|
||||||
#ifndef _NUCLEI_SDK_SOC_H
|
|
||||||
#define _NUCLEI_SDK_SOC_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "hbird.h"
|
|
||||||
#include "hbird_uart.h"
|
|
||||||
#include "hbird_gpio.h"
|
|
||||||
#include "hbird_i2c.h"
|
|
||||||
#include "hbird_spi.h"
|
|
||||||
#include "hbird_pwm.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
static inline int _stub(int err)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
Loading…
Reference in New Issue