You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/12/29 09:52:23 UTC

[incubator-nuttx] 03/09: Solve the problems pointed out in the comments

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit ce40edbd111f18e4219a1fd0e40a28d6b213a7da
Author: Virus.V <vi...@live.com>
AuthorDate: Fri Dec 18 17:12:33 2020 +0800

    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 +
 arch/risc-v/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 +-
 boards/risc-v/bl602/bl602evb/scripts/Make.defs   | 21 ------
 boards/risc-v/bl602/bl602evb/scripts/ld.script   | 74 +-------------------
 boards/risc-v/bl602/bl602evb/src/bl602_appinit.c |  2 +-
 boards/risc-v/bl602/bl602evb/src/bl602_boot.c    | 12 +---
 boards/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 e428757..afc95b0 100644
--- a/arch/risc-v/include/bl602/chip.h
+++ b/arch/risc-v/include/bl602/chip.h
@@ -31,6 +31,5 @@
 #include <stdbool.h>
 
 #include <arch/irq.h>
-#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 b6eb9a1..8a3f562 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 d7d60e0..0d2e9f8 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 2a9c750..065c30c 100644
--- a/arch/risc-v/src/bl602/bl602_allocateheap.c
+++ b/arch/risc-v/src/bl602/bl602_allocateheap.c
@@ -24,11 +24,16 @@
 
 #include <nuttx/config.h>
 
-#include <arch/board/board.h>
-
 #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 4a7ff08..e4611a7 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: <Inline function 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: <Global function 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 f811682..00dadd1 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 <arch/rv32im/irq.h>
 
 	.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:
-
 
+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
+1:
 #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 8b876ec..c517ba1 100644
--- a/arch/risc-v/src/bl602/bl602_glb.c
+++ b/arch/risc-v/src/bl602/bl602_glb.c
@@ -25,49 +25,6 @@
 #include "hardware/bl602_glb.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: <Static function 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 116931a..6c2fc29 100644
--- a/arch/risc-v/src/bl602/bl602_gpio.c
+++ b/arch/risc-v/src/bl602/bl602_gpio.c
@@ -27,49 +27,6 @@
 #include "hardware/bl602_glb.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: <Static function 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 f81a4ad..cb58d21 100644
--- a/arch/risc-v/src/bl602/bl602_hbn.c
+++ b/arch/risc-v/src/bl602/bl602_hbn.c
@@ -26,49 +26,6 @@
 #include "hardware/bl602_hbn.h"
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: <Static function 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 f860773..36f096a 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 235603c..9b6d748 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 ba6c0f7..bdc1452 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 efa5275..041f8e5 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 b539c68..2c2e8fd 100644
--- a/arch/risc-v/src/bl602/bl602_serial.c
+++ b/arch/risc-v/src/bl602/bl602_serial.c
@@ -23,6 +23,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <nuttx/arch.h>
 
 #include <sys/types.h>
 #include <stdint.h>
@@ -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 5ec82e1..2aad898 100644
--- a/arch/risc-v/src/bl602/bl602_start.c
+++ b/arch/risc-v/src/bl602/bl602_start.c
@@ -25,12 +25,16 @@
 #include <stdint.h>
 
 #include <nuttx/config.h>
+#include <nuttx/arch.h>
 
 #include <arch/board/board.h>
 
-#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 ddda6fd..390c666 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 <nuttx/config.h>
+#include <nuttx/arch.h>
 
 #include <sys/types.h>
 
@@ -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 592681d..e039040 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 e428757..afc95b0 100644
--- a/arch/risc-v/src/bl602/chip.h
+++ b/arch/risc-v/src/bl602/chip.h
@@ -31,6 +31,5 @@
 #include <stdbool.h>
 
 #include <arch/irq.h>
-#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 b6f551a..be3f808 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 829f6d9..822d09a 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 7608882..e013ed8 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 cc6a4eb..2c22feb 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 7513276..d28ba44 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 <nuttx/board.h>
 #include <arch/board/board.h>
 
-#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 2f151f2..fdc7235 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 5d3d391..d58c1a7 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 */
+