Closed kahoch closed 6 months ago
If TMOS_SystemProcess
is undefined, where is this function implemented? If it's in a source file (*.c
, *.S
, ..), then that file must be either in src/
or in lib/<subfolder>
. If you cannot find the function in any such file, it may be defined by some libXXX.a
library which you forgot to link in (-L<path to folder where the .a is>,
-l
If you post the exact project files, we can help you more.
Acturally all of these functions are defined, in vscode, I can use "go to difinition" to trace them. Please check the whole project I uploaded. Please note there is a modified CH58x_common.h file. kb2.zip
And this is the original WCH example. Three-mode_kbd.zip
No, they are declared (to exist), not defined in any C file. The file that defines them is in the same folder as the header file.
What you are missing is to include those .a
files (linISP583 should be autoincluded by the SPL already).
LIBCH58xBLE.a
to just libCH58xBLE.a
(will prevent build errors on non-Windows systems)-Llib/BLE_LIB/
-lCH58xBLE
to the build_flags
A similiar thing is done is the official example here: https://github.com/Community-PIO-CH32V/platform-ch32v/tree/develop/examples/ble-usb-cdc-ch58x/lib/BLE_LIB. There, the inclusion of the .a
file is done through the library.json
automatically.
Due to this project having a modified CH58x_common.h
(bad practice! this is supposed to be standard and the same for all SDK projects!), it's easier to not use framework = nonesos-sdk
and go with bare-metal instead. The project contains all needed files anyways. It's also easier to not use "PlatformIO-style libraries" in lib/
because the library dependency finder fails on the files with the weird chinese encoding and can't detect proper dependency chains, even with lib_ldf_mode = chain+
. Also, you copied files in test/
, which is wrong because those files are only used during the "PIO Test" Unit-testing task. They should have been in src/
instead.
This here is the converted version of the project. Not a single line of C source code has been touched. Only the configuration in terms of defined macros, include paths and linked libraries were copied between the MounRiverStudio project and PlatformIO.
Linking .pio\build\genericCH582M\firmware.elf
Checking size .pio\build\genericCH582M\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [==== ] 39.8% (used 13044 bytes from 32768 bytes)
Flash: [==== ] 36.4% (used 179020 bytes from 491520 bytes)
Building .pio\build\genericCH582M\firmware.bin
===============[SUCCESS] Took 16.09 seconds ===============
Thank you!!! I'm really appreciate your help and your incredible work! I have been struggling with this problem for few days.
This problem is mostly lack of documentation on our side. https://readthedocs.org/projects/pio-ch32v/ is wholly incomplete as of now. I will write a "How to convert a MounRiverStudio project to PlatformIO" page, this would have taken care of all problems here, and will take care of problems in the future.
I got a 3 mode keyboard example from WCH, it can be built by MRS, but I got a lot of "undefined reference to xxx" error in PIO. Just show as below.
I have re-organized the folder structure, put .h files in the "include" folder, .c files in the "src" folder and the library files in the "lib" folder.
here is my platform.ini:
How can I solve this problem? Thanks!