Community-PIO-CH32V / platform-ch32v

PlatformIO platform for CH32V RISC-V chips (CH32V003, CH32V103, CH32V20x, CH32V30x, CH32X035) and CH56x, CH57x, CH58x, CH59x
Apache License 2.0
234 stars 37 forks source link

CH32V003 for openwch not support J4 8pin and A4 16pin ? #39

Closed Witawat closed 1 year ago

Witawat commented 1 year ago

CH32V003 for openwch not support J4 8pin and A4 16pin ?

C:\Users\XSoFTz-PC\.platformio\penv\Scripts\pio run -e genericCH32V003J4M6
Processing genericCH32V003J4M6 (platform: ch32v; board: genericCH32V003J4M6; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ch32v/genericCH32V003J4M6.html
PLATFORM: WCH CH32V (1.1.0+sha.f0d5f28) > Generic CH32V003J4M6
HARDWARE: CH32V003J4M6 48MHz, 2KB RAM, 16KB Flash
DEBUG: Current (wch-link) On-board (wch-link) External (minichlink)
PACKAGES: 
 - framework-arduino-openwch-ch32 @ 0.0.0+sha.3eac18a 
 - tool-openocd-riscv-wch @ 2.1100.230329 (11.0) 
 - toolchain-riscv @ 1.80200.190731+sha.8ee4117
KeyError: "Invalid board option 'build.arduino.openwch.variant_h'":
  File "C:\Users\XSoFTz-PC\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\XSoFTz-PC\.platformio\platforms\ch32v\builder\main.py", line 84:
    target_elf = env.BuildProgram()
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\XSoFTz-PC\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\XSoFTz-PC\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 121:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "C:\Users\XSoFTz-PC\.platformio\penv\lib\site-packages\platformio\builder\tools\piobuild.py", line 342:
    SConscript(env.GetFrameworkScript(name), exports="env")
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 662:
    return method(*args, **kw)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\XSoFTz-PC\.platformio\platforms\ch32v\builder\frameworks\arduino.py", line 58:
    SConscript(build_script)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 662:
    return method(*args, **kw)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\XSoFTz-PC\.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\XSoFTz-PC\.platformio\packages\framework-arduino-openwch-ch32\tools\platformio-build.py", line 37:
    variant_h = board.get("build.arduino.openwch.variant_h")
  File "C:\Users\XSoFTz-PC\.platformio\penv\lib\site-packages\platformio\platform\board.py", line 47:
    raise KeyError("Invalid board option '%s'" % path)
========================== [FAILED] Took 0.61 seconds ==========================

how to add ?

maxgerhardt commented 1 year ago

Hm. The core https://github.com/openwch/arduino_core_ch32/tree/main/variants/CH32V00x only has CH32V003F4, but not the CH32V003J4 and A4 chip. However, the only difference is that they should have less pins. Can you just try and change to board = ch32v003f4p6_evt_r0?

The pin names are available per https://github.com/openwch/arduino_core_ch32/blob/f14a216b441e03907d2c0c9afab03e3985ab6852/variants/CH32V00x/CH32V003F4/variant_CH32V003F4.h#L21-L39