Only re-compile version.c as often as necessary

Make bootrom version information pointer a proper symbol (with hacky ld strangeness workaround)
This commit is contained in:
henryk@ploetzli.ch 2009-08-29 06:14:28 +00:00
commit 4271e82d56
7 changed files with 33 additions and 21 deletions

View file

@ -13,7 +13,6 @@ THUMBSRC = start.c \
lfops.c \
iso15693.c \
util.c \
version.c \
hitag2.c \
usb.c
@ -30,14 +29,14 @@ all: $(OBJDIR)/osimage.s19 $(OBJDIR)/fpgaimage.s19
$(OBJDIR)/fpga.o: fpga.bit
$(OBJCOPY) -O elf32-littlearm -I binary -B arm --redefine-sym _binary____fpga_fpga_bit_start=_binary_fpga_bit_start --redefine-sym _binary____fpga_fpga_bit_end=_binary_fpga_bit_end --prefix-sections=fpga_bit $^ $@
$(OBJDIR)/fullimage.elf: $(OBJDIR)/fpga.o $(THUMBOBJ) $(ARMOBJ) $(ARMLIB)/libgcc.a
$(OBJDIR)/fullimage.elf: $(VERSIONOBJ) $(OBJDIR)/fpga.o $(THUMBOBJ) $(ARMOBJ) $(ARMLIB)/libgcc.a
$(LD) -g -Tldscript -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
$(OBJDIR)/fpgaimage.elf: $(OBJDIR)/fullimage.elf
$(OBJCOPY) -F elf32-littlearm --only-section fpgaimage $^ $@
$(OBJCOPY) -F elf32-littlearm --only-section .fpgaimage $^ $@
$(OBJDIR)/osimage.elf: $(OBJDIR)/fullimage.elf
$(OBJCOPY) -F elf32-littlearm --remove-section fpgaimage $^ $@
$(OBJCOPY) -F elf32-littlearm --remove-section .fpgaimage $^ $@
clean:
$(DELETE) $(OBJDIR)$(PATHSEP)*.o

View file

@ -238,17 +238,19 @@ void ReadMem(int addr)
/* osimage version information is linked in */
extern struct version_information version_information;
/* bootrom version information is pointed to from _bootphase1_version_pointer */
extern char _bootphase1_version_pointer, _flash_start, _flash_end;
void SendVersion(void)
{
char temp[48]; /* Limited data payload in USB packets */
DbpString("Prox/RFID mark3 RFID instrument");
/* Try to find the bootrom version information. For the time being, expect
* to find a pointer at address 0x1001fc, perform slight sanity checks on
* the pointer, then use it.
/* Try to find the bootrom version information. Expect to find a pointer at
* symbol _bootphase1_version_pointer, perform slight sanity checks on the
* pointer, then use it.
*/
void *bootrom_version = *(void**)0x1001fc;
if( bootrom_version < (void*)0x100000 || bootrom_version > (void*)0x101000 ) {
void *bootrom_version = *(void**)&_bootphase1_version_pointer;
if( bootrom_version < (void*)&_flash_start || bootrom_version >= (void*)&_flash_end ) {
DbpString("bootrom version information appears invalid");
} else {
FormatVersionInformation(temp, sizeof(temp), "bootrom: ", bootrom_version);

View file

@ -3,7 +3,7 @@ INCLUDE ../common/ldscript.common
ENTRY(Vector)
SECTIONS
{
fpgaimage : {
.fpgaimage : {
*(fpga_bit.data)
} >fpgaimage
.start : { *(.startos) } >osimage