git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@231 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
5a2e74f131
commit
611ff4d2ed
|
@ -0,0 +1,165 @@
|
||||||
|
#
|
||||||
|
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
|
||||||
|
#
|
||||||
|
##############################################################################################
|
||||||
|
#
|
||||||
|
# On command line:
|
||||||
|
#
|
||||||
|
# make all = Create project
|
||||||
|
#
|
||||||
|
# make clean = Clean project files.
|
||||||
|
#
|
||||||
|
# To rebuild project do "make clean" and "make all".
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################################
|
||||||
|
# Start of default section
|
||||||
|
#
|
||||||
|
|
||||||
|
TRGT = arm-none-eabi-
|
||||||
|
CC = $(TRGT)gcc
|
||||||
|
CP = $(TRGT)objcopy
|
||||||
|
AS = $(TRGT)gcc -x assembler-with-cpp
|
||||||
|
OD = $(TRGT)objdump
|
||||||
|
HEX = $(CP) -O ihex
|
||||||
|
BIN = $(CP) -O binary
|
||||||
|
|
||||||
|
MCU = cortex-m3
|
||||||
|
|
||||||
|
# List all default C defines here, like -D_DEBUG=1
|
||||||
|
DDEFS =
|
||||||
|
|
||||||
|
# List all default ASM defines here, like -D_DEBUG=1
|
||||||
|
DADEFS =
|
||||||
|
|
||||||
|
# List all default directories to look for include files here
|
||||||
|
DINCDIR =
|
||||||
|
|
||||||
|
# List the default directory to look for the libraries here
|
||||||
|
DLIBDIR =
|
||||||
|
|
||||||
|
# List all default libraries here
|
||||||
|
DLIBS =
|
||||||
|
|
||||||
|
#
|
||||||
|
# End of default section
|
||||||
|
##############################################################################################
|
||||||
|
|
||||||
|
##############################################################################################
|
||||||
|
# Start of user section
|
||||||
|
#
|
||||||
|
|
||||||
|
# Define project name here
|
||||||
|
PROJECT = ch
|
||||||
|
|
||||||
|
# Define linker script file here
|
||||||
|
LDSCRIPT= ch.ld
|
||||||
|
|
||||||
|
# List all user C define here, like -D_DEBUG=1
|
||||||
|
UDEFS =
|
||||||
|
|
||||||
|
# Define ASM defines here
|
||||||
|
UADEFS =
|
||||||
|
|
||||||
|
# List ARM-mode C source files here
|
||||||
|
SRC = ../../ports/ARMCM3/chcore.c \
|
||||||
|
../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \
|
||||||
|
../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \
|
||||||
|
../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \
|
||||||
|
../../src/chserial.c \
|
||||||
|
../../src/lib/evtimer.c ../../test/test.c \
|
||||||
|
board.c main.c
|
||||||
|
|
||||||
|
# List ASM source files here
|
||||||
|
ASMSRC =
|
||||||
|
#../../ports/ARMCM3/crt0.s
|
||||||
|
|
||||||
|
# List all user directories here
|
||||||
|
UINCDIR = ../../src/include ../../src/lib ../../ports/ARMCM3
|
||||||
|
|
||||||
|
# List the user directory to look for the libraries here
|
||||||
|
ULIBDIR =
|
||||||
|
|
||||||
|
# List all user libraries here
|
||||||
|
ULIBS =
|
||||||
|
|
||||||
|
# Common options here
|
||||||
|
# NOTE: -ffixed-r7 is only needed if you enabled CH_CURRP_REGISTER_CACHE in
|
||||||
|
# chconf.h.
|
||||||
|
# NOTE: -falign-functions=16 may improve the performance, not always, but
|
||||||
|
# increases the code size.
|
||||||
|
OPT = -O2 -ggdb -fomit-frame-pointer
|
||||||
|
#OPT += -ffixed-r7
|
||||||
|
#OPT += -falign-functions=16
|
||||||
|
|
||||||
|
# Define warning options here
|
||||||
|
WARN = -Wall -Wstrict-prototypes
|
||||||
|
|
||||||
|
#
|
||||||
|
# End of user defines
|
||||||
|
##############################################################################################
|
||||||
|
|
||||||
|
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
|
||||||
|
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
|
||||||
|
DEFS = $(DDEFS) $(UDEFS)
|
||||||
|
ADEFS = $(DADEFS) $(UADEFS)
|
||||||
|
COBJS = $(SRC:.c=.o)
|
||||||
|
ASMOBJS = $(ASMSRC:.s=.o)
|
||||||
|
OBJS = $(ASMOBJS) $(COBJS)
|
||||||
|
LIBS = $(DLIBS) $(ULIBS)
|
||||||
|
MCFLAGS = -mcpu=$(MCU) -mthumb
|
||||||
|
|
||||||
|
ASFLAGS = $(MCFLAGS) -mthumb -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
|
||||||
|
CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
|
||||||
|
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
|
||||||
|
ODFLAGS = -x --syms
|
||||||
|
|
||||||
|
# Generate dependency information
|
||||||
|
CPFLAGS += -MD -MP -MF .dep/$(@F).d
|
||||||
|
|
||||||
|
#
|
||||||
|
# Makefile rules
|
||||||
|
#
|
||||||
|
|
||||||
|
all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp
|
||||||
|
|
||||||
|
$(COBJS) : %.o : %.c
|
||||||
|
@echo
|
||||||
|
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
|
||||||
|
|
||||||
|
$(ASMOBJS) : %.o : %.s
|
||||||
|
@echo
|
||||||
|
$(AS) -c $(ASFLAGS) -I . $(INCDIR) $< -o $@
|
||||||
|
|
||||||
|
%elf: $(OBJS)
|
||||||
|
@echo
|
||||||
|
$(CC) $(ASMOBJS) $(COBJS) $(LDFLAGS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
%hex: %elf
|
||||||
|
$(HEX) $< $@
|
||||||
|
|
||||||
|
%bin: %elf
|
||||||
|
$(BIN) $< $@
|
||||||
|
|
||||||
|
%dmp: %elf
|
||||||
|
$(OD) $(ODFLAGS) $< > $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f $(OBJS)
|
||||||
|
-rm -f $(PROJECT).elf
|
||||||
|
-rm -f $(PROJECT).dmp
|
||||||
|
-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 $(ASMSRC:.s=.s.bak)
|
||||||
|
-rm -f $(ASMSRC:.s=.lst)
|
||||||
|
-rm -fR .dep
|
||||||
|
|
||||||
|
#
|
||||||
|
# Include the dependency files, should be the last of the makefile
|
||||||
|
#
|
||||||
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||||
|
|
||||||
|
# *** EOF ***
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hardware initialization goes here.
|
||||||
|
* NOTE: Interrupts are still disabled.
|
||||||
|
*/
|
||||||
|
void hwinit(void) {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BOARD_H_
|
||||||
|
#define _BOARD_H_
|
||||||
|
|
||||||
|
#define BOARD_OLIMEX_STM32_P103
|
||||||
|
|
||||||
|
#endif /* _BOARD_H_ */
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configuration file for LPC214x-GCC demo project.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup Config
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHCONF_H_
|
||||||
|
#define _CHCONF_H_
|
||||||
|
|
||||||
|
/** Configuration option: if specified then time efficient rather than space
|
||||||
|
* efficient code is used when two possible implementations exist, note
|
||||||
|
* that this is not related to the compiler optimization options.*/
|
||||||
|
#define CH_OPTIMIZE_SPEED
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Virtual Timers subsystem is
|
||||||
|
* included in the kernel.*/
|
||||||
|
#define CH_USE_VIRTUAL_TIMERS
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
|
* included in the kernel.*/
|
||||||
|
#define CH_USE_SYSTEMTIME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSleep() function is
|
||||||
|
* included in the kernel.
|
||||||
|
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/
|
||||||
|
#define CH_USE_SLEEP
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdResume()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_RESUME
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdSuspend()
|
||||||
|
* function is included in the kernel.*/
|
||||||
|
#define CH_USE_SUSPEND
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdTerminate()
|
||||||
|
* and \p chThdShouldTerminate() functions are included in the kernel.*/
|
||||||
|
#define CH_USE_TERMINATE
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chThdWait() function
|
||||||
|
* is included in the kernel.*/
|
||||||
|
#define CH_USE_WAITEXIT
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Semaphores APIs are included
|
||||||
|
* in the kernel.*/
|
||||||
|
#define CH_USE_SEMAPHORES
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Semaphores atomic Signal+Wait
|
||||||
|
* APIs are included in the kernel.*/
|
||||||
|
#define CH_USE_SEMSW
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Semaphores with timeout APIs
|
||||||
|
* are included in the kernel.
|
||||||
|
* @note requires \p CH_USE_SEMAPHORES.
|
||||||
|
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/
|
||||||
|
#define CH_USE_SEMAPHORES_TIMEOUT
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Mutexes APIs are included in
|
||||||
|
* the kernel.*/
|
||||||
|
#define CH_USE_MUTEXES
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Events APIs are included in
|
||||||
|
* the kernel.*/
|
||||||
|
#define CH_USE_EVENTS
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chEvtWaitTimeout()
|
||||||
|
* function is included in the kernel.
|
||||||
|
* @note requires \p CH_USE_EVENTS.
|
||||||
|
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/
|
||||||
|
#define CH_USE_EVENTS_TIMEOUT
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the Synchronous Messages APIs are
|
||||||
|
* included in the kernel.*/
|
||||||
|
#define CH_USE_MESSAGES
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the \p chMsgSendWithEvent()
|
||||||
|
* function is included in the kernel.
|
||||||
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
|
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/
|
||||||
|
#define CH_USE_MESSAGES_EVENT
|
||||||
|
|
||||||
|
/** Configuration option: If enabled then the threads have an option to serve
|
||||||
|
* messages by priority instead of FIFO order.
|
||||||
|
* @note requires \p CH_USE_MESSAGES.*/
|
||||||
|
//#define CH_USE_MESSAGES_PRIORITY
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the
|
||||||
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
|
* @note requires \p CH_USE_EVENTS.*/
|
||||||
|
#define CH_USE_EXIT_EVENT
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
|
* in the kernel.*/
|
||||||
|
#define CH_USE_QUEUES
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the halfduplex queue APIs are
|
||||||
|
* included in the kernel.*/
|
||||||
|
#define CH_USE_QUEUES_HALFDUPLEX
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the I/O queues with timeout
|
||||||
|
* APIs are included in the kernel.
|
||||||
|
* @note requires \p CH_USE_SEMAPHORES_TIMEOUT.*/
|
||||||
|
#define CH_USE_QUEUES_TIMEOUT
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the full duplex serial driver APIs
|
||||||
|
* are included in the kernel.*/
|
||||||
|
#define CH_USE_SERIAL_FULLDUPLEX
|
||||||
|
|
||||||
|
/** Configuration option: if specified then the half duplex serial driver APIs
|
||||||
|
* are included in the kernel.*/
|
||||||
|
#define CH_USE_SERIAL_HALFDUPLEX
|
||||||
|
|
||||||
|
/** Configuration option: Frequency of the system timer that drives the system
|
||||||
|
* ticks. This also defines the system time unit.*/
|
||||||
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
|
/** Configuration option: This constant is the number of ticks allowed for the
|
||||||
|
* threads before preemption occurs.*/
|
||||||
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
* global \p currp variable. Caching this variable in a register can greatly
|
||||||
|
* improve both space and time efficiency of the generated code. Another side
|
||||||
|
* effect is that one less register has to be saved during the context switch
|
||||||
|
* resulting in lower RAM usage and faster code.
|
||||||
|
* @note This option is only useable with the GCC compiler and is only useful
|
||||||
|
* on processors with many registers like ARM cores.
|
||||||
|
* @note If this option is enabled then ALL the libraries linked to the
|
||||||
|
* ChibiOS/RT code <b>must</b> be recompiled with the GCC option \p
|
||||||
|
* -ffixed-<reg>.
|
||||||
|
*/
|
||||||
|
//#define CH_CURRP_REGISTER_CACHE "r7"
|
||||||
|
|
||||||
|
/** Configuration option: Includes basic debug support to the kernel.
|
||||||
|
* @note the debug support is port-dependent, it may be not present on some
|
||||||
|
* targets. In that case stub functions will be included.
|
||||||
|
*/
|
||||||
|
//#define CH_USE_DEBUG
|
||||||
|
|
||||||
|
/** Debug option: Includes the threads context switch tracing feature.
|
||||||
|
*/
|
||||||
|
//#define CH_USE_TRACE
|
||||||
|
|
||||||
|
#endif /* _CHCONF_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Red LEDs blinker thread, times are in milliseconds.
|
||||||
|
*/
|
||||||
|
static WorkingArea(waThread1, 64);
|
||||||
|
static msg_t Thread1(void *arg) {
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
chThdSleep(1000);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Entry point, the interrupts are disabled on entry.
|
||||||
|
*/
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The main() function becomes a thread here then the interrupts are
|
||||||
|
* enabled and ChibiOS/RT goes live.
|
||||||
|
*/
|
||||||
|
chSysInit();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates the blinker threads.
|
||||||
|
*/
|
||||||
|
chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Normal main() thread activity, in this demo it does nothing except
|
||||||
|
* sleeping in a loop.
|
||||||
|
*/
|
||||||
|
while (TRUE)
|
||||||
|
chThdSleep(1000);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* System idle thread loop.
|
||||||
|
*/
|
||||||
|
void _IdleThread(void *p) {
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* System console message (not implemented).
|
||||||
|
*/
|
||||||
|
void chSysPuts(char *msg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Context switch.
|
||||||
|
*/
|
||||||
|
void chSysSwitchI(Thread *otp, Thread *ntp) {
|
||||||
|
register struct intctx * volatile sp asm("sp"); /* Don't ask... */
|
||||||
|
|
||||||
|
#ifdef CH_CURRP_REGISTER_CACHE
|
||||||
|
asm ("" : : : "r4", "r5", "r6", "r8", "r9", "r10", "r11", "lr");
|
||||||
|
#else
|
||||||
|
asm ("" : : : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "lr");
|
||||||
|
#endif
|
||||||
|
otp->p_ctx.r13 = sp;
|
||||||
|
sp = ntp->p_ctx.r13;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* System halt.
|
||||||
|
*/
|
||||||
|
__attribute__((naked, weak))
|
||||||
|
void chSysHalt(void) {
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((naked, weak))
|
||||||
|
void threadstart(void) {
|
||||||
|
|
||||||
|
chSysUnlock();
|
||||||
|
asm volatile ("mov r0, r5 \n\t" \
|
||||||
|
"blx r4 \n\t" \
|
||||||
|
"bl chThdExit ");
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHCORE_H_
|
||||||
|
#define _CHCORE_H_
|
||||||
|
|
||||||
|
typedef void *regarm;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interrupt saved context.
|
||||||
|
*/
|
||||||
|
struct extctx {
|
||||||
|
regarm spsr_irq;
|
||||||
|
regarm lr_irq;
|
||||||
|
regarm r0;
|
||||||
|
regarm r1;
|
||||||
|
regarm r2;
|
||||||
|
regarm r3;
|
||||||
|
regarm r12;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* System saved context.
|
||||||
|
*/
|
||||||
|
struct intctx {
|
||||||
|
regarm r4;
|
||||||
|
regarm r5;
|
||||||
|
regarm r6;
|
||||||
|
#ifndef CH_CURRP_REGISTER_CACHE
|
||||||
|
regarm r7;
|
||||||
|
#endif
|
||||||
|
regarm r8;
|
||||||
|
regarm r9;
|
||||||
|
regarm r10;
|
||||||
|
regarm r11;
|
||||||
|
regarm lr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Port dependent part of the Thread structure, you may add fields in
|
||||||
|
* this structure.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
struct intctx *r13;
|
||||||
|
} Context;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Platform dependent part of the \p chThdCreate() API.
|
||||||
|
*/
|
||||||
|
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
|
||||||
|
tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \
|
||||||
|
wsize - \
|
||||||
|
sizeof(struct intctx)); \
|
||||||
|
tp->p_ctx.r13->r4 = pf; \
|
||||||
|
tp->p_ctx.r13->r5 = arg; \
|
||||||
|
tp->p_ctx.r13->lr = threadstart; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define chSysLock() asm("cpsid i")
|
||||||
|
#define chSysUnlock() asm("cpsie i")
|
||||||
|
|
||||||
|
#define INT_REQUIRED_STACK 0x10
|
||||||
|
#define StackAlign(n) ((((n) - 1) | 3) + 1)
|
||||||
|
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||||
|
sizeof(struct intctx) + \
|
||||||
|
sizeof(struct extctx) + \
|
||||||
|
(n) + \
|
||||||
|
INT_REQUIRED_STACK)
|
||||||
|
#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2];
|
||||||
|
|
||||||
|
#define chSysIRQEnterI() { \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define chSysIRQExitI() { \
|
||||||
|
asm("b IrqCommon \n\t"); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* It requires zero bytes, but better be safe.*/
|
||||||
|
#define IDLE_THREAD_STACK_SIZE 8
|
||||||
|
void _IdleThread(void *p) __attribute__((noreturn));
|
||||||
|
|
||||||
|
void chSysHalt(void);
|
||||||
|
void chSysSwitchI(Thread *otp, Thread *ntp);
|
||||||
|
void chSysPuts(char *msg);
|
||||||
|
void threadstart(void);
|
||||||
|
|
||||||
|
#endif /* _CHCORE_H_ */
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHTYPES_H_
|
||||||
|
#define _CHTYPES_H_
|
||||||
|
|
||||||
|
#define __need_NULL
|
||||||
|
#define __need_size_t
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if !defined(_STDINT_H) && !defined(__STDINT_H_)
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int8_t bool_t;
|
||||||
|
typedef uint8_t tmode_t;
|
||||||
|
typedef uint8_t tstate_t;
|
||||||
|
typedef uint16_t tid_t;
|
||||||
|
typedef uint32_t tprio_t;
|
||||||
|
typedef int32_t msg_t;
|
||||||
|
typedef int32_t eventid_t;
|
||||||
|
typedef uint32_t eventmask_t;
|
||||||
|
typedef uint32_t systime_t;
|
||||||
|
typedef int32_t cnt_t;
|
||||||
|
|
||||||
|
#define INLINE inline
|
||||||
|
|
||||||
|
#endif /* _CHTYPES_H_ */
|
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
|
||||||
|
|
||||||
|
This file is part of ChibiOS/RT.
|
||||||
|
|
||||||
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic ARM startup file for ChibiOS/RT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.extern _main
|
||||||
|
|
||||||
|
.set MODE_USR, 0x10
|
||||||
|
.set MODE_FIQ, 0x11
|
||||||
|
.set MODE_IRQ, 0x12
|
||||||
|
.set MODE_SVC, 0x13
|
||||||
|
.set MODE_ABT, 0x17
|
||||||
|
.set MODE_UND, 0x1B
|
||||||
|
.set MODE_SYS, 0x1F
|
||||||
|
|
||||||
|
.equ I_BIT, 0x80
|
||||||
|
.equ F_BIT, 0x40
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.balign 4
|
||||||
|
/*
|
||||||
|
* System entry points.
|
||||||
|
*/
|
||||||
|
_start:
|
||||||
|
b ResetHandler
|
||||||
|
ldr pc, _undefined
|
||||||
|
ldr pc, _swi
|
||||||
|
ldr pc, _prefetch
|
||||||
|
ldr pc, _abort
|
||||||
|
nop
|
||||||
|
ldr pc, [pc,#-0xFF0] /* VIC - IRQ Vector Register */
|
||||||
|
ldr pc, _fiq
|
||||||
|
|
||||||
|
_undefined:
|
||||||
|
.word UndHandler
|
||||||
|
_swi:
|
||||||
|
.word SwiHandler
|
||||||
|
_prefetch:
|
||||||
|
.word PrefetchHandler
|
||||||
|
_abort:
|
||||||
|
.word AbortHandler
|
||||||
|
_fiq:
|
||||||
|
.word FiqHandler
|
||||||
|
.word 0
|
||||||
|
.word 0
|
||||||
|
.word 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset handler.
|
||||||
|
*/
|
||||||
|
ResetHandler:
|
||||||
|
/*
|
||||||
|
* Stack pointers initialization.
|
||||||
|
*/
|
||||||
|
ldr r0, =__ram_end__
|
||||||
|
/* Undefined */
|
||||||
|
msr CPSR_c, #MODE_UND | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
ldr r1, =__und_stack_size__
|
||||||
|
sub r0, r0, r1
|
||||||
|
/* Abort */
|
||||||
|
msr CPSR_c, #MODE_ABT | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
ldr r1, =__abt_stack_size__
|
||||||
|
sub r0, r0, r1
|
||||||
|
/* FIQ */
|
||||||
|
msr CPSR_c, #MODE_FIQ | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
ldr r1, =__fiq_stack_size__
|
||||||
|
sub r0, r0, r1
|
||||||
|
/* IRQ */
|
||||||
|
msr CPSR_c, #MODE_IRQ | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
ldr r1, =__irq_stack_size__
|
||||||
|
sub r0, r0, r1
|
||||||
|
/* Supervisor */
|
||||||
|
msr CPSR_c, #MODE_SVC | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
ldr r1, =__svc_stack_size__
|
||||||
|
sub r0, r0, r1
|
||||||
|
/* System */
|
||||||
|
msr CPSR_c, #MODE_SYS | I_BIT | F_BIT
|
||||||
|
mov sp, r0
|
||||||
|
// ldr r1, =__sys_stack_size__
|
||||||
|
// sub r0, r0, r1
|
||||||
|
/*
|
||||||
|
* Data initialization.
|
||||||
|
* NOTE: It assumes that the DATA size is a multiple of 4.
|
||||||
|
*/
|
||||||
|
ldr r1, =_textdata
|
||||||
|
ldr r2, =_data
|
||||||
|
ldr r3, =_edata
|
||||||
|
dataloop:
|
||||||
|
cmp r2, r3
|
||||||
|
ldrlo r0, [r1], #4
|
||||||
|
strlo r0, [r2], #4
|
||||||
|
blo dataloop
|
||||||
|
/*
|
||||||
|
* BSS initialization.
|
||||||
|
* NOTE: It assumes that the BSS size is a multiple of 4.
|
||||||
|
*/
|
||||||
|
mov r0, #0
|
||||||
|
ldr r1, =_bss_start
|
||||||
|
ldr r2, =_bss_end
|
||||||
|
bssloop:
|
||||||
|
cmp r1, r2
|
||||||
|
strlo r0, [r1], #4
|
||||||
|
blo bssloop
|
||||||
|
/*
|
||||||
|
* Application-provided HW initialization routine.
|
||||||
|
*/
|
||||||
|
#ifndef THUMB_NO_INTERWORKING
|
||||||
|
bl hwinit
|
||||||
|
/*
|
||||||
|
* main(0, NULL).
|
||||||
|
*/
|
||||||
|
mov r0, #0
|
||||||
|
mov r1, r0
|
||||||
|
bl main
|
||||||
|
bl chSysHalt
|
||||||
|
#else
|
||||||
|
add r0, pc, #1
|
||||||
|
bx r0
|
||||||
|
.code 16
|
||||||
|
bl hwinit
|
||||||
|
mov r0, #0
|
||||||
|
mov r1, r0
|
||||||
|
bl main
|
||||||
|
bl chSysHalt
|
||||||
|
.code 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.weak UndHandler
|
||||||
|
.globl UndHandler
|
||||||
|
UndHandler:
|
||||||
|
|
||||||
|
.weak SwiHandler
|
||||||
|
.globl SwiHandler
|
||||||
|
SwiHandler:
|
||||||
|
|
||||||
|
.weak PrefetchHandler
|
||||||
|
.globl PrefetchHandler
|
||||||
|
PrefetchHandler:
|
||||||
|
|
||||||
|
.weak AbortHandler
|
||||||
|
.globl AbortHandler
|
||||||
|
AbortHandler:
|
||||||
|
|
||||||
|
.weak FiqHandler
|
||||||
|
.globl FiqHandler
|
||||||
|
FiqHandler:
|
||||||
|
|
||||||
|
.loop: b .loop
|
|
@ -36,6 +36,9 @@ ARM7-LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets
|
||||||
ARM7-LPC214x-GCC-min - Minimal demo for LPC214X.
|
ARM7-LPC214x-GCC-min - Minimal demo for LPC214X.
|
||||||
ARM7-AT91SAM7X-GCC - Port for Atmel AT91SAM7X256. The demo program targets
|
ARM7-AT91SAM7X-GCC - Port for Atmel AT91SAM7X256. The demo program targets
|
||||||
the Olimex SAM7-EX256 board.
|
the Olimex SAM7-EX256 board.
|
||||||
|
ARMCM3-ST32F103-GCC - ARM Cortex-M3 port, work in progress, not complete
|
||||||
|
yet. The demo will target the Olimex STM32-P103
|
||||||
|
board.
|
||||||
AVR-AVRmega128-GCC - Port on AVRmega128, experimental. A special thanks to
|
AVR-AVRmega128-GCC - Port on AVRmega128, experimental. A special thanks to
|
||||||
Vladimir for the work done on the AVR port. The demo
|
Vladimir for the work done on the AVR port. The demo
|
||||||
program targets the Olimex AVR-MT-128 mini terminal
|
program targets the Olimex AVR-MT-128 mini terminal
|
||||||
|
@ -47,8 +50,6 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet.
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
- Look into importing *or* implementing a TCP/IP stack and a File System.
|
- Look into importing *or* implementing a TCP/IP stack and a File System.
|
||||||
- Start the work on a Cortex-M3 port as soon GCC 4.3.0 will be released and
|
|
||||||
incorporated in YAGARTO.
|
|
||||||
- Evaluate other architectures for a possible ChibiOS/RT port. An important
|
- Evaluate other architectures for a possible ChibiOS/RT port. An important
|
||||||
selection parameter will be the availability of FOSS toolchains. Currently
|
selection parameter will be the availability of FOSS toolchains. Currently
|
||||||
we are evaluating the Cortex-M3 and the MSP430.
|
we are evaluating the Cortex-M3 and the MSP430.
|
||||||
|
@ -72,7 +73,9 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet.
|
||||||
- Removed the -falign-functions=16 option from the AT91SAM7X demo makefiles,
|
- Removed the -falign-functions=16 option from the AT91SAM7X demo makefiles,
|
||||||
the Atmel chip does not require it, the option is still present on the
|
the Atmel chip does not require it, the option is still present on the
|
||||||
LPC21xx demos. This saves significant program space.
|
LPC21xx demos. This saves significant program space.
|
||||||
- Fixes to the doxigen documentation.
|
- Started work on ARM Cortex-M3 architecture. The target chip is the ST32F103
|
||||||
|
on a Olimex STM32-P103 board.
|
||||||
|
- Various fixes to the doxigen documentation.
|
||||||
|
|
||||||
*** 0.6.0 ***
|
*** 0.6.0 ***
|
||||||
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
|
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
|
||||||
|
|
Loading…
Reference in New Issue