CommunityGD32Cores / ArduinoCore-GD32

Arduino core for GD32 devices, community developed, based on original GigaDevice's core
Other
86 stars 33 forks source link

Can't upload in the Arduino IDE #25

Closed maxgerhardt closed 3 years ago

maxgerhardt commented 3 years ago

Refer #6.

The platform.txt etc. is referencing a missing upload package

https://github.com/CommunityGD32Cores/GD32Core-New/blob/462ceb8ab5894d6a2e9d6239a4cc206ba8f45172/platform.txt#L112-L121

It is partly available from https://github.com/CommunityGD32Cores/GD32Core (JLink & Serial but no GDLink).

However, I don't like this particular setup of calling into a batch file for multiple different OSes and then having helper scripts there. Also I don't like that the upload method uses .bin files, this is missing a potential upload offset if one is used (e.g., for bootloaders). At least for SWD / JTAG based uploads, we should be able to directly reference OpenOCD as a package and call into it with the right flags, just like I do in PlatformIO. (

An OpenOCD upload via a ST-Link (SWD) e.g. looks like

openocd -d2 -s C:\Users\Max\.platformio\packages\tool-openocd/scripts -f interface/stlink.cfg -c "transport select hla_swd" -c "set CPUTAPID 0x2ba01477" -f target/stm32f1x.cfg -c "program {.pio\build\genericGD32F303CC\firmware.elf} verify reset; shutdown;"

And similiarily for the GDLink (which is a cmsis-dap -- and actually the STLink can be treated as a cmsis-dap.cfg as well).

I see a custom OpenOCD version being developed at https://github.com/GigaDevice-Semiconductor/openocd/ but actually I did not have the need to use it since it also works well-enough treating the chips as STM32 chips in regards to uploading to flash.

maxgerhardt commented 3 years ago

Fixed in b28647201a3bfc95c8f445f979d59b7d8cf8253f, c3e73e6f05732ea0f462c779a280f74824f959aa and 3c4693f51dad56e3699786682c97d7b67902cd38, tested with STLink works fine.

grafik