This article mainly introduces the
k210-freertos folder in the port directory of Micropython code, which is the code structure of the kendryte210 platform.
Briefly introduce files and directories in
main.c is outside the code of the program entry. If the contributing developer needs to modify the main function, we can edit it in this file.
Under normal circumstances, please do not modify the script file to avoid accidents.
config.sh is a configuration script that needs to be used at compile time. It mainly uses export to configure variables in the shell environment to make the compilation work normally.
build.sh is used to compile the code, please see the code compilation section for code compilation.
clean_inc.sh for all mk files generated during compilation
flash.sh is used to program in linux environment
The mk file is an intermediate file generated during the compilation process and is generally used for the path containing the code file.
The following directory is all the code for storing
mpy_support stores MicroPython code related to Openmv
platform stores platform-related code such as sdk, drivers, etc.
third_party stores portable third-party code, such as spiffs
output stores the compiled output file
tools to store the tool scripts needed for the development process, such as the package file system
build stores the .o file during compilation. All the code folders have a build folder, which is used to store .o files.
inc stores the mk file in the middle of each subdirectory. Generally, the files in this directory are not modified.
docs for storing documents and routine demos
Below we will detail the directories we use frequently during the development process to facilitate developers to develop faster.
mpy_support folder is used to store all the code related to micropython, including micropython all platform porting code, such as mpconfigport.h, mpconfigboard.h, and so on. Also stores all micropython standard modules such as os, time, etc., as well as common hardware modules such as SPI, IIC, etc.
standard_lib is used to store the standard library code of micropython, such as machine, socket, os, etc. Each module has its own separate folder, and the
include folder stores all the header files. You can refer to this when developing standard modules.
omv stores the code related to the openmv port. If you need to develop modules such as lcd, sensor, and image, you can modify the files in the directory.
Maix stores the code of the platform feature function, such as FPIOA function, which is rare in other platforms, so we store the relevant code of FPIOA in the Maix directory. Functions that may be developed later, such as I2S and KPU, are stored here.
builtin-py stores the Python files built into MaixPy. Micropython supports compiling Python files into firmware. We store all the Python files we want to build in here so that they can be compiled into the firmware. Functions such as fm and board_info are implemented using the Python files here.
Platform stores all platform related code, such as sdk, driver, etc.
sdk stores the software development kit for kendryte210. In general, we don't need to modify the code here.
drivers store code for common peripherals on the development board, such as lcd, flash, sd card, etc.
third_party stores all third-party porting code. If you need to use other third-party libraries or functions during development, you need to store the code in this directory.
spiffs stores the porting code of the spiffs file system. During the open process, if you need to modify the configuration of the spiffs file system, you can find the configuration file and modify it in this directory.
tool is a self-written function script used in the development process, such as packaging the file system, removing redundant arrays in the firmware, etc. If you write your own script during development, you need to put the script in this directory.
output directory stores all the final results of the compilation, including the static library generated by each code folder and third-party code, the output binary file and the elf file, where we burn the binary .bin file.