From c6b2b65c2daad04c8c6f575255fb7c2974d07c41 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 14 Aug 2020 18:09:44 +0200 Subject: [PATCH] initial --- .gitignore | 5 +++++ Makefile | 36 ++++++++++++++++++++++++++++++++++++ main.c | 41 +++++++++++++++++++++++++++++++++++++++++ readme.md | 13 +++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 main.c create mode 100644 readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be81f3d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*~ +.*~ +*.o +*.elf +core diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..92e6b90 --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +CC=msp430-gcc + +# regular +CFLAGS=-Wall -mmcu=msp430g2553 -std=gnu99 -O3 -g0 + +# for debugging +# CFLAGS=-Wall -mmcu=msp430g2553 -std=gnu99 -g3 -ggdb -gdwarf-2 + +LDFLAGS=-mmcu=msp430g2553 + +mbus-frontend.elf: main.o + $(CC) -o $@ $(LDFLAGS) $^ + +.c.o: + $(CC) $(CFLAGS) -c $< + + +.PHONY: all +all: mbus-frontend.elf + +.PHONY: clean +clean: + -rm -f *.o *.elf + +.PHONY: upload +upload: mbus-frontend.elf + mspdebug rf2500 "prog mbus-frontend.elf" + +.PHONY: debug +debug: upload + mspdebug rf2500 gdb & + ddd --debugger "msp430-gdb -x blinky1.gdb" + + + + diff --git a/main.c b/main.c new file mode 100644 index 0000000..fd33029 --- /dev/null +++ b/main.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include + +#include "time.h" +#include "PontCoopScheduler.h" + +#include "led.h" +#include "pattern.h" +#include "measure.h" + + +int main() { + WDTCTL = WDTPW | WDTHOLD; + + __disable_interrupt(); + + // highest possible system clock + DCOCTL = DCO0 | DCO1 | DCO2; + BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3; + BCSCTL2 = 0; + BCSCTL3 = 0; + + + timeInit(); + schInit(); + + ledInit(); + patternInit(); + measureInit(); + // ledSetMatrix(0, 0, BLUE); + + __enable_interrupt(); + + while (1) { + schExec(); + ledExec(); + } +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..23deac9 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +Build: +* make all + +Flash: +* make upload + +Debugger: +* enable debugging in Makefile +* mspdebug rf2500 gdb +* ddd --debugger msp430-gdb +* for every code change upload using Makefile and restart both mspdebug and ddd (or find a way to reset the both) + +