whitequark / libfx2

Chip support package for Cypress EZ-USB FX2 series microcontrollers
BSD Zero Clause License
73 stars 26 forks source link

build issue with latest sdcc svn version #11

Closed mcuee closed 8 months ago

mcuee commented 1 year ago

Somehow the build failed with latest svn version of sdcc. Tested under Ubuntu 20.04.

mcuee@UbuntuSwift3:~/build/cyusb/libfx2$ make -C firmware
...
...
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/usbdfu.rel usbdfu.c
include/fx2ints.h:43: warning 283: function declarator with no prototype
include/fx2ints.h:44: warning 283: function declarator with no prototype
include/fx2ints.h:45: warning 283: function declarator with no prototype
include/fx2ints.h:46: warning 283: function declarator with no prototype
include/fx2ints.h:47: warning 283: function declarator with no prototype
include/fx2ints.h:48: warning 283: function declarator with no prototype
include/fx2ints.h:49: warning 283: function declarator with no prototype
include/fx2ints.h:50: warning 283: function declarator with no prototype
include/fx2ints.h:51: warning 283: function declarator with no prototype
include/fx2ints.h:52: warning 283: function declarator with no prototype
include/fx2ints.h:53: warning 283: function declarator with no prototype
include/fx2ints.h:54: warning 283: function declarator with no prototype
include/fx2ints.h:55: warning 283: function declarator with no prototype
include/fx2ints.h:77: warning 283: function declarator with no prototype
include/fx2ints.h:78: warning 283: function declarator with no prototype
include/fx2ints.h:79: warning 283: function declarator with no prototype
include/fx2ints.h:80: warning 283: function declarator with no prototype
include/fx2ints.h:81: warning 283: function declarator with no prototype
include/fx2ints.h:82: warning 283: function declarator with no prototype
include/fx2ints.h:83: warning 283: function declarator with no prototype
include/fx2ints.h:84: warning 283: function declarator with no prototype
include/fx2ints.h:85: warning 283: function declarator with no prototype
include/fx2ints.h:86: warning 283: function declarator with no prototype
include/fx2ints.h:87: warning 283: function declarator with no prototype
include/fx2ints.h:88: warning 283: function declarator with no prototype
include/fx2ints.h:89: warning 283: function declarator with no prototype
include/fx2ints.h:90: warning 283: function declarator with no prototype
include/fx2ints.h:91: warning 283: function declarator with no prototype
include/fx2ints.h:92: warning 283: function declarator with no prototype
include/fx2ints.h:93: warning 283: function declarator with no prototype
include/fx2ints.h:94: warning 283: function declarator with no prototype
include/fx2ints.h:95: warning 283: function declarator with no prototype
include/fx2ints.h:96: warning 283: function declarator with no prototype
include/fx2ints.h:97: warning 283: function declarator with no prototype
include/fx2ints.h:98: warning 283: function declarator with no prototype
include/fx2ints.h:99: warning 283: function declarator with no prototype
include/fx2ints.h:100: warning 283: function declarator with no prototype
include/fx2ints.h:101: warning 283: function declarator with no prototype
include/fx2ints.h:102: warning 283: function declarator with no prototype
include/fx2ints.h:103: warning 283: function declarator with no prototype
include/fx2ints.h:126: warning 283: function declarator with no prototype
include/fx2ints.h:127: warning 283: function declarator with no prototype
include/fx2ints.h:128: warning 283: function declarator with no prototype
include/fx2ints.h:129: warning 283: function declarator with no prototype
include/fx2ints.h:130: warning 283: function declarator with no prototype
include/fx2ints.h:131: warning 283: function declarator with no prototype
include/fx2ints.h:132: warning 283: function declarator with no prototype
include/fx2ints.h:133: warning 283: function declarator with no prototype
include/fx2ints.h:134: warning 283: function declarator with no prototype
include/fx2ints.h:135: warning 283: function declarator with no prototype
include/fx2ints.h:136: warning 283: function declarator with no prototype
include/fx2ints.h:137: warning 283: function declarator with no prototype
include/fx2ints.h:138: warning 283: function declarator with no prototype
include/fx2ints.h:139: warning 283: function declarator with no prototype
include/fx2usb.h:186: warning 283: function declarator with no prototype
include/fx2usbdfu.h:60: warning 283: function declarator with no prototype
sdar rc lib/huge/fx2dfu.lib build/huge/usbdfu.rel
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/uf2scsi.rel uf2scsi.c
sdcc -mmcs51 --std-sdcc99 -Iinclude  --model-huge -c -o build/huge/uf2fat.rel uf2fat.c
sdar rc lib/huge/fx2uf2.lib build/huge/uf2scsi.rel build/huge/uf2fat.rel
make[1]: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware/library'
make[1]: Entering directory '/home/mcuee/build/cyusb/libfx2/firmware/boot-cypress'
sdcc -mmcs51 --iram-size 0x100 --code-size 0x3e00 --xram-loc  0x3e00 --xram-size 0x0200 --std-sdcc99 --model-small  -I../library/include -L../library/lib/small -Wp,-MQ,build/main.rel,-MMD,build/main.d -c -o build/main.rel main.c
sdcpp: warning: '-x c' after last input file has no effect
cc1: fatal error: build/main.d: No such file or directory
compilation terminated.
at 1: warning 190: ISO C forbids an empty translation unit
subprocess error 256
make[1]: *** [../library/fx2rules.mk:39: build/main.rel] Error 1
make[1]: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware/boot-cypress'
make: *** [Makefile:4: all] Error 2
make: Leaving directory '/home/mcuee/build/cyusb/libfx2/firmware'

mcuee@UbuntuSwift3:~/build/cyusb/libfx2$ sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 TD- 4.2.14 #14088 (Linux)
published under GNU General Public License (GPL)
mcuee commented 1 year ago

No issues with the sdcc 3.9 release version. I wil test other release version.

whitequark commented 1 year ago

Could you perhaps report this against sdcc? That seems like a regression then.

mcuee commented 1 year ago

Could you perhaps report this against sdcc? That seems like a regression then.

I will try other sdcc release version and then report to sdcc. Thanks.

mcuee commented 1 year ago

I just tried sdcc 4.2.0 release and it is okay. So there seems to be a regression in svn. I will report to sdcc.

whitequark commented 1 year ago

Thanks! I'll close it here. Let me know if it's actually a libfx2 bug and I'll reopen.

mcuee commented 1 year ago

Further discussion is in the mailing list. I will update further. https://sourceforge.net/p/sdcc/mailman/message/37851015/

mcuee commented 1 year ago

The fix for the sdcc svn version as per the sdcc mailing list discussion.

diff --git a/firmware/library/fx2rules.mk b/firmware/library/fx2rules.mk
index 0a8e44b..7580f5a 100644
--- a/firmware/library/fx2rules.mk
+++ b/firmware/library/fx2rules.mk
@@ -36,7 +36,7 @@ $(LIBFX2)/.stamp: $(wildcard $(LIBFX2)/*.c $(LIBFX2)/*.asm $(LIBFX2)/include/*.h
 -include build/*.d
 build/%.rel: %.c
        @mkdir -p $(dir $@)
-       $(SDCC) -Wp,-MQ,$@,-MMD,build/$*.d -c -o $@ $<
+       $(SDCC) -Wp,-MQ,$@,-MMD,-MF,build/$*.d -c -o $@ $<

 build/%.rel: %.asm
        @mkdir -p $(dir $@)

Unfortunately it will break the build for the sdcc release version like latest 4.2.0 release.

mcuee commented 1 year ago

@whitequark

BTW, the warnings 283 can be suppressed by the following as per @spth but he does not recommend to go this route.

#pragma disable_warning 283
mcuee commented 11 months ago

Please also refer to the fix in fx2lib here.

whitequark commented 11 months ago

That seems like an entirely unrelated fix.

carlossless commented 8 months ago

@whitequark what do you think about a two-pass solution mentioned here - https://sourceforge.net/p/sdcc/mailman/message/37851121/ ?

Based on my testing, this seems to work both for sddc 4.3.0 and 4.2.0.

spth commented 8 months ago

How about future SDCC 4.4.0? There already is SDCC 4.4.0 RC3.

whitequark commented 8 months ago

Fixed in #15, thanks!