From 2053503385a67e1f7f13ec45b85ac02378b9b0bb Mon Sep 17 00:00:00 2001 From: arighi Date: Fri, 26 Mar 2010 16:12:45 +0000 Subject: [PATCH] examples: add a simple LM3S1968 Cortex-M3 testcase. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3280 38d2e660-2303-0410-9eaa-f027e97ec537 --- Makefile | 1 + examples/lm3s1968/lm3s1968.c | 41 +++++++++++++++++++++++++---------- examples/lm3s1968/lm3s1968.mk | 23 +++++++++++++++----- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index dd96a9fc..b846eec1 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ include bertos/config.mk include examples/demo/demo.mk #include examples/at91sam7/at91sam7s.mk #include examples/at91sam7/at91sam7x.mk +#include examples/lm3s1968/lm3s1968.mk #include examples/avr-kern/avr-kern.mk #include examples/triface/triface.mk #include examples/benchmark/kernel-only_arm/kernel-only_arm.mk diff --git a/examples/lm3s1968/lm3s1968.c b/examples/lm3s1968/lm3s1968.c index 514f255c..6316ad18 100644 --- a/examples/lm3s1968/lm3s1968.c +++ b/examples/lm3s1968/lm3s1968.c @@ -26,24 +26,43 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2007 Develer S.r.l. (http://www.develer.com/) + * Copyright 2010 Develer S.r.l. (http://www.develer.com/) * * --> * - * \version $Id$ + * \brief LM3S1968 Cortex-M3 testcase * - * \author Manuele Fanelli - * - * \brief LM3S168 porting test. + * \author Andrea Righi */ -#include "bertos/cpu/detect.h" +#include +#include "io/lm3s.h" +#include "drv/timer.h" + +extern unsigned long ticks; -int main (void) +int main(void) { - int c; + timer_hw_init(); + + /* Enable the GPIO port that is used for the on-board LED */ + SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG; + /* + * Perform a dummy read to insert a few cycles delay before enabling + * the peripheral. + */ + (void)SYSCTL_RCGC2_R; + /* Enable the GPIO pin for the LED */ + GPIO_PORTG_DIR_R = 0x04; + GPIO_PORTG_DEN_R = 0x04; - for (;;) - c++; - return 0; + while(1) + { + /* Turn on the LED */ + if ((ticks & 0x04) == 0x04) + GPIO_PORTG_DATA_R |= 0x04; + /* Turn off the LED */ + else if ((ticks & 0x04) == 0) + GPIO_PORTG_DATA_R &= ~0x04; + } } diff --git a/examples/lm3s1968/lm3s1968.mk b/examples/lm3s1968/lm3s1968.mk index 3efdf315..f197f1c6 100644 --- a/examples/lm3s1968/lm3s1968.mk +++ b/examples/lm3s1968/lm3s1968.mk @@ -12,20 +12,33 @@ # Set to 1 for debug builds lm3s1968_DEBUG = 0 - # Our target application TRG += lm3s1968 lm3s1968_CSRC = \ examples/lm3s1968/lm3s1968.c \ - #bertos/cpu/cortex-m3/startup_lm3s.c + bertos/cpu/cortex-m3/drv/irq.c \ + bertos/cpu/cortex-m3/drv/timer.c \ + bertos/cpu/cortex-m3/startup_lm3s.c # This is an hosted application lm3s1968_PREFIX = arm-none-eabi- -lm3s1968_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -mthumb -lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -D'CPU_FREQ=(48023000L)' -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 -lm3s1968_LDFLAGS = -nostartfiles -T examples/lm3s1968/standalone.ld -Wl,--no-warn-mismatch +lm3s1968_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -mthumb -fno-strict-aliasing -fwrapv +lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -D'CPU_FREQ=(48023000L)' -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 -fno-strict-aliasing -fwrapv +lm3s1968_LDFLAGS = -nostartfiles -T bertos/cpu/cortex-m3/scripts/lm3s1968_rom.ld -Wl,--no-warn-mismatch -fno-strict-aliasing -fwrapv lm3s1968_CPU = cortex-m3 +lm3s1968_PROGRAMMER_CPU = lm3s1968 +lm3s1968_PROGRAMMER_TYPE = lm3s1968 +lm3s1968_FLASH_SCRIPT = bertos/prg_scripts/arm/flash-cortex.sh +lm3s1968_STOPFLASH_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh +lm3s1968_DEBUG_SCRIPT = bertos/prg_scripts/arm/debug.sh +lm3s1968_STOPDEBUG_SCRIPT = bertos/prg_scripts/arm/stopopenocd.sh + +# Debug stuff +ifeq ($(demo_DEBUG),0) + demo_CFLAGS += -Os -fomit-frame-pointer + demo_CXXFLAGS += -Os -fomit-frame-pointer +endif -- 2.25.1