summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-05-24 09:10:16 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-05-24 09:10:16 +0200
commit942d0d174f8b109bd1e7c1597820dd8228dbcec2 (patch)
tree4abbd32d77ed893a59f0ae9669be7a85b289a6ad /src/app
parentef918672a6415f862fa7b44d185088eee1816b7c (diff)
add test/benchmark app for MSP430 EnergyTrace time resolution
Diffstat (limited to 'src/app')
-rw-r--r--src/app/energybench/Makefile.inc2
-rw-r--r--src/app/energybench/main.cc81
2 files changed, 83 insertions, 0 deletions
diff --git a/src/app/energybench/Makefile.inc b/src/app/energybench/Makefile.inc
new file mode 100644
index 0000000..d7dcd37
--- /dev/null
+++ b/src/app/energybench/Makefile.inc
@@ -0,0 +1,2 @@
+timer_cycles ?= 1
+loop ?= 1
diff --git a/src/app/energybench/main.cc b/src/app/energybench/main.cc
new file mode 100644
index 0000000..59a775e
--- /dev/null
+++ b/src/app/energybench/main.cc
@@ -0,0 +1,81 @@
+#include "arch.h"
+#include "driver/gpio.h"
+#include "driver/stdout.h"
+#include "driver/uptime.h"
+
+#ifndef TIMER_CYCLES
+#error makeflag timer_cycles=1 required
+#endif
+
+void loop(void)
+{
+#if 0
+ static unsigned char i = 0;
+
+ switch (i) {
+ case 0:
+ gpio.led_on(0);
+ gpio.led_off(0);
+ break;
+ case 1:
+ gpio.led_on(0);
+ arch.delay_us(1);
+ gpio.led_off(0);
+ break;
+ case 2:
+ gpio.led_on(0);
+ arch.delay_us(2);
+ gpio.led_off(0);
+ break;
+ case 3:
+ gpio.led_on(1);
+ gpio.led_off(1);
+ break;
+ case 4:
+ gpio.led_on(1);
+ arch.delay_us(1);
+ gpio.led_off(1);
+ break;
+ case 5:
+ gpio.led_on(1);
+ arch.delay_us(2);
+ gpio.led_off(1);
+ break;
+ case 6:
+ gpio.led_on(0);
+ break;
+ case 7:
+ gpio.led_off(0);
+ break;
+ case 8:
+ gpio.led_on(1);
+ break;
+ case 9:
+ gpio.led_off(1);
+ break;
+ default:
+ break;
+ }
+
+
+ i = (i+1) % 10;
+#endif
+}
+
+int main(void)
+{
+ arch.setup();
+ gpio.setup();
+ kout.setup();
+
+ kout << "Hello, World!" << endl;
+ kout << "Test, World!" << endl;
+ kout << dec << uptime.get_cycles() << endl;
+ kout << dec << uptime.get_cycles() << endl;
+ kout << dec << uptime.get_cycles() << endl;
+ kout << dec << uptime.get_cycles() << endl;
+
+ arch.idle_loop();
+
+ return 0;
+}