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

master
gdisirio 2007-09-22 14:10:02 +00:00
parent b389116a6f
commit cfdef89c71
6 changed files with 78 additions and 27 deletions

View File

@ -61,15 +61,20 @@ UDEFS =
# Define ASM defines here
UADEFS =
# List C source files here
SRC = chcore.c buzzer.c main.c \
# List ARM-mode C source files here
ASRC = chcore.c main.c buzzer.c \
../../ports/ARM7-LPC214x/GCC/lpc214x_serial.c \
../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \
../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \
../../src/chqueues.c ../../src/chserial.c
# List THUMB-mode C sources here
# NOTE: If any module is compiled in thumb mode then -mthumb-interwork is
# enabled for all modules and that lowers performance.
TSRC =
# List ASM source files here
ASRC = crt0.s chcore2.s
ASMSRC = crt0.s chcore2.s
# List all user directories here
UINCDIR = ../../src/include ../../ports/ARM7-LPC214x/GCC
@ -80,12 +85,18 @@ ULIBDIR =
# List all user libraries here
ULIBS =
# Define optimisation level here
# NOTE: -mthumb-interwork increases the code size, remove it if you don't really need it.
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -D THUMB
# Common options here
# NOTE: -mthumb-interwork increases the code size, remove it if you dont have
# Thumb code anywhere in the project.
# NOTE: -ffixed-f7 is only needed if you enabled CH_CURRP_REGISTER_CACHE in chconf.h.
#OPT = -Os -ggdb -fomit-frame-pointer -fno-strict-aliasing
#OPT = -O0 -ggdb -fomit-frame-pointer -fno-strict-aliasing
OPT = -O2 -ggdb -fomit-frame-pointer -fno-strict-aliasing
#OPT += -ffixed-f7
# Define warning options here
WARN = -Wall -Wstrict-prototypes
@ -98,33 +109,44 @@ INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
AOBJS = $(ASRC:.c=.o)
TOBJS = $(TSRC:.c=.o)
OBJS = $(ASMOBJS) $(AOBJS) $(TOBJS)
ASMOBJS = $(ASMSRC:.s=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
#ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
ODFLAGS = -x --syms
ifneq ($(TSRC),)
ASFLAGS += -mthumb-interwork -D THUMB_INTERWORK
CPFLAGS += -mthumb-interwork -D THUMB_INTERWORK
LDFLAGS += -mthumb-interwork
endif
# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d
#
# makefile rules
# Makefile rules
#
all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp
%o : %c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
$(AOBJS) : %.o : %.c
$(CC) -c $(CPFLAGS) $(AOPT) -I . $(INCDIR) $< -o $@
%o : %s
$(TOBJS) : %.o : %.c
$(CC) -c $(CPFLAGS) $(TOPT) -I . $(INCDIR) $< -o $@
$(ASMOBJS) : %.o : %.s
$(AS) -c $(ASFLAGS) $< -o $@
%elf: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
$(CC) $(ASMOBJS) $(AOBJS) $(TOBJS) $(LDFLAGS) $(LIBS) -o $@
%hex: %elf
$(HEX) $< $@
@ -142,10 +164,12 @@ clean:
-rm -f $(PROJECT).map
-rm -f $(PROJECT).hex
-rm -f $(PROJECT).bin
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.s=.s.bak)
-rm -f $(ASRC:.s=.lst)
-rm -f $(ASRC:.c=.c.bak)
-rm -f $(ASRC:.c=.lst)
-rm -f $(TSRC:.c=.c.bak)
-rm -f $(TSRC:.c=.lst)
-rm -f $(ASMSRC:.s=.s.bak)
-rm -f $(ASMSRC:.s=.lst)
-rm -fR .dep
#

View File

@ -76,9 +76,13 @@ typedef struct {
}
#endif
#ifdef THUMB
extern void chSysLock(void);
extern void chSysUnlock(void);
#else /* !THUMB */
#define chSysLock() asm("msr CPSR_c, #0x9F")
#define chSysUnlock() asm("msr CPSR_c, #0x1F")
#endif /* THUMB */
#define INT_REQUIRED_STACK 0x40 // Must include registers and stack frames.

View File

@ -55,21 +55,41 @@ DefIrqHandler:
FiqHandler:
b FiqHandler
#ifdef THUMB_INTERWORK
.globl chSysLock
chSysLock:
msr CPSR_c, #0x9F
bx lr
.globl chSysUnlock
chSysUnlock:
msr CPSR_c, #0x1F
bx lr
#endif
.globl chSysSwitchI
chSysSwitchI:
#ifdef MK_CURRP_REGISTER_CACHE
#ifdef CH_CURRP_REGISTER_CACHE
stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr}
str sp, [r0, #0]
ldr sp, [r1, #0]
#ifdef THUMB_INTERWORK
ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr}
bx lr
bx lr
#else
ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, pc}
#endif
#else
stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
str sp, [r0, #0]
ldr sp, [r1, #0]
#ifdef THUMB_INTERWORK
ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
bx lr
bx lr
#else
ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}
#endif
#endif /* CH_CURRP_REGISTER_CACHE */
/*
* System stack frame structure after a context switch in the

View File

@ -63,7 +63,6 @@ static t_msg Thread3(void *arg) {
if (!(IO0PIN & 0x00010000)) // Button 2
chFDDWrite(&COM1, (BYTE8 *)"Hello World!\r\n", 14);
chThdSleep(500);
}
return 0;
}
@ -71,9 +70,9 @@ static t_msg Thread3(void *arg) {
int main(int argc, char **argv) {
chSysInit();
chThdCreate(NORMALPRIO + 1, 0, waThread1, sizeof(waThread1), Thread1, NULL);
chThdCreate(NORMALPRIO + 1, 0, waThread2, sizeof(waThread2), Thread2, NULL);
chThdCreate(NORMALPRIO + 1, 0, waThread3, sizeof(waThread3), Thread3, NULL);
chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
chThdCreate(NORMALPRIO, 0, waThread2, sizeof(waThread2), Thread2, NULL);
chThdCreate(NORMALPRIO, 0, waThread3, sizeof(waThread3), Thread3, NULL);
chSysPause();
return 0;
}

View File

@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = ChibiOS/RT
PROJECT_NUMBER = "0.1.1 alpha"
PROJECT_NUMBER = "0.2.0 alpha"
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

View File

@ -30,6 +30,10 @@ LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the
*** Releases ***
*****************************************************************************
*** 0.2.0 ***
- Introduced support for ARM in thumb mode.
- Minor fixes to the ARM demo.
*** 0.1.1 ***
- Some fixes into the documentation
- Renamed makefiles to Makefiles, upper case M.