Project doesn't compile only on specific board (lpmsp430fr5739)

The MSP430 Arduino core is not widedely used when compared to the Arduino AVR core or others, and so many libraries fail to try to detect and adapt for it. Even though there are many “Arduino” cores, they all have slight differences in API between them, especially with libraries like SPI, Wire (I2C) etc.

Looking e.g. at the compile error

You can see that

  1. Yes the Arduino core does have a SPI library
  2. It does have a setBitOrder() function, taking a uint8_t
  3. But it does not have a BitOrder enum.

You can see that the library tries to detect all the different device types you’re compiling for here, and it finally lands in a case where it thinks the Arduino core you’re using has a BitOrder enum (line 45) when it does in fact not. It should have gone in the case for line 27 to 30 with an added || defined(ENERGIA) condition or similiar.

What further hinders you is that for compilation, it uses a really old GCC and C++ version, this library doesn’t like that

I’d recommend to:

  • First start compiling the simplest possible example for the board that does not need external libraries. Like, blinky, serial output, etc. This way you can make sure you can generally compile a sketch for the board, upload it and see it working
  • You can make PlatformIO use a newer GCC compiler by using a forked platform and a new compiler package. See GitHub - maxgerhardt/pio-timsp430-new-toolchain-example: A PlatformIO example utilizing a new version of the GCC toolchain and large memory model for technical details. That would enable you to enable a modern C++ standard satisfying the MFRC522 library.
  • You may also be able to use the current GCC 4.6.3 with C++11 by adding build_flags = -std=c++11 in the platformio.ini (docs).
  • You can modify / fork the Adafruit BusIO library to make it recognize the specifics of the Energia MSP430 core per above, then that library may work.
1 Like