examples: add a simple LM3S1968 Cortex-M3 testcase.
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 26 Mar 2010 16:12:45 +0000 (16:12 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 26 Mar 2010 16:12:45 +0000 (16:12 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3280 38d2e660-2303-0410-9eaa-f027e97ec537

Makefile
examples/lm3s1968/lm3s1968.c
examples/lm3s1968/lm3s1968.mk

index dd96a9fc98e60dfe4829dd6bfbbbec60762997b1..b846eec11c7bbe3c44fb0250869071f38133c8d1 100644 (file)
--- 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
index 514f255ca5201c080cfd51e87ae3fc4448a1580f..6316ad18373e09b0c9c1e795c35538b945f2c255 100644 (file)
  * 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 <qwert@develer.com>
- *
- * \brief LM3S168 porting test.
+ * \author Andrea Righi <arighi@develer.com>
  */
 
-#include "bertos/cpu/detect.h"
+#include <cpu/irq.h>
+#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;
+       }
 }
index 3efdf31573480f020c2f547fb6f8e7b7e7da1271..f197f1c63c8e9aadcd20ddbc780866f071c76548 100644 (file)
 # 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