aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/ARMCM3-STM32F103-GCC/Makefile2
-rw-r--r--demos/ARMCM3-STM32F103-GCC/ch.ld1
-rw-r--r--ports/ARM7/chcore.h3
-rw-r--r--ports/ARMCM3/chcore.c20
-rw-r--r--ports/ARMCM3/chcore.h5
-rw-r--r--readme.txt5
6 files changed, 32 insertions, 4 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile
index dc01e39e3..5b0e8f23e 100644
--- a/demos/ARMCM3-STM32F103-GCC/Makefile
+++ b/demos/ARMCM3-STM32F103-GCC/Makefile
@@ -71,7 +71,7 @@ SRC = ../../ports/ARMCM3/chcore.c \
board.c main.c
# List ASM source files here
-ASMSRC = ../../ports/ARMCM3/crt0.s
+ASMSRC = ../../ports/ARMCM3/crt0.s ../../ports/ARMCM3-STM32F103/vectors.s
# List all user directories here
UINCDIR = ../../src/include ../../src/lib ../../ports/ARMCM3
diff --git a/demos/ARMCM3-STM32F103-GCC/ch.ld b/demos/ARMCM3-STM32F103-GCC/ch.ld
index 2ddc2aab4..96c5a3a1d 100644
--- a/demos/ARMCM3-STM32F103-GCC/ch.ld
+++ b/demos/ARMCM3-STM32F103-GCC/ch.ld
@@ -41,6 +41,7 @@ SECTIONS
.text :
{
_text = .;
+ *(INTVEC);
*(.text);
*(.rodata);
*(.rodata*);
diff --git a/ports/ARM7/chcore.h b/ports/ARM7/chcore.h
index 7965f1174..84c508d2c 100644
--- a/ports/ARM7/chcore.h
+++ b/ports/ARM7/chcore.h
@@ -32,7 +32,8 @@ struct extctx {
regarm r1;
regarm r2;
regarm r3;
- regarm r12;
+ regarm r12
+ regarm lr_usr;
};
/*
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c
index a98da808b..7ef8f8daf 100644
--- a/ports/ARMCM3/chcore.c
+++ b/ports/ARMCM3/chcore.c
@@ -66,5 +66,25 @@ void threadstart(void) {
asm volatile ("mov r0, r5 \n\t" \
"blx r4 \n\t" \
"bl chThdExit ");
+}
+
+void *retaddr;
+
+__attribute__((naked, weak))
+void threadswitch(void) {
+
+ asm volatile ("sub sp, sp, #4 \n\t" \
+ "push {r0-r3, r12, lr} \n\t" \
+ "mrs r0, XPSR \n\t" \
+ "push {r0} \n\t" \
+ "ldr r0, =retaddr \n\t" \
+ "str r0, [sp, #28] ");
+
+ chSchDoRescheduleI();
+ asm volatile ("pop {r0} \n\t" \
+ "msr XPSR, r0 \n\t" \
+ "pop {r0-r3, r12, lr} \n\t" \
+ "cpsie i \n\t" \
+ "pop {pc} ");
}
diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h
index 706f49c28..9fee0c61d 100644
--- a/ports/ARMCM3/chcore.h
+++ b/ports/ARMCM3/chcore.h
@@ -26,13 +26,14 @@ typedef void *regarm;
* Interrupt saved context.
*/
struct extctx {
- regarm spsr_irq;
- regarm lr_irq;
+ regarm pc;
+ regarm xpsr;
regarm r0;
regarm r1;
regarm r2;
regarm r3;
regarm r12;
+ regarm lr;
};
/*
diff --git a/readme.txt b/readme.txt
index 690f7e936..e8c068bab 100644
--- a/readme.txt
+++ b/readme.txt
@@ -60,6 +60,11 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*** Releases ***
*****************************************************************************
+*** 0.6.2 ***
+- Fixed a minor problem in the ARM7 port, the structure extctx definition was
+ missing one field, the effect was to allocate stacks 4 bytes shorter. This
+ was not a problem in most scenarios.
+
*** 0.6.1 ***
- Removed some redundant checks from the scheduler code: improved threads
flyback time, reduced interrupts service time.