Skip to content

Commit 0bbb7a8

Browse files
tannewtdhalbert
authored andcommitted
Add support for patching newer ASF4 code. (adafruit#292)
* atmel-samd: Support patching after updating ASF4. This makes it possible to automatically fix newer code. * atmel-samd: Update ASF4 to include flash APIs for SAMD51. This is the first automatic update that has caused a few deletions where code was previously copied instead of moved. This is a prerequisite for adafruit#260.
1 parent 8466d76 commit 0bbb7a8

File tree

284 files changed

+6283
-42142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+6283
-42142
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- samd21_vanilla/hal/utils/include/utils_assert.h 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/hal/utils/include/utils_assert.h 2017-09-19 13:07:29.000000000 -0700
3+
@@ -72,7 +72,7 @@
4+
if (!(condition)) \
5+
__asm("BKPT #0");
6+
#else
7+
-#define ASSERT_IMPL(condition, file, line) assert((condition), file, line)
8+
+#define ASSERT_IMPL(condition, file, line) asf_assert((condition), file, line)
9+
#endif
10+
11+
#else /* DEBUG */
12+
@@ -95,7 +95,7 @@
13+
* \param[in] file File name
14+
* \param[in] line Line number
15+
*/
16+
-void assert(const bool condition, const char *const file, const int line);
17+
+void asf_assert(const bool condition, const char *const file, const int line);
18+
19+
#ifdef __cplusplus
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- samd21_vanilla/hal/src/hal_timer.c 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/hal/src/hal_timer.c 2017-09-19 13:07:29.000000000 -0700
3+
@@ -236,7 +236,10 @@
4+
*/
5+
static void timer_process_counted(struct _timer_device *device)
6+
{
7+
+ #pragma GCC diagnostic push
8+
+ #pragma GCC diagnostic ignored "-Wcast-align"
9+
struct timer_descriptor *timer = CONTAINER_OF(device, struct timer_descriptor, device);
10+
+ #pragma GCC diagnostic pop
11+
struct timer_task * it = (struct timer_task *)list_get_head(&timer->tasks);
12+
uint32_t time = ++timer->time;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- samd21_vanilla/CMSIS/Include/core_cmInstr.h 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/CMSIS/Include/core_cmInstr.h 2017-09-19 13:07:29.000000000 -0700
3+
@@ -171,7 +171,7 @@
4+
#define __BKPT(value) __breakpoint(value)
5+
6+
7+
-#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
8+
+#if (__CORTEX_M >= 0x03) || (defined(__CORTEX_SC) && __CORTEX_SC >= 300)
9+
10+
/** \brief Reverse bit order of value
11+
12+
@@ -538,7 +538,7 @@
13+
#define __BKPT(value) __ASM volatile ("bkpt "#value)
14+
15+
16+
-#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
17+
+#if (__CORTEX_M >= 0x03) || (defined(__CORTEX_SC) && __CORTEX_SC >= 300)
18+
19+
/** \brief Reverse bit order of value
20+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- samd21_vanilla/hpl/gclk/hpl_gclk.c 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/hpl/gclk/hpl_gclk.c 2017-09-19 13:07:29.000000000 -0700
3+
@@ -147,7 +147,7 @@
4+
| CONF_GCLK_GEN_7_SRC
5+
| GCLK_GENCTRL_ID(7));
6+
#endif
7+
-#if CONF_GCLK_GEN_8_GENEN == 1
8+
+#if defined(CONF_GCLK_GEN_8_GENEN) && CONF_GCLK_GEN_8_GENEN == 1
9+
hri_gclk_write_GENDIV_reg(GCLK, GCLK_GENDIV_DIV(CONF_GCLK_GEN_8_DIV) | GCLK_GENDIV_ID(8));
10+
hri_gclk_write_GENCTRL_reg(GCLK,
11+
(CONF_GCLK_GEN_8_RUNSTDBY << GCLK_GENCTRL_RUNSTDBY_Pos)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--- samd21_vanilla/include/samd21e18a.h 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/include/samd21e18a.h 2017-09-19 13:07:30.000000000 -0700
3+
@@ -210,7 +210,7 @@
4+
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
5+
*/
6+
7+
-#define LITTLE_ENDIAN 1
8+
+// #define LITTLE_ENDIAN 1
9+
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
10+
#define __MPU_PRESENT 0 /*!< MPU present or not */
11+
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */
12+
--- samd21_vanilla/include/samd21g18a.h 2017-09-28 12:05:22.000000000 -0700
13+
+++ samd21/include/samd21g18a.h 2017-09-19 13:07:30.000000000 -0700
14+
@@ -214,7 +214,7 @@
15+
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
16+
*/
17+
18+
-#define LITTLE_ENDIAN 1
19+
+//#define LITTLE_ENDIAN 1
20+
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
21+
#define __MPU_PRESENT 0 /*!< MPU present or not */
22+
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- samd21_vanilla/hpl/usb/hpl_usb.c 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/hpl/usb/hpl_usb.c 2017-09-19 13:07:29.000000000 -0700
3+
@@ -300,7 +300,7 @@
4+
/** Endpoint cache buffer for OUT transactions (none-control) or SETUP/IN/OUT
5+
* transactions (control). */
6+
#if CONF_USB_EP1_CACHE && CONF_USB_D_MAX_EP_N >= 1
7+
-static uint32_t _usb_ep1_cache[_usb_align_up(CONF_USB_EP1_CACHE) / 4];
8+
+uint32_t _usb_ep1_cache[_usb_align_up(CONF_USB_EP1_CACHE) / 4];
9+
#else
10+
#define _usb_ep1_cache NULL
11+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- samd21_vanilla/gcc/gcc/startup_samd21.c 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd21/gcc/gcc/startup_samd21.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -104,7 +105,7 @@
4+
void I2S_Handler(void) __attribute__((weak, alias("Dummy_Handler")));
5+
6+
/* Exception Table */
7+
-__attribute__((section(".vectors"))) const DeviceVectors exception_table = {
8+
+__attribute__((section(".vectors"), used)) const DeviceVectors exception_table = {
9+
10+
/* Configure Initial Stack Pointer, using linker-generated symbols */
11+
.pvStack = (void *)(&_estack),
12+
@@ -234,7 +234,7 @@
13+
NVMCTRL->CTRLB.bit.MANW = 1;
14+
15+
/* Initialize the C library */
16+
- __libc_init_array();
17+
+ //__libc_init_array();
18+
19+
/* Branch to main function */
20+
main();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- samd21_vanilla/hpl/sysctrl/hpl_sysctrl.c 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/hpl/sysctrl/hpl_sysctrl.c 2017-09-19 13:07:29.000000000 -0700
3+
@@ -114,7 +114,7 @@
4+
5+
#if CONF_OSCULP32K_CONFIG == 1
6+
hri_sysctrl_write_OSCULP32K_reg(hw,
7+
-#if OSC32K_OVERWRITE_CALIBRATION == 1
8+
+#if CONF_OSC32K_OVERWRITE_CALIBRATION == 1
9+
SYSCTRL_OSCULP32K_CALIB(CONF_OSCULP32K_CALIB) |
10+
#else
11+
SYSCTRL_OSCULP32K_CALIB(calib) |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--- samd21_vanilla/usb/device/usbdc.c 2017-09-28 12:05:22.000000000 -0700
2+
+++ samd21/usb/device/usbdc.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -739,7 +737,7 @@
4+
*/
5+
int32_t usbdc_check_desces(struct usbdc_descriptors *desces)
6+
{
7+
-#if CONF_USBD_HS_SP
8+
+#ifdef CONF_USBD_HS_SP
9+
int32_t rc;
10+
if (desces->hs == NULL && desces->ls_fs == NULL) {
11+
return ERR_NOT_FOUND;
12+
--- samd21_vanilla/usb/device/usbdc.h 2017-09-28 12:05:22.000000000 -0700
13+
+++ samd21/usb/device/usbdc.h 2017-09-19 13:07:30.000000000 -0700
14+
@@ -105,7 +105,7 @@
15+
/** Describes the USB device core descriptors. */
16+
struct usbdc_descriptors {
17+
struct usbd_descriptors *ls_fs;
18+
-#if CONF_USBD_HS_SP
19+
+#ifdef CONF_USBD_HS_SP
20+
struct usbd_descriptors *hs;
21+
#endif
22+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- samd51_vanilla/hal/utils/include/utils_assert.h 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/hal/utils/include/utils_assert.h 2017-09-19 13:07:30.000000000 -0700
3+
@@ -72,7 +72,7 @@
4+
if (!(condition)) \
5+
__asm("BKPT #0");
6+
#else
7+
-#define ASSERT_IMPL(condition, file, line) assert((condition), file, line)
8+
+#define ASSERT_IMPL(condition, file, line) asf_assert((condition), file, line)
9+
#endif
10+
11+
#else /* DEBUG */
12+
@@ -95,7 +95,7 @@
13+
* \param[in] file File name
14+
* \param[in] line Line number
15+
*/
16+
-void assert(const bool condition, const char *const file, const int line);
17+
+void asf_assert(const bool condition, const char *const file, const int line);
18+
19+
#ifdef __cplusplus
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- samd51_vanilla/hal/src/hal_timer.c 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/hal/src/hal_timer.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -236,7 +236,10 @@
4+
*/
5+
static void timer_process_counted(struct _timer_device *device)
6+
{
7+
+ #pragma GCC diagnostic push
8+
+ #pragma GCC diagnostic ignored "-Wcast-align"
9+
struct timer_descriptor *timer = CONTAINER_OF(device, struct timer_descriptor, device);
10+
+ #pragma GCC diagnostic pop
11+
struct timer_task * it = (struct timer_task *)list_get_head(&timer->tasks);
12+
uint32_t time = ++timer->time;
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
--- samd51_vanilla/include/samd51g18a.h 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/include/samd51g18a.h 2017-09-19 13:07:30.000000000 -0700
3+
@@ -511,7 +512,7 @@
4+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
5+
*/
6+
7+
-#define LITTLE_ENDIAN 1
8+
+//#define LITTLE_ENDIAN 1
9+
#define __CM4_REV 1 /*!< Core revision r0p1 */
10+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
11+
#define __FPU_PRESENT 1 /*!< FPU present or not */
12+
--- samd51_vanilla/include/samd51g19a.h 2017-09-20 22:33:52.000000000 -0700
13+
+++ samd51/include/samd51g19a.h 2017-09-19 13:07:30.000000000 -0700
14+
@@ -511,7 +512,7 @@
15+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
16+
*/
17+
18+
-#define LITTLE_ENDIAN 1
19+
+//#define LITTLE_ENDIAN 1
20+
#define __CM4_REV 1 /*!< Core revision r0p1 */
21+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
22+
#define __FPU_PRESENT 1 /*!< FPU present or not */
23+
--- samd51_vanilla/include/samd51j18a.h 2017-09-20 22:33:52.000000000 -0700
24+
+++ samd51/include/samd51j18a.h 2017-09-19 13:07:30.000000000 -0700
25+
@@ -529,7 +530,7 @@
26+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
27+
*/
28+
29+
-#define LITTLE_ENDIAN 1
30+
+//#define LITTLE_ENDIAN 1
31+
#define __CM4_REV 1 /*!< Core revision r0p1 */
32+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
33+
#define __FPU_PRESENT 1 /*!< FPU present or not */
34+
--- samd51_vanilla/include/samd51j19a.h 2017-09-20 22:33:52.000000000 -0700
35+
+++ samd51/include/samd51j19a.h 2017-09-19 13:07:30.000000000 -0700
36+
@@ -529,7 +530,7 @@
37+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
38+
*/
39+
40+
-#define LITTLE_ENDIAN 1
41+
+//#define LITTLE_ENDIAN 1
42+
#define __CM4_REV 1 /*!< Core revision r0p1 */
43+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
44+
#define __FPU_PRESENT 1 /*!< FPU present or not */
45+
--- samd51_vanilla/include/samd51j20a.h 2017-09-20 22:33:52.000000000 -0700
46+
+++ samd51/include/samd51j20a.h 2017-09-19 13:07:30.000000000 -0700
47+
@@ -529,7 +530,7 @@
48+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
49+
*/
50+
51+
-#define LITTLE_ENDIAN 1
52+
+//#define LITTLE_ENDIAN 1
53+
#define __CM4_REV 1 /*!< Core revision r0p1 */
54+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
55+
#define __FPU_PRESENT 1 /*!< FPU present or not */
56+
--- samd51_vanilla/include/samd51n19a.h 2017-09-20 22:33:52.000000000 -0700
57+
+++ samd51/include/samd51n19a.h 2017-09-19 13:07:30.000000000 -0700
58+
@@ -551,7 +552,7 @@
59+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
60+
*/
61+
62+
-#define LITTLE_ENDIAN 1
63+
+//#define LITTLE_ENDIAN 1
64+
#define __CM4_REV 1 /*!< Core revision r0p1 */
65+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
66+
#define __FPU_PRESENT 1 /*!< FPU present or not */
67+
--- samd51_vanilla/include/samd51n20a.h 2017-09-20 22:33:52.000000000 -0700
68+
+++ samd51/include/samd51n20a.h 2017-09-19 13:07:30.000000000 -0700
69+
@@ -551,7 +552,7 @@
70+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
71+
*/
72+
73+
-#define LITTLE_ENDIAN 1
74+
+//#define LITTLE_ENDIAN 1
75+
#define __CM4_REV 1 /*!< Core revision r0p1 */
76+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
77+
#define __FPU_PRESENT 1 /*!< FPU present or not */
78+
--- samd51_vanilla/include/samd51p19a.h 2017-09-20 22:33:52.000000000 -0700
79+
+++ samd51/include/samd51p19a.h 2017-09-19 13:07:30.000000000 -0700
80+
@@ -551,7 +552,7 @@
81+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
82+
*/
83+
84+
-#define LITTLE_ENDIAN 1
85+
+//#define LITTLE_ENDIAN 1
86+
#define __CM4_REV 1 /*!< Core revision r0p1 */
87+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
88+
#define __FPU_PRESENT 1 /*!< FPU present or not */
89+
--- samd51_vanilla/include/samd51p20a.h 2017-09-20 22:33:52.000000000 -0700
90+
+++ samd51/include/samd51p20a.h 2017-09-19 13:07:30.000000000 -0700
91+
@@ -551,7 +552,7 @@
92+
* \brief Configuration of the Cortex-M4 Processor and Core Peripherals
93+
*/
94+
95+
-#define LITTLE_ENDIAN 1
96+
+//#define LITTLE_ENDIAN 1
97+
#define __CM4_REV 1 /*!< Core revision r0p1 */
98+
#define __DEBUG_LVL 3 /*!< Full debug plus DWT data matching */
99+
#define __FPU_PRESENT 1 /*!< FPU present or not */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- samd51_vanilla/hpl/usb/hpl_usb.c 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/hpl/usb/hpl_usb.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -299,14 +299,14 @@
4+
/** Endpoint cache buffer for OUT transactions (none-control) or SETUP/IN/OUT
5+
* transactions (control). */
6+
#if CONF_USB_EP1_CACHE && CONF_USB_D_MAX_EP_N >= 1
7+
-static uint32_t _usb_ep1_cache[_usb_align_up(CONF_USB_EP1_CACHE) / 4];
8+
+uint32_t _usb_ep1_cache[_usb_align_up(CONF_USB_EP1_CACHE) / 4];
9+
#else
10+
#define _usb_ep1_cache NULL
11+
#endif
12+
13+
/** Endpoint cache buffer for IN transactions (none-control). */
14+
#if CONF_USB_EP1_I_CACHE && CONF_USB_D_MAX_EP_N >= 1
15+
-static uint32_t _usb_ep1_i_cache[_usb_align_up(CONF_USB_EP1_I_CACHE) / 4];
16+
+uint32_t _usb_ep1_i_cache[_usb_align_up(CONF_USB_EP1_I_CACHE) / 4];
17+
#else
18+
#define _usb_ep1_i_cache NULL
19+
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- samd51_vanilla/gcc/gcc/startup_samd51.c 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/gcc/gcc/startup_samd51.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -314,7 +315,7 @@
4+
#endif
5+
6+
/* Exception Table */
7+
-__attribute__((section(".vectors"))) const DeviceVectors exception_table
8+
+__attribute__((section(".vectors"), used)) const DeviceVectors exception_table
9+
= {
10+
11+
/* Configure Initial Stack Pointer, using linker-generated symbols */
12+
@@ -660,7 +661,7 @@
13+
#endif
14+
15+
/* Initialize the C library */
16+
- __libc_init_array();
17+
+ //__libc_init_array();
18+
19+
/* Branch to main function */
20+
main();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--- samd51_vanilla/usb/device/usbdc.c 2017-09-20 22:33:52.000000000 -0700
2+
+++ samd51/usb/device/usbdc.c 2017-09-19 13:07:30.000000000 -0700
3+
@@ -739,7 +741,7 @@
4+
*/
5+
int32_t usbdc_check_desces(struct usbdc_descriptors *desces)
6+
{
7+
-#if CONF_USBD_HS_SP
8+
+#ifdef CONF_USBD_HS_SP
9+
int32_t rc;
10+
if (desces->hs == NULL && desces->ls_fs == NULL) {
11+
return ERR_NOT_FOUND;
12+
--- samd51_vanilla/usb/device/usbdc.h 2017-09-20 22:33:52.000000000 -0700
13+
+++ samd51/usb/device/usbdc.h 2017-09-19 13:07:30.000000000 -0700
14+
@@ -105,7 +105,7 @@
15+
/** Describes the USB device core descriptors. */
16+
struct usbdc_descriptors {
17+
struct usbd_descriptors *ls_fs;
18+
-#if CONF_USBD_HS_SP
19+
+#ifdef CONF_USBD_HS_SP
20+
struct usbd_descriptors *hs;
21+
#endif
22+
};

atmel-samd/asf4/samd21/CMSIS/Include/core_cmInstr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value
523523
*/
524524
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
525525
{
526-
return (op1 >> op2) | (op1 << (32 - op2));
526+
return (op1 >> op2) | (op1 << (32 - op2));
527527
}
528528

529529

0 commit comments

Comments
 (0)