From 1480f7296cbf80908aad51ed3947472cc9817a58 Mon Sep 17 00:00:00 2001 From: flyingcys Date: Sun, 8 Jan 2023 15:26:31 +0800 Subject: [PATCH] format file && update README.md --- bsp/bl808/README.md | 38 ++++++++++++++--------- bsp/bl808/m0/applications/main.c | 4 +-- bsp/bl808/m0/drivers/board.c | 8 ++--- bsp/bl808/m0/drivers/board.h | 2 +- bsp/bl808/m0/drivers/drv_uart.c | 12 +++---- bsp/bl808/m0/drivers/drv_uart.h | 2 +- bsp/bl808/m0/libraries/.ignore_format.yml | 8 +++++ 7 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 bsp/bl808/m0/libraries/.ignore_format.yml diff --git a/bsp/bl808/README.md b/bsp/bl808/README.md index 64f2aa0d98..68d0b025b9 100644 --- a/bsp/bl808/README.md +++ b/bsp/bl808/README.md @@ -40,15 +40,34 @@ IR remote、 Display 和 GPIO。 ## 2. 编译说明 -BL808是多核异构架构,每个核需要单独编译,并烧录到对应的位置。 +BL808是多核异构架构,分为m0和d0,每个核需要单独编译,并烧录到对应的位置。 -Windows下推荐使用[env工具][1],然后在console下进入bsp/bl808目录中,选择需要编译的核心,m0或d0,运行: +### 2.1. 交叉编译期路径设置 +下载risc-v的工具链,[下载地址1](https://occ.t-head.cn/community/download?id=4073475960903634944)或[下载地址2](https://dl.sipeed.com/shareURL/others/toolchain) + +Windows下请使用使用[env工具][1],使用命令 `tar -xvf Xuantie-900-gcc-elf-newlib-mingw-V2.6.1-20220906.tar.gz` 解压交叉编译器,使用Windows下解压工具直接解压可能出现Windows下编译错误。 + +在`rtconfig.py`中将risc-v工具链的本地路径加入 `EXEC_PATH` 或通过 `RTT_EXEC_PATH` 环境变量指定路径 + +Windows: +``` +set RTT_EXEC_PATH=C:\Users\xxxx\Downloads\Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1\bin +``` + +Linux: +``` +export RTT_EXEC_PATH=/opt/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/bin +``` + +### 2.2. 编译 + +Windows下推荐使用[env工具][1],在console下进入bsp/bl808目录中,选择需要编译的核心,m0或d0,运行: cd bsp/bl808/m0 menuconfig pkgs --update -如果在Linux平台下,可以先执行 +如果在Linux平台下,可以先执行: scons --menuconfig @@ -58,19 +77,8 @@ Windows下推荐使用[env工具][1],然后在console下进入bsp/bl808目录 cd bsp/bl808/m0 pkgs --update -下载risc-v的工具链,[下载地址](https://occ.t-head.cn/community/download?id=4073475960903634944)或[下载地址](https://dl.sipeed.com/shareURL/others/toolchain) - -更新完软件包后,在`rtconfig.py`中将risc-v工具链的本地路径加入文档。 - -然后执行scons编译: - -``` - set RTT_EXEC_PATH=C:\Users\xxxx\Downloads\Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/bin - scons -``` -来编译这个板级支持包。 -或者通过 `scons --exec-path="GCC工具链路径"` 命令,在指定工具链位置的同时直接编译。 +更新完软件包后,执行 `scons -j10` 或 `scons -j10 --verbose` 来编译这个板级支持包。或者通过 `scons --exec-path="GCC工具链路径"` 命令,在指定工具链位置的同时直接编译。 如果编译正确无误,会产生rtthread.elf、rtthread_m0.bin文件。其中rtthread_m0.bin需要烧写到设备中进行运行。 diff --git a/bsp/bl808/m0/applications/main.c b/bsp/bl808/m0/applications/main.c index 7323c56d98..46101be0ad 100644 --- a/bsp/bl808/m0/applications/main.c +++ b/bsp/bl808/m0/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,4 +16,4 @@ int main(void) rt_kprintf("Hello, world\n"); return 0; -} \ No newline at end of file +} diff --git a/bsp/bl808/m0/drivers/board.c b/bsp/bl808/m0/drivers/board.c index ad3ae2dafa..97e0504610 100644 --- a/bsp/bl808/m0/drivers/board.c +++ b/bsp/bl808/m0/drivers/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -57,9 +57,9 @@ static void cmd_jtag_cpu0(void) /* This is the timer interrupt service routine. */ static void mtime_handler(void) -{ +{ rt_tick_increase(); - + csi_coret_config(CPU_Get_MTimer_Clock() / RT_TICK_PER_SECOND, MTIME_IRQn); } @@ -74,7 +74,7 @@ void rt_hw_board_init(void) #ifdef RT_USING_HEAP /* initialize memory system */ rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END); -#endif +#endif /* UART driver initialization is open by default */ #ifdef RT_USING_SERIAL diff --git a/bsp/bl808/m0/drivers/board.h b/bsp/bl808/m0/drivers/board.h index e1cb5a3c28..ead8fbdf84 100644 --- a/bsp/bl808/m0/drivers/board.h +++ b/bsp/bl808/m0/drivers/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/bl808/m0/drivers/drv_uart.c b/bsp/bl808/m0/drivers/drv_uart.c index 52c67e5a85..5f880cae9f 100644 --- a/bsp/bl808/m0/drivers/drv_uart.c +++ b/bsp/bl808/m0/drivers/drv_uart.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2022, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -170,7 +170,7 @@ static rt_err_t _uart_configure(struct rt_serial_device *serial, struct serial_c case STOP_BITS_1: uart_cfg.stopBits = UART_STOPBITS_1; break; - + case STOP_BITS_2: uart_cfg.stopBits = UART_STOPBITS_2; break; @@ -213,7 +213,7 @@ static rt_err_t _uart_configure(struct rt_serial_device *serial, struct serial_c /* enable uart */ UART_AutoBaudDetection(id, 0); - UART_Enable(id, UART_TXRX); + UART_Enable(id, UART_TXRX); return RT_EOK; } @@ -231,7 +231,7 @@ static rt_err_t _uart_control(struct rt_serial_device *serial, int cmd, void *ar { /* disable interrupt */ case RT_DEVICE_CTRL_CLR_INT: - bl_uart_int_disable(uart->port); + bl_uart_int_disable(uart->port); bl_uart_int_rx_notify_unregister(uart->port, _uart_rx_irq, uart); break; @@ -309,10 +309,10 @@ int rt_hw_uart_init(void) /* register USART device */ result = rt_hw_serial_register(serial, "uart0", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); RT_ASSERT(result == RT_EOK); #endif return 0; -} \ No newline at end of file +} diff --git a/bsp/bl808/m0/drivers/drv_uart.h b/bsp/bl808/m0/drivers/drv_uart.h index a4f82ba98b..f9158348d2 100644 --- a/bsp/bl808/m0/drivers/drv_uart.h +++ b/bsp/bl808/m0/drivers/drv_uart.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2022, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/bl808/m0/libraries/.ignore_format.yml b/bsp/bl808/m0/libraries/.ignore_format.yml new file mode 100644 index 0000000000..526edb3898 --- /dev/null +++ b/bsp/bl808/m0/libraries/.ignore_format.yml @@ -0,0 +1,8 @@ +# files format check exclude path, please follow the instructions below to modify; +# If you need to exclude an entire folder, add the folder path in dir_path; +# If you need to exclude a file, add the path to the file in file_path. + +dir_path: +- platform +- stage +- utils \ No newline at end of file -- GitLab