1From ca573f42e31400b1e8301e75a74424a9248a1f75 Mon Sep 17 00:00:00 2001
2From: Travis Geiselbrecht <travisg@gmail.com>
3Date: Tue, 11 Jun 2019 15:37:00 -0700
4Subject: [PATCH] reapply the systick patch to cmsis
5
6SysTick_Config() tries to set the systick priority to max. Comment out
7this line since arch/arm/arm-m/arch.c sets the priority to medium to
8compete with the rest of the exceptions in the system.
9
10Also include lk/compiler.h to avoid redundant cmsis macros.
11---
12 external/arch/arm/arm-m/CMSIS/Include/cmsis_gcc.h      | 3 +++
13 external/arch/arm/arm-m/CMSIS/Include/core_armv81mml.h | 2 +-
14 external/arch/arm/arm-m/CMSIS/Include/core_armv8mbl.h  | 2 +-
15 external/arch/arm/arm-m/CMSIS/Include/core_armv8mml.h  | 2 +-
16 external/arch/arm/arm-m/CMSIS/Include/core_cm0.h       | 2 +-
17 external/arch/arm/arm-m/CMSIS/Include/core_cm0plus.h   | 2 +-
18 external/arch/arm/arm-m/CMSIS/Include/core_cm1.h       | 2 +-
19 external/arch/arm/arm-m/CMSIS/Include/core_cm23.h      | 2 +-
20 external/arch/arm/arm-m/CMSIS/Include/core_cm3.h       | 2 +-
21 external/arch/arm/arm-m/CMSIS/Include/core_cm33.h      | 2 +-
22 external/arch/arm/arm-m/CMSIS/Include/core_cm35p.h     | 2 +-
23 external/arch/arm/arm-m/CMSIS/Include/core_cm4.h       | 2 +-
24 external/arch/arm/arm-m/CMSIS/Include/core_cm55.h      | 2 +-
25 external/arch/arm/arm-m/CMSIS/Include/core_cm7.h       | 2 +-
26 external/arch/arm/arm-m/CMSIS/Include/core_sc000.h     | 2 +-
27 external/arch/arm/arm-m/CMSIS/Include/core_sc300.h     | 2 +-
28 16 files changed, 18 insertions(+), 15 deletions(-)
29
30diff --git a/external/arch/arm/arm-m/CMSIS/Include/cmsis_gcc.h b/external/arch/arm/arm-m/CMSIS/Include/cmsis_gcc.h
31index 67bda4ef..dc3ae357 100644
32--- a/external/arch/arm/arm-m/CMSIS/Include/cmsis_gcc.h
33+++ b/external/arch/arm/arm-m/CMSIS/Include/cmsis_gcc.h
34@@ -25,6 +25,9 @@
35 #ifndef __CMSIS_GCC_H
36 #define __CMSIS_GCC_H
37
38+/* LK: include lk's compiler.h first, which has some of the same #defines */
39+#include <lk/compiler.h>
40+
41 /* ignore some GCC warnings */
42 #pragma GCC diagnostic push
43 #pragma GCC diagnostic ignored "-Wsign-conversion"
44diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_armv81mml.h b/external/arch/arm/arm-m/CMSIS/Include/core_armv81mml.h
45index 4a15992f..7e95a520 100644
46--- a/external/arch/arm/arm-m/CMSIS/Include/core_armv81mml.h
47+++ b/external/arch/arm/arm-m/CMSIS/Include/core_armv81mml.h
48@@ -4084,7 +4084,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
49   }
50
51   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
52-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
53+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
54   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
55   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
56                    SysTick_CTRL_TICKINT_Msk   |
57diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_armv8mbl.h b/external/arch/arm/arm-m/CMSIS/Include/core_armv8mbl.h
58index 932d3d18..eeb0342e 100644
59--- a/external/arch/arm/arm-m/CMSIS/Include/core_armv8mbl.h
60+++ b/external/arch/arm/arm-m/CMSIS/Include/core_armv8mbl.h
61@@ -2168,7 +2168,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
62   }
63
64   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
65-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
66+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
67   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
68   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
69                    SysTick_CTRL_TICKINT_Msk   |
70diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_armv8mml.h b/external/arch/arm/arm-m/CMSIS/Include/core_armv8mml.h
71index 2bd9e760..80bd6818 100644
72--- a/external/arch/arm/arm-m/CMSIS/Include/core_armv8mml.h
73+++ b/external/arch/arm/arm-m/CMSIS/Include/core_armv8mml.h
74@@ -3065,7 +3065,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
75   }
76
77   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
78-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
79+// LK NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
80   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
81   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
82                    SysTick_CTRL_TICKINT_Msk   |
83diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm0.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm0.h
84index 6441ff34..f4d5d7e9 100644
85--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm0.h
86+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm0.h
87@@ -928,7 +928,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
88   }
89
90   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
91-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
92+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
93   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
94   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
95                    SysTick_CTRL_TICKINT_Msk   |
96diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm0plus.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm0plus.h
97index 4e7179a6..7c589dc1 100644
98--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm0plus.h
99+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm0plus.h
100@@ -1063,7 +1063,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
101   }
102
103   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
104-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
105+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
106   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
107   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
108                    SysTick_CTRL_TICKINT_Msk   |
109diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm1.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm1.h
110index 76b45697..aebd6960 100644
111--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm1.h
112+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm1.h
113@@ -955,7 +955,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
114   }
115
116   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
117-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
118+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
119   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
120   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
121                    SysTick_CTRL_TICKINT_Msk   |
122diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm23.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm23.h
123index 55fff995..717bc828 100644
124--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm23.h
125+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm23.h
126@@ -2243,7 +2243,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
127   }
128
129   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
130-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
131+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
132   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
133   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
134                    SysTick_CTRL_TICKINT_Msk   |
135diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm3.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm3.h
136index 74fb87e5..fd2bcfc8 100644
137--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm3.h
138+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm3.h
139@@ -1841,7 +1841,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
140   }
141
142   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
143-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
144+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
145   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
146   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
147                    SysTick_CTRL_TICKINT_Msk   |
148diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm33.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm33.h
149index f9cf6ab1..e0ba8e0e 100644
150--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm33.h
151+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm33.h
152@@ -3133,7 +3133,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
153   }
154
155   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
156-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
157+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
158   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
159   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
160                    SysTick_CTRL_TICKINT_Msk   |
161diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm35p.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm35p.h
162index 552c2946..ab65cc51 100644
163--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm35p.h
164+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm35p.h
165@@ -3133,7 +3133,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
166   }
167
168   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
169-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
170+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
171   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
172   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
173                    SysTick_CTRL_TICKINT_Msk   |
174diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm4.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm4.h
175index e21cd149..52ef4922 100644
176--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm4.h
177+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm4.h
178@@ -2027,7 +2027,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
179   }
180
181   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
182-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
183+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
184   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
185   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
186                    SysTick_CTRL_TICKINT_Msk   |
187diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm55.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm55.h
188index 51b68e6d..e0af1db5 100644
189--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm55.h
190+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm55.h
191@@ -4145,7 +4145,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
192   }
193
194   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
195-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
196+// LK NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
197   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
198   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
199                    SysTick_CTRL_TICKINT_Msk   |
200diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_cm7.h b/external/arch/arm/arm-m/CMSIS/Include/core_cm7.h
201index 010506e9..3a45a63b 100644
202--- a/external/arch/arm/arm-m/CMSIS/Include/core_cm7.h
203+++ b/external/arch/arm/arm-m/CMSIS/Include/core_cm7.h
204@@ -2264,7 +2264,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
205   }
206
207   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
208-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
209+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
210   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
211   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
212                    SysTick_CTRL_TICKINT_Msk   |
213diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_sc000.h b/external/arch/arm/arm-m/CMSIS/Include/core_sc000.h
214index dbc755ff..fe52f94c 100644
215--- a/external/arch/arm/arm-m/CMSIS/Include/core_sc000.h
216+++ b/external/arch/arm/arm-m/CMSIS/Include/core_sc000.h
217@@ -1006,7 +1006,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
218   }
219
220   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
221-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
222+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
223   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
224   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
225                    SysTick_CTRL_TICKINT_Msk   |
226diff --git a/external/arch/arm/arm-m/CMSIS/Include/core_sc300.h b/external/arch/arm/arm-m/CMSIS/Include/core_sc300.h
227index d6662103..ce1405f9 100644
228--- a/external/arch/arm/arm-m/CMSIS/Include/core_sc300.h
229+++ b/external/arch/arm/arm-m/CMSIS/Include/core_sc300.h
230@@ -1815,7 +1815,7 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
231   }
232
233   SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
234-  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
235+// LK  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
236   SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
237   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
238                    SysTick_CTRL_TICKINT_Msk   |
239--
2402.25.1
241
242