From 8964c60d9a62a93e06e6c493b9126c6cd16a678a Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Wed, 22 Apr 2009 16:04:50 -0400 Subject: [PATCH] enabling thumb only enter user mode in tmr-ints. usermode breaks rftests. --- Makefile | 2 +- config.mk | 2 +- src/start.S | 10 +++++----- tests/tmr-ints.c | 6 ++++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1f12d73dd..4803b5e1b 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ NOTHUMB_CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -I$(TOPDIR)/include \ -fno-builtin -ffreestanding -nostdinc -isystem \ $(gccincdir) -pipe -NOTHUMB_CPPFLAGS_EXTRA = -march=armv4t -mlong-calls -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ #-mthumb-interwork +NOTHUMB_CPPFLAGS_EXTRA = -march=armv4t -mlong-calls -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ -mthumb-interwork src/isr.o: src/isr.c diff --git a/config.mk b/config.mk index b5f092959..c21f9b280 100644 --- a/config.mk +++ b/config.mk @@ -26,7 +26,7 @@ # clean the slate ... PLATFORM_LDFLAGS = PLATFORM_RELFLAGS = -fno-strict-aliasing -fno-common -ffixed-r8 -ffunction-sections -msoft-float -PLATFORM_CPPFLAGS = -march=armv4t -mlong-calls -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ #-mcallee-super-interworking -mthumb -mthumb-interwork +PLATFORM_CPPFLAGS = -march=armv4t -mlong-calls -mtune=arm7tdmi-s -DCONFIG_ARM -D__ARM__ -mcallee-super-interworking -mthumb -mthumb-interwork TEXT_BASE = 0x00400000 ######################################################################### diff --git a/src/start.S b/src/start.S index 683e79226..bc991ad7d 100644 --- a/src/start.S +++ b/src/start.S @@ -113,13 +113,13 @@ _begin: mov sp,r1 // msr cpsr_c,#(USR_MODE | I_BIT | F_BIT) -// add r1,r1,#usr_stack_size -// mov sp,r1 - bl _rom_data_init+.-base - msr cpsr_c,#(SVC_MODE) // turn on interrupts --- for debug only -// swi + msr cpsr_c,#(SVC_MODE) // turn on interrupts --- for debug only +// msr cpsr_c,#(USR_MODE) // turn on interrupts --- for debug only +// add r1,r1,#usr_stack_size +// mov sp,r1 + b main _undefined_instruction: .word undefined_instruction diff --git a/tests/tmr-ints.c b/tests/tmr-ints.c index f72222f40..e93b142e1 100644 --- a/tests/tmr-ints.c +++ b/tests/tmr-ints.c @@ -124,8 +124,10 @@ void main(void) { /* go into user mode to handle IRQs */ /* disabling interrupts is now difficult */ - asm("msr cpsr_c,#(0x10)"); - + asm(".code 32;" + "msr cpsr_c,#(0x10);" + ".code 16; "); + while(1) { /* sit here and let the interrupts do the work */ };