The CH32V003 chips are on the market for a while now. They can be programmed via “MounRiver”.
Since the Chip is an excellent embedded platform it would be cool to have it in platform io programming in arduino.
Of course it is a lot of work to implement all the Arduino functions.
WCH recently notified us they they wil support arduino.
They already provided a “board definition” for the arduino IDE
I know that Arduino board definitions cannot simply be imported to platform io since they hold a lot info about environments.
I personally do not have an idea about how to provide a new platform to platformio.
I hope the work of WCH will bring the topic a big step forward.
I can install the platform… Platform IO tells me: “OK”
I restart visual code and try to create a new project… Platform IO tries to evaluate the boards and throws an error:
“Could not load borads list”
File "C:\Users\Max\AppData\Roaming\Python\Python311\site-packages\platformio\package\manager\platform.py", line 112, in get_installed_boards
for config in p.get_boards().values():
^^^^^^^^^^^^^^
File "C:\Users\Max\.platformio\platforms\ch32v\platform.py", line 32, in get_boards
result[key] = self._add_default_debug_tools(result[key])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Max\.platformio\platforms\ch32v\platform.py", line 127, in _add_default_debug_tools
assert debug.get("openocd_target"), (
AssertionError: Missing target configuration for genericGR5515IGN
I can reproduce that by myself, my platform code seems to require every installed board, even from other platforms, to have a openocd target configuration, which is bullshit. This is probably your error message too. Will fix asap.
Hm actually I only ran into this because I’m having another dev platform installed that has that genericGR5515IGN board… does pio boards throw an error for you? Which one exactly?
AssertionError: Traceback (most recent call last):
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\__main__.py", line 103, in main
cli() # pylint: disable=no-value-for-parameter
^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\cli.py", line 85, in invoke
return super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\commands\boards.py", line 34, in cli
for board in _get_boards(installed):
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\commands\boards.py", line 75, in _get_boards
return pm.get_installed_boards() if installed else pm.get_all_boards()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\package\manager\platform.py", line 124, in get_all_boards
boards = self.get_installed_boards()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\util.py", line 56, in wrapper
self.cache[key] = (time.time(), func(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\penv\Lib\site-packages\platformio\package\manager\platform.py", line 112, in get_installed_boards
for config in p.get_boards().values():
^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\platforms\ch32v\platform.py", line 32, in get_boards
result[key] = self._add_default_debug_tools(result[key])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\volke\.platformio\platforms\ch32v\platform.py", line 127, in _add_default_debug_tools
assert debug.get("openocd_target"), (
AssertionError: Missing target configuration for ATmega328P_8MHz
============================================================
An unexpected error occurred. Further steps:
* Verify that you have the latest version of PlatformIO using
`python -m pip install -U platformio` command
* Try to find answer in FAQ Troubleshooting section
https://docs.platformio.org/page/faq/index.html
* Report this problem to the developers
https://github.com/platformio/platformio-core/issues
============================================================
uhhh my bad… a board of mine indeed. I removed it and it works.
Funny enough… Without having your CH32 platform import it worked also… with it it is a problem now.
Anyway…
I will check my boards again. No need for corrections on your side.
70 cm problem on my side… sorry
Thanx for the help anyway.
This is still very confusing for me what the core is doing there. One platform’s code should not evaluate another platform’s boards and make requirements for them… will try to cleanly reproduce the issue.
In any case, the Arduino example should build and upload fine, via a e.g. WCH-LinkE.
One more question here.
How often will you update the core? Their github releases show a latest release of Version 1.0.4.
1.0.2 would be the most interesting one since SPI and I2C came in then.
Actually more core fork was already the latest version, it was just missing a README change. I’ve fully updated it (repo) so, SPI and I2C should be regularly available in then openwch core.
It compiles but the linker complains… what am I missing ?
c:/users/use/.platformio/packages/toolchain-riscv/bin/…/lib/gcc/riscv-none-embed/8.2.0/…/…/…/…/riscv-none-embed/bin/ld.exe: .pio\build\ch32v003f4p6\src\main.ino.cpp.o: in function loop': main.ino.cpp:(.text.loop+0x0): undefined reference to Wire’
c:/users/use/.platformio/packages/toolchain-riscv/bin/…/lib/gcc/riscv-none-embed/8.2.0/…/…/…/…/riscv-none-embed/bin/ld.exe: main.ino.cpp:(.text.loop+0x4): undefined reference to Wire' c:/users/use/.platformio/packages/toolchain-riscv/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: main.ino.cpp:(.text.loop+0x8): undefined reference to TwoWire::begin()’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\ch32v003f4p6\firmware.elf] Error 1