一、VsCode
二、踩坑教程
1、打开VsCode
我们明明按照要求做了,却死活不一样,像这样

这时我们打开vscode,点击文件,打开文件夹,选择SDK

打开之后,我们得到

2、进行build文件夹和文件的创建

这里创建完成后,进入build,进行cmake编译
注意,教程下载的win10的版本,我们下载的时win11版本的


对这两个**.txt**文件进行修改
三、MinGW的下载
https://sourceforge.net/projects/mingw-w64/

3、cmake
在同一个文件夹下创建MinGW文件夹
接着打开build进行cmake
cpp
cmake .. -DPROJ=hello_world -G "MinGW Makefiles" -DTOOLCHAIN="G:/k210/kendryte-toolchain/bin"
后面是我编译器的下载路径
cpp
PS G:\k210\SDK\build> cmake .. -DPROJ=hello_world -G "MinGW Makefiles" -DTOOLCHAIN="G:/k210/kendryte-toolchain/bin"
PROJ = hello_world
-- Check for RISCV toolchain ...
-- Using G:/k210/kendryte-toolchain/bin RISCV toolchain
CMake Deprecation Warning at third_party/gsl-lite/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
CMake Deprecation Warning at third_party/mpark-variant/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
CMake Deprecation Warning at third_party/nlohmann_json/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
SOURCE_FILES=G:/k210/SDK/src/hello_world/main.c
CMake Warning (dev) at cmake/executable.cmake:53 (add_custom_command):
The following keywords are not supported when using
add_custom_command(TARGET): DEPENDS.
Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
Run "cmake --help-policy CMP0175" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
CMakeLists.txt:34 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
Project: hello_world
LIST_FILE=G:/k210/SDK/cmake/executable.cmake
TOOLCHAIN=G:/k210/kendryte-toolchain/bin
KENDRYTE_IDE=
BUILDING_SDK=yes
CMAKE_BUILD_TYPE=Debug
CMAKE_C_COMPILER=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-gcc.exe
CMAKE_CXX_COMPILER=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-g++.exe
CMAKE_LINKER=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-ld.exe
CMAKE_OBJCOPY=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-objcopy.exe
CMAKE_OBJDUMP=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-objdump.exe
CMAKE_RANLIB=G:/k210/kendryte-toolchain/bin/riscv64-unknown-elf-ranlib.exe
CMAKE_MAKE_PROGRAM=G:/k210/kendryte-toolchain/bin/make.exe
CMAKE_C_FLAGS= -mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -ffast-math -fno-math-errno -fsingle-precision-constant -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 -Wno-multichar -Wextra -Werror=frame-larger-than=32768 -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-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses -Wno-old-style-declaration
CMAKE_CXX_FLAGS= -mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -ffast-math -fno-math-errno -fsingle-precision-constant -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 -Wno-multichar -Wextra -Werror=frame-larger-than=32768 -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-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses
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 G:/k210/SDK/lds/kendryte.ld
CMAKE_BINARY_DIR=G:/k210/SDK/build
Makefile created.
-- Configuring done (0.1s)
-- Generating done (0.7s)
-- Build files have been written to: G:/k210/SDK/build
-- Configuring done (0.1s)
-- Generating done (0.7s)
-- Build files have been written to: G:/k210/SDK/build
可以看到cmake已经成功了
4、make
进行make
cpp
G:\k210\MINGW\MinGW-w64\mingw64\bin\mingw32-make.exe
cpp
PS G:\k210\SDK\build> G:\k210\MINGW\MinGW-w64\mingw64\bin\mingw32-make.exe
[ 2%] Building CXX object lib/nncase/v1/CMakeFiles/nncase-v1.dir/nncase_v1.cpp.obj
[ 4%] Linking CXX static library libnncase-v1.a
[ 4%] Built target nncase-v1
[ 6%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/nncase_v0.cpp.obj
G:\k210\SDK\lib\nncase\v0\nncase_v0.cpp:29:6: warning: 'void {anonymous}::kpu_upload_dma(dmac_channel_number_t, const uint8_t*, uint8_t*, size_t, plic_irq_callback_t, void*)' defined but not used [-Wunused-function]
void kpu_upload_dma(dmac_channel_number_t dma_ch, const uint8_t *src, uint8_t *dest, size_t input_size, plic_irq_callback_t callback, void *userdata)
^~~~~~~~~~~~~~
[ 8%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/cpu/cpu_ops.cpp.obj
[ 10%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/interpreter.cpp.obj
[ 12%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/k210/interpreter.cpp.obj
[ 14%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/k210/k210_ops.cpp.obj
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp: In function 'nncase::runtime::kernel_call_result nncase::runtime::k210::kpu_conv2d(nncase::runtime::k210::kpu_conv2d_options&, nncase::runtime::interpreter_t&, nncase::runtime::interpreter_step_t)':
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp:130:18: warning: unused variable is_depthwise' [-Wunused-variable]
auto is_depthwise = options.layer.interrupt_enabe.data.depth_wise_layer != 0;
^~~~~~~~~~~~
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp:135:29: warning: unused variable in_shape' [-Wunused-variable]
runtime_shape_t in_shape { options.batches, in_ch, in_h, in_w };
^~~~~~~~
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp: At global scope:
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp:96:5: warning: 'int {anonymous}::kpu_dma_plic_thunk(void*)' defined but not used [-Wunused-function]
int kpu_dma_plic_thunk(void *userdata)
^~~~~~~~~~~~~~~~~~
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp:88:6: warning: 'void {anonymous}::kpu_upload_dma(dmac_channel_number_t, const uint8_t*, uint8_t*, size_t, plic_irq_callback_t, void*)' defined but not used [-Wunused-function]
void kpu_upload_dma(dmac_channel_number_t dma_ch, const uint8_t *src, uint8_t *dest, size_t input_size, plic_irq_callback_t callback, void *userdata)
^~~~~~~~~~~~~~
G:\k210\SDK\lib\nncase\v0\runtime\k210\k210_ops.cpp:73:6: warning: 'void {anonymous}::kpu_conv2d_output(kpu_layer_argument_t&, dmac_channel_number_t, uint8_t*, plic_irq_callback_t, void*)' defined but not used [-Wunused-function]
void kpu_conv2d_output(kpu_layer_argument_t &layer, dmac_channel_number_t dma_ch, uint8_t *dest, plic_irq_callback_t callback, void *userdata)
^~~~~~~~~~~~~~~~~
[ 17%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/kernel_registry.cpp.obj
[ 19%] Building CXX object lib/nncase/v0/CMakeFiles/nncase-v0.dir/runtime/neutral/neutral_ops.cpp.obj
In file included from G:\k210\SDK\lib\nncase\v0\runtime\neutral\neutral_ops.cpp:15:
G:\k210\SDK\lib\nncase\v0\include/kernels/neutral/neutral_kernels.h: In function 'void nncase::kernels::neutral::conv2d_transpose(const float*, float*, const float*, const float*, const runtime_shape_t&, int32_t, const runtime_shape_t&, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, const nncase::padding&, const nncase::padding&, const nncase::value_range<float>&)':
G:\k210\SDK\lib\nncase\v0\include/kernels/neutral/neutral_kernels.h:293:43: warning: unused variable 'value' [-Wunused-variable]
float value = bias[g * g_oc + oc];
^~~~~
[ 21%] Linking CXX static library libnncase-v0.a
[ 21%] Built target nncase-v0
[ 23%] Building CXX object lib/nncase/CMakeFiles/nncase-wrapper.dir/nncase.cpp.obj
[ 25%] Linking CXX static library libnncase-wrapper.a
[ 25%] Built target nncase-wrapper
[ 27%] Building C object lib/CMakeFiles/kendryte.dir/bsp/crt.S.obj
[ 29%] Building C object lib/CMakeFiles/kendryte.dir/bsp/entry.c.obj
[ 31%] Building C object lib/CMakeFiles/kendryte.dir/bsp/entry_user.c.obj
[ 34%] Building C object lib/CMakeFiles/kendryte.dir/bsp/interrupt.c.obj
[ 36%] Building C object lib/CMakeFiles/kendryte.dir/bsp/locks.c.obj
[ 38%] Building C object lib/CMakeFiles/kendryte.dir/bsp/printf.c.obj
[ 40%] Building C object lib/CMakeFiles/kendryte.dir/bsp/sleep.c.obj
[ 42%] Building C object lib/CMakeFiles/kendryte.dir/bsp/syscalls.c.obj
[ 44%] Building C object lib/CMakeFiles/kendryte.dir/drivers/aes.c.obj
[ 46%] Building C object lib/CMakeFiles/kendryte.dir/drivers/apu.c.obj
[ 48%] Building C object lib/CMakeFiles/kendryte.dir/drivers/clint.c.obj
[ 51%] Building C object lib/CMakeFiles/kendryte.dir/drivers/dmac.c.obj
[ 53%] Building C object lib/CMakeFiles/kendryte.dir/drivers/dvp.c.obj
[ 55%] Building C object lib/CMakeFiles/kendryte.dir/drivers/fft.c.obj
[ 57%] Building C object lib/CMakeFiles/kendryte.dir/drivers/fpioa.c.obj
[ 59%] Building C object lib/CMakeFiles/kendryte.dir/drivers/gpio.c.obj
[ 61%] Building C object lib/CMakeFiles/kendryte.dir/drivers/gpiohs.c.obj
[ 63%] Building C object lib/CMakeFiles/kendryte.dir/drivers/i2c.c.obj
[ 65%] Building C object lib/CMakeFiles/kendryte.dir/drivers/i2s.c.obj
[ 68%] Building C object lib/CMakeFiles/kendryte.dir/drivers/iomem.c.obj
[ 70%] Building C object lib/CMakeFiles/kendryte.dir/drivers/kpu.c.obj
[ 72%] Building C object lib/CMakeFiles/kendryte.dir/drivers/plic.c.obj
[ 74%] Building C object lib/CMakeFiles/kendryte.dir/drivers/pwm.c.obj
[ 76%] Building C object lib/CMakeFiles/kendryte.dir/drivers/rtc.c.obj
[ 78%] Building C object lib/CMakeFiles/kendryte.dir/drivers/sha256.c.obj
[ 80%] Building C object lib/CMakeFiles/kendryte.dir/drivers/spi.c.obj
[ 82%] Building C object lib/CMakeFiles/kendryte.dir/drivers/sysctl.c.obj
[ 85%] Building C object lib/CMakeFiles/kendryte.dir/drivers/timer.c.obj
[ 87%] Building C object lib/CMakeFiles/kendryte.dir/drivers/uart.c.obj
[ 89%] Building C object lib/CMakeFiles/kendryte.dir/drivers/uarths.c.obj
[ 91%] Building C object lib/CMakeFiles/kendryte.dir/drivers/utils.c.obj
[ 93%] Building C object lib/CMakeFiles/kendryte.dir/drivers/wdt.c.obj
[ 95%] Linking C static library libkendryte.a
[ 95%] Built target kendryte
[ 97%] Building C object CMakeFiles/hello_world.dir/src/hello_world/main.c.obj
[100%] Linking C executable hello_world
Generating .bin file ...
[100%] Built target hello_world
make成功
查看
cpp
G:\k210\SDK\build> ls
目录: G:\k210\SDK\build
目录: G:\k210\SDK\build
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2025/12/4 10:52 CMakeFiles
d----- 2025/12/4 10:52 lib
d----- 2025/12/4 10:38 third_party
-a---- 2025/12/4 10:38 20601 CMakeCache.txt
-a---- 2025/12/4 10:41 2430 cmake_install.cmake
-a---- 2025/12/4 10:52 3715856 hello_world
-a---- 2025/12/4 10:52 1054712 hello_world.bin
-a---- 2025/12/4 10:41 7559 Makefile