summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2015-03-29 22:08:57 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2015-03-29 22:08:57 +0200
commit3bddb71d56d5d556a41779f04b4fefa135f319cd (patch)
tree0465a83ced793b81ee752c94f12d91d3d9431b92
Blink LED.f0_blink
-rw-r--r--.gdbinit22
-rw-r--r--.gitignore5
-rw-r--r--.gitmodules3
-rw-r--r--SConstruct11
m---------laks0
-rw-r--r--main.cpp22
6 files changed, 63 insertions, 0 deletions
diff --git a/.gdbinit b/.gdbinit
new file mode 100644
index 0000000..99eae86
--- /dev/null
+++ b/.gdbinit
@@ -0,0 +1,22 @@
+define flash
+file demo.elf
+load
+end
+
+define restart
+run
+end
+
+define attach_swd
+mon swdp_scan
+attach 1
+end
+
+define attach_jtag
+mon jtag_scan
+attach 1
+end
+
+file demo.elf
+
+set mem inaccessible-by-default off
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b137a4a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.o
+*.a
+*.elf
+*.swp
+.sconsign.dblite
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..cd4f3c2
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "laks"]
+ path = laks
+ url = git://git.jvnv.net/laks.git
diff --git a/SConstruct b/SConstruct
new file mode 100644
index 0000000..aaeea43
--- /dev/null
+++ b/SConstruct
@@ -0,0 +1,11 @@
+import os
+
+env = Environment(
+ ENV = os.environ,
+)
+
+SConscript('laks/build_rules')
+
+env.SelectMCU('stm32f051r8')
+
+env.Firmware('demo.elf', Glob('*.cpp'))
diff --git a/laks b/laks
new file mode 160000
+Subproject 16cc0f1414c33772dd6daa6c19d2be9dcaca2e6
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..57b1ed0
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,22 @@
+#include <rcc/rcc.h>
+#include <gpio/gpio.h>
+#include <os/time.h>
+
+Pin led_green = GPIOC[8];
+Pin led_blue = GPIOC[9];
+
+int main() {
+ // Initialize system timer.
+ STK.LOAD = 8000000 / 8 / 1000; // 1000 Hz.
+ STK.CTRL = 0x03;
+
+ RCC.enable(RCC.GPIOC);
+
+ led_green.set_mode(Pin::Output);
+
+ while(1) {
+ Time::sleep(500);
+
+ led_green.toggle();
+ }
+}