Created
August 8, 2018 12:11
-
-
Save FHeilmann/e38654309829b69d42306d6543d7103c to your computer and use it in GitHub Desktop.
ATMEL SAM4E Series Device Support and CMSIS 5, fix for AFEC and exception table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- a/ic.sam4e/gcc/gcc/startup_sam4e.c | |
| +++ b/ic.sam4e/gcc/gcc/startup_sam4e.c | |
| @@ -135,6 +136,7 @@ const DeviceVectors exception_table = { | |
| (void*) PMC_Handler, /* 5 Power Management Controller */ | |
| (void*) EFC_Handler, /* 6 Enhanced Embedded Flash Controller */ | |
| (void*) UART0_Handler, /* 7 UART 0 */ | |
| + (void*) Dummy_Handler, /* 8 Dummy */ | |
| (void*) PIOA_Handler, /* 9 Parallel I/O Controller A */ | |
| (void*) PIOB_Handler, /* 10 Parallel I/O Controller B */ | |
| (void*) PIOC_Handler, /* 11 Parallel I/O Controller C */ | |
| @@ -166,6 +168,10 @@ const DeviceVectors exception_table = { | |
| (void*) CAN0_Handler, /* 37 CAN0 */ | |
| (void*) CAN1_Handler, /* 38 CAN1 */ | |
| (void*) AES_Handler, /* 39 AES */ | |
| + (void*) Dummy_Handler, /* 40 Dummy */ | |
| + (void*) Dummy_Handler, /* 41 Dummy */ | |
| + (void*) Dummy_Handler, /* 42 Dummy */ | |
| + (void*) Dummy_Handler, /* 43 Dummy */ | |
| (void*) GMAC_Handler, /* 44 EMAC */ | |
| (void*) UART1_Handler /* 45 UART */ | |
| }; | |
| --- a/ic.sam4e/include/component/afec.h | |
| +++ b/ic.sam4e/include/component/afec.h | |
| @@ -59,9 +59,9 @@ typedef struct { | |
| RoReg Reserved2[1]; | |
| RwReg AFE_CDOR; /**< \brief (Afec Offset: 0x5C) Channel DC Offset Register */ | |
| RwReg AFE_DIFFR; /**< \brief (Afec Offset: 0x60) Channel Differential Register */ | |
| - RoReg AFE_CSELR; /**< \brief (Afec Offset: 0x64) Channel Register Selection */ | |
| + RwReg AFE_CSELR; /**< \brief (Afec Offset: 0x64) Channel Register Selection */ | |
| RoReg AFE_CDR; /**< \brief (Afec Offset: 0x68) Channel Data Register */ | |
| - RoReg AFE_COCR; /**< \brief (Afec Offset: 0x6C) Channel Offset Compensation Register */ | |
| + RwReg AFE_COCR; /**< \brief (Afec Offset: 0x6C) Channel Offset Compensation Register */ | |
| RwReg AFE_TEMPMR; /**< \brief (Afec Offset: 0x70) Temperature Sensor Mode Register */ | |
| RwReg AFE_TEMPCWR; /**< \brief (Afec Offset: 0x74) Temperature Compare Window Register */ | |
| RoReg Reserved3[7]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without the
Dummy_Handlerentries in the exception table my SAM4E board would not boot (possibly because the table is out of alignment and the jumps to anything after theUART0_Handlerwill end up with the wrong handler.AFE_CSELRandAFE_COCRare described as Read/Write in the SAM4e8e datasheet, but marked as Read-Only in the latest version of the device support package. This makes it impossible to writeAFE_CSELRto select a channel to read data from and impossible to writeAFE_COCRto set a channel offset.Hope this helps someone struggling with the same issues.