From 8f6cde69ed20d1f0dd1292af9d895fcc11e69b17 Mon Sep 17 00:00:00 2001 From: travisutk Date: Thu, 19 Jan 2012 19:51:39 +0000 Subject: [PATCH] Fixed synching bug which was introduced by dropping the custom linker scripts. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1084 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/Makefile | 6 ++---- firmware/config.mk | 35 ++++++++++++++++++++--------------- firmware/lib/msp430f2418.c | 5 +++++ firmware/lib/msp430f2618.c | 33 ++++++++++++++++----------------- 4 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 firmware/lib/msp430f2418.c diff --git a/firmware/Makefile b/firmware/Makefile index 319ffd5..4df4028 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -12,8 +12,6 @@ MSP430BSL?=goodfet.bsl --speed=38400 JTAG=msp430-jtag - - #N.B., gcc WILL NOT BITCH if this file doesn't exist. GCCINC?= @@ -25,7 +23,7 @@ GCC?=msp430-gcc LDFLAGS?=-mmcu=$(mcu) #-Wl,-dT ldscripts/$(mcu).x CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -Dboard=$(board) $(GCCINC) -I include -I platforms -CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA) +CC=$(GCC) -Wall -O1 -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA) # Available Applications # ====================== @@ -270,7 +268,7 @@ endif # include adc app ifeq ($(filter adc, $(config)), adc) - ifeq ($(mcu), msp430x2274) + ifeq ($(mcu), msp430f2274) apps+= apps/adc/adc.o hdrs+= adc.h else diff --git a/firmware/config.mk b/firmware/config.mk index 945c7ce..773e3d2 100644 --- a/firmware/config.mk +++ b/firmware/config.mk @@ -1,56 +1,61 @@ ################################## ## These are production boards. ################################## -mcu = undef + ifneq (,$(findstring $(board),goodfet20 goodfet10 goodfet11)) -mcu := msp430f1612 +mcu ?= msp430f1612 platform := goodfet endif ifneq (,$(findstring $(board),goodfet21)) -mcu := msp430f2618 +mcu ?= msp430f2618 platform := goodfet endif ifneq (,$(findstring $(board),goodfet30 goodfet31)) -mcu := msp430f2274 +mcu ?= msp430f2274 platform := goodfet # This will link to fit in a '2254, so unneeded packages should be omited. CONFIG_ccspi = n endif ifneq (,$(findstring $(board),goodfet40 goodfet41)) -mcu := msp430f2618 +mcu ?= msp430f2618 +platform := goodfet +endif + +ifneq (,$(findstring $(board),goodfet24)) +mcu ?= msp430f2618 platform := goodfet endif ifneq (,$(findstring $(board),nhb12b)) -mcu := msp430f2618 +mcu ?= msp430f2618 CONFIG_nrf = y platform := nhb12b endif ifneq (,$(findstring $(board),nhb12)) -mcu := msp430f2618 +mcu ?= msp430f2618 CONFIG_nrf = y platform := nhb12 endif ifneq (,$(findstring $(board),goodfet50 goodfet51)) -mcu := msp430f5510 +mcu ?= msp430f5510 platform := goodfet endif ifeq ($(board),telosb) -mcu := msp430f1611 +mcu ?= msp430f1611 platform := telosb config := monitor spi ccspi CFLAGS += -Duseuart1 endif ifeq ($(board),telosbbt) -mcu :=msp430f1612 +mcu ?=msp430f1612 platform := telosb config := monitor spi ccspi endif @@ -64,29 +69,29 @@ endif ifneq (,$(findstring $(board),donbfet)) GCC := avr-gcc -mcu := atmega644p +mcu ?= atmega644p CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields config := monitor avr spi jscan endif ifneq (,$(findstring $(board),arduino)) GCC := avr-gcc -mcu := atmega168 +mcu ?= atmega168 #BSL := avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex LDFLAGS := config := monitor endif ifneq (,$(findstring $(board),tilaunchpad)) -mcu :=msp430f1612 +mcu ?=msp430f1612 CFLAGS := -DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG -#CFLAGS+= -Werror +CFLAGS+= -Werror -Wall config := monitor chipcon i2c endif - +mcu ?= undef ifeq ($(mcu),undef) $(error Please define board, as explained in the README) endif diff --git a/firmware/lib/msp430f2418.c b/firmware/lib/msp430f2418.c new file mode 100644 index 0000000..b2aa30c --- /dev/null +++ b/firmware/lib/msp430f2418.c @@ -0,0 +1,5 @@ + +//platform.h will handle patching Port 5 to be Port 3. + + +#include "msp430f2618.c" diff --git a/firmware/lib/msp430f2618.c b/firmware/lib/msp430f2618.c index 408e3ee..8ba3319 100644 --- a/firmware/lib/msp430f2618.c +++ b/firmware/lib/msp430f2618.c @@ -5,13 +5,9 @@ #include "platform.h" #include "dco_calib.h" -#ifdef __MSPGCC__ + #include -#else -#include -#include -#include -#endif +#include //! Receive a byte. @@ -114,27 +110,30 @@ void msp430_init_uart(){ } +//This must be in .noinit. +__attribute__ ((section (".noinit"))) char dcochoice; + //! Initialization is correct. void msp430_init_dco_done(){ - char *choice=(char *) 0x200; //First word of RAM. - choice[0]--; + //char *dcochoice=(char *) DCOCHOICEAT; //First word of RAM. + dcochoice--; } //! Initialize the MSP430 clock. void msp430_init_dco() { int i=1000; - char *choice=(char *) 0x200; //First word of RAM. - + //char *dcochoice=(char *) DCOCHOICEAT; //First word of RAM. + #ifdef __MSP430_HAS_PORT8__ P8SEL = 0; // disable XT2 on P8.7/8 #endif - + //Set P2.6 mode for MSP430F2274 #ifndef __MSP430_HAS_PORT5__ P2SEL = 0; //disable XIN on 2274 #endif - - + + #ifdef STATICDCO BCSCTL1 = (STATICDCO>>8); DCOCTL = (STATICDCO&0xFF); @@ -152,10 +151,10 @@ void msp430_init_dco() { */ DCOCTL = 0x00; //clear DCO - BCSCTL1 = dco_calibrations[2*choice[0]+1]; - DCOCTL = dco_calibrations[2*choice[0]]; - choice[0]++; - choice[0]%=dco_calibrations_count; + BCSCTL1 = dco_calibrations[2*dcochoice+1]; + DCOCTL = dco_calibrations[2*dcochoice]; + dcochoice++; + dcochoice%=dco_calibrations_count; } #endif -- 2.20.1