Commit 49420b56 authored by Jan Kasprzak's avatar Jan Kasprzak
Browse files

Include git revision and date in the eeprom variable

parent d09c1dcb
PROGRAM=lights
SRC=main.c logging.c pwm.c adc.c pwmled.c pattern.c buttons.c control.c \
battery.c wdt.c
SRC=version.c main.c logging.c pwm.c adc.c pwmled.c pattern.c buttons.c \
control.c battery.c wdt.c
OBJ=$(SRC:.c=.o)
......@@ -62,5 +62,8 @@ objdump: $(PROGRAM).elf
clean:
rm -f $(PROGRAM).hex $(PROGRAM).eep $(PROGRAM).elf *.o *.s eeprom.raw
.PHONY: all clean dump_eeprom program program_flash program_eeprom objdump
version.c:
./version.pl > version.c
.PHONY: all clean dump_eeprom program program_flash program_eeprom objdump version.c
#!/usr/bin/perl -w
use strict;
use POSIX qw(strftime);
my $git = `git rev-parse --short HEAD`;
chomp $git;
my $now = strftime('%Y%m%d', localtime(time));
print <<EOF;
/* DO NOT EDIT - GENERATED BY $0 */
#include <avr/eeprom.h>
unsigned char version[] EEMEM = {
EOF
print hex2c($git, "git revision");
print hex2c($now, "date");
print "};\n\n/* EOF - this file has not been truncated */\n\n";
sub hex2c {
my ($data, $comment) = @_;
my $data1 = $data;
$data1 .= '0' if (length($data1) & 1 == 1);
$data1 =~ s/(..)/0x$1, /g;
return "\t$data1 /* $comment $data */\n";
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment