mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 15:48:02 +00:00
buildtime.h now contains the compilation time, fixing broken start times in JTAG-programmed boards. Close #106.
This commit is contained in:
parent
a467c84e20
commit
1f46bd79ef
25
bin/buildtime.py
Executable file
25
bin/buildtime.py
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python2
|
||||
|
||||
|
||||
## This is a quick and dirty script for placing the build time into
|
||||
## the GoodWatch's source code, much as we put the git tag.
|
||||
## Previously, we just wrote the compile time to memory at 0xff00, but
|
||||
## that left it out of the ELF file, causing some confusion.
|
||||
|
||||
import time, sys;
|
||||
|
||||
|
||||
lt=time.localtime()
|
||||
#See firmware/rtc.c for the format.
|
||||
timestr=(
|
||||
#Hour, Minute, Second first.
|
||||
chr(lt.tm_hour)+chr(lt.tm_min)+chr(lt.tm_sec)+"\xFF"+
|
||||
#u16 Year, u8 Month, u8 Day
|
||||
chr(lt.tm_year&0xFF)+chr(lt.tm_year>>8)+chr(lt.tm_mon)+chr(lt.tm_mday)
|
||||
);
|
||||
|
||||
sys.stdout.write("#define BUILDTIME \"");
|
||||
for b in timestr:
|
||||
sys.stdout.write("\\x%02x"%ord(b));
|
||||
sys.stdout.write("\"\n");
|
||||
|
@ -336,8 +336,6 @@ if __name__=='__main__':
|
||||
help='Prints the dmesg.',action='count');
|
||||
parser.add_argument('-u','--unlock',
|
||||
help='Unlock BSL.',action='count');
|
||||
parser.add_argument('-t','--time',
|
||||
help='Set the Time.',action='count');
|
||||
parser.add_argument('-r','--rate',
|
||||
help='Baud Rate', default=9600);
|
||||
|
||||
@ -371,16 +369,22 @@ if __name__=='__main__':
|
||||
if args.file!=None:
|
||||
print "Writing %s as Intel hex." % args.file
|
||||
bsl.writeihexfile(args.file);
|
||||
if args.time!=None:
|
||||
lt=time.localtime()
|
||||
#See firmware/rtc.c for the format.
|
||||
timestr=(
|
||||
#Hour, Minute, Second first.
|
||||
chr(lt.tm_hour)+chr(lt.tm_min)+chr(lt.tm_sec)+"\xFF"+
|
||||
#u16 Year, u8 Month, u8 Day
|
||||
chr(lt.tm_year&0xFF)+chr(lt.tm_year>>8)+chr(lt.tm_mon)+chr(lt.tm_mday)
|
||||
);
|
||||
bsl.write(0xFF00,timestr);
|
||||
|
||||
## Peviously, we manually wrote the time to 0xFF00. This is now
|
||||
## handled by buildtime.h, but I wouldn't object to writing the
|
||||
## time to SRAM. --Travis
|
||||
|
||||
# if args.time!=None:
|
||||
# lt=time.localtime()
|
||||
# #See firmware/rtc.c for the format.
|
||||
# timestr=(
|
||||
# #Hour, Minute, Second first.
|
||||
# chr(lt.tm_hour)+chr(lt.tm_min)+chr(lt.tm_sec)+"\xFF"+
|
||||
# #u16 Year, u8 Month, u8 Day
|
||||
# chr(lt.tm_year&0xFF)+chr(lt.tm_year>>8)+chr(lt.tm_mon)+chr(lt.tm_mday)
|
||||
# );
|
||||
# bsl.write(0xFF00,timestr);
|
||||
|
||||
if args.dump!=None:
|
||||
coredump(bsl);
|
||||
if args.dmesg!=None:
|
||||
|
1
firmware/.gitignore
vendored
1
firmware/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
config.h
|
||||
buildtime.h
|
||||
libs/assembler
|
||||
|
@ -87,10 +87,13 @@ apps= $(APPS_OBJ)
|
||||
|
||||
all: goodwatch.hex
|
||||
|
||||
*.c: githash.h
|
||||
*.c: githash.h buildtime.h
|
||||
|
||||
githash.h:
|
||||
echo "#define GITHASH" 0x`git rev-parse HEAD | head -c7` > githash.h
|
||||
buildtime.h:
|
||||
../bin/buildtime.py >buildtime.h
|
||||
|
||||
goodwatch.elf: $(modules) $(apps) *.h
|
||||
$(CC) -T msp430.x -o goodwatch.elf $(modules) $(apps)
|
||||
../bin/printsizes.py goodwatch.elf || echo "Please install python-pyelftools."
|
||||
@ -99,14 +102,14 @@ goodwatch.hex: goodwatch.elf
|
||||
msp430-objcopy -O ihex goodwatch.elf goodwatch.hex
|
||||
|
||||
clean:
|
||||
rm -rf *~ */*~ *.hex *.elf *.o */*.o goodwatch githash.h html latex goodwatch.elf energytrace.png energytrace.txt
|
||||
rm -rf *~ */*~ *.hex *.elf *.o */*.o goodwatch githash.h buildtime.h html latex goodwatch.elf energytrace.png energytrace.txt
|
||||
erase:
|
||||
$(BSL) -e
|
||||
sbwflash: goodwatch.hex codeplug.hex
|
||||
mspdebug tilib "prog goodwatch.elf" "load codeplug.hex"
|
||||
|
||||
flash: goodwatch.hex
|
||||
$(BSL) -etf goodwatch.hex
|
||||
$(BSL) -ef goodwatch.hex
|
||||
dmesg:
|
||||
$(BSL) -P goodwatch.hex -uD
|
||||
sbwdmesg:
|
||||
|
@ -9,12 +9,15 @@
|
||||
#include "api.h"
|
||||
#include "apps/calibrate.h"
|
||||
|
||||
//Automatically generated, not a part of the git repo.
|
||||
#include "buildtime.h"
|
||||
|
||||
//! If this is 0xdeadbeef, the ram time is good.
|
||||
static unsigned long magicword __attribute__ ((section (".noinit")));
|
||||
//! Time and date, in case of a reboot.
|
||||
static unsigned char ramsavetime[8] __attribute__ ((section (".noinit")));
|
||||
//! ROM copy of the manufacturing time.
|
||||
unsigned char *romsavetime=(unsigned char*) 0xFF00;
|
||||
unsigned char *romsavetime=(unsigned char*) BUILDTIME;
|
||||
// Alarm tone status
|
||||
static unsigned int alarm_ringing = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user