Code Monkey home page Code Monkey logo

k210_freertos_sdk's Introduction

Kendryte K210 SDK with FreeRTOS

This SDK is for Kendryte K210 which contains FreeRTOS support.
Ported from Kendryte kendryte-freertos-sdk

Changes to make the SDK work better with MicroPython, but can be used as SDK for other applications to

You may want to edit lib/freertos/conf/FreeRTOSConfig.h to make some changes to better suit your needs.


Use the latest Kendryte GNU Toolchain v8.2.0-20190409.


To compile only the libraries, execute (no project given):

cd build
cmake ../ -DTOOLCHAIN=<path_to_kendryte-toolchain>/bin
make 

The following libraries will be created in build directory:

third_party/fatfs/libfatfs.a
third_party/lwip/liblwipcore.a
SDK/bsp/libbsp.a
SDK/drivers/libdrivers.a
SDK/hal/libhal.a
SDK/posix/libposix.a
SDK/freertos/libfreertos.a

To build the project, place your project source files in the directory src/<project_name> and execute:

cd build
cmake ../ -DPROJ=<project_name> -DTOOLCHAIN=<path_to_kendryte-toolchain>/bin
make 

Use -jN make option for faster build.


Example: Build 'uart_example' project

Change working directory to build directory.
Export your Kendryte toolchain directory path, for example
export CROSS_COMPILE=${PWD}/../../kendryte-toolchain/bin

Execute:

cmake ../ -DPROJ=uart_example -DTOOLCHAIN=${CROSS_COMPILE}
make -j8

Flash the created uart_example.bin to your board.

kflash.py is provided in the src directory.
Change working directory to src directory.
Execute:

./kflash.py -p /dev/ttyUSB0 -b 2000000 -t ../build/uart_example.bin

This version of kflash.py has terminal emulator included, with -t option it will be started after flashing.


Modifications

  • Drivers
    • uarths: added - uarths_baudrate global variable used by uarths_init function
    • uart: enable using external uart irq handler, added functions uart_get_driver(handle_t file), uart_get_handle(void *driver)
    • i2c: some changes and new functions
    • spi: many changes, some new functions, much improved slave support
    • gpiohs: some changes for better interrupt handling
    • gpio: added some missing functions
    • timer: added some functions
    • pwm: added some functions
    • dmac: dma_completion_isr, do not assert on wrong int status, but provide the interrupt status in global variable to be used by caller function
  • syslog: various changes
    • print log time in micro seconds
    • make syslog level configurable during run time
    • make syslog colors configurable during run time
    • add syslog mutex
    • enable filtering of non-printable characters
  • FreeRTOS tasks:
    • lot of changes for better multiprocessor support
    • some useful functions added or enabled
    • all notification functions uses 64-bit values
  • FreeRTOS heap_4: added functions pvPortRealloc & pvPortCalloc
  • filesystem: added setting file time from external function (get_fattime(void) function), enabled f_mkfs() function, default code page set to 850
  • lwip: added SHA256, enabled PPP support, enabled IGMP, thread priority set to 12
    • SNTP: added function set_rtc_time_from_seconds(time_t seconds) to set RTC, enabled support for DNS names
  • added reading 64-bit CSR, function: read_csr64(reg)
  • other small changes for better functionality and no compiler warnings

Full list of modified files:

  • lib/arch/include/
    • encoding.h
  • lib/bsp/
    • entry_user.c
    • dump.c
    • printf.c
    • device/
      • dmac.cpp
      • gpiohs.cpp
      • i2c.cpp
      • pwm.cpp
      • rtc.cpp
      • spi.cpp
      • timer.cpp
      • uart.cpp
  • lib/drivers/src/storage/
    • sdcard.cpp
  • lib/utils/include/
    • syslog.h
  • lib/freertos/
    • conf/
      • FreeRTOSConfig.h
    • include/
      • devices.h
      • filesystem.h
      • hal.h
      • FreeRTOS.h
      • osdefs.h
      • portabe.h
      • task.h
      • kernel/
        • driver.hpp
        • object.hpp
    • kernel/
      • devices.cpp
      • storage/
        • filesystem.cpp
    • portable/
      • heap_4.c
      • portmacro.h
  • lib/hal/
    • uarths.c
    • include/
      • spi.h
      • uarths.h
  • third_party/
    • fatfs/
      • source/
        • ffconf.h
    • lwip/
      • src/
        • Filelist.cmake
        • api/
          • sockets.c
        • include/
          • lwipopts.h
          • lwip/
            • opt.h
            • apps/
              • sntp_opts.h`
          • netif/
            • ppp/
              • ppp_opts.h

k210_freertos_sdk's People

Contributors

loboris avatar

Stargazers

 avatar  avatar  avatar  avatar

k210_freertos_sdk's Issues

Does K210 supports RTS/CTS ?

Hi Loboris,
I've seen that you have added rts and cts in the uart configuration. I was wondering if k210 supports hardware handshaking since in the uart.h file it's been mentioned that "The UART peripheral does not support hardware flow control or other modem control signals". Can you please clarify that?

Missing data from UART port

Hi Loboris,
I noticed that when another task is running and reads from flash memory I'll miss some of the data from uart port and don't receive the total packet. I've done some changes in the uart example code attached the source code here. I am waiting for 100 bytes starting and ending with CR character. once I receive that I'll send packet number and OK string. On the other side when OK string is received 100bytes will be sent out. I am using Docklight serial monitor rools so send the data.
Also I've created another task that reads from flash memory every one second and I noticed that when it starts reading I'll miss some of the data on serial port.
uart_example.zip

Here is the firmware output:
image

Here is the transmitter output:
image

Esp8266 port for freertos

There is an esp8266/lwip port in the STM AVS package

https://www.st.com/en/embedded-software/x-cube-vs4a.html

./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/Config
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/Config/jansson_config.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_wifi_private.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/network.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_network.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_lwip_porting_imp.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_network_private.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_lwip_drv_network.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_lwip_network_imp.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_lwip_net_sockets.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvOS.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvGlueAvs.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvCore.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvProtocol.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvCore.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvOS.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvEvents.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvComUart.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvGlueAvs.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espDrv/espDrvNetif.c
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/blank-1.0-0x7E000.bin
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/esp_init_data_default-1.0-0x7C000.bin
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/LICENSE_bin_files.txt
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/flash-espFw.sh
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/flash-espFw.bat
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/licenses.txt
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/espFw.eagle.irom0text-1.0-0x20000.bin
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/STUsbCom.exe
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/esp_tool.exe
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/espFwBin/espFw.eagle.flash-1.0-0x00000.bin
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/threading_alt.h
./Middlewares/ST/STVS4A/Src/Porting/Network/LWIP_esp/avs_lwip_tls_imp.c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.