This is a repository with some 'stuff' I created while playing with the Sipeed MAIX GO board. That board features a Kendryte K210 processor. I use the kendryte-standalone-sdk and kendryte-toolchain for this work, and often base it on examples in kendryte-standalone-demo.
The 'stuff' is:
The kendryte demos are (probably) for their KD233 board. There are some differences between that board and the Sipeed MAIX GO but often the main difference is the assignment of functions to pins. For example, assigning the microphone outputs to a pin in the kendryte demos looks like this:
// the four I2S channels for I2S device 0
fpioa_set_function(42, FUNC_I2S0_IN_D0);
fpioa_set_function(43, FUNC_I2S0_IN_D1);
fpioa_set_function(44, FUNC_I2S0_IN_D2);
fpioa_set_function(45, FUNC_I2S0_IN_D3);
// the left/right clock
fpioa_set_function(46, FUNC_I2S0_WS);
// the data clock
fpioa_set_function(39, FUNC_I2S0_SCLK);
While for the MAIX GO it looks like this:
// the four I2S channels for I2S device 0
fpioa_set_function(20, FUNC_I2S0_IN_D0);
fpioa_set_function(21, FUNC_I2S0_IN_D1);
fpioa_set_function(22, FUNC_I2S0_IN_D2);
fpioa_set_function(23, FUNC_I2S0_IN_D3);
// the left/right clock
fpioa_set_function(19, FUNC_I2S0_WS);
// the data clock
fpioa_set_function(18, FUNC_I2S0_SCLK);
You can find the correct pin numbers by looking at examples, making educated guesses, and looking at the schematic of the MAIX GO. For example, for the microphone array:
Note that to get this compiled the -fpermissive compiler flag needs to be set. In the file kendryte-standalone-sdk/cmake/compile-flags.cmake this flag can be added to add_compile_flags:
add_compile_flags(CXX -std=gnu++17 -fpermissive)
At first I used the pre-compiled toolchain from the Kendryte website, but then (25-3-2019) switched to the versions on github kendryte-gnu-toolchain. This caused two additional problems. There was an "undefined reference to `vtable for cxxabiv1::si_class_type_info" error, which was solved by adding yet another compile flag:
add_compile_flags(CXX -std=gnu++17 -fpermissive -fno-rtti)
There is also a linker error "undefined reference to `__cxa_pure_virtual'" for some of the files. The root cause probably has something to do with the Arduino origin of those files. This was solved by adding the following at the start of the problematic files:
extern "C" void __cxa_pure_virtual() { while (1); }