microsoft / uf2-samdx1

USB Mass Storage bootloader (based on UF2) for SAMD21 and SAMD51
Other
243 stars 300 forks source link

Encountered two compile errors and propose a patch #103

Closed JackCasual closed 2 years ago

JackCasual commented 2 years ago

Starting with a fresh clone from master. Compiling on 5.15.7-arch1-1 x86_64 GNU/Linux using arm-none-eabi-gcc 11.2.0-1 leads to two errors:

First src/cdc_enumerate.c: In function 'AT91F_USB_SendZlp': src/cdc_enumerate.c:725:5: error: 'c' may be used uninitialized [-Werror=maybe-uninitialized] 724 | uint8_t c; 725 | USB_Write(&c, 0, 0);

which can be fixed by initialising uint8_t c = 0; although c should be overwritten anyway, humor the compiler ;)

Second lib/cmsis/CMSIS/Include/core_cm0plus.h:85:28: error: listing the stack pointer register 'sp' in a clobber list is deprecated [-Werror=deprecated] lib/cmsis/CMSIS/Include/core_cmFunc.h:456:3: note: in expansion of macro '__ASM' 456 | __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");

which can be fixed by omitting "sp" __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : );

The result compiles and was tested working on SAMD21.

Both changes exported from git diff compile.patch

Thank you for your work and effort :)

mmoskal commented 2 years ago

Thank you!