[fluksod + avr] include freshly compiled avr binaries into the flukso package

This commit is contained in:
Bart Van Der Meerssche 2011-05-02 23:03:50 +02:00
parent 0b18afa8cc
commit fc90003688
3 changed files with 36 additions and 9 deletions

View File

@ -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)

View File

@ -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))

View File

@ -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