mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-04 23:23:43 +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:
parent
23f84bc8b0
commit
908e04c309
@ -53,20 +53,39 @@ endif
|
||||
|
||||
# ----- Rules -----------------------------------------------------------------
|
||||
|
||||
.PHONY: all clean upload prog
|
||||
.PHONY: all clean upload prog version.c
|
||||
|
||||
all: $(NAME).bin
|
||||
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 ----------------------------------------------------------
|
||||
|
||||
|
@ -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
23
atusb/fw3/version.h
Normal 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 */
|
Loading…
Reference in New Issue
Block a user