diff options
Diffstat (limited to 'ports')
-rw-r--r-- | ports/ARMCM3/chcore.c | 8 | ||||
-rw-r--r-- | ports/ARMCM3/chcore.h | 4 | ||||
-rw-r--r-- | ports/ARMCM3/crt0.s | 4 | ||||
-rw-r--r-- | ports/ARMCM3/nvic.h | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c index d691cee20..5a718abc0 100644 --- a/ports/ARMCM3/chcore.c +++ b/ports/ARMCM3/chcore.c @@ -75,9 +75,7 @@ void threadstart(void) { void SysTickVector(void) {
chSysIRQEnterI();
-
chSysTimerHandlerI();
-
chSysIRQExitI();
}
@@ -94,8 +92,9 @@ void chSysIRQExitI(void) { if (chSchRescRequiredI()) {
asm volatile ("mrs r0, PSP \n\t" \
- "ldr r1, =retaddr \n\t" \
"ldr r2, [r0, #24] \n\t" \
+ "orr r2, r2, #1 \n\t" \
+ "ldr r1, =retaddr \n\t" \
"str r2, [r1] \n\t" \
"ldr r1, =threadswitch \n\t" \
"str r1, [r0, #24] ");
@@ -117,8 +116,9 @@ void threadswitch(void) { "mrs r0, XPSR \n\t" \
"push {r0} \n\t" \
"ldr r0, =retaddr \n\t" \
+ "ldr r0, [r0] \n\t" \
"str r0, [sp, #28] \n\t" \
- "b chSchDoRescheduleI \n\t" \
+ "bl chSchDoRescheduleI \n\t" \
"pop {r0} \n\t" \
"msr XPSR, r0 \n\t" \
"pop {r0-r3, r12, lr} \n\t" \
diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h index 2810368b6..0ff988189 100644 --- a/ports/ARMCM3/chcore.h +++ b/ports/ARMCM3/chcore.h @@ -87,8 +87,8 @@ typedef struct { #define chSysIRQEnterI()
-/* It requires zero bytes, but better be safe.*/
-#define IDLE_THREAD_STACK_SIZE 8
+/* It should be 8.*/
+#define IDLE_THREAD_STACK_SIZE 16
void _IdleThread(void *p) __attribute__((noreturn));
void chSysHalt(void);
diff --git a/ports/ARMCM3/crt0.s b/ports/ARMCM3/crt0.s index 75be93753..836934c33 100644 --- a/ports/ARMCM3/crt0.s +++ b/ports/ARMCM3/crt0.s @@ -24,16 +24,16 @@ .set CONTROL_MODE_PRIVILEGED, 0
.set CONTROL_MODE_UNPRIVILEGED, 1
.set CONTROL_USE_MSP, 0
-.set CONTROL_USE_PSP, 0
+.set CONTROL_USE_PSP, 2
.text
.balign 2
.syntax unified
+.thumb
/*
* Reset handler.
*/
-.thumb
.thumb_func
.global ResetHandler
ResetHandler:
diff --git a/ports/ARMCM3/nvic.h b/ports/ARMCM3/nvic.h index 62ea7317d..f7d513412 100644 --- a/ports/ARMCM3/nvic.h +++ b/ports/ARMCM3/nvic.h @@ -43,8 +43,8 @@ typedef struct { #define ENABLE_OFF_BITS (0 << 0)
#define ENABLE_ON_BITS (1 << 0)
#define CSR_TICKINT_MASK (0x1 << 1)
-#define TICKINT_DISABLED_BITS (0 << 0)
-#define TICKINT_ENABLED_BITS (1 << 0)
+#define TICKINT_DISABLED_BITS (0 << 1)
+#define TICKINT_ENABLED_BITS (1 << 1)
#define CSR_CLKSOURCE_MASK (0x1 << 2)
#define CLKSOURCE_EXT_BITS (0 << 2)
#define CLKSOURCE_CORE_BITS (1 << 2)
|