PeakSat / minimal-dev-setup

2 stars 0 forks source link

Integration of MPLAB-generated peripheral libraries #2

Open lightspot21 opened 5 months ago

lightspot21 commented 5 months ago

Find a way to generate peripheral drivers and automatically include them as a CMake linkable target, preferably at build generation time. In case the generator (either MCC or MHC) cannot be found, fail the project.

Currently thinking of creating a CMake custom function to do this job behind the scenes.

This is gonna be quite tricky -- since MHC (the old generator) and MCC (what MPLAB now includes) both use the chip's DFP for their generated drivers. The tricky part is that since the DFP must be kept in Conan (for version control purposes), the generator must always use the same version as in Conan. Current ideas:

Also, no undocumented behavior if at all possible.

lightspot21 commented 5 months ago

The solution I have currently in mind:

Package up every Harmony component separately (DFP, CSP, the MHC generator) with Conan recipes. Then, create a "Harmony3" metapackage explicitly depending on specific DFP/CSP/MHC versions. This metapackage will also include a FindHarmony.cmake script, which will:

This way, Harmony is contained and constrained to what it can use and how. In case MHC ceases working, users can grab the latest generated files, re-expose the targets and commit them to version control without any needs for the CMakeLists targets to change.