mirror of
https://github.com/travisgoodspeed/goodwatch
synced 2024-11-21 23:58:31 +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');
|
help='Prints the dmesg.',action='count');
|
||||||
parser.add_argument('-u','--unlock',
|
parser.add_argument('-u','--unlock',
|
||||||
help='Unlock BSL.',action='count');
|
help='Unlock BSL.',action='count');
|
||||||
parser.add_argument('-t','--time',
|
|
||||||
help='Set the Time.',action='count');
|
|
||||||
parser.add_argument('-r','--rate',
|
parser.add_argument('-r','--rate',
|
||||||
help='Baud Rate', default=9600);
|
help='Baud Rate', default=9600);
|
||||||
|
|
||||||
@ -371,16 +369,22 @@ if __name__=='__main__':
|
|||||||
if args.file!=None:
|
if args.file!=None:
|
||||||
print "Writing %s as Intel hex." % args.file
|
print "Writing %s as Intel hex." % args.file
|
||||||
bsl.writeihexfile(args.file);
|
bsl.writeihexfile(args.file);
|
||||||
if args.time!=None:
|
|
||||||
lt=time.localtime()
|
## Peviously, we manually wrote the time to 0xFF00. This is now
|
||||||
#See firmware/rtc.c for the format.
|
## handled by buildtime.h, but I wouldn't object to writing the
|
||||||
timestr=(
|
## time to SRAM. --Travis
|
||||||
#Hour, Minute, Second first.
|
|
||||||
chr(lt.tm_hour)+chr(lt.tm_min)+chr(lt.tm_sec)+"\xFF"+
|
# if args.time!=None:
|
||||||
#u16 Year, u8 Month, u8 Day
|
# lt=time.localtime()
|
||||||
chr(lt.tm_year&0xFF)+chr(lt.tm_year>>8)+chr(lt.tm_mon)+chr(lt.tm_mday)
|
# #See firmware/rtc.c for the format.
|
||||||
);
|
# timestr=(
|
||||||
bsl.write(0xFF00,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:
|
if args.dump!=None:
|
||||||
coredump(bsl);
|
coredump(bsl);
|
||||||
if args.dmesg!=None:
|
if args.dmesg!=None:
|
||||||
|
1
firmware/.gitignore
vendored
1
firmware/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
config.h
|
config.h
|
||||||
|
buildtime.h
|
||||||
libs/assembler
|
libs/assembler
|
||||||
|
@ -87,10 +87,13 @@ apps= $(APPS_OBJ)
|
|||||||
|
|
||||||
all: goodwatch.hex
|
all: goodwatch.hex
|
||||||
|
|
||||||
*.c: githash.h
|
*.c: githash.h buildtime.h
|
||||||
|
|
||||||
githash.h:
|
githash.h:
|
||||||
echo "#define GITHASH" 0x`git rev-parse HEAD | head -c7` > 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
|
goodwatch.elf: $(modules) $(apps) *.h
|
||||||
$(CC) -T msp430.x -o goodwatch.elf $(modules) $(apps)
|
$(CC) -T msp430.x -o goodwatch.elf $(modules) $(apps)
|
||||||
../bin/printsizes.py goodwatch.elf || echo "Please install python-pyelftools."
|
../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
|
msp430-objcopy -O ihex goodwatch.elf goodwatch.hex
|
||||||
|
|
||||||
clean:
|
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:
|
erase:
|
||||||
$(BSL) -e
|
$(BSL) -e
|
||||||
sbwflash: goodwatch.hex codeplug.hex
|
sbwflash: goodwatch.hex codeplug.hex
|
||||||
mspdebug tilib "prog goodwatch.elf" "load codeplug.hex"
|
mspdebug tilib "prog goodwatch.elf" "load codeplug.hex"
|
||||||
|
|
||||||
flash: goodwatch.hex
|
flash: goodwatch.hex
|
||||||
$(BSL) -etf goodwatch.hex
|
$(BSL) -ef goodwatch.hex
|
||||||
dmesg:
|
dmesg:
|
||||||
$(BSL) -P goodwatch.hex -uD
|
$(BSL) -P goodwatch.hex -uD
|
||||||
sbwdmesg:
|
sbwdmesg:
|
||||||
|
@ -9,12 +9,15 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include "apps/calibrate.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.
|
//! If this is 0xdeadbeef, the ram time is good.
|
||||||
static unsigned long magicword __attribute__ ((section (".noinit")));
|
static unsigned long magicword __attribute__ ((section (".noinit")));
|
||||||
//! Time and date, in case of a reboot.
|
//! Time and date, in case of a reboot.
|
||||||
static unsigned char ramsavetime[8] __attribute__ ((section (".noinit")));
|
static unsigned char ramsavetime[8] __attribute__ ((section (".noinit")));
|
||||||
//! ROM copy of the manufacturing time.
|
//! ROM copy of the manufacturing time.
|
||||||
unsigned char *romsavetime=(unsigned char*) 0xFF00;
|
unsigned char *romsavetime=(unsigned char*) BUILDTIME;
|
||||||
// Alarm tone status
|
// Alarm tone status
|
||||||
static unsigned int alarm_ringing = 0;
|
static unsigned int alarm_ringing = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user