SDCC >= 3.8.0 appears to have a bug (https://sourceforge.net/p/sdcc/bugs/3381/) which causes incorrect compilation of the ep5.OUTlen += len; line in chipcon_usb.c, corrupting the value of ep5.OUTlen. To work around the problem, we can mark the OUTlen field as volatile to prevent optimizations from being applied to it.
After this change, I can build a working firmware using SDCC 3.8.0, which ships with Ubuntu 20.04.
Fixes #121.
SDCC >= 3.8.0 appears to have a bug (https://sourceforge.net/p/sdcc/bugs/3381/) which causes incorrect compilation of the
ep5.OUTlen += len;
line in chipcon_usb.c, corrupting the value ofep5.OUTlen
. To work around the problem, we can mark theOUTlen
field as volatile to prevent optimizations from being applied to it.After this change, I can build a working firmware using SDCC 3.8.0, which ships with Ubuntu 20.04.