aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dispatch/vector_nvic.c3
-rw-r--r--lib/lm4f/Makefile35
-rw-r--r--lib/lm4f/gpio.c31
-rw-r--r--lib/lm4f/libopencm3_lm4f.ld2
4 files changed, 70 insertions, 1 deletions
diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c
index 33104eb..182de4c 100644
--- a/lib/dispatch/vector_nvic.c
+++ b/lib/dispatch/vector_nvic.c
@@ -23,7 +23,8 @@
#elif defined(LPC43XX)
# include "../lpc43xx/vector_nvic.c"
-#elif defined(LM3S)
+#elif defined(LM3S) || defined(LM4F)
+/* Yes, we use the same interrupt table for both LM3S and LM4F */
# include "../lm3s/vector_nvic.c"
#else
diff --git a/lib/lm4f/Makefile b/lib/lm4f/Makefile
new file mode 100644
index 0000000..8f4c151
--- /dev/null
+++ b/lib/lm4f/Makefile
@@ -0,0 +1,35 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## This library is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This library 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 Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this library. If not, see <http://www.gnu.org/licenses/>.
+##
+
+LIBNAME = libopencm3_lm4f
+
+PREFIX ?= arm-none-eabi
+#PREFIX ?= arm-elf
+CC = $(PREFIX)-gcc
+AR = $(PREFIX)-ar
+CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \
+ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -Wstrict-prototypes \
+ -ffunction-sections -fdata-sections -MD -DLM4F
+# ARFLAGS = rcsv
+ARFLAGS = rcs
+OBJS = gpio.o vector.o assert.o
+
+VPATH += ../cm3
+
+include ../Makefile.include
diff --git a/lib/lm4f/gpio.c b/lib/lm4f/gpio.c
new file mode 100644
index 0000000..2d50116
--- /dev/null
+++ b/lib/lm4f/gpio.c
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libopencm3/lm4f/gpio.h>
+
+void gpio_set(u32 gpioport, u8 gpios)
+{
+ /* ipaddr[9:2] mask the bits to be set, hence the array index */
+ GPIO_DATA(gpioport)[gpios] = 0xff;
+}
+
+void gpio_clear(u32 gpioport, u8 gpios)
+{
+ GPIO_DATA(gpioport)[gpios] = 0;
+}
diff --git a/lib/lm4f/libopencm3_lm4f.ld b/lib/lm4f/libopencm3_lm4f.ld
new file mode 100644
index 0000000..12d939e
--- /dev/null
+++ b/lib/lm4f/libopencm3_lm4f.ld
@@ -0,0 +1,2 @@
+/* Yes, we can simply use the lm3s linker script */
+INCLUDE "libopencm3_lm3s.ld"