System part compilation causes user-part compilation SPI/I2C error

A question regarding a minor inconvenience in the firmware compilation process, the cause of which took me hours to find since I was looking in the wrong places.

The system part build file ( ‘modules/photon/system-part2/’ ) defines SPARK_WIRING_NO_SPI and SPARK_WIRING_NO_I2C variables. If either interface is used in the user application then the compilation of the system software fails at the ‘user-part’ - after this the only way to compile the user-part is to clean the whole build and compile ‘user-part’ separately in the ‘main’ directory.

So the process of completely flashing the device a system compile is first required, where the selected application is tinker (or something else, where SPI nor I2C is used), then the compiled files have to be cleaned after which it is possible again to separately compile the user application.

Is this behaviour unavoidable or is there a solution which would make building the whole firmware more elegant?

Hi @Melx

Many thanks for reporting this. It’s been on my todo list for a long time. I finally got around to resolving this now at the weekend. The fix is in the develop branch, and will be part of 0.4.6.

Essentially, I moved the globals SPI, Wire to a separate module (wiring_globals) so that they don’t need to be explicitly excluded in projects that don’t need them.

I hope that makes the build smoother for you :smile:

1 Like

Thanks a lot :smile: