diff options
Diffstat (limited to 'demos')
| -rw-r--r-- | demos/ARMCM3-STM32F103-GCC/Makefile | 165 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.c | 28 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103-GCC/board.h | 25 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103-GCC/chconf.h | 169 | ||||
| -rw-r--r-- | demos/ARMCM3-STM32F103-GCC/main.c | 57 | 
5 files changed, 444 insertions, 0 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile new file mode 100644 index 000000000..2de43bf20 --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/Makefile @@ -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 ***
 diff --git a/demos/ARMCM3-STM32F103-GCC/board.c b/demos/ARMCM3-STM32F103-GCC/board.c new file mode 100644 index 000000000..ec5ac2fb4 --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/board.c @@ -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) {
 +
 +}
 diff --git a/demos/ARMCM3-STM32F103-GCC/board.h b/demos/ARMCM3-STM32F103-GCC/board.h new file mode 100644 index 000000000..88459c3e7 --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/board.h @@ -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_ */
 diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h new file mode 100644 index 000000000..c8817f85c --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/chconf.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_ */
 +
 +/** @} */
 diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c new file mode 100644 index 000000000..60e53abd3 --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -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;
 +}
  | 
