From ce40edbd111f18e4219a1fd0e40a28d6b213a7da Mon Sep 17 00:00:00 2001 From: "Virus.V" Date: Fri, 18 Dec 2020 17:12:33 +0800 Subject: [PATCH] Solve the problems pointed out in the comments --- arch/risc-v/include/bl602/chip.h | 1 - arch/risc-v/include/bl602/irq.h | 11 +-- arch/risc-v/src/bl602/Kconfig | 6 -- arch/risc-v/src/bl602/bl602_allocateheap.c | 12 +-- arch/risc-v/src/bl602/bl602_boot2.h | 63 -------------- arch/risc-v/src/bl602/bl602_entry.S | 86 ++++++------------- arch/risc-v/src/bl602/bl602_glb.c | 43 ---------- arch/risc-v/src/bl602/bl602_gpio.c | 44 +--------- arch/risc-v/src/bl602/bl602_hbn.c | 44 +--------- arch/risc-v/src/bl602/bl602_idle.c | 1 + arch/risc-v/src/bl602/bl602_irq.c | 13 ++- arch/risc-v/src/bl602/bl602_irq_dispatch.c | 1 + .../src/bl602/bl602_schedulesigaction.c | 1 + arch/risc-v/src/bl602/bl602_serial.c | 2 + arch/risc-v/src/bl602/bl602_start.c | 15 +++- arch/risc-v/src/bl602/bl602_tim_lowerhalf.c | 2 + arch/risc-v/src/bl602/bl602_timerisr.c | 1 + arch/risc-v/src/bl602/chip.h | 1 - boards/risc-v/bl602/bl602evb/include/board.h | 6 +- .../risc-v/bl602/bl602evb/scripts/Make.defs | 21 ----- .../risc-v/bl602/bl602evb/scripts/ld.script | 74 +--------------- .../risc-v/bl602/bl602evb/src/bl602_appinit.c | 2 +- boards/risc-v/bl602/bl602evb/src/bl602_boot.c | 12 +-- .../risc-v/bl602/bl602evb/src/bl602_bringup.c | 2 +- boards/risc-v/bl602/bl602evb/src/bl602evb.h | 3 +- 25 files changed, 82 insertions(+), 385 deletions(-) diff --git a/arch/risc-v/include/bl602/chip.h b/arch/risc-v/include/bl602/chip.h index e428757bded..afc95b0b160 100644 --- a/arch/risc-v/include/bl602/chip.h +++ b/arch/risc-v/include/bl602/chip.h @@ -31,6 +31,5 @@ #include #include -#include "riscv_internal.h" #endif /* __ARCH_RISCV_INCLUDE_BL602_CHIP_H */ diff --git a/arch/risc-v/include/bl602/irq.h b/arch/risc-v/include/bl602/irq.h index b6eb9a1e691..8a3f562a2e3 100644 --- a/arch/risc-v/include/bl602/irq.h +++ b/arch/risc-v/include/bl602/irq.h @@ -35,10 +35,6 @@ #define CLIC_TIMER_ENABLE_ADDRESS (0x02800407) -/* In mstatus register */ - -#define MIE_MSIE (0x1 << 3) /* Machine Software Interrupt Enable */ - /* Map RISC-V exception code to NuttX IRQ */ /* IRQ 0-15 : (exception:interrupt=0) */ @@ -54,8 +50,8 @@ #define BL602_IRQ_ECALLU (8) /* Environment Call from U-mode */ /* 9-10: Reserved */ -#define BL602_IRQ_ECALLM (11) /* Environment Call from M-mode */ - /* 12-15: Reserved */ +#define BL602_IRQ_ECALLM (11) /* Environment Call from M-mode */ + /* 12-15: Reserved */ /* IRQ 16- : (async event:interrupt=1) */ @@ -231,8 +227,6 @@ extern "C" EXTERN irqstate_t up_irq_save(void); EXTERN void up_irq_restore(irqstate_t); EXTERN irqstate_t up_irq_enable(void); -EXTERN void up_disable_irq(int irq); -EXTERN void up_enable_irq(int irq); #undef EXTERN #if defined(__cplusplus) @@ -240,3 +234,4 @@ EXTERN void up_enable_irq(int irq); #endif #endif /* __ASSEMBLY__ */ #endif /* __ARCH_RISCV_INCLUDE_BL602_IRQ_H */ + diff --git a/arch/risc-v/src/bl602/Kconfig b/arch/risc-v/src/bl602/Kconfig index d7d60e0144f..0d2e9f888cc 100644 --- a/arch/risc-v/src/bl602/Kconfig +++ b/arch/risc-v/src/bl602/Kconfig @@ -9,13 +9,11 @@ menu "BL602 Peripheral Support" config BL602_HAVE_UART0 bool - default y select UART0_SERIALDRIVER select ARCH_HAVE_SERIAL_TERMIOS config BL602_UART0 bool "UART0" - default y select ARCH_HAVE_UART0 config BL602_UART0_TX_PIN @@ -40,13 +38,11 @@ config BL602_UART0_CTS_PIN config BL602_HAVE_UART1 bool - default y select UART1_SERIALDRIVER select ARCH_HAVE_SERIAL_TERMIOS config BL602_UART1 bool "UART1" - default y select ARCH_HAVE_UART1 config BL602_UART1_TX_PIN @@ -71,9 +67,7 @@ config BL602_UART1_CTS_PIN config BL602_TIMER0 bool "TIMER0" - default y config BL602_TIMER1 bool "TIMER1" - default y endmenu diff --git a/arch/risc-v/src/bl602/bl602_allocateheap.c b/arch/risc-v/src/bl602/bl602_allocateheap.c index 2a9c7509869..065c30cd9c1 100644 --- a/arch/risc-v/src/bl602/bl602_allocateheap.c +++ b/arch/risc-v/src/bl602/bl602_allocateheap.c @@ -24,10 +24,15 @@ #include -#include - #include "chip.h" +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +extern uint8_t _heap_start; +extern uint8_t _heap_size; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -55,9 +60,6 @@ void up_addregion(void) * ****************************************************************************/ -extern uint8_t _heap_start; -extern uint8_t _heap_size; - void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { *heap_start = (FAR void *)&_heap_start; diff --git a/arch/risc-v/src/bl602/bl602_boot2.h b/arch/risc-v/src/bl602/bl602_boot2.h index 4a7ff08bf17..e4611a70c6c 100644 --- a/arch/risc-v/src/bl602/bl602_boot2.h +++ b/arch/risc-v/src/bl602/bl602_boot2.h @@ -106,68 +106,5 @@ struct pt_table_stuff_config_s uint32_t crc32; /* Partition entries crc32 */ }; -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Inline Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: - * - * Description: - * Description of the operation of the inline function. - * - * Input Parameters: - * A list of input parameters, one-per-line, appears here along with a - * description of each input parameter. - * - * Returned Value: - * Description of the value returned by this function (if any), - * including an enumeration of all possible error values. - * - * Assumptions/Limitations: - * Anything else that one might need to know to use this function. - * - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: - * - * Description: - * Description of the operation of the function. - * - * Input Parameters: - * A list of input parameters, one-per-line, appears here along with a - * description of each input parameter. - * - * Returned Value: - * Description of the value returned by this function (if any), - * including an enumeration of all possible error values. - * - * Assumptions/Limitations: - * Anything else that one might need to know to use this function. - * - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - #endif /* __ASSEMBLY__ */ #endif /* __ARCH_RISCV_SRC_BL602_HARDWARE_BL602_BOOT2_H */ diff --git a/arch/risc-v/src/bl602/bl602_entry.S b/arch/risc-v/src/bl602/bl602_entry.S index f811682ff76..00dadd1c1fb 100644 --- a/arch/risc-v/src/bl602/bl602_entry.S +++ b/arch/risc-v/src/bl602/bl602_entry.S @@ -18,11 +18,11 @@ * ****************************************************************************/ -/* This is defined in sifive/platform.h, but that can't be included from - * assembly. */ -#define CLINT_CTRL_ADDR 0x02000000 -#define MSTATUS_FS 0x00006000 -#define MSTATUS_MIE 0x00000008 +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include .section .init .globl bl602_start @@ -33,9 +33,11 @@ __start: bl602_start: .cfi_startproc .cfi_undefined ra -.option push -.option norelax - /*disable IRQ*/ + .option push + .option norelax + + /*disable IRQ*/ + li t0, MSTATUS_MIE csrc mstatus, t0 @@ -43,76 +45,76 @@ bl602_start: .option pop la sp, _sp_main - #ifndef RUN_IN_RAM /* Load boot2 partition address */ + la a0, __boot2_pt_addr_src la a1, __boot2_pt_addr_start la a2, __boot2_pt_addr_end bgeu a1, a2, 2f + 1: lw t0, (a0) sw t0, (a1) addi a0, a0, 4 addi a1, a1, 4 bltu a1, a2, 1b + 2: - - /* Load boot2 flashCfg address */ + jal boot2_get_flash_addr la a1, __boot2_flash_cfg_start la a2, __boot2_flash_cfg_end bgeu a1, a2, 2f + 1: lw t0, (a0) sw t0, (a1) addi a0, a0, 4 addi a1, a1, 4 bltu a1, a2, 1b + 2: #endif - /* Load data section */ + la a0, _data_load la a1, _data_run la a2, _data_run_end bgeu a1, a2, 2f + 1: lw t0, (a0) sw t0, (a1) addi a0, a0, 4 addi a1, a1, 4 bltu a1, a2, 1b -2: +2: /* Clear bss section */ + la a0, __bss_start la a1, __bss_end bgeu a0, a1, 3f + 1: sw zero, (a0) addi a0, a0, 4 bltu a0, a1, 1b /* Clear bss section */ + la a0, __wifi_bss_start la a1, __wifi_bss_end bgeu a0, a1, 3f + 1: sw zero, (a0) addi a0, a0, 4 bltu a0, a1, 1b 3: - - /* Call global constructors */ -#if 0 - la a0, __libc_fini_array - call atexit - call __libc_init_array -#endif - #ifndef __riscv_float_abi_soft /* Enable FPU */ li t0, MSTATUS_FS @@ -121,56 +123,22 @@ bl602_start: and t1, t1, t0 beqz t1, 1f fssr x0 + 1: #endif -#if defined(ENABLE_SMP) - smp_resume(t0, t1) - - csrr a0, mhartid - bnez a0, 2f -#endif - auipc ra, 0 addi sp, sp, -16 -#if __riscv_xlen == 32 sw ra, 8(sp) -#else - sd ra, 8(sp) -#endif /* argc = argv = 0 */ + li a0, 0 li a1, 0 call bfl_main -#if 0 - tail exit -#endif -1: - j 1b - -#if defined(ENABLE_SMP) -2: - la t0, trap_entry - csrw mtvec, t0 - - csrr a0, mhartid - la t1, _sp_main - slli t0, a0, 10 - sub sp, t1, t0 - - auipc ra, 0 - addi sp, sp, -16 -#if __riscv_xlen == 32 - sw ra, 8(sp) -#else - sd ra, 8(sp) -#endif - - call secondary_main - tail exit 1: j 1b -#endif + .cfi_endproc + diff --git a/arch/risc-v/src/bl602/bl602_glb.c b/arch/risc-v/src/bl602/bl602_glb.c index 8b876ecd878..c517ba1b0e1 100644 --- a/arch/risc-v/src/bl602/bl602_glb.c +++ b/arch/risc-v/src/bl602/bl602_glb.c @@ -24,49 +24,6 @@ #include "hardware/bl602_glb.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: - * - * Description: - * Description of the operation of the static function. - * - * Input Parameters: - * A list of input parameters, one-per-line, appears here along with a - * description of each input parameter. - * - * Returned Value: - * Description of the value returned by this function (if any), - * including an enumeration of all possible error values. - * - * Assumptions/Limitations: - * Anything else that one might need to know to use this function. - * - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/bl602/bl602_gpio.c b/arch/risc-v/src/bl602/bl602_gpio.c index 116931aaaa9..6c2fc29ef41 100644 --- a/arch/risc-v/src/bl602/bl602_gpio.c +++ b/arch/risc-v/src/bl602/bl602_gpio.c @@ -26,49 +26,6 @@ #include "hardware/bl602_gpio.h" #include "hardware/bl602_glb.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: - * - * Description: - * Description of the operation of the static function. - * - * Input Parameters: - * A list of input parameters, one-per-line, appears here along with a - * description of each input parameter. - * - * Returned Value: - * Description of the value returned by this function (if any), - * including an enumeration of all possible error values. - * - * Assumptions/Limitations: - * Anything else that one might need to know to use this function. - * - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -182,3 +139,4 @@ void gpio_init(struct gpio_cfg_s *cfg) *p_out = tmp_out; } + diff --git a/arch/risc-v/src/bl602/bl602_hbn.c b/arch/risc-v/src/bl602/bl602_hbn.c index f81a4add78f..cb58d213d59 100644 --- a/arch/risc-v/src/bl602/bl602_hbn.c +++ b/arch/risc-v/src/bl602/bl602_hbn.c @@ -25,49 +25,6 @@ #include "hardware/bl602_hbn.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: - * - * Description: - * Description of the operation of the static function. - * - * Input Parameters: - * A list of input parameters, one-per-line, appears here along with a - * description of each input parameter. - * - * Returned Value: - * Description of the value returned by this function (if any), - * including an enumeration of all possible error values. - * - * Assumptions/Limitations: - * Anything else that one might need to know to use this function. - * - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -98,3 +55,4 @@ void hbn_set_uart_clk_sel(enum hbn_uart_clk_type_e clk_sel) tmp_val = BL_SET_REG_BITS_VAL(tmp_val, HBN_UART_CLK_SEL, clk_sel); BL_WR_REG(HBN_BASE, HBN_GLB, tmp_val); } + diff --git a/arch/risc-v/src/bl602/bl602_idle.c b/arch/risc-v/src/bl602/bl602_idle.c index f8607732d69..36f096a96e8 100644 --- a/arch/risc-v/src/bl602/bl602_idle.c +++ b/arch/risc-v/src/bl602/bl602_idle.c @@ -65,3 +65,4 @@ void up_idle(void) #endif } + diff --git a/arch/risc-v/src/bl602/bl602_irq.c b/arch/risc-v/src/bl602/bl602_irq.c index 235603c9835..9b6d748ba56 100644 --- a/arch/risc-v/src/bl602/bl602_irq.c +++ b/arch/risc-v/src/bl602/bl602_irq.c @@ -40,22 +40,26 @@ #include "chip.h" -void bl_irq_enable(unsigned int source) +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static inline void bl_irq_enable(unsigned int source) { *(volatile uint8_t *)(CLIC_HART0_ADDR + CLIC_INTIE + source) = 1; } -void bl_irq_disable(unsigned int source) +static inline void bl_irq_disable(unsigned int source) { *(volatile uint8_t *)(CLIC_HART0_ADDR + CLIC_INTIE + source) = 0; } -void bl_irq_pending_set(unsigned int source) +static inline void bl_irq_pending_set(unsigned int source) { *(volatile uint8_t *)(CLIC_HART0_ADDR + CLIC_INTIP + source) = 1; } -void bl_irq_pending_clear(unsigned int source) +static inline void bl_irq_pending_clear(unsigned int source) { *(volatile uint8_t *)(CLIC_HART0_ADDR + CLIC_INTIP + source) = 0; } @@ -251,3 +255,4 @@ irqstate_t up_irq_enable(void) asm volatile("csrrs %0, mstatus, %1" : "=r"(oldstat) : "r"(MSTATUS_MIE)); return oldstat; } + diff --git a/arch/risc-v/src/bl602/bl602_irq_dispatch.c b/arch/risc-v/src/bl602/bl602_irq_dispatch.c index ba6c0f77dde..bdc1452fc86 100644 --- a/arch/risc-v/src/bl602/bl602_irq_dispatch.c +++ b/arch/risc-v/src/bl602/bl602_irq_dispatch.c @@ -103,3 +103,4 @@ void *bl602_dispatch_irq(uint32_t vector, uint32_t *regs) return regs; } + diff --git a/arch/risc-v/src/bl602/bl602_schedulesigaction.c b/arch/risc-v/src/bl602/bl602_schedulesigaction.c index efa5275a2fd..041f8e5c26c 100644 --- a/arch/risc-v/src/bl602/bl602_schedulesigaction.c +++ b/arch/risc-v/src/bl602/bl602_schedulesigaction.c @@ -193,3 +193,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) leave_critical_section(flags); } + diff --git a/arch/risc-v/src/bl602/bl602_serial.c b/arch/risc-v/src/bl602/bl602_serial.c index b539c687a85..2c2e8fdcac7 100644 --- a/arch/risc-v/src/bl602/bl602_serial.c +++ b/arch/risc-v/src/bl602/bl602_serial.c @@ -23,6 +23,7 @@ ****************************************************************************/ #include +#include #include #include @@ -982,3 +983,4 @@ int up_putc(int ch) } #endif /* USE_SERIALDRIVER */ + diff --git a/arch/risc-v/src/bl602/bl602_start.c b/arch/risc-v/src/bl602/bl602_start.c index 5ec82e10ff0..2aad8989b3c 100644 --- a/arch/risc-v/src/bl602/bl602_start.c +++ b/arch/risc-v/src/bl602/bl602_start.c @@ -25,12 +25,16 @@ #include #include +#include #include -#include "bl602_boot2.h" +#include "riscv_internal.h" #include "chip.h" +#include "bl602_boot2.h" +#include "hardware/bl602_hbn.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -115,6 +119,8 @@ uint32_t boot2_get_flash_addr(void) void bfl_main(void) { + uint32_t tmp_val; + /* set interrupt vector */ asm volatile("csrw mtvec, %0" ::"r"((uintptr_t)exception_common + 2)); @@ -123,6 +129,12 @@ void bfl_main(void) bl602_lowsetup(); + /* HBN Config AON pad input and SMT */ + + tmp_val = BL_RD_REG(HBN_BASE, HBN_IRQ_MODE); + tmp_val = BL_SET_REG_BITS_VAL(tmp_val, HBN_REG_AON_PAD_IE_SMT, 1); + BL_WR_REG(HBN_BASE, HBN_IRQ_MODE, tmp_val); + #ifdef USE_EARLYSERIALINIT up_earlyserialinit(); #endif @@ -140,3 +152,4 @@ void bfl_main(void) while (1) ; } + diff --git a/arch/risc-v/src/bl602/bl602_tim_lowerhalf.c b/arch/risc-v/src/bl602/bl602_tim_lowerhalf.c index ddda6fd0e07..390c6663f91 100644 --- a/arch/risc-v/src/bl602/bl602_tim_lowerhalf.c +++ b/arch/risc-v/src/bl602/bl602_tim_lowerhalf.c @@ -23,6 +23,7 @@ ****************************************************************************/ #include +#include #include @@ -447,3 +448,4 @@ int bl602_timer_initialize(FAR const char *devpath, int timer) return OK; } + diff --git a/arch/risc-v/src/bl602/bl602_timerisr.c b/arch/risc-v/src/bl602/bl602_timerisr.c index 592681d9efd..e0390402bc1 100644 --- a/arch/risc-v/src/bl602/bl602_timerisr.c +++ b/arch/risc-v/src/bl602/bl602_timerisr.c @@ -154,3 +154,4 @@ void up_timer_initialize(void) up_enable_irq(BL602_IRQ_MTIMER); } + diff --git a/arch/risc-v/src/bl602/chip.h b/arch/risc-v/src/bl602/chip.h index e428757bded..afc95b0b160 100644 --- a/arch/risc-v/src/bl602/chip.h +++ b/arch/risc-v/src/bl602/chip.h @@ -31,6 +31,5 @@ #include #include -#include "riscv_internal.h" #endif /* __ARCH_RISCV_INCLUDE_BL602_CHIP_H */ diff --git a/boards/risc-v/bl602/bl602evb/include/board.h b/boards/risc-v/bl602/bl602evb/include/board.h index b6f551a6489..be3f80850d9 100644 --- a/boards/risc-v/bl602/bl602evb/include/board.h +++ b/boards/risc-v/bl602/bl602evb/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/litex/arty_a7/include/board.h + * boards/risc-v/bl602/bl602evb/include/board.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -58,11 +58,11 @@ extern "C" * Name: litex_boardinitialize ****************************************************************************/ -void litex_boardinitialize(void); +void bl602_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) } #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_RISC-V_BL602_EVB_INCLUDE_BOARD_H */ +#endif /* __BOARDS_RISC_V_BL602_BL602EVB_INCLUDE_BOARD_H */ diff --git a/boards/risc-v/bl602/bl602evb/scripts/Make.defs b/boards/risc-v/bl602/bl602evb/scripts/Make.defs index 829f6d92b51..822d09a2e89 100644 --- a/boards/risc-v/bl602/bl602evb/scripts/Make.defs +++ b/boards/risc-v/bl602/bl602evb/scripts/Make.defs @@ -27,31 +27,12 @@ ARCH_INCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)include LDSCRIPT = ld.script -CINCPATH := ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include} -CXXINCPATH := ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include$(DELIM)cxx} - -ARCHINCLUDES += $(CINCPATH) -ARCHXXINCLUDES += $(CINCPATH) $(CXXINCPATH) - ifeq ($(CONFIG_CYGWIN_WINTOOL),y) ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}" else ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) endif -CC = $(CROSSDEV)gcc -CXX = $(CROSSDEV)g++ -CPP = $(CROSSDEV)gcc -E -LD = $(CROSSDEV)ld -STRIP = $(CROSSDEV)strip --strip-unneeded -AR = $(ARCROSSDEV)ar rcs -NM = $(ARCROSSDEV)nm -OBJCOPY = $(CROSSDEV)objcopy -OBJDUMP = $(CROSSDEV)objdump - -ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} -ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} - ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATION = -g ASARCHCPUFLAGS += -Wa,-g @@ -85,5 +66,3 @@ LDNXFLATFLAGS = -e main -s 2048 LDFLAGS += --gc-sections -melf32lriscv -HOSTCC = gcc -HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe diff --git a/boards/risc-v/bl602/bl602evb/scripts/ld.script b/boards/risc-v/bl602/bl602evb/scripts/ld.script index 76088826990..e013ed8b375 100644 --- a/boards/risc-v/bl602/bl602evb/scripts/ld.script +++ b/boards/risc-v/bl602/bl602evb/scripts/ld.script @@ -189,23 +189,10 @@ SECTIONS __freertos_irq_stack_top = .; } >ram_tcm - - /*SYMOBOL used in code*/ - PROVIDE( _ld_bl_static_cli_cmds_start = _bl_static_cli_cmds_start ); - PROVIDE( _ld_bl_static_cli_cmds_end = _bl_static_cli_cmds_end ); - /*CFG FW used in code*/ PROVIDE( _ld_bl_static_cfg_entry_start = _bl_static_fw_cfg_entry_start ); PROVIDE( _ld_bl_static_cfg_entry_end = _bl_static_fw_cfg_entry_end ); - - /* blog */ - PROVIDE( _ld_bl_static_blogcomponent_code_start = _bl_static_blogcomponent_code_start ); - PROVIDE( _ld_bl_static_blogcomponent_code_end = _bl_static_blogcomponent_code_end ); - PROVIDE( _ld_bl_static_blogfile_code_start = _bl_static_blogfile_code_start ); - PROVIDE( _ld_bl_static_blogfile_code_end = _bl_static_blogfile_code_end ); - PROVIDE( _ld_bl_static_blogpri_code_start = _bl_static_blogpri_code_start ); - PROVIDE( _ld_bl_static_blogpri_code_end = _bl_static_blogpri_code_end ); - + PROVIDE( _ld_ram_size0 = LENGTH(flash) ); PROVIDE( _ld_ram_addr0 = ORIGIN(flash) ); PROVIDE( _ld_ram_size1 = LENGTH(ram_tcm) ); @@ -218,62 +205,5 @@ SECTIONS PROVIDE ( __boot2_pt_addr_src = BOOT2_PT_ADDR ); PROVIDE ( __boot2_flash_cfg_src = BOOT2_FLASHCFG_ADDR ); - PROVIDE(xTaskGetTickCount = 0x0000000021017694); - PROVIDE(xTaskGetTickCountFromISR = 0x00000000210176aa); - PROVIDE(pvPortMalloc = 0x0000000021019662); - PROVIDE(vPortFree = 0x000000002101973a); - PROVIDE(vTaskNotifyGiveFromISR = 0x00000000210188e8); - PROVIDE(vTaskSwitchContext = 0x0000000021017a04); - PROVIDE(ulTaskNotifyTake = 0x0000000021018548); - PROVIDE(vTaskExitCritical = 0x00000000210183f4); - PROVIDE(vTaskEnterCritical = 0x00000000210183e4); - PROVIDE(xTaskGetCurrentTaskHandle = 0x0000000021018152); - PROVIDE(xQueueSemaphoreTake = 0x0000000021015ce8); - PROVIDE(xQueueGenericSend = 0x0000000021015834); - PROVIDE(xQueueGenericSendFromISR = 0x0000000021015a4c); - PROVIDE(xTaskCreateStatic = 0x00000000210170a2); - PROVIDE(xTaskCreate = 0x000000002101713a); - PROVIDE(xQueueCreateMutex = 0x0000000021015a1c); - PROVIDE(xQueueCreateMutexStatic = 0x0000000021015994); - PROVIDE(vQueueDelete = 0x00000000210161d8); - PROVIDE(xQueueGenericCreateStatic = 0x00000000210156c2); - PROVIDE(xQueueGenericCreate = 0x0000000021015744); - PROVIDE(xQueueReceive = 0x0000000021015b8a); - PROVIDE(uxQueueMessagesWaiting = 0x0000000021016168); - PROVIDE(vTaskDelay = 0x00000000210179c6); - PROVIDE(vTaskDelayUntil = 0x0000000021017952); - PROVIDE(xPortGetFreeHeapSize = 0x00000000210197ce); - PROVIDE(vTaskList = 0x0000000021018408); - PROVIDE(xTimerGenericCommand = 0x0000000021018bec); - PROVIDE(xTimerCreateTimerTask = 0x0000000021018a9e); - PROVIDE(xTimerCreate = 0x0000000021018af6); - PROVIDE(xTimerCreateStatic = 0x0000000021018b66); - PROVIDE(xQueueCreateCountingSemaphoreStatic = 0x00000000210157c2); - PROVIDE(xQueueCreateCountingSemaphore = 0x0000000021015800); - PROVIDE(pTrapNetCounter = __global_pointer_head$); - PROVIDE(TrapNetCounter = __global_pointer_head$ + 0x58); - PROVIDE(vEventGroupDelete = 0x00000000210153be); - PROVIDE(xEventGroupWaitBits = 0x0000000021015086); - PROVIDE(xEventGroupCreateStatic = 0x0000000021015000); - PROVIDE(xEventGroupSetBits = 0x00000000210151e0); - PROVIDE(xStreamBufferGenericCreateStatic = 0x00000000210165c0); - PROVIDE(xStreamBufferReceive = 0x00000000210169ae); - PROVIDE(xStreamBufferSend = 0x00000000210167a8); - PROVIDE(pvTimerGetTimerID = 0x0000000021018fd4); - PROVIDE(xTaskGenericNotify = 0x00000000210186be); - PROVIDE(xTaskGenericNotifyFromISR = 0x00000000210187de); - PROVIDE(xQueueGiveMutexRecursive = 0x00000000210159c8); - PROVIDE(xQueueTakeMutexRecursive = 0x0000000021015e70); - PROVIDE(xTaskGetTickCount2 = 0x000000002101769a); - PROVIDE(xQueueGiveFromISR = 0x0000000021015b0e); - PROVIDE(vTaskDelete = 0x00000000210171b6); - PROVIDE(uxTaskGetStackHighWaterMark = 0x0000000021018110); - PROVIDE(pcTaskGetName = 0x00000000210176b6); - PROVIDE(vTaskStartScheduler = 0x0000000021017610); - PROVIDE(vPortDefineHeapRegions = 0x00000000210197da); - PROVIDE(__LD_CONFIG_EM_SEL = __EM_SIZE); - - PROVIDE( _ld_symbol_rom_framework_audio_device_start = _rom_framework_audio_device_start); - PROVIDE( _ld_symbol_rom_framework_audio_device_end = _rom_framework_audio_device_end); - + PROVIDE (__LD_CONFIG_EM_SEL = __EM_SIZE); } diff --git a/boards/risc-v/bl602/bl602evb/src/bl602_appinit.c b/boards/risc-v/bl602/bl602evb/src/bl602_appinit.c index cc6a4eb1464..2c22feb04e1 100644 --- a/boards/risc-v/bl602/bl602evb/src/bl602_appinit.c +++ b/boards/risc-v/bl602/bl602evb/src/bl602_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/bl602/evb/src/litex_appinit.c + * boards/risc-v/bl602/evb/src/bl602_appinit.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/bl602/bl602evb/src/bl602_boot.c b/boards/risc-v/bl602/bl602evb/src/bl602_boot.c index 75132765f55..d28ba44de0b 100644 --- a/boards/risc-v/bl602/bl602evb/src/bl602_boot.c +++ b/boards/risc-v/bl602/bl602evb/src/bl602_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/bl602/evb/src/litex_boot.c + * boards/risc-v/bl602/evb/src/bl602_boot.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,8 +29,6 @@ #include #include -#include "hardware/bl602_hbn.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -47,7 +45,7 @@ * Name: bl602_boardinitialize * * Description: - * All LITEX architectures must provide the following entry point. + * All bl602 architectures must provide the following entry point. * This entry point is called early in the initialization -- after all * memory has been configured and mapped but before any devices have been * initialized. @@ -56,9 +54,5 @@ void bl602_boardinitialize(void) { - uint32_t tmp_val; - - tmp_val = BL_RD_REG(HBN_BASE, HBN_IRQ_MODE); - tmp_val = BL_SET_REG_BITS_VAL(tmp_val, HBN_REG_AON_PAD_IE_SMT, 1); - BL_WR_REG(HBN_BASE, HBN_IRQ_MODE, tmp_val); } + diff --git a/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c b/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c index 2f151f24e29..fdc7235b671 100644 --- a/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c +++ b/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/bl602/evb/src/litex_bringup.c + * boards/risc-v/bl602/evb/src/bl602_bringup.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/bl602/bl602evb/src/bl602evb.h b/boards/risc-v/bl602/bl602evb/src/bl602evb.h index 5d3d3919ee9..d58c1a7ce85 100644 --- a/boards/risc-v/bl602/bl602evb/src/bl602evb.h +++ b/boards/risc-v/bl602/bl602evb/src/bl602evb.h @@ -29,4 +29,5 @@ int bl602_bringup(void); -#endif /* __BOARDS_RISCV_BL602_EVB_SRC_ARTY_A7_H */ +#endif /* __BOARDS_RISCV_BL602_BL602EVB_SRC_BL602EVB_H */ +