From 8a0613ec19bfd5aecd32d5f7adae48ceaeb26ad1 Mon Sep 17 00:00:00 2001 From: travisutk Date: Sun, 25 Nov 2012 22:00:21 +0000 Subject: [PATCH] Beginnings of support for Zigduino. AVR code is really out of shape. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1351 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/monitor/monitor.c | 12 +++++++++--- firmware/apps/spi/spi.c | 8 ++++---- firmware/config.mk | 10 ++++++++++ firmware/lib/atmega1284p.c | 16 +++++++--------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/firmware/apps/monitor/monitor.c b/firmware/apps/monitor/monitor.c index b6858aa..db8749c 100644 --- a/firmware/apps/monitor/monitor.c +++ b/firmware/apps/monitor/monitor.c @@ -7,18 +7,20 @@ #include "platform.h" #include "monitor.h" #include "builddate.h" + + #if (platform == tilaunchpad) #include extern jmp_buf warmstart; - #endif + #define MONITOR_APP //! Handles a monitor command. void monitor_handle_fn(uint8_t const app, - uint8_t const verb, - uint32_t const len); + uint8_t const verb, + uint32_t const len); //! Overwrite all of RAM with 0xBEEF, then reboot. void monitor_ram_pattern(); @@ -223,9 +225,13 @@ unsigned int monitor_ram_depth() //! Call a function by address. int fncall(unsigned int adr) { + #ifdef MSP430 int (*machfn)() = 0; machfn = (int (*)()) adr; return machfn(); + #else + debugstr("fncall() not supported on this platform."); + #endif } diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index bb1753a..f92fcf5 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -10,10 +10,10 @@ #ifdef __MSPGCC__ #include -#else -#include -#include -#include +/* #else */ +/* #include */ +/* #include */ +/* #include */ #endif #include "spi.h" diff --git a/firmware/config.mk b/firmware/config.mk index 8ed0785..f001b48 100644 --- a/firmware/config.mk +++ b/firmware/config.mk @@ -147,6 +147,16 @@ CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wu config := monitor avr spi jscan endif +ifneq (,$(findstring $(board),zigduino)) +GCC := avr-gcc +CC := avr-gcc +mcu ?= atmega1284p +platform = donbfet +CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields +config := monitor #avr spi +endif + + ifneq (,$(findstring $(board),arduino)) GCC := avr-gcc mcu ?= atmega168 diff --git a/firmware/lib/atmega1284p.c b/firmware/lib/atmega1284p.c index 2199ecf..12150df 100644 --- a/firmware/lib/atmega1284p.c +++ b/firmware/lib/atmega1284p.c @@ -74,21 +74,19 @@ void donbfet_init_uart0(){ _delay_ms(500); //takes a bit to stabilize } -void -led_on() -{ +void led_init(){ + +} + +void led_on() { PLEDOUT |= (1 << PLEDPIN); } -void -led_off() -{ +void led_off() { PLEDOUT &= ~(1 << PLEDPIN); } -void -donbfet_init() -{ +void donbfet_init(){ uint8_t x; /* explicitly clear interrupts */ -- 2.20.1