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

284 files changed

Lines changed: 6283 additions & 42142 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
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+
}

0 commit comments

Comments
 (0)