From 7e84874cb15ca36124febc4f77131b13a22bf87f Mon Sep 17 00:00:00 2001 From: "Virus.V" Date: Fri, 18 Dec 2020 23:06:41 +0800 Subject: [PATCH] Reconstruct bl602 readme; move up_irq_save/restore declaration to common place --- arch/risc-v/include/bl602/irq.h | 2 -- arch/risc-v/src/bl602/bl602_lowputc.c | 3 --- boards/risc-v/bl602/bl602evb/README.txt | 28 ++++++++++---------- include/nuttx/arch.h | 34 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/arch/risc-v/include/bl602/irq.h b/arch/risc-v/include/bl602/irq.h index 8a3f562a2e3..aef56640298 100644 --- a/arch/risc-v/include/bl602/irq.h +++ b/arch/risc-v/include/bl602/irq.h @@ -224,8 +224,6 @@ extern "C" * Public Function Prototypes ****************************************************************************/ -EXTERN irqstate_t up_irq_save(void); -EXTERN void up_irq_restore(irqstate_t); EXTERN irqstate_t up_irq_enable(void); #undef EXTERN diff --git a/arch/risc-v/src/bl602/bl602_lowputc.c b/arch/risc-v/src/bl602/bl602_lowputc.c index 8305cbf56ad..6e66b6b9fc5 100644 --- a/arch/risc-v/src/bl602/bl602_lowputc.c +++ b/arch/risc-v/src/bl602/bl602_lowputc.c @@ -426,9 +426,6 @@ void bl602_lowsetup(void) bl602_uart_configure(BL602_CONSOLE_BASE, &g_bl602_console_config); - up_lowputc('A'); - up_lowputc('\r'); - up_lowputc('\n'); #endif /* HAVE_SERIAL_CONSOLE */ } diff --git a/boards/risc-v/bl602/bl602evb/README.txt b/boards/risc-v/bl602/bl602evb/README.txt index e7bd857d011..5fd2e7b79fd 100644 --- a/boards/risc-v/bl602/bl602evb/README.txt +++ b/boards/risc-v/bl602/bl602evb/README.txt @@ -2,27 +2,27 @@ $ curl https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz -2. Follow instruction on https://github.com/enjoy-digital/litex to build the vexriscv softcore fpga gateware - and flash to arty_a7 board +2. Download Bouffalo lab flash tools + + $ git clone https://github.com/bouffalo/flash_tools.git 3. Configure and build NuttX $ mkdir ./nuttx; cd ./nuttx - $ git clone https://bitbucket.org/nuttx/nuttx.git - $ git clone https://bitbucket.org/nuttx/apps.git + $ git clone https://github.com/apache/incubator-nuttx.git nuttx + $ git clone https://github.com/apache/incubator-nuttx-apps.git apps $ cd nuttx $ make distclean - $ ./tools/configure.sh arty_a7:nsh - $ make V=1 + $ ./tools/configure.sh bl602evb:nsh + $ make -j -4. Setup tftp server on your laptop, copy nuttx.bin to your tftpboot directory and change its name to boot.bin +4. Connect bl602 and computer via USB -5. Setup the wire connection(uart and tftp) between your board and laptop +5. Run flash tools, select the nuttx.bin generated in the previous step in the + Firmware bin field, and refer to the document for the settings of the remaining fields. + Click the download button to download bin to bl602. -6. Run $ minicom -b 1000000 /dev/ttyUSB1 (the default baudrate on litex vexriscv is 1e6) - when you see the bios prompt "litex>", type "netboot" and enter soon comes the nsh prompt +6. Run $ picocom -b 115200 /dev/ttyUSB0 (If you see garbled characters at the begining, it is because + boot2 outputs some log at 2M baud rate), then you will see "nuttx>" prompt. -7. TODO - - Support GPIO/SPI/I2C/RTC/WDT/PWM - Support RISC-V User mode +How to download to bl602 can refer to the docs in the https://github.com/bouffalolab/bl_iot_sdk repository. diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 31cd3b0e039..328f593ee5d 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -81,6 +81,7 @@ #include #include +#include #include #include @@ -1353,6 +1354,39 @@ void up_irqinitialize(void); bool up_interrupt_context(void); +/**************************************************************************** + * Name: up_irq_save + * + * Description: + * Save the current interrupt state and disable interrupts. + * + * Input Parameters: + * None + * + * Returned Value: + * Interrupt state prior to disabling interrupts. + * + ****************************************************************************/ + +irqstate_t up_irq_save(void); + +/**************************************************************************** + * Name: up_irq_restore + * + * Description: + * Restore the previous irq state (i.e., the one previously + * returned by up_irq_save()) + * + * Input Parameters: + * irqstate - The interrupt state to be restored. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_irq_restore(irqstate_t irqstate); + /**************************************************************************** * Name: up_enable_irq *