So I downloaded the latest MPLABX, which apparently comes with "packs" from https://packs.download.microchip.com/ , which are a couple of versions past the "Atmel Packs" at http://packs.download.atmel.com/
I suppose that that would be OK, except that it looks like pretty much ALL of types and top-level peripheral definitions have changed !!!
Atmel (..../Atmel.SAMC21_DFP.1.2.176/samc21/include/samc21g18a.h)
#define PORT ((Port *)0x41000000UL) /**< \brief (PORT) APB Base Address */ #define PORT_IOBUS ((Port *)0x60000000UL) /**< \brief (PORT) IOBUS Base Address */ #define PORT_INST_NUM 1 /**< \brief (PORT) Number of instances */ #define PORT_INSTS { PORT } /**< \brief (PORT) Instances List */ #define PORT_IOBUS_INST_NUM 1 /**< \brief (PORT) Number of instances */ #define PORT_IOBUS_INSTS { PORT_IOBUS } /**< \brief (PORT) Instances List */ #define PTC ((void *)0x42005800UL) /**< \brief (PTC) APB Base Address */ #define PTC_GCLK_ID 37 #define PTC_INST_NUM 1 /**< \brief (PTC) Number of instances */ #define PTC_INSTS { PTC } /**< \brief (PTC) Instances List */ #define RSTC ((Rstc *)0x40000C00UL) /**< \brief (RSTC) APB Base Address */ #define RSTC_INST_NUM 1 /**< \brief (RSTC) Number of instances */ #define RSTC_INSTS { RSTC } /**< \brief (RSTC) Instances List */ #define RTC ((Rtc *)0x40002400UL) /**< \brief (RTC) APB Base Address */ #define RTC_INST_NUM 1 /**< \brief (RTC) Number of instances */ #define RTC_INSTS { RTC } /**< \brief (RTC) Instances List */ #define SDADC ((Sdadc *)0x42004C00UL) /**< \brief (SDADC) APB Base Address */ #define SDADC_INST_NUM 1 /**< \brief (SDADC) Number of instances */ #define SDADC_INSTS { SDADC } /**< \brief (SDADC) Instances List */ #define SERCOM0 ((Sercom *)0x42000400UL) /**< \brief (SERCOM0) APB Base Address */ #define SERCOM1 ((Sercom *)0x42000800UL) /**< \brief (SERCOM1) APB Base Address */
Microchip (...mplabx/v5.25/packs/Microchip/SAMC21_DFP/3.0.22/samc21/include/samc21g18a.h)
#define PORT_REGS ((port_registers_t*)0x41000000) /**< \brief PORT Registers Address */ #define PORT_IOBUS_REGS ((port_registers_t*)0x60000000) /**< \brief PORT Registers Address */ #define PTC_REGS ((ptc_registers_t*)0x42005800) /**< \brief PTC Registers Address */ #define RSTC_REGS ((rstc_registers_t*)0x40000c00) /**< \brief RSTC Registers Address */ #define RTC_REGS ((rtc_registers_t*)0x40002400) /**< \brief RTC Registers Address */ #define SDADC_REGS ((sdadc_registers_t*)0x42004c00) /**< \brief SDADC Registers Address */ #define SERCOM0_REGS ((sercom_registers_t*)0x42000400) /**< \brief SERCOM0 Registers Address */ #define SERCOM1_REGS ((sercom_registers_t*)0x42000800) /**< \brief SERCOM1 Registers Address */ #define SERCOM2_REGS ((sercom_registers_t*)0x42000c00) /**< \brief SERCOM2 Registers Address */
Names internal to the structures have changed as well, PORT register definitions gaining a PORT_ prefix and losing a level of type hierarchy:
__IO PORT_DIR_Type DIR; /**< \brief Offset: 0x00 (R/W 32) Data Direction */ __IO PORT_DIRCLR_Type DIRCLR; /**< \brief Offset: 0x04 (R/W 32) Data Direction Clear */
vs
__IO uint32_t PORT_DIR; /**< Offset: 0x00 (R/W 32) Data Direction */ __IO uint32_t PORT_DIRCLR; /**< Offset: 0x04 (R/W 32) Data Direction Clear */
This is really disturbing from a "backward compatibility" and readability point of view, even if you can "fix" it by including whatever version you want in your project (assuming you use the AS7 or MPLABX project scheme.)
Especially since I haven't seen any warnings that this was happening!
Also, this doesn't match either the documentation or the IO view (which doesn't quite seem to be working yet, but still...)
Grr.