K210 Standalone SDK v0.5.3 released


  • |  Mod

    Major change

    • Modify KPU driver for latest model compiler
    • Add freertos
    • Add new gpiohs and wdt interrupt function
    • Add dvp xclk setting
    • Add sysctl reset status

    Non-breaking bug fixes

    • Fix i2c issues
    • Fix spi issues

    Breaking change

    • Fix uarths stopbit problem
    • Fix core1 stack problem
    • Fix core1 interrupt problem

    You can find the release on https://github.com/kendryte/kendryte-standalone-sdk/releases/tag/V0.5.3 or https://kendryte.com/downloads/

    kendryte_standalone_programming_guide https://s3.cn-north-1.amazonaws.com.cn/dl.kendryte.com/documents/kendryte_standalone_programming_guide_v0.4.0.pdf

    Demo synchronous update https://github.com/kendryte/kendryte-standalone-demo/tree/master


  • Staff |  Mod



  • If the programming guides and other Chinese-only documents were published as HTML rather than PDF, Chrome and other tools would provide translations. PDF is a limiting format.



  • @skxo I've only been able to compile by rebuilding the toolchain from https://github.com/kendryte/kendryte-gnu-toolchain after modifying newlib/libc/sys/riscv/lock.c and newlib/libc/sys/riscv/sys/lock.h to implement those functions. I haven't tested it yet to see if it actually produces working firmware.

    If you just provide empty implementations (returning 0 for _lock_try_acquire() and _lock_try_acquire_recursive()), it seems like it should work as long as you only call newlib functions from one core or RTOS task. It's also straightforward to implement them using the atomic.h from the SDK, which is what I did.



  • @cjameshuff
    hello,

    thanks for your post.
    I have the same undefined reference to `_lock_release_recursive' when I try to compile an hello_world using the sdk kendryte-freertos-sdk-0.7.0.
    Are you able to compile? If yes, which one sdk please?

    Regards
    sk



  • @Bits the relevant file seems to be cmake/executable.cmake, and it already has the needed --start-group/--end-group.

    The problem seems to be here:
    https://github.com/kendryte/kendryte-newlib/blob/develop/newlib/libc/sys/riscv/lock.c

    The implementations for those functions are missing. I'm not sure, but I think newlib is actually failing to link in the second stage, and files from the first stage were being reused, giving the impression that it built properly.

    Just stubbing those functions out should be enough to get things building properly, though you'll have to be careful to only use the affected newlib functions (like malloc()) from one core/thread. I copied over atomic.h from the SDK and used it to implement the locks, but haven't tested it yet...it's still building.



  • @Bits HI

    can you give more details? Which file did you modify please?
    I encounter the same error....:-( during the linking

    [ 99%] Linking C executable hello_world....
    ....
    undefined reference to `_lock_acquire_recursive'

    thanks!



  • @neal I encountered the same problem when building the Arduino core, but it has been solved, which is caused by the search order between. a static library file generated by SDK and libc. a library.

    In the build options in the link section

    -Wl,--start-group -lc "sdk.a" -Wl,--end-group

    Adding the above similar options to place libc and SDK libraries in the same group may solve this problem



  • When build I got this error

    /kendryte-standalone-sdk-0.5.3/build$ cmake .. -DPROJ=hello_world -DTOOLCHAIN=/opt/kendryte-toolchain/bin && sudo make
    
    

    Error:

    /opt/kendryte-toolchain/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /opt/kendryte-toolchain/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-vfprintf.o): in function `.L2':
    vfprintf.c:(.text._vfprintf_r+0x90): undefined reference to `_lock_acquire_recursive'
    
    

    Some result
    PROJ = hello_world
    -- Check for RISCV toolchain ...
    -- Using /opt/kendryte-toolchain/bin RISCV toolchain
    -- The C compiler identification is GNU 8.2.0
    -- The CXX compiler identification is GNU 8.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/kendryte-toolchain/bin/riscv64-unknown-elf-gcc
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    SOURCE_FILES=/home/nilanga/learning/ai/kendryte-standalone-sdk-0.5.3/src/hello_world/main.c

    Project: hello_world
    LIST_FILE=/home/nilanga/learning/ai/kendryte-standalone-sdk-0.5.3/cmake/executable.cmake
    TOOLCHAIN=/opt/kendryte-toolchain/bin
    KENDRYTE_IDE=
    BUILDING_SDK=yes

    CMAKE_BUILD_TYPE=Debug
    CMAKE_C_COMPILER=/opt/kendryte-toolchain/bin/riscv64-unknown-elf-gcc
    CMAKE_CXX_COMPILER=/opt/kendryte-toolchain/bin/riscv64-unknown-elf-g++
    CMAKE_LINKER=/opt/kendryte-toolchain/bin/riscv64-unknown-elf-ld
    CMAKE_OBJCOPY=/opt/kendryte-toolchain/bin/riscv64-unknown-elf-objcopy
    CMAKE_OBJDUMP=/opt/kendryte-toolchain/bin/riscv64-unknown-elf-objdump
    CMAKE_MAKE_PROGRAM=/usr/bin/make

    CMAKE_C_FLAGS= -mcmodel=medany -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -std=gnu11 -Wno-pointer-to-int-cast -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-old-style-declaration
    CMAKE_CXX_FLAGS= -mcmodel=medany -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -std=gnu++17 -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers
    LDFLAGS= -nostartfiles -static -Wl,--gc-sections -Wl,-static -Wl,--start-group -Wl,--whole-archive -Wl,--no-whole-archive -Wl,--end-group -Wl,-EL -Wl,--no-relax -T /home/nilanga/learning/ai/kendryte-standalone-sdk-0.5.3/lds/kendryte.ld
    CMAKE_BINARY_DIR=/home/nilanga/learning/ai/kendryte-standalone-sdk-0.5.3/build
    Makefile created.

    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/nilanga/learning/ai/kendryte-standalone-sdk-0.5.3/build