Maybe I'm just blind, but I didn't find any evidence that the headers are required to be used "only with authentic Microchip products". I didn't find anything in the gputils .inc files, nor in the documentation. Not even in the headers and .inc files of the xc8 compiler. Please correct me if I'm wrong, but it simply seems to me like it once was required to use those files only with MC products, but they changed it.
Various people had already reached the conclusion that such a requirement is likely unenforceable in the context of simple header files.
Maybe Microchip has reached the same conclusion and quietly dropped that requirement. If that can be verified, the "non-free" folder structure becomes unnecessary.
It would be awesome for my project as I would be able to release it as fully opensource.
I can confirm that there are clear signs that indicate the C headers in Microchip's XC8 compilers are officially free. The restrictive "only with authentic Microchip products" license has disappeared, and now only a 3-clause BSD-like license remains (Perhaps Oracle v. Google has finally taught their lawyers a lesson?)
So, if you just want to release your project as 100% "fully open-source", just copy your MCU's header from XC8 into your project, as Microchip's copyright notice explicitly allows you to do so, then you can include this file locally without ever using the
--use-non-free
option in SDCC. Possibly, SDCC can also ship these headers by default and the PIC target would no longer be "non-free".However, there are still problems.
Integrating these headers into SDCC in a backward-compatible manner remains problematic - the SDCC headers are automatically generated from gputils's assembler headers, which themselves are obtained from the Microchip's (now unsupported legacy) MPASM assember, and NOT the XC8 C compiler. So the headers will not be fully identical. Perhaps we can use a separate directory named "xc8/", I can contribute a patch for that!
Although the restrictive "only with authentic Microchip products" license no longer covers SDCC, it still covers gputils, which is used by SDCC to produce the final object code from assembly. These headers are actually under a technically more restrictive "all rights reserved" license, so in theory, gputils is not allowed to even redistribute them at all (perhaps the developers of gputils previously asked Microchip and they were told that redistribute by gputils is allowed under the conditions of "only with authentic Microchip products"). A contributor from GNU Guix actually raised the problem here: https://sourceforge.net/p/gputils/bugs/317/ It's still unanswered.
For reference, a typical (free) device header in Microchip's XC8 compiler looks like this:
Last edit: Tom Li 2023-01-02
I know practically nothing about the PIC part of SDCC and gputils, but are you saying that the MPASM C header files are converted to ASM include files for gputils and then converted back to C header files for SDCC?
And is there any reason why the new C header files from XC8 are not usable with SDCC?
Further, does SDCC use those (free or not) ASM include files from gputils at all? Or is it only using gpasm and gplink to convert the generated assembly code into a binary?