[nRF port] Unable to activate MICROPY_PY_SYS_STDFILES in mpconfigport.h
I was unable to turn on some of the features in mpconfigport.h, such as MICROPY_PY_SYS_STDFILES, MICROPY_PY_MATH_SPECIAL_FUNCTIONS, MICROPY_PY_IO_FILEIO and MICROPY_PY_MACHINE_SPI, as make would fail with those features on (nRF port).
Below are the error messages:
- Error when
#define MICROPY_PY_SYS_STDFILES (1):
LINK build-pca10040-s132/firmware.elf
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o: in function `mp_sys_print_exception.lto_priv.992':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modsys.c:110: undefined reference to `mp_sys_stdout_obj'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o:(.rodata+0xb4): undefined reference to `mp_sys_stdout_obj'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o:(.rodata+0x1c8): undefined reference to `mp_sys_stdout_obj'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o:(.rodata+0x246c): undefined reference to `mp_sys_stdin_obj'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o:(.rodata+0x2474): undefined reference to `mp_sys_stdout_obj'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccCsRh6Z.ltrans2.ltrans.o:(.rodata+0x247c): undefined reference to `mp_sys_stderr_obj'
collect2: error: ld returned 1 exit status
make: *** [Makefile:344: build-pca10040-s132/firmware.elf] Error 1
- Error when
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1)
CC build-pca10040-s132/pins_gen.c
LINK build-pca10040-s132/firmware.elf
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_lgamma.lto_priv.1007':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:170: undefined reference to `lgammaf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_gamma.lto_priv.1006':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:168: undefined reference to `tgammaf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_erfc.lto_priv.1005':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:166: undefined reference to `erfcf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_erf.lto_priv.1004':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:164: undefined reference to `erff'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_atanh.lto_priv.982':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:120: undefined reference to `atanhf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_asinh.lto_priv.981':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:118: undefined reference to `asinhf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_acosh.lto_priv.980':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:116: undefined reference to `acoshf'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/cchaRFoM.ltrans2.ltrans.o: in function `mp_math_log2.lto_priv.975':
/mnt/c/Users/sebi/Documents/TINKERING/MicroPython/FORKS/micropython/ports/nrf/../../py/modmath.c:106: undefined reference to `log2f'
collect2: error: ld returned 1 exit status
make: *** [Makefile:344: build-pca10040-s132/firmware.elf] Error 1
- Error when
#define MICROPY_PY_IO_FILEIO (1)
LINK build-pca10040-s132/firmware.elf
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccKalfRU.ltrans2.ltrans.o:(.rodata+0x25fc): undefined reference to `fatfs_type_fileio'
/usr/local/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /tmp/ccKalfRU.ltrans2.ltrans.o:(.rodata+0x2604): undefined reference to `fatfs_type_textio'
collect2: error: ld returned 1 exit status
make: *** [Makefile:344: build-pca10040-s132/firmware.elf] Error 1
- Error when
#define MICROPY_PY_MACHINE_SPI (1):
CC ../../extmod/machine_spi.c
../../extmod/machine_spi.c: In function 'mp_machine_soft_spi_print':
../../extmod/machine_spi.c:175:67: error: expected ')' before 'MP_HAL_PIN_FMT'
mp_printf(print, "SoftSPI(baudrate=%u, polarity=%u, phase=%u,"
^
)
" sck=" MP_HAL_PIN_FMT ", mosi=" MP_HAL_PIN_FMT ", miso=" MP_HAL_PIN_FMT ")",
~~~~~~~~~~~~~~
../../extmod/machine_spi.c:174:32: error: unused variable 'self' [-Werror=unused-variable]
mp_machine_soft_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
^~~~
At top level:
../../extmod/machine_spi.c:146:17: error: 'baudrate_from_delay_half' defined but not used [-Werror=unused-function]
STATIC uint32_t baudrate_from_delay_half(uint32_t delay_half) {
^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [../../py/mkrules.mk:47: build-pca10040-s132/extmod/machine_spi.o] Error 1
nrf/os: Fix building with MICROPY_VFS enabled.
Building the nrf/actinius_icarus board has recently been broken due to changes in the VFS configuration. I've seen this in my ci builds as such:
micropython/ports/nrf/modules/uos/moduos.c:90: undefined reference to `disk_ioctl'
ld: /tmp/firmware.elf.GCE5h4.ltrans1.ltrans.o:(.rodata+0xdc0): undefined reference to `mp_fat_vfs_type'
#define MICROPY_VFS is disabled by default for the nrf port, however this board has it enabled explicitly.
@alextsam can you provide some more information about whether this was enabled intentionally?
The first commit here is the simplest one which #defines out fatfs dependencies from ports/nrf/modules/uos/moduos.c if MICROPY_VFS_FAT is not enabled.
Secondly, I've enabled MICROPY_VFS_FAT in mpconfigboard.h and MICROPY_FATFS in mpconfigboard.mk for actinius_icarus. @alextsam let me know if this was not desired on this board (I don't have one) and I can remove that commit again.