aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-22 11:29:17 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-22 11:29:17 +0000
commit080fb7d084f878e792563a60a255b5fc993ae0ba (patch)
treeb3aeb0818129704170bf3027a7f676b04d514806
parent8d478094e0b24d5ba94a4ba69cc291210ed3807f (diff)
downloadChibiOS-080fb7d084f878e792563a60a255b5fc993ae0ba.tar.gz
ChibiOS-080fb7d084f878e792563a60a255b5fc993ae0ba.tar.bz2
ChibiOS-080fb7d084f878e792563a60a255b5fc993ae0ba.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@104 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARM7-LPC214x-GCC/Makefile2
-rw-r--r--demos/ARM7-LPC214x-GCC/Makefile.thumb4
-rw-r--r--demos/ARM7-LPC214x-GCC/chcore2.s63
-rw-r--r--demos/ARM7-LPC214x-GCC/crt0.s28
-rw-r--r--demos/ARM7-LPC214x-GCC/main.c6
-rw-r--r--readme.txt6
-rw-r--r--test/test.c2
7 files changed, 44 insertions, 67 deletions
diff --git a/demos/ARM7-LPC214x-GCC/Makefile b/demos/ARM7-LPC214x-GCC/Makefile
index 6c0750add..3698582e7 100644
--- a/demos/ARM7-LPC214x-GCC/Makefile
+++ b/demos/ARM7-LPC214x-GCC/Makefile
@@ -138,7 +138,7 @@ ifneq ($(TSRC),)
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly
CPFLAGS += -D THUMB
LDFLAGS += -mthumb
- ASFLAGS += -mthumb-interwork -D THUMB -D PURE_THUMB
+ ASFLAGS += -mthumb-interwork -D THUMB -D THUMB_NO_INTERWORKING
endif
endif
diff --git a/demos/ARM7-LPC214x-GCC/Makefile.thumb b/demos/ARM7-LPC214x-GCC/Makefile.thumb
index 05a63460d..c08d632f9 100644
--- a/demos/ARM7-LPC214x-GCC/Makefile.thumb
+++ b/demos/ARM7-LPC214x-GCC/Makefile.thumb
@@ -135,9 +135,9 @@ ifneq ($(TSRC),)
ASFLAGS += -mthumb-interwork -D THUMB
else
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly
- CPFLAGS += -D THUMB
+ CPFLAGS += -D THUMB -D THUMB_NO_INTERWORKING
LDFLAGS += -mthumb
- ASFLAGS += -mthumb-interwork -D THUMB -D PURE_THUMB
+ ASFLAGS += -mthumb-interwork -D THUMB -D THUMB_NO_INTERWORKING
endif
endif
diff --git a/demos/ARM7-LPC214x-GCC/chcore2.s b/demos/ARM7-LPC214x-GCC/chcore2.s
index c9ad0c208..a450d9b74 100644
--- a/demos/ARM7-LPC214x-GCC/chcore2.s
+++ b/demos/ARM7-LPC214x-GCC/chcore2.s
@@ -37,16 +37,15 @@
.globl threadstart
threadstart:
msr CPSR_c, #MODE_SYS
-#ifndef PURE_THUMB
+#ifndef THUMB_NO_INTERWORKING
mov r0, r5
mov lr, pc
bx r4
bl chThdExit
#else
- ldr r0, =.L1
+ add r0, pc, #1
bx r0
.code 16
-.L1:
mov r0, r5
mov lr, pc
bx r4
@@ -68,7 +67,7 @@ AbortHandler:
.globl FiqHandler
FiqHandler:
-#ifdef PURE_THUMB
+#ifdef THUMB_NO_INTERWORKING
ldr r0, =chSysHalt
bx r0
#else
@@ -139,80 +138,74 @@ chSysSwitchI:
IrqHandler:
sub lr, lr, #4
stmfd sp!, {r0-r3, r12, lr}
-#ifdef PURE_THUMB
- ldr r0, =NonVectoredIrq
- mov lr, pc
+#ifdef THUMB_NO_INTERWORKING
+ add r0, pc, #1
bx r0
.code 16
- mov lr, pc
- bx lr
+ bl NonVectoredIrq
+ b IrqCommon
.code 32
#else
bl NonVectoredIrq
-#endif
b IrqCommon
+#endif
.globl T0IrqHandler
T0IrqHandler:
sub lr, lr, #4
stmfd sp!, {r0-r3, r12, lr}
-#ifdef PURE_THUMB
- ldr r0, =Timer0Irq
- mov lr, pc
+#ifdef THUMB_NO_INTERWORKING
+ add r0, pc, #1
bx r0
.code 16
- mov lr, pc
- bx lr
+ bl Timer0Irq
+ b IrqCommon
.code 32
#else
bl Timer0Irq
-#endif
b IrqCommon
+#endif
.globl UART0IrqHandler
UART0IrqHandler:
sub lr, lr, #4
stmfd sp!, {r0-r3, r12, lr}
-#ifdef PURE_THUMB
- ldr r0, =UART0Irq
- mov lr, pc
+#ifdef THUMB_NO_INTERWORKING
+ add r0, pc, #1
bx r0
.code 16
- mov lr, pc
- bx lr
+ bl UART0Irq
+ b IrqCommon
.code 32
#else
bl UART0Irq
-#endif
b IrqCommon
+#endif
.globl UART1IrqHandler
UART1IrqHandler:
sub lr, lr, #4
stmfd sp!, {r0-r3, r12, lr}
-#ifdef PURE_THUMB
- ldr r0, =UART1Irq
- mov lr, pc
+#ifdef THUMB_NO_INTERWORKING
+ add r0, pc, #1
bx r0
.code 16
- mov lr, pc
- bx lr
+ bl UART1Irq
+ b IrqCommon
.code 32
#else
bl UART1Irq
-#endif
b IrqCommon
+#endif
/*
* Common exit point for all IRQ routines, it performs the rescheduling if
* required.
*/
IrqCommon:
-#ifdef PURE_THUMB
- ldr r0, =chSchRescRequiredI
- mov lr, pc
- bx r0
+#ifdef THUMB_NO_INTERWORKING
.code 16
+ bl chSchRescRequiredI
mov lr, pc
bx lr
.code 32
@@ -233,11 +226,11 @@ IrqCommon:
stmfd sp!, {r0, r1} // Push R0=SPSR, R1=LR_IRQ.
// Context switch.
-#ifdef PURE_THUMB
- ldr r0, =chSchDoRescheduleI
- mov lr, pc
+#ifdef THUMB_NO_INTERWORKING
+ add r0, pc, #1
bx r0
.code 16
+ bl chSchDoRescheduleI
mov lr, pc
bx lr
.code 32
diff --git a/demos/ARM7-LPC214x-GCC/crt0.s b/demos/ARM7-LPC214x-GCC/crt0.s
index 7bf91e291..a7845036d 100644
--- a/demos/ARM7-LPC214x-GCC/crt0.s
+++ b/demos/ARM7-LPC214x-GCC/crt0.s
@@ -127,33 +127,23 @@ bssloop:
/*
* Application-provided HW initialization routine.
*/
-#ifndef PURE_THUMB
+#ifndef THUMB_NO_INTERWORKING
bl hwinit
-#else
- ldr r0, =hwinit
- mov lr, pc
- bx r0
-.code 16
- mov lr, pc
- bx lr
-.code 32
-#endif
/*
* main(0, NULL).
*/
mov r0, #0
- mov r1, #0
-#ifndef PURE_THUMB
+ mov r1, r0
bl main
bl chSysHalt
#else
- ldr r2, =main
- mov lr, pc
- bx r2
+ add r0, pc, #1
+ bx r0
.code 16
- mov lr, pc
- bx lr
+ bl hwinit
+ mov r0, #0
+ mov r1, r0
+ bl main
+ bl chSysHalt
.code 32
- ldr r2, =chSysHalt
- bx r2
#endif
diff --git a/demos/ARM7-LPC214x-GCC/main.c b/demos/ARM7-LPC214x-GCC/main.c
index 1829e6eb6..f84874f78 100644
--- a/demos/ARM7-LPC214x-GCC/main.c
+++ b/demos/ARM7-LPC214x-GCC/main.c
@@ -136,12 +136,6 @@ int main(int argc, char **argv) {
}
/*
- * Allows the other threads to run by lowering the priority, remember,
- * the priority is set to the maximum in the \p chSysInit().
- */
- chThdSetPriority(NORMALPRIO);
-
- /*
* Normal main() activity, in this demo it serves events generated by
* various sources.
*/
diff --git a/readme.txt b/readme.txt
index 5e05bb776..baf97a2a0 100644
--- a/readme.txt
+++ b/readme.txt
@@ -39,9 +39,9 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
*****************************************************************************
*** 0.4.2 ***
-- Improved the THUMB mode: when all C sources are compiled in thumb mode then
- the -mthumb-interworking option is not enabled in the makefile, this greatly
- improves the performance and reduces the overall code size.
+- Introduced support for "pure" THUMB mode, it is activated when all the
+ source files are compiled in THUMB mode, the option -mthumb-interworking is
+ not used in this scenario greatly improving both code size and speed.
It is recommended to either use ARM mode or THUMB mode and not mix them
unless you know exactly what you are doing and understand the consequences.
Mixing is still supported anyway.
diff --git a/test/test.c b/test/test.c
index fe0cb5df7..a40a059f3 100644
--- a/test/test.c
+++ b/test/test.c
@@ -77,7 +77,7 @@ static void println(char *msgp) {
t_msg Thread1(void *p) {
-// chFDDPut(comp, *(BYTE8 *)p);
+ chFDDPut(comp, *(BYTE8 *)p);
return 0;
}