aboutsummaryrefslogtreecommitdiff
path: root/examples/efm32
diff options
context:
space:
mode:
Diffstat (limited to 'examples/efm32')
-rw-r--r--examples/efm32/tinygecko/Makefile.include97
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/Makefile.include29
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/README9
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/Makefile23
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/README8
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/generate_lcd_mapping.py76
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_demo.c130
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_mapping.yaml192
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/Makefile22
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/README13
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-busywait.c40
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-common.c88
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-interrupt.c71
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch.c30
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/Makefile26
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/README9
l---------examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_cmu.c1
l---------examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_gpio.c1
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/miniblink.c69
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/Makefile23
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/README9
-rw-r--r--examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c71
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/Makefile.include29
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/README14
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/Makefile26
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/README9
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_cmu.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_gpio.c1
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/miniblink.c70
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/Makefile26
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_acmp.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_adc.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_aes.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_assert.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_burtc.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_cmu.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dac.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dbg.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dma.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_ebi.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_emu.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_gpio.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_i2c.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_int.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lcd.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lesense.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_letimer.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_leuart.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_mpu.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_msc.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_opamp.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_pcnt.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_prs.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rmu.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rtc.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_system.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_timer.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_usart.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_vcmp.c1
l---------examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_wdog.c1
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/gdbinit14
-rw-r--r--examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/test.c115
62 files changed, 1372 insertions, 0 deletions
diff --git a/examples/efm32/tinygecko/Makefile.include b/examples/efm32/tinygecko/Makefile.include
new file mode 100644
index 0000000..8c42816
--- /dev/null
+++ b/examples/efm32/tinygecko/Makefile.include
@@ -0,0 +1,97 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+PREFIX ?= arm-none-eabi
+#PREFIX ?= arm-elf
+CC = $(PREFIX)-gcc
+LD = $(PREFIX)-gcc
+OBJCOPY = $(PREFIX)-objcopy
+OBJDUMP = $(PREFIX)-objdump
+GDB = $(PREFIX)-gdb
+# Uncomment this line if you want to use the installed (not local) library.
+#TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+TOOLCHAIN_DIR = ../../../../..
+CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
+ -fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD\
+ -D$(FAMILY)
+LDSCRIPT ?= ${TOOLCHAIN_DIR}/lib/efm32/tinygecko/$(MCU).ld
+LDFLAGS += -lc -lnosys -L$(TOOLCHAIN_DIR)/lib/efm32/tinygecko \
+ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
+ -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
+OBJS += $(BINARY).o
+
+# Be silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
+NULL := 2>/dev/null
+else
+LDFLAGS += -Wl,--print-gc-sections
+endif
+
+.SUFFIXES: .elf .bin .hex .srec .list .images
+.SECONDEXPANSION:
+.SECONDARY:
+
+all: images
+
+images: $(BINARY).images
+flash: $(BINARY).flash
+
+%.images: %.bin %.hex %.srec %.list
+ @#echo "*** $* images generated ***"
+
+%.bin: %.elf
+ @#printf " OBJCOPY $(*).bin\n"
+ $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
+
+%.hex: %.elf
+ @#printf " OBJCOPY $(*).hex\n"
+ $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
+
+%.srec: %.elf
+ @#printf " OBJCOPY $(*).srec\n"
+ $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
+
+%.list: %.elf
+ @#printf " OBJDUMP $(*).list\n"
+ $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
+
+%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/efm32/tinygecko/libopencm3_efm32tinygecko.a
+ @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LD) -o $(*).elf $(OBJS) -lopencm3_efm32tinygecko $(LDFLAGS)
+
+%.o: %.c Makefile
+ @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(CC) $(CFLAGS) -o $@ -c $<
+
+clean:
+ $(Q)rm -f *.o
+ $(Q)rm -f *.d
+ $(Q)rm -f *.elf
+ $(Q)rm -f *.bin
+ $(Q)rm -f *.hex
+ $(Q)rm -f *.srec
+ $(Q)rm -f *.list
+
+.PHONY: images clean
+
+-include $(OBJS:.o=.d)
+
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/Makefile.include b/examples/efm32/tinygecko/efm32-tg-stk3300/Makefile.include
new file mode 100644
index 0000000..218abd8
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/Makefile.include
@@ -0,0 +1,29 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+MCU = EFM32TG840F32
+FAMILY = TINYGECKO
+
+EACOMMANDER = ~/energymicro/energymicro/eACommander.sh
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.include
+
+upload: $(BINARY).bin
+ # eacommander is just as nonfree as jlink.sh, but much less of a hasle
+ $(EACOMMANDER) --flash $< --verify --mode mcu --address 0 --reset
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/README b/examples/efm32/tinygecko/efm32-tg-stk3300/README
new file mode 100644
index 0000000..ffa3b59
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/README
@@ -0,0 +1,9 @@
+=========================
+EFM32-TG-STK3300 Examples
+=========================
+
+Examples in this directory are designed to be run on the Energy Micro EFM32
+Tiny Gecko Starter Kit, which is based on the EFM32TG840F32 MCU, has an onboard
+USB debug and power management interface, and a bunch of peripherials built in
+that demonstrate the chip's low power capabilities (LED, LCD display, light
+sensor, touch slider, LC sensor, push buttons).
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/Makefile b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/Makefile
new file mode 100644
index 0000000..7ef06ad
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/Makefile
@@ -0,0 +1,23 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = lcd_demo
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/README b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/README
new file mode 100644
index 0000000..207ed10
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/README
@@ -0,0 +1,8 @@
+=========================================
+EFM32-TG-STK3300 Examples LCD Demo README
+=========================================
+
+This is an example on how to use the LCD peripherial on Energy Micro Tiny Gecko
+chips.
+
+It's intended for the EFM32-TG-STK3300 eval board.
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/generate_lcd_mapping.py b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/generate_lcd_mapping.py
new file mode 100644
index 0000000..1b6405f
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/generate_lcd_mapping.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+import yaml
+
+class Font(dict):
+ def __init__(self, letterdict):
+ for (k, v) in letterdict.items():
+ self[k] = set(v.split())
+
+class Display(object):
+ def __init__(self, data):
+ self.mapping = {}
+
+ for c, segs in enumerate(data['coms']):
+ for s, name in enumerate(segs):
+ self.mapping[name] = (c, s)
+
+ def render_text(self, text, symbols, font):
+ cursor = 1
+ segments = set()
+ for letter in text:
+ if letter == '.':
+ segments.add("a%s_dp"%(cursor-1))
+ elif letter == ':':
+ segments.add("a%s_colon"%(cursor-1))
+ elif letter in font:
+ for segment in font[letter]:
+ segments.add("a%s_%s"%(cursor, segment))
+ cursor += 1
+
+ for s in symbols:
+ segments.add(s)
+
+ coms = {}
+ for segment in segments:
+ com, seg = self.mapping[segment]
+ coms[com] = coms.get(com, 0) | (1<<seg)
+
+ return coms
+
+def main():
+ data = yaml.load(open("lcd_mapping.yaml"))
+
+ d = Display(data)
+
+ text = "{FNORD}"
+ symbols = ['gecko']
+ f = Font({
+ '-': 'g1 g2',
+ 'A': 'e f a b c g1 g2',
+ 'C': 'a f e d',
+ 'D': 'a b c d i l',
+ 'E': 'a f g1 g2 e d',
+ 'F': 'a f g1 g2 e',
+ 'H': "f b g1 g2 e c",
+ 'I': "i l a d",
+ 'L': 'f e d',
+ 'M': 'e f h j b c',
+ 'N': 'e f h m c b',
+ 'O': 'a f e d c b',
+ 'R': 'a e f g1 j m',
+ 'T': 'i l a',
+ 'U': 'f e d c b',
+ '[': 'a d e f',
+ ']': 'a b c d',
+ '{': 'a d k h g1',
+ '}': 'a j g2 m d',
+ })
+
+ for com, data in d.render_text(text, symbols, f).items():
+ print "set_bank(%d, %#08.0x);"%(com, data)
+# with open('lcd_mapping.c', 'w') as outfile:
+# for symbol in data['symbols']:
+
+if __name__ == "__main__":
+ main()
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_demo.c b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_demo.c
new file mode 100644
index 0000000..d4ddb74
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_demo.c
@@ -0,0 +1,130 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/>.
+ */
+
+/** @file
+ * Demo of the LCD display aboard the EFM32-TG-STK330 eval board.
+ */
+
+#include <libopencm3/efm32/tinygecko/cmu.h>
+#include <libopencm3/efm32/tinygecko/gpio.h>
+#include <libopencm3/efm32/tinygecko/lcd.h>
+#include "../lightswitch/lightswitch-common.c"
+void led_toggle(void) { gpio_toggle(GPIO_PD, GPIO7); }
+
+void delay(void)
+{
+ int x;
+
+ /* Start up delay until we mess with clock stuff, so the debugger can catch up. */
+ for(x = 0; x < 10000000; ++x) led_on();
+}
+
+void lcd_init(void)
+{
+ /* LCD is a LE module. We're constantly powered on for now, so using
+ * HFCORECLK/2 */
+ CMU_HFCORECLKEN0 |= CMU_HFCORECLKEN0_LE;
+ CMU_LFCLKSEL = (CMU_LFCLKSEL & ~CMU_LFCLKSEL_LFA_MASK) | CMU_LFCLKSEL_LFA_HFCORECLKLEDIV2;
+ /* We need to get this down to reasonable 100Hz from 14MHz, 7MHz at
+ * LFACLK, 70kHz after LFA prescaler, 10kHz after FDIV. Octaplexing
+ * brings us down to about 500Hz. */
+ CMU_LFAPRESC0 |= CMU_LFAPRESC0_LCD_DIV128;
+ CMU_LCDCTRL |= CMU_LCDCTRL_FDIV_MASK; /* factor 7+1 */
+
+ /* If we don't wait for the prescaler to become ready, the "Do it" step
+ * won't pass. */
+ while (CMU_SYNCBUSY & CMU_SYNCBUSY_LFAPRESC0);
+
+ CMU_LFACLKEN0 |= CMU_LFACLKEN0_LCD;
+
+ while (CMU_SYNCBUSY & CMU_SYNCBUSY_LFACLKEN0);
+
+ /* Voltage is around 3.3V anyway, we don't need voltage boosting,
+ * leaving it disabled. I don't fully understand the implications of
+ * biasing yet, but it seems like he more biased the better, and will
+ * just affect frame rate negatively. */
+ LCD_DISPCTRL = (LCD_DISPCTRL & ~(LCD_DISPCTRL_BIAS_MASK | LCD_DISPCTRL_MUX_MASK)) | LCD_DISPCTRL_BIAS_ONEFOURTH | LCD_DISPCTRL_MUX_OCTAPLEX;
+
+ /* Segments default to disabled, enable the 20 relevant ones */
+ LCD_SEGEN = ~(~0<<5);
+
+ /* Do it */
+ LCD_CTRL |= LCD_CTRL_EN;
+
+ while (LCD_SYNCBUSY & LCD_SYNCBUSY_CTRL) led_off();
+ led_on();
+}
+
+void set_bank(u8 com, u32 data)
+{
+ switch(com)
+ {
+ case 0: LCD_SEGD0L = data; break;
+ case 1: LCD_SEGD1L = data; break;
+ case 2: LCD_SEGD2L = data; break;
+ case 3: LCD_SEGD3L = data; break;
+ case 4: LCD_SEGD4L = data; break;
+ case 5: LCD_SEGD5L = data; break;
+ case 6: LCD_SEGD6L = data; break;
+ case 7: LCD_SEGD7L = data; break;
+ }
+}
+
+int main(void)
+{
+ u8 active_bit = 0;
+ u8 active_com = 0;
+
+ gpio_setup();
+
+// delay();
+
+ lcd_init();
+
+ /* "{FNORD}" with a gecko as generated by current generate_lcd_mapping.py */
+set_bank(0, 0x000a00);
+set_bank(1, 0x0031cb);
+set_bank(2, 0x004622);
+set_bank(3, 0x0012a8);
+set_bank(4, 0x00481a);
+set_bank(5, 0x001140);
+set_bank(6, 0x004642);
+set_bank(7, 0x0051ac);
+
+ while(1)
+ {
+ if (pb0_get())
+ {
+ while(pb0_get());
+
+ set_bank(active_com, ~0);
+ active_bit = (active_bit + 1) % 21; /* one more to see where 0 is */
+ set_bank(active_com, ~(1<<active_bit));
+ }
+ if (pb1_get())
+ {
+ while(pb1_get());
+
+ set_bank(active_com, ~0);
+ active_com = (active_com + 1) % 9; /* one more to see where 0 is */
+ set_bank(active_com, ~(1<<active_bit));
+ }
+ led_toggle();
+ }
+}
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_mapping.yaml b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_mapping.yaml
new file mode 100644
index 0000000..e3efbe1
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lcd_demo/lcd_mapping.yaml
@@ -0,0 +1,192 @@
+description:
+ LCD segment layout for the EFM32TG_STK3300 kit.
+
+ Determined by trial and error.
+
+ The digit display is called D1..D4 left to right, the alphanumerics
+ A1..A7.
+
+ The 7 segment display bars are labeled a..g from top cw with g being
+ the last in the center.
+
+ The 14 segment display bars are labelled a..f as with 7-segment, g1
+ and g2 the parts of 7-segment's g from left to right, and then h, i,
+ j left to right top parts, and k, l, m left to right bottom parts.
+
+ (Labelling according to the 7 segment display Wikipedia article; for 14,
+ found in German Wikipedia.)
+
+ Sectors start at the top, CCW.
+
+ Rings are numbered from the outside startin at 0, the dot in the middle
+ being 4.
+symbols: [efm, antenna, celsius, fahrenheit]
+coms:
+ -
+ - sector_0
+ - sector_1
+ - sector_2
+ - sector_3
+ - sector_4
+ - sector_5
+ - sector_6
+ - sector_7
+ - efm
+ - a5_a
+ - a4_colon
+ - a6_a
+ - antenna
+ - battery_outline
+ - celsius
+ - fahrenheit
+ - battery_1
+ - battery_0
+ - battery_2
+ - ring0
+ -
+ - gecko
+ - a1_a
+ - a1_b
+ - a2_a
+ - a2_b
+ - a3_a
+ - a3_b
+ - a4_a
+ - a4_b
+ - a5_h
+ - a5_b
+ - a6_h
+ - a6_b
+ - a7_a
+ - a7_b
+ - d4_d
+ - d3_d
+ - d2_d
+ - d1_d
+ - ring1
+ -
+ - lock_closed
+ - a1_h
+ - a1_j
+ - a2_h
+ - a2_j
+ - a3_h
+ - a3_j
+ - a4_h
+ - a4_j
+ - a5_f
+ - a5_j
+ - a6_f
+ - a6_j
+ - a7_h
+ - a7_j
+ - d4_c
+ - d3_c
+ - d2_c
+ - d1_c
+ - ring3
+ -
+ - a_minus
+ - a1_f
+ - a1_i
+ - a2_f
+ - a2_i
+ - a3_f
+ - a3_i
+ - a4_f
+ - a4_i
+ - a5_g1
+ - a5_i
+ - a6_g1
+ - a6_i
+ - a7_f
+ - a7_i
+ - d4_e
+ - d3_e
+ - d2_e
+ - d1_e
+ - lock_open
+ -
+ - a2_colon
+ - a1_g1
+ - a1_g2
+ - a2_g1
+ - a2_g2
+ - a3_g1
+ - a3_g2
+ - a4_g1
+ - a4_g2
+ - a5_l
+ - a5_g2
+ - a6_l
+ - a6_g2
+ - a7_g1
+ - a7_g2
+ - d4_g
+ - d3_g
+ - d2_g
+ - d1_g
+ - d2_dp
+ -
+ - a2_dp
+ - a1_l
+ - a1_c
+ - a2_l
+ - a2_c
+ - a3_l
+ - a3_c
+ - a4_l
+ - a4_c
+ - a5_k
+ - a5_c
+ - a6_k
+ - a6_c
+ - a7_l
+ - a7_c
+ - d4_b
+ - d3_b
+ - d2_b
+ - d1_b
+ - d2_dp
+ -
+ - a4_dp
+ - a1_k
+ - a1_m
+ - a2_k
+ - a2_m
+ - a3_k
+ - a3_m
+ - a4_k
+ - a4_m
+ - a5_e
+ - a5_m
+ - a6_e
+ - a6_m
+ - a7_k
+ - a7_m
+ - d4_f
+ - d3_f
+ - d2_f
+ - d1_f
+ - ring4
+ -
+ - a1_dp
+ - a1_e
+ - a1_d
+ - a2_e
+ - a2_d
+ - a3_e
+ - a3_d
+ - a4_e
+ - a4_d
+ - a4_dp
+ - a5_d
+ - a5_dp
+ - a6_d
+ - a7_e
+ - a7_d
+ - d4_a
+ - d3_a
+ - d2_a
+ - d1_a
+ - ring2
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/Makefile b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/Makefile
new file mode 100644
index 0000000..d3a1987
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/Makefile
@@ -0,0 +1,22 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = lightswitch
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/README b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/README
new file mode 100644
index 0000000..41943dc
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/README
@@ -0,0 +1,13 @@
+============================================
+EFM32-TG-STK3300 Examples lightswitch README
+============================================
+
+This is a small example program for GPIO input and output, and how the device
+can be configured to use minimal power (although the example is merely
+scratching the surface of what is possible powersaving-wise).
+
+It's intended for the EFM32-TG-STK3300 eval board. It turn the User LED on when
+PB0 is pressed, and off when PB1 is pressed.
+
+Various implementations are offered (-busywait, -interrupt), and can configured
+in lightswitch.c.
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-busywait.c b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-busywait.c
new file mode 100644
index 0000000..d78d0e1
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-busywait.c
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/efm32/tinygecko/irq.h>
+#include <libopencm3/efm32/tinygecko/emu.h>
+
+#define ISER0 MMIO32(0xE000E100)
+#define ICER0 MMIO32(0xE000E180)
+#define ISPR0 MMIO32(0XE000E200)
+#define ICPR0 MMIO32(0XE000E280)
+
+/** @file Simplest implementation of the lightswitch mechanism. */
+
+int main(void)
+{
+ gpio_setup();
+
+ while(1) {
+ if (pb0_get())
+ led_on();
+ if (pb1_get())
+ led_off();
+ };
+}
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-common.c b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-common.c
new file mode 100644
index 0000000..dcc5984
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-common.c
@@ -0,0 +1,88 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/>.
+ */
+
+/** @file Common definitions used by all lightswitch implementations */
+
+#include <libopencm3/efm32/tinygecko/gpio.h>
+#include <libopencm3/efm32/tinygecko/cmu.h>
+
+/** The User LED is connected to PD7 to the plus side of the LED according to
+ * t0011_efm32_tiny_gecko_stk_user_manual.pdf figures 16.2 and 16.3 (called
+ * UIF_LED0)
+ */
+#define LED_PORT GPIO_PD
+#define LED_PIN GPIO7
+
+#define BUTTON0_PORT GPIO_PD
+#define BUTTON0_PORT_EXTIPSEL GPIO_EXTIPSEL_PORTD
+#define BUTTON0_PIN_NUMBER 8
+#define BUTTON0_PIN GPIO8
+#define BUTTON1_PORT GPIO_PB
+#define BUTTON1_PORT_EXTIPSEL GPIO_EXTIPSEL_PORTB
+#define BUTTON1_PIN_NUMBER 11
+#define BUTTON1_PIN GPIO11
+
+void gpio_setup(void);
+void led_on(void);
+void led_off(void);
+
+bool pb0_get(void);
+bool pb1_get(void);
+
+/**
+ * Enable GPIO, and set up port D7 as an output pin and D8 and B11 as input.
+ */
+
+void gpio_setup(void)
+{
+ // Before GPIO works, according to d0034_efm32tg_reference_manual.pdf
+ // note in section 28.3.7, we'll have to enable GPIO in CMU_HFPERCLKEN0
+
+ CMU_HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
+
+ gpio_set_mode(LED_PORT, GPIO_MODE_PUSHPULL, LED_PIN);
+
+ // Button PB0 is connected to pin PD8 and pulled low when pushed,
+ // Botton PB1 to pin PB11 (sources as for LED). Pullups and debouncing
+ // are alreay in place in hardware, so no filtering or pullup is
+ // needed.
+
+ gpio_set_mode(BUTTON0_PORT, GPIO_MODE_INPUT, BUTTON0_PIN);
+ gpio_set_mode(BUTTON1_PORT, GPIO_MODE_INPUT, BUTTON1_PIN);
+}
+
+void led_on(void)
+{
+ gpio_set(LED_PORT, LED_PIN);
+}
+
+void led_off(void)
+{
+ gpio_clear(LED_PORT, LED_PIN);
+}
+
+bool pb0_get(void)
+{
+ return !gpio_get(GPIO_PD, GPIO8);
+}
+
+bool pb1_get(void)
+{
+ return !gpio_get(GPIO_PB, GPIO11);
+}
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-interrupt.c b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-interrupt.c
new file mode 100644
index 0000000..71a1008
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch-interrupt.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/efm32/tinygecko/irq.h>
+#include <libopencm3/efm32/tinygecko/emu.h>
+
+#define ISER0 MMIO32(0xE000E100)
+
+void interrupt_setup()
+{
+ // These are the ports the pin interrupts for 8 and 11 are to be
+ // configured to, and they should trigger on falling edge.
+
+ GPIO_EXTIPSELH = (BUTTON0_PORT_EXTIPSEL << ((BUTTON0_PIN_NUMBER-8)*4)) |
+ (BUTTON1_PORT_EXTIPSEL << ((BUTTON1_PIN_NUMBER-8)*4));
+
+ GPIO_EXTIFALL = BUTTON0_PIN | BUTTON1_PIN;
+
+ // Enable interrupts on the GPIO side
+
+ GPIO_INSENSE = GPIO_INSENSE_INT;
+ GPIO_IEN = BUTTON0_PIN | BUTTON1_PIN;
+
+ // Enable GPIO interrupts in NVIC
+
+ ISER0 = (1<<IRQ_GPIO_EVEN) | (1<<IRQ_GPIO_ODD);
+}
+
+int main(void)
+{
+ gpio_setup();
+ interrupt_setup();
+
+ while(1) {
+ emu_sleep_em1();
+ };
+}
+
+void gpio_even_isr()
+{
+ // Clearing the GPIO interrupt pending register. While the NVIC
+ // interrupt pending register gets cleared automatically once it jumps
+ // here, the pin's pending state has to be cleared explicitly.
+ // (Dispatch to different subroutines for different even pins that
+ // trigger an interrupt would happen here.)
+ GPIO_IFC = BUTTON0_PIN;
+ led_on();
+}
+
+void gpio_odd_isr()
+{
+ // See gpio_even_isr.
+ GPIO_IFC = BUTTON1_PIN;
+ led_off();
+}
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch.c b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch.c
new file mode 100644
index 0000000..72a5299
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/lightswitch/lightswitch.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/>.
+ */
+
+/** @file
+ * Example for switching the User LED of the EFM32-TG-STK330 eval board on and
+ * off using the buttons.
+ */
+
+#include "lightswitch-common.c"
+
+/** Change this include to -busywait, -interrupt, or -prs (not implemented
+ * yet). The overall behavior will not change, but different implementations
+ * will be used. */
+#include "lightswitch-busywait.c"
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/Makefile b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/Makefile
new file mode 100644
index 0000000..0da7462
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/Makefile
@@ -0,0 +1,26 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = miniblink
+
+OBJS += efm32_gpio.o efm32_cmu.o
+CFLAGS += -I/tmp/EFM32_CMSIS_2.4.1/efm32lib/inc/ -I /tmp/EFM32_CMSIS_2.4.1/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/ -DEFM32TG840F32 -I.
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/README b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/README
new file mode 100644
index 0000000..49c6d11
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/README
@@ -0,0 +1,9 @@
+===================================================
+EFM32-TG-STK3300 Examples miniblink-efm32lib README
+===================================================
+
+This is a port of the miniblink example to the efm32lib library.
+
+It's intended for the EFM32-TG-STK3300 eval board. It should blink the user LED
+on the board, just as the original miniblink example does.
+
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_cmu.c b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_cmu.c
new file mode 120000
index 0000000..168574b
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_cmu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_cmu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_gpio.c b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_gpio.c
new file mode 120000
index 0000000..0b2df21
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/efm32_gpio.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_gpio.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/miniblink.c b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/miniblink.c
new file mode 100644
index 0000000..9fa0b23
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/miniblink.c
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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 <efm32_cmu.h>
+#include <efm32_gpio.h>
+
+void led_setup(void);
+void led_toggle(void);
+
+/** @file
+ * Minimal example for making the User LED of the EFM32-TG-STK330 eval board blink.
+ */
+
+/**
+ * Toggle the User LED in an infinite loop, with time between the toggling
+ * determined by a busy loop stupidly counting up.
+ */
+
+int main(void)
+{
+ int x;
+
+ led_setup();
+
+ while(1) {
+ for(x = 0; x < 200000; ++x) asm("mov r0,r0"); /* no-op, prevent compiler from optimizing this away */
+ led_toggle();
+ };
+}
+
+/**
+ * Enable GPIO, and set up port D7 as an output pin.
+ */
+
+void led_setup(void)
+{
+ // Before GPIO works, according to d0034_efm32tg_reference_manual.pdf
+ // note in section 28.3.7, we'll have to enable GPIO in CMU_HFPERCLKEN0
+
+ CMU->HFPERCLKEN0 |= _CMU_HFPERCLKEN0_GPIO_MASK;
+
+ // The User LED is connected to PD7 to the plus side of the LED
+ // according to t0011_efm32_tiny_gecko_stk_user_manual.pdf figures 16.2
+ // and 16.3 (called UIF_LED0)
+
+ GPIO_PinModeSet(gpioPortD, 7, gpioModePushPull, 0);
+}
+
+void led_toggle(void)
+{
+ GPIO_PinOutToggle(gpioPortD, 7);
+}
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/Makefile b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/Makefile
new file mode 100644
index 0000000..760b99b
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/Makefile
@@ -0,0 +1,23 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = miniblink
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/README b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/README
new file mode 100644
index 0000000..d19e4fe
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/README
@@ -0,0 +1,9 @@
+==========================================
+EFM32-TG-STK3300 Examples miniblink README
+==========================================
+
+This is the smallest-possible example program using libopencm3.
+
+It's intended for the EFM32-TG-STK3300 eval board. It should blink
+the user LED on the board.
+
diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c
new file mode 100644
index 0000000..0269847
--- /dev/null
+++ b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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/efm32/tinygecko/gpio.h>
+#include <libopencm3/efm32/tinygecko/cmu.h>
+
+void led_setup(void);
+void led_toggle(void);
+
+/** @file
+ * Minimal example for making the User LED of the EFM32-TG-STK330 eval board blink.
+ */
+
+/**
+ * Toggle the User LED in an infinite loop, with time between the toggling
+ * determined by a busy loop stupidly counting up.
+ */
+
+int main(void)
+{
+ int x;
+
+ led_setup();
+
+ while(1) {
+ for(x = 0; x < 200000; ++x) asm("mov r0,r0"); /* no-op, prevent compiler from optimizing this away */
+ led_toggle();
+ };
+}
+
+/**
+ * Enable GPIO, and set up port D7 as an output pin.
+ */
+
+void led_setup(void)
+{
+ // Before GPIO works, according to d0034_efm32tg_reference_manual.pdf
+ // note in section 28.3.7, we'll have to enable GPIO in CMU_HFPERCLKEN0
+
+ CMU_HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
+
+ // The User LED is connected to PD7 to the plus side of the LED
+ // according to t0011_efm32_tiny_gecko_stk_user_manual.pdf figures 16.2
+ // and 16.3 (called UIF_LED0)
+
+ gpio_set_mode(GPIO_PD, GPIO_MODE_PUSHPULL, GPIO7);
+ // GPIO_PD_MODEL = GPIO_MODE_PUSHPULL<<(7*4);
+}
+
+void led_toggle(void)
+{
+ gpio_toggle(GPIO_PD, GPIO7);
+ // GPIO_PD_DOUTTGL = 1<<7;
+}
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/Makefile.include b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/Makefile.include
new file mode 100644
index 0000000..6e927a6
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/Makefile.include
@@ -0,0 +1,29 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+MCU = EFM32TG840F32
+FAMILY = GECKO
+
+EACOMMANDER = ~/energymicro/energymicro/eACommander.sh
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.include
+
+upload: $(BINARY).bin
+ # eacommander is just as nonfree as jlink.sh, but much less of a hasle
+ $(EACOMMANDER) --flash $< --verify --mode out --address 0 --reset
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/README b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/README
new file mode 100644
index 0000000..7360a8c
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/README
@@ -0,0 +1,14 @@
+========================
+EM-32G880F128-H Examples
+========================
+
+Examples in this directory are designed to be run on the OlimexEM-32G880F128-H
+header breakout board, which is based on the EFM32G880F128 MCU.
+
+The board is equipped with two user LEDs, a user button, reset button, power
+supply, 20 pin debug connector and 10 pin UEXT connector (Olimex' open
+versatile microcontroller connector).
+
+The build system is designed to upload programs using the EFM32-TG-STK3300
+board's external Segger debugger, which has to be configured for external
+operation beforehand.
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/Makefile b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/Makefile
new file mode 100644
index 0000000..df8985a
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/Makefile
@@ -0,0 +1,26 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = miniblink
+
+OBJS += efm32_gpio.o efm32_cmu.o
+CFLAGS += -I/tmp/EFM32_CMSIS_2.4.1/efm32lib/inc/ -I /tmp/EFM32_CMSIS_2.4.1/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/ -DEFM32G880F128 -I.
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/README b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/README
new file mode 100644
index 0000000..2500f4d
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/README
@@ -0,0 +1,9 @@
+====================================================
+EM32-32G880F128-H Examples miniblink-efm32lib README
+====================================================
+
+This is a port of the miniblink example to the efm32lib library.
+
+It's intended for the EM32-32G880F128-H eval board. It should blink LED1 on the
+board, just as the original miniblink example does.
+
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_cmu.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_cmu.c
new file mode 120000
index 0000000..168574b
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_cmu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_cmu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_gpio.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_gpio.c
new file mode 120000
index 0000000..0b2df21
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/efm32_gpio.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_gpio.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/miniblink.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/miniblink.c
new file mode 100644
index 0000000..3838c94
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/miniblink.c
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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 <efm32_cmu.h>
+#include <efm32_gpio.h>
+
+void led_setup(void);
+void led_toggle(void);
+
+/** @file
+ * Minimal example for making the User LED of the olimex EM32-32G880F128-H eval
+ * board blink.
+ */
+
+/**
+ * Toggle the User LED in an infinite loop, with time between the toggling
+ * determined by a busy loop stupidly counting up.
+ */
+
+int main(void)
+{
+ int x;
+
+ led_setup();
+
+ while(1) {
+ for(x = 0; x < 200000; ++x) asm("mov r0,r0"); /* no-op, prevent compiler from optimizing this away */
+ led_toggle();
+ };
+}
+
+/**
+ * Enable GPIO, and set up port E1 as an output pin, and inverted.
+ */
+
+void led_setup(void)
+{
+ // Before GPIO works, according to d0034_efm32tg_reference_manual.pdf
+ // note in section 28.3.7, we'll have to enable GPIO in CMU_HFPERCLKEN0
+
+ CMU->HFPERCLKEN0 |= _CMU_HFPERCLKEN0_GPIO_MASK;
+
+ // The User LED is connected to PD7 to the plus side of the LED
+ // according to t0011_efm32_tiny_gecko_stk_user_manual.pdf figures 16.2
+ // and 16.3 (called UIF_LED0)
+
+ GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
+}
+
+void led_toggle(void)
+{
+ GPIO_PinOutToggle(gpioPortE, 1);
+}
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/Makefile b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/Makefile
new file mode 100644
index 0000000..181e15a
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/Makefile
@@ -0,0 +1,26 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+##
+## 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/>.
+##
+
+BINARY = test
+
+OBJS += core_cm3.o $(patsubst %.c,%.o,$(wildcard efm32_*.c))
+CFLAGS += -I/tmp/EFM32_CMSIS_2.4.1/efm32lib/inc/ -I /tmp/EFM32_CMSIS_2.4.1/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/ -DEFM32G880F128 -I.
+
+include ../Makefile.include
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_acmp.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_acmp.c
new file mode 120000
index 0000000..1e1fcef
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_acmp.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_acmp.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_adc.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_adc.c
new file mode 120000
index 0000000..00fca91
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_adc.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_adc.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_aes.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_aes.c
new file mode 120000
index 0000000..5048a82
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_aes.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_aes.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_assert.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_assert.c
new file mode 120000
index 0000000..d5de54d
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_assert.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_assert.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_burtc.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_burtc.c
new file mode 120000
index 0000000..8a73bbd
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_burtc.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_burtc.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_cmu.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_cmu.c
new file mode 120000
index 0000000..168574b
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_cmu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_cmu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dac.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dac.c
new file mode 120000
index 0000000..7e12e03
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dac.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_dac.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dbg.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dbg.c
new file mode 120000
index 0000000..1e0b9ae
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dbg.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_dbg.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dma.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dma.c
new file mode 120000
index 0000000..c72b91c
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_dma.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_dma.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_ebi.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_ebi.c
new file mode 120000
index 0000000..c9d26bb
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_ebi.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_ebi.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_emu.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_emu.c
new file mode 120000
index 0000000..7a8b76e
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_emu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_emu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_gpio.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_gpio.c
new file mode 120000
index 0000000..0b2df21
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_gpio.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_gpio.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_i2c.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_i2c.c
new file mode 120000
index 0000000..681adc3
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_i2c.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_i2c.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_int.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_int.c
new file mode 120000
index 0000000..176d6cf
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_int.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_int.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lcd.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lcd.c
new file mode 120000
index 0000000..4d6026b
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lcd.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_lcd.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lesense.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lesense.c
new file mode 120000
index 0000000..8c7ea28
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_lesense.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_lesense.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_letimer.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_letimer.c
new file mode 120000
index 0000000..aa5eca6
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_letimer.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_letimer.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_leuart.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_leuart.c
new file mode 120000
index 0000000..64b3a57
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_leuart.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_leuart.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_mpu.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_mpu.c
new file mode 120000
index 0000000..141dcfb
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_mpu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_mpu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_msc.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_msc.c
new file mode 120000
index 0000000..c1f750e
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_msc.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_msc.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_opamp.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_opamp.c
new file mode 120000
index 0000000..b6a558b
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_opamp.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_opamp.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_pcnt.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_pcnt.c
new file mode 120000
index 0000000..2df78bd
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_pcnt.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_pcnt.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_prs.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_prs.c
new file mode 120000
index 0000000..15b98fe
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_prs.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_prs.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rmu.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rmu.c
new file mode 120000
index 0000000..242f40d
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rmu.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_rmu.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rtc.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rtc.c
new file mode 120000
index 0000000..9ec9a46
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_rtc.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_rtc.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_system.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_system.c
new file mode 120000
index 0000000..74114f4
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_system.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_system.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_timer.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_timer.c
new file mode 120000
index 0000000..b81acaa
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_timer.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_timer.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_usart.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_usart.c
new file mode 120000
index 0000000..7c78c2c
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_usart.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_usart.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_vcmp.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_vcmp.c
new file mode 120000
index 0000000..e3b6650
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_vcmp.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_vcmp.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_wdog.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_wdog.c
new file mode 120000
index 0000000..12c48f1
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/efm32_wdog.c
@@ -0,0 +1 @@
+/tmp/EFM32_CMSIS_2.4.1/efm32lib/src/efm32_wdog.c \ No newline at end of file
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/gdbinit b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/gdbinit
new file mode 100644
index 0000000..7ccaa72
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/gdbinit
@@ -0,0 +1,14 @@
+# gets set when loading the file, without this i get the "Remote 'g' packet
+# reply is too long" errors
+set arm abi AAPCS
+
+target remote localhost:2331
+monitor speed auto
+# this seems to be less about the architecture and more about how to
+# communicate with gdb. "set endian big" works just as well.
+monitor endian little
+
+# sometimes this doesn't work, then the gdbserver has to be restarted
+monitor reset
+monitor go
+monitor halt
diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/test.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/test.c
new file mode 100644
index 0000000..02954bb
--- /dev/null
+++ b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/test.c
@@ -0,0 +1,115 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
+ *
+ * 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 <efm32_acmp.h>
+#include <efm32_adc.h>
+#include <efm32_aes.h>
+#include <efm32_assert.h>
+#include <efm32_bitband.h>
+#include <efm32_burtc.h>
+#include <efm32_chip.h>
+#include <efm32_cmu.h>
+#include <efm32_common.h>
+#include <efm32_dac.h>
+#include <efm32_dbg.h>
+#include <efm32_dma.h>
+#include <efm32_ebi.h>
+#include <efm32_emu.h>
+#include <efm32_gpio.h>
+#include <efm32_i2c.h>
+#include <efm32_int.h>
+#include <efm32_lcd.h>
+#include <efm32_lesense.h>
+#include <efm32_letimer.h>
+#include <efm32_leuart.h>
+#include <efm32_mpu.h>
+#include <efm32_msc.h>
+#include <efm32_opamp.h>
+#include <efm32_pcnt.h>
+#include <efm32_prs.h>
+#include <efm32_rmu.h>
+#include <efm32_rtc.h>
+#include <efm32_system.h>
+#include <efm32_timer.h>
+#include <efm32_usart.h>
+#include <efm32_vcmp.h>
+#include <efm32_version.h>
+#include <efm32_wdog.h>
+
+#include <stdio.h>
+
+void setup(void);
+void led_toggle(void);
+bool button_is_pressed(void);
+void debug(int a);
+
+#define LOG_SIZE 1024
+volatile char logbuffer[LOG_SIZE];
+
+int main(void)
+{
+ int x;
+ int n_pressed = 0;
+
+ setup();
+
+ while(1) {
+ if (button_is_pressed())
+ {
+ for(x = 0; x < 200000; ++x) asm("mov r0,r0"); /* no-op, prevent compiler from optimizing this away */
+ n_pressed += 1;
+ debug(n_pressed);
+ }
+ led_toggle();
+ };
+}
+
+void debug(int a)
+{
+ snprintf(logbuffer, LOG_SIZE, "Data %d.\n", a);
+}
+
+void setup(void)
+{
+ // Before GPIO works, according to d0034_efm32tg_reference_manual.pdf
+ // note in section 28.3.7, we'll have to enable GPIO in CMU_HFPERCLKEN0
+
+ CMU->HFPERCLKEN0 |= _CMU_HFPERCLKEN0_GPIO_MASK;
+
+ GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
+ GPIO_PinModeSet(gpioPortE, 2, gpioModePushPull, 0);
+
+ GPIO_PinModeSet(gpioPortE, 0, gpioModeInputPull, 1); /* pull up */
+
+ // Counter-blink the other user LED
+
+ GPIO_PinOutToggle(gpioPortE, 2);
+}
+
+void led_toggle(void)
+{
+ GPIO_PinOutToggle(gpioPortE, 1);
+ GPIO_PinOutToggle(gpioPortE, 2);
+}
+
+bool button_is_pressed(void)
+{
+ return !GPIO_PinInGet(gpioPortE, 0);
+}