git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@104 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2007-11-22 11:29:17 +00:00
parent 8d478094e0
commit 080fb7d084
7 changed files with 44 additions and 67 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -135,12 +135,6 @@ int main(int argc, char **argv) {
chThdCreate(NORMALPRIO, 0, waThread2, sizeof(waThread2), Thread2, NULL);
}
/*
* 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.

View File

@ -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.

View File

@ -77,7 +77,7 @@ static void println(char *msgp) {
t_msg Thread1(void *p) {
// chFDDPut(comp, *(BYTE8 *)p);
chFDDPut(comp, *(BYTE8 *)p);
return 0;
}