Ver Fonte

format file && update README.md

flyingcys há 2 anos atrás
pai
commit
1480f7296c

+ 23 - 15
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需要烧写到设备中进行运行。  
 

+ 2 - 2
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;
-}
+}

+ 4 - 4
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

+ 1 - 1
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
  *

+ 6 - 6
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;
-}
+}

+ 1 - 1
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
  *

+ 8 - 0
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