1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-26 04:56:16 +02:00

atusb/fw3: added proper versioning

- Makefile (atusb.elf): generate a new version iff generating a new
  executable
- Makefile (atusb.bin): print the build number and the file size
- Makefile (clean): remove the various constituend files of the version
- Makefile (version.c): generate version.c
- version.h: definitions for the generated version.c
- ep0.c (build_number, build_date): removed dummy version information
  and include version.h instead
This commit is contained in:
Werner Almesberger 2011-02-14 11:26:17 -03:00
parent 23f84bc8b0
commit 908e04c309
3 changed files with 46 additions and 6 deletions

View File

@ -53,20 +53,39 @@ endif
# ----- Rules -----------------------------------------------------------------
.PHONY: all clean upload prog
.PHONY: all clean upload prog version.c
all: $(NAME).bin
$(NAME).elf: $(OBJS)
$(CC) $(CFLAGS) -mmcu=$(CHIP) -o $@ $(OBJS)
$(MAKE) version.o
$(CC) $(CFLAGS) -mmcu=$(CHIP) -o $@ $(OBJS) version.o
%.bin: %.elf
$(BUILD) $(OBJCOPY) -j .text -j .data -O binary $< $@
@echo "build #`cat .version`, `ls -l $@`"
# ----- Cleanup ---------------------------------------------------------------
clean:
rm -f $(NAME).bin $(NAME).elf $(OBJS) $(OBJS:.o=.d)
rm -f version.c version.d version.o
# ----- Build version ---------------------------------------------------------
version.c:
@if [ -f .version ]; then \
v=`cat .version`; \
expr $$v + 1 >.version; \
else \
echo 0 >.version; \
fi
@[ -s .version ] || echo 0 >.version
@echo '/* MACHINE-GENERATED. DO NOT EDIT ! */' >version.c
@echo '#include "version.h"' >>version.c
@echo "const char *build_date = \"`date`\";" >>version.c
@echo "const uint16_t build_number = `cat .version`;" \
>>version.c
# ----- Dependencies ----------------------------------------------------------

View File

@ -27,14 +27,12 @@
#include "at86rf230.h"
#include "atusb/ep0.h"
//#include "version.h"
#include "version.h"
#include "board.h"
#include "spi.h"
#define HW_TYPE HW_TYPE_110131
static const char *build_date = "today";
static unsigned build_number = 42;
#define debug(...)
#define error(...)

23
atusb/fw3/version.h Normal file
View File

@ -0,0 +1,23 @@
/*
* boot/version.h - Automatically generated version string
*
* Written 2008, 2011 by Werner Almesberger
* Copyright 2008, 2011 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef VERSION_H
#define VERSION_H
#include <stdint.h>
extern const char *build_date;
extern const uint16_t build_number;
#endif /* !VERSION_H */