aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMoritz Fischer <moritz.fischer@ettus.com>2016-01-05 13:57:04 -0800
committerMoritz Fischer <moritz.fischer@ettus.com>2016-01-26 18:27:09 +0100
commit2ba7395f88df4a0ad73621a978f2fa3043234d32 (patch)
tree378ea22f84d4aec106a7c955381574a4800bd09d /firmware
parent45335d1e1ca9da7872f4ab9a91b9d214e5ef6ba6 (diff)
downloaduhd-2ba7395f88df4a0ad73621a978f2fa3043234d32.tar.gz
uhd-2ba7395f88df4a0ad73621a978f2fa3043234d32.tar.bz2
uhd-2ba7395f88df4a0ad73621a978f2fa3043234d32.zip
firmware: e3xx: Added .eeprom section that gets written.
The EEPROM section was not getting written by make install, so whatever was in there is in there. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/e300/battery/Makefile9
-rw-r--r--firmware/e300/battery/eeprom.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/firmware/e300/battery/Makefile b/firmware/e300/battery/Makefile
index 1ce0bf279..7f825cbd8 100644
--- a/firmware/e300/battery/Makefile
+++ b/firmware/e300/battery/Makefile
@@ -40,17 +40,18 @@ PROGRAMMER = jtag3isp
PORT = usb
AVRDUDE = avrdude -p $(MMCU) -c $(PROGRAMMER) -P $(PORT) -V
FUSES = -U hfuse:w:hfuse.hex:i -U lfuse:w:lfuse.hex:i -U efuse:w:efuse.hex:i -u
+EEPROM = -U eeprom:w:$(TARGET).eeprom.hex
##################################################
# Global Targets
##################################################
-all: $(TARGET).hex size hfuse.hex lfuse.hex efuse.hex
+all: $(TARGET).hex $(TARGET).eeprom.hex size hfuse.hex lfuse.hex efuse.hex
clean:
$(RM) *.o *.elf *.hex
install: all
- $(AVRDUDE) -U flash:w:$(TARGET).hex:i $(FUSES)
+ $(AVRDUDE) -U flash:w:$(TARGET).hex:i $(FUSES) $(EEPROM)
size: $(TARGET).hex
@$(SIZE) --format=SysV --mcu=$(MMCU) $(TARGET).elf
@@ -74,6 +75,10 @@ efuse.hex: fuses.hex
$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -R .eeprom -R .fuse -O ihex $< $@
+$(TARGET).eeprom.hex: $(TARGET).elf
+ $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma \
+ .eeprom=0 -O ihex $(TARGET).elf $@
+
$(TARGET).elf: $(SRCS:.c=.o)
$(CC) -mmcu=$(MMCU) $^ -o $@
diff --git a/firmware/e300/battery/eeprom.c b/firmware/e300/battery/eeprom.c
index f8bc172d2..79b1f9052 100644
--- a/firmware/e300/battery/eeprom.c
+++ b/firmware/e300/battery/eeprom.c
@@ -16,6 +16,9 @@
#include "eeprom.h"
#include <avr/eeprom.h>
+/* default values for eeprom */
+char eeprom[] EEMEM = {0x00, 0x00, 0x00};
+
/* the avr libc wants it this way ... */
static uint8_t* EEPROM_AUTOBOOT_OFFSET = (uint8_t *) 0x00;
static uint16_t *EEPROM_LAST_FULL_OFFSET = (uint16_t *) 0x04;