kbhomes/ps2plus

[dev] Replace MPLAB X build with different build solution

Closed this issue · 2 comments

Doing containerized builds of the firmware/bootloader on Microchip hardware (i.e. the only current platform) requires installing XC8 and MPLAB X, running the prjMakefilesGenerator script, and then running Make. Replacing this with custom Makefiles that invoke XC8 directly would have some benefits:

  • Eases ports to other Microchip hardware without inflating the MPLAB X project with additional configurations
  • Eases ports to non-Microchip hardware as compiling must occur outside of MPLAB X anyway
  • Allows development in any C editor or IDE (VS Code and CLion would be ideal)
  • Significantly slimlines the build container image

Downside of this is potentially losing the ability to do on-device debugging.

Looking now to make use of SCons, which I first learned about from using PlatformIO to build the initial Arduino prototype of this port. It seems really flexible, but most importantly, it seems actually enjoyable to use as a developer writing a build system.

Goals for this:

  • Use SCons to build firmware/bootloader variants for all platforms
  • Support multiple platforms, each with individual toolchains and compilation instructions (to start, there is just the PIC18F46K42 platform with the Microchip XC8 compiler toolchain)
  • Generate project and IDE files:
    • Create a VS Code c_cpp_properties.json file, which has C configurations for each combination of + <bootloader/firmware>, so that the editor can give accurate code analysis
    • Create an MPLAB X nbproject structure, making it easier to write Microchip platform code in a familiar IDE

Closing this since the SCons build seems to be working well. 🥳 I also recently used the MPLAB X project file generated by the build system to successfully debug the PIC18F46K42 firmware in the IDE, so I'm pretty satisfied!