Blinkinlabs / ch554_sdcc

CH554 software development kit for SDCC
295 stars 70 forks source link

ws2812 example does not compile under Windows MinGW #33

Closed buttim closed 3 years ago

buttim commented 3 years ago

Tested with SDCC 4.0.0 #11528 (MINGW64)

The error reported is: main.c:5:19: fatal error: ch554.h: No such file or directory

You have to change

#include <ch554.h>
#include <debug.h>

to

#include "../../include/ch554.h"
#include "../../include/debug.h"
cibomahto commented 3 years ago

How are you building it? Using make (from Qt, but installing it from elsewhere should be similar), it seems to work for me:

blinkinlabs@VALHALLA MINGW64 ~/Blinkinlabs-Repos/ch554_sdcc/examples/ws2812 (master)
$ /c/qt/Tools/mingw810_64/bin/mingw32-make.exe
sdcc -c -V -mmcs51 --model-small --xram-size 0x0400 --xram-loc 0x0000 --code-size 0x3800 -IC:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include -DFREQ_SYS=16000000  main.c
+ C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -I"C:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include" -D"FREQ_SYS=16000000" -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=3_6_0 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=6 -D__SDCC_VERSION_PATCH=0 -DSDCC=360 -D__SDCC_REVISION=9615 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\Program Files\SDCC\bin\..\include\mcs51" -isystem "C:\Program Files\SDCC\bin\..\include"  "main.c"
+ C:\PROGRA~1\SDCC\bin\sdas8051.exe -plosgffw "main.rel" "main".asm
sdcc -c -V -mmcs51 --model-small --xram-size 0x0400 --xram-loc 0x0000 --code-size 0x3800 -IC:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include -DFREQ_SYS=16000000  bitbang.c
+ C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -I"C:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include" -D"FREQ_SYS=16000000" -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=3_6_0 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=6 -D__SDCC_VERSION_PATCH=0 -DSDCC=360 -D__SDCC_REVISION=9615 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\Program Files\SDCC\bin\..\include\mcs51" -isystem "C:\Program Files\SDCC\bin\..\include"  "bitbang.c"
+ C:\PROGRA~1\SDCC\bin\sdas8051.exe -plosgffw "bitbang.rel" "bitbang".asm
sdcc -c -V -mmcs51 --model-small --xram-size 0x0400 --xram-loc 0x0000 --code-size 0x3800 -IC:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include -DFREQ_SYS=16000000  ../../include/debug.c
+ C:\PROGRA~1\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -I"C:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include" -D"FREQ_SYS=16000000" -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=3_6_0 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=6 -D__SDCC_VERSION_PATCH=0 -DSDCC=360 -D__SDCC_REVISION=9615 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\Program Files\SDCC\bin\..\include\mcs51" -isystem "C:\Program Files\SDCC\bin\..\include"  "../../include/debug.c"
+ C:\PROGRA~1\SDCC\bin\sdas8051.exe -plosgffw "debug.rel" "debug".asm
../../include/debug.c:177: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
../../include/debug.c:272: warning 158: overflow in implicit constant conversion
sdcc main.rel bitbang.rel debug.rel -V -mmcs51 --model-small --xram-size 0x0400 --xram-loc 0x0000 --code-size 0x3800 -IC:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include -DFREQ_SYS=16000000  -o ws2812.ihx
+ C:\PROGRA~1\SDCC\bin\sdld.exe -nf "ws2812.lk"
objcopy -I ihex -O binary ws2812.ihx ws2812.bin
packihx ws2812.ihx > ws2812.hex
packihx: read 34 lines, wrote 53: OK.
cibomahto commented 3 years ago

If you're compiling by hand, you'd need to specify the include directory (for example): -I"C:/Users/blinkinlabs/Blinkinlabs-Repos/ch554_sdcc/examples/../include"

buttim commented 3 years ago

Yes, I'm using make. But I checked and the make executable being used was from cygwin, not MSYS. Cygwin uses paths relative to /cygdrive/c, which SDCC cannot understand. Everything is fine with the right one, thank you

cibomahto commented 3 years ago

Great!