Skip to content

Update headers

Neofoxx requested to merge neofoxx/pic32-parts-free:update_headers into master

This PR updates the header files and assembly definitions to the current Microchip compiler version (XC32 v2.50, released 21 Sep 2020). The idea being that all future additions should also be from v2.50 and up. Reasoning - the initial import was from 2016, probably XC32 v1.42, with some files contributed from v2.15 (.S files added by me). There are many errors in those files, mostly in the PIC32MM family. Some practical examples are below.

p32mm0256gpm036.h:

  • _FDEVOPT_USERID_POSITION has a wrong value, so shifting by it produces wrong results
  • TRSIC definition has TRISC0 - TRISC9, but instead of TRISC3 it has only TRIS3.
  • Extra VBUSBIAS bit definition in PORTB and a couple others

p32MM0256GPM036.S (note, this file isn't included in the project yet, but tests were done on the v2.15 version):

  • Wrong addresses. For example, IEC0. Datasheet specifies 0xBF80F080, as does the V2.15 file. But the newer v2.50 file specifies it at 0xBF80F0C0! (where IPC0 should be). Testing confirmed, that there is something at F080, but it wasn't possible to set the USBIE bit. However using the F0C0 address worked. Other addresses (IEC1-3, IPC0-x) are similarly shifted. There is no mention of this in the errata or in the datasheet.

An update to V2.50 should bring all files to the current state, and make it easier to add new chips (like the MK MCJ & MCM families).

Method of updating was a copy&paste operation, followed by a sed command to strip ",address(...)" attributes that were added in the XC32 compiler files, but are unsupported by GCC. Most were updated, and some were even added (MCUs released in the meantime). One file was not copied over - p32mxgeneric.h (a quick grep showed it wasn't used in these files), even though it is present in the current tree. A report.txt with updated/added/unchanged files is attached.

  • 251 definitions were updated.
  • 73 definitions were added
  • 26 files were unchanged (p32mxgeneric.h being one of them) The 25/26 files are definitions for MCUs that don't exist (not in the datasheet, very few search results found). Suggestion - deletion.

In the process some .S files got renamed, as some were lowercase and some uppercase. Everything but the first p is now capitalized, as in XC32.

Test compiles showed that everything compiles to the same size, except the MM064GPL example, which is now 80B smaller. Reason being that some vector definitions got removed from the .h file, and now the code for those vectors is not emitted. The removed vectors were for peripherals I2C1 and I2C2 (3 vectors each), which the chip does not even have. All examples were flashed and worked.

@rhn Could you give this a once-over? I checked that the license is the same (well, +1 line that states "[...] Publication is not required when this file is used in an embedded application."), but there's a chance I missed something, or that something else should be added.

Merge request reports