From 4e21c1254da4489222ee1d33301add99dbb30210 Mon Sep 17 00:00:00 2001 From: shinu_61 Date: Mon, 23 Aug 2021 16:02:29 +0800 Subject: [PATCH] update K210 BSP --- bsp/k210/README.md | 11 ++++++++++- bsp/k210/link.lds | 25 +++++++++++++++++++++++++ bsp/k210/rtconfig.py | 4 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/bsp/k210/README.md b/bsp/k210/README.md index cdf0848444..eb16f53f63 100644 --- a/bsp/k210/README.md +++ b/bsp/k210/README.md @@ -31,9 +31,18 @@ Kendryte中文含义为勘智,而勘智取自勘物探智。这颗芯片主要 ## 2. 编译说明 -编译K210,需要有RT-Thread的代码,因为K210的sdk是以软件包方式,所以需要在bsp/k210下做软件包更新。Windows下推进使用[env工具][1],然后在console下进入bsp/k210目录中,运行: +编译 K210,需要有 RT-Thread 的代码,因为 K210 的 sdk 是以软件包方式,所以需要在 bsp/k210 下做软件包更新。注意,需要使用 latest 的 RT-Thread 源码和 Latest 的软件包,软件包在menuconfig中的配置路径如下: + +​ RT-Thread online packages ---> peripheral libraries and drivers ---> kendryte K210 SDK package for rt-thread 。 + +最新的 k210 SDK 使用了 C++17 编写了部分代码,因此需要打开 C++ 组件,C++组件在menuconfig中的配置路径如下: + +​ RT-Thread Components ---> C++ features + +Windows下推进使用[env工具][1],然后在console下进入bsp/k210目录中,运行: cd bsp/k210 + menuconfig # 在软件包中选择最新的 k210 SDK pkgs --update 如果在Linux平台下,可以先执行 diff --git a/bsp/k210/link.lds b/bsp/k210/link.lds index bcf7681595..60b39fb5f1 100644 --- a/bsp/k210/link.lds +++ b/bsp/k210/link.lds @@ -44,6 +44,18 @@ SECTIONS *(.glue_7) *(.glue_7t) *(.gnu.linkonce.t*) + + . = ALIGN(8); + + PROVIDE(__ctors_start__ = .); + /* old GCC version uses .ctors */ + KEEP(*(SORT(.ctors.*))) + KEEP(*(.ctors)) + /* new GCC version uses .init_array */ + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + /* section information for finsh shell */ . = ALIGN(8); @@ -63,6 +75,13 @@ SECTIONS __rt_init_end = .; . = ALIGN(8); + + __spi_func_start = .; + KEEP(*(.spi_call)) + __spi_func_end = .; + + . = ALIGN(8); + __rt_utest_tc_tab_start = .; KEEP(*(UtestTcTab)) __rt_utest_tc_tab_end = .; @@ -93,6 +112,12 @@ SECTIONS *(.sdata) *(.sdata.*) + + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); + } > SRAM /* stack for dual core */ diff --git a/bsp/k210/rtconfig.py b/bsp/k210/rtconfig.py index 0f336d545e..723552776b 100755 --- a/bsp/k210/rtconfig.py +++ b/bsp/k210/rtconfig.py @@ -15,7 +15,7 @@ if os.getenv('RTT_CC'): if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = r'/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin' + EXEC_PATH = r'D:\K210\xpack-riscv-none-embed-gcc-8.3.0-1.2-win32-x64\xpack-riscv-none-embed-gcc-8.3.0-1.2\bin' else: print('Please make sure your toolchains is GNU GCC!') exit(0) @@ -51,7 +51,7 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2 -Os' - CXXFLAGS = CFLAGS + CXXFLAGS = CFLAGS + ' -std=gnu++17 -Wno-multichar' DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n' POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' -- GitLab