From fc90003688c7b70555188361958d9e893ad4a613 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Mon, 2 May 2011 23:03:50 +0200 Subject: [PATCH] [fluksod + avr] include freshly compiled avr binaries into the flukso package --- mote/v2/avr/makefile | 18 +++++++++--------- mote/v2/openwrt/package/flukso/Makefile | 8 ++++++++ .../openwrt/package/flukso/config/flukso.init | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/mote/v2/avr/makefile b/mote/v2/avr/makefile index a5efa8b..226b7da 100644 --- a/mote/v2/avr/makefile +++ b/mote/v2/avr/makefile @@ -72,11 +72,11 @@ FORMAT = ihex # Target file name (without extension). -TARGET = main +TARGET = $(shell git rev-parse HEAD | awk '{print substr($$0,1,16)}') # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c buffer.c uart.c spi.c ctrl.c +SRC = main.c buffer.c uart.c spi.c ctrl.c # List Assembler source files here. @@ -542,13 +542,13 @@ clean: begin clean_list end clean_list : @echo @echo $(MSG_CLEANING) - $(REMOVE) $(TARGET).hex - $(REMOVE) $(TARGET).eep - $(REMOVE) $(TARGET).cof - $(REMOVE) $(TARGET).elf - $(REMOVE) $(TARGET).map - $(REMOVE) $(TARGET).sym - $(REMOVE) $(TARGET).lss + $(REMOVE) *.hex + $(REMOVE) *.eep + $(REMOVE) *.cof + $(REMOVE) *.elf + $(REMOVE) *.map + $(REMOVE) *.sym + $(REMOVE) *.lss $(REMOVE) $(OBJ) $(REMOVE) $(LST) $(REMOVE) $(SRC:.c=.s) diff --git a/mote/v2/openwrt/package/flukso/Makefile b/mote/v2/openwrt/package/flukso/Makefile index 66b1ee8..1bdc7da 100644 --- a/mote/v2/openwrt/package/flukso/Makefile +++ b/mote/v2/openwrt/package/flukso/Makefile @@ -29,6 +29,11 @@ define Build/Prepare $(CP) ./luasrc/* $(PKG_BUILD_DIR)/ $(CP) ./config/* $(PKG_BUILD_DIR)/ $(CP) -r ./files $(PKG_BUILD_DIR)/ + + make -C ../../../avr clean + make -C ../../../avr + mkdir -p $(PKG_BUILD_DIR)/avr + $(CP) ../../../avr/*.{hex,eep} $(PKG_BUILD_DIR)/avr/ endef FLUKSO_COMMIT:=$(shell git rev-parse HEAD | awk '{print substr($$0,1,16)}') @@ -65,6 +70,9 @@ define Package/flukso/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/fdude.lua $(1)/usr/bin/fdude $(INSTALL_BIN) $(PKG_BUILD_DIR)/fcheck.sh $(1)/usr/bin/fcheck $(INSTALL_BIN) $(PKG_BUILD_DIR)/restful.lua $(1)/usr/bin/restful + + $(INSTALL_DIR) $(1)/usr/bin/avr + $(INSTALL_DATA) $(PKG_BUILD_DIR)/avr/*.{hex,eep} $(1)/usr/bin/avr/ endef $(eval $(call BuildPackage,flukso)) diff --git a/mote/v2/openwrt/package/flukso/config/flukso.init b/mote/v2/openwrt/package/flukso/config/flukso.init index fadc152..d0ffdc6 100755 --- a/mote/v2/openwrt/package/flukso/config/flukso.init +++ b/mote/v2/openwrt/package/flukso/config/flukso.init @@ -21,6 +21,24 @@ load_config() logger 'configuring flukso device and sensor ids' } +program_sensor_board() +{ + AVRDUDE=fdude + + MCU=atmega168p + PROGRAMMER=gpio + FLAGS="-p $MCU -c $PROGRAMMER" + FUSES="-U lfuse:w:0xEC:m -U hfuse:w:0xD6:m -U efuse:w:0x01:m" + + AVRDIR=/usr/bin/avr + HEXFILE=$(find $AVRDIR/*.hex) + EEPFILE=$(find $AVRDIR/*.eep) + + FLASH="-U flash:w:$HEXFILE" + EEPROM="-U eeprom:w:$EEPFILE" + + $AVRDUDE $FLAGS $FUSES $FLASH $EEPROM +} start() { @@ -29,6 +47,7 @@ start() if [ $FIRSTBOOT -eq '1' ] then load_config + program_sensor_board fi chmod 666 /dev/spidev0.0