git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@104 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
8d478094e0
commit
080fb7d084
|
@ -138,7 +138,7 @@ ifneq ($(TSRC),)
|
||||||
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly
|
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly
|
||||||
CPFLAGS += -D THUMB
|
CPFLAGS += -D THUMB
|
||||||
LDFLAGS += -mthumb
|
LDFLAGS += -mthumb
|
||||||
ASFLAGS += -mthumb-interwork -D THUMB -D PURE_THUMB
|
ASFLAGS += -mthumb-interwork -D THUMB -D THUMB_NO_INTERWORKING
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,9 @@ ifneq ($(TSRC),)
|
||||||
ASFLAGS += -mthumb-interwork -D THUMB
|
ASFLAGS += -mthumb-interwork -D THUMB
|
||||||
else
|
else
|
||||||
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly
|
# 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
|
LDFLAGS += -mthumb
|
||||||
ASFLAGS += -mthumb-interwork -D THUMB -D PURE_THUMB
|
ASFLAGS += -mthumb-interwork -D THUMB -D THUMB_NO_INTERWORKING
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,15 @@
|
||||||
.globl threadstart
|
.globl threadstart
|
||||||
threadstart:
|
threadstart:
|
||||||
msr CPSR_c, #MODE_SYS
|
msr CPSR_c, #MODE_SYS
|
||||||
#ifndef PURE_THUMB
|
#ifndef THUMB_NO_INTERWORKING
|
||||||
mov r0, r5
|
mov r0, r5
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
bx r4
|
bx r4
|
||||||
bl chThdExit
|
bl chThdExit
|
||||||
#else
|
#else
|
||||||
ldr r0, =.L1
|
add r0, pc, #1
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
.L1:
|
|
||||||
mov r0, r5
|
mov r0, r5
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
bx r4
|
bx r4
|
||||||
|
@ -68,7 +67,7 @@ AbortHandler:
|
||||||
|
|
||||||
.globl FiqHandler
|
.globl FiqHandler
|
||||||
FiqHandler:
|
FiqHandler:
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =chSysHalt
|
ldr r0, =chSysHalt
|
||||||
bx r0
|
bx r0
|
||||||
#else
|
#else
|
||||||
|
@ -139,80 +138,74 @@ chSysSwitchI:
|
||||||
IrqHandler:
|
IrqHandler:
|
||||||
sub lr, lr, #4
|
sub lr, lr, #4
|
||||||
stmfd sp!, {r0-r3, r12, lr}
|
stmfd sp!, {r0-r3, r12, lr}
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =NonVectoredIrq
|
add r0, pc, #1
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
mov lr, pc
|
bl NonVectoredIrq
|
||||||
bx lr
|
b IrqCommon
|
||||||
.code 32
|
.code 32
|
||||||
#else
|
#else
|
||||||
bl NonVectoredIrq
|
bl NonVectoredIrq
|
||||||
#endif
|
|
||||||
b IrqCommon
|
b IrqCommon
|
||||||
|
#endif
|
||||||
|
|
||||||
.globl T0IrqHandler
|
.globl T0IrqHandler
|
||||||
T0IrqHandler:
|
T0IrqHandler:
|
||||||
sub lr, lr, #4
|
sub lr, lr, #4
|
||||||
stmfd sp!, {r0-r3, r12, lr}
|
stmfd sp!, {r0-r3, r12, lr}
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =Timer0Irq
|
add r0, pc, #1
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
mov lr, pc
|
bl Timer0Irq
|
||||||
bx lr
|
b IrqCommon
|
||||||
.code 32
|
.code 32
|
||||||
#else
|
#else
|
||||||
bl Timer0Irq
|
bl Timer0Irq
|
||||||
#endif
|
|
||||||
b IrqCommon
|
b IrqCommon
|
||||||
|
#endif
|
||||||
|
|
||||||
.globl UART0IrqHandler
|
.globl UART0IrqHandler
|
||||||
UART0IrqHandler:
|
UART0IrqHandler:
|
||||||
sub lr, lr, #4
|
sub lr, lr, #4
|
||||||
stmfd sp!, {r0-r3, r12, lr}
|
stmfd sp!, {r0-r3, r12, lr}
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =UART0Irq
|
add r0, pc, #1
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
mov lr, pc
|
bl UART0Irq
|
||||||
bx lr
|
b IrqCommon
|
||||||
.code 32
|
.code 32
|
||||||
#else
|
#else
|
||||||
bl UART0Irq
|
bl UART0Irq
|
||||||
#endif
|
|
||||||
b IrqCommon
|
b IrqCommon
|
||||||
|
#endif
|
||||||
|
|
||||||
.globl UART1IrqHandler
|
.globl UART1IrqHandler
|
||||||
UART1IrqHandler:
|
UART1IrqHandler:
|
||||||
sub lr, lr, #4
|
sub lr, lr, #4
|
||||||
stmfd sp!, {r0-r3, r12, lr}
|
stmfd sp!, {r0-r3, r12, lr}
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =UART1Irq
|
add r0, pc, #1
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
mov lr, pc
|
bl UART1Irq
|
||||||
bx lr
|
b IrqCommon
|
||||||
.code 32
|
.code 32
|
||||||
#else
|
#else
|
||||||
bl UART1Irq
|
bl UART1Irq
|
||||||
#endif
|
|
||||||
b IrqCommon
|
b IrqCommon
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Common exit point for all IRQ routines, it performs the rescheduling if
|
* Common exit point for all IRQ routines, it performs the rescheduling if
|
||||||
* required.
|
* required.
|
||||||
*/
|
*/
|
||||||
IrqCommon:
|
IrqCommon:
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =chSchRescRequiredI
|
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
|
||||||
.code 16
|
.code 16
|
||||||
|
bl chSchRescRequiredI
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
bx lr
|
bx lr
|
||||||
.code 32
|
.code 32
|
||||||
|
@ -233,11 +226,11 @@ IrqCommon:
|
||||||
stmfd sp!, {r0, r1} // Push R0=SPSR, R1=LR_IRQ.
|
stmfd sp!, {r0, r1} // Push R0=SPSR, R1=LR_IRQ.
|
||||||
|
|
||||||
// Context switch.
|
// Context switch.
|
||||||
#ifdef PURE_THUMB
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
ldr r0, =chSchDoRescheduleI
|
add r0, pc, #1
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
|
bl chSchDoRescheduleI
|
||||||
mov lr, pc
|
mov lr, pc
|
||||||
bx lr
|
bx lr
|
||||||
.code 32
|
.code 32
|
||||||
|
|
|
@ -127,33 +127,23 @@ bssloop:
|
||||||
/*
|
/*
|
||||||
* Application-provided HW initialization routine.
|
* Application-provided HW initialization routine.
|
||||||
*/
|
*/
|
||||||
#ifndef PURE_THUMB
|
#ifndef THUMB_NO_INTERWORKING
|
||||||
bl hwinit
|
bl hwinit
|
||||||
#else
|
|
||||||
ldr r0, =hwinit
|
|
||||||
mov lr, pc
|
|
||||||
bx r0
|
|
||||||
.code 16
|
|
||||||
mov lr, pc
|
|
||||||
bx lr
|
|
||||||
.code 32
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* main(0, NULL).
|
* main(0, NULL).
|
||||||
*/
|
*/
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
mov r1, #0
|
mov r1, r0
|
||||||
#ifndef PURE_THUMB
|
|
||||||
bl main
|
bl main
|
||||||
bl chSysHalt
|
bl chSysHalt
|
||||||
#else
|
#else
|
||||||
ldr r2, =main
|
add r0, pc, #1
|
||||||
mov lr, pc
|
bx r0
|
||||||
bx r2
|
|
||||||
.code 16
|
.code 16
|
||||||
mov lr, pc
|
bl hwinit
|
||||||
bx lr
|
mov r0, #0
|
||||||
|
mov r1, r0
|
||||||
|
bl main
|
||||||
|
bl chSysHalt
|
||||||
.code 32
|
.code 32
|
||||||
ldr r2, =chSysHalt
|
|
||||||
bx r2
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -135,12 +135,6 @@ int main(int argc, char **argv) {
|
||||||
chThdCreate(NORMALPRIO, 0, waThread2, sizeof(waThread2), Thread2, NULL);
|
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
|
* Normal main() activity, in this demo it serves events generated by
|
||||||
* various sources.
|
* various sources.
|
||||||
|
|
|
@ -39,9 +39,9 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** 0.4.2 ***
|
*** 0.4.2 ***
|
||||||
- Improved the THUMB mode: when all C sources are compiled in thumb mode then
|
- Introduced support for "pure" THUMB mode, it is activated when all the
|
||||||
the -mthumb-interworking option is not enabled in the makefile, this greatly
|
source files are compiled in THUMB mode, the option -mthumb-interworking is
|
||||||
improves the performance and reduces the overall code size.
|
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
|
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.
|
unless you know exactly what you are doing and understand the consequences.
|
||||||
Mixing is still supported anyway.
|
Mixing is still supported anyway.
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void println(char *msgp) {
|
||||||
|
|
||||||
t_msg Thread1(void *p) {
|
t_msg Thread1(void *p) {
|
||||||
|
|
||||||
// chFDDPut(comp, *(BYTE8 *)p);
|
chFDDPut(comp, *(BYTE8 *)p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue