DeqingSun / ch55xduino

An Arduino-like programming API for the CH55X
GNU Lesser General Public License v2.1
449 stars 87 forks source link

CMSIS_DAP example build error #72

Closed reppad closed 1 year ago

reppad commented 2 years ago

Hi,

I tried to compile the CMSIS_DAP example with ch55xduino 0.0.12 but compilation fail when trying to compile "SW_DP.c" file :

[...]
/home/reppad/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2022.05.06/wrapper/sdcc.sh /home/reppad/.arduino15/packages/CH55xDuino/tools/sdcc/build.13407/bin/sdcc /tmp/arduino_build_281224/sketch/src/CMSIS_DAPusb/SW_DP.c /tmp/arduino_build_281224/sketch/src/CMSIS_DAPusb/SW_DP.c.o re1 -MMD -c -Ddouble=float -DUSE_STDINT -D__PROG_TYPES_COMPAT__ --less-pedantic -mmcs51 -DCH551 -DF_CPU=24000000L -DARDUINO=10815 -DARDUINO_ch55x -DARDUINO_ARCH_MCS51 --model-small -DUSER_USB_RAM=148 -I/home/reppad/.arduino15/packages/CH55xDuino/hardware/mcs51/0.0.12/cores/ch55xduino -I/home/reppad/.arduino15/packages/CH55xDuino/hardware/mcs51/0.0.12/variants/ch552 -I/home/reppad/.arduino15/packages/CH55xDuino/tools/sdcc/build.13407/share/sdcc/include
Caught signal 11: SIGSEGV
cp: impossible d'évaluer '/tmp/arduino_build_281224/sketch/src/CMSIS_DAPusb/DAP.c.o': Aucun fichier ou dossier de ce type
exit status 1
Error compiling for board CH551 Board.

Same behavior with the 4 supported boards. Same behavior on Linux and Windows.

I tried to downgrade few version to test if it is a regression: 0.0.12 : KO 0.0.11 : KO 0.0.10 : OK 0.0.9 : OK

So it seems this example does not build from 0.0.11 release.

Thanks !

DeqingSun commented 2 years ago

@reppad This is a compiler bug.

https://sourceforge.net/p/sdcc/bugs/3401/

You can either use a old version, or change num to uint32_t type.

reppad commented 2 years ago

Thanks @DeqingSun, Indeed it works by changing the type of num. Do you want me to do a PR with this workaround or do you prefer to wait for a fixed version of SDCC?

DeqingSun commented 2 years ago

@reppad I'll wait for a fixed version of SDCC

DeqingSun commented 2 years ago

Bug seems fixed on SDCC side. I will check again later when I do the next release

DeqingSun commented 2 years ago

Although this bug is fixed, the current SDCC build introduces some new worse bugs. I'll wait till there is a fix.

DeqingSun commented 1 year ago

SDCC seems slow on fixing bugs, use the workaround for now.