[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Adding date/version information to project??

From: Matt.VanDeWerken
Subject: RE: [avr-gcc-list] Adding date/version information to project??
Date: Tue, 29 Nov 2005 15:15:16 +1000

Hi David/avr-gcc list:

The __DATE__ and __TIME__ macros as mentioned by others in this thread
are useful for timestamps. 

However, I'm having a problem getting my head around the following:

Suppose I create a version.c file, that contains those macros as progmem
strings, like this:

const progmem char BUILDDATE[] = "__DATE__ __TIME__"; /* or similar,
forget exact syntax */

Then, as suggested, I delete the version.o file (or, equivalently, touch
version.c) as the last step in the build process. 

Next I program my micro with the command "make program", and it has to
compile and link version.o; not just this time, but every time I program
the micro. Not necessarily a bad thing, except I now want another board
to have the same version of the software, so I "make program" that board
- same thing happens, and a different version.o file is created (with a
new date/time), which is NOT what I want, since I'd like to verify if
two different boards are running the same software.

There are a couple of possible solutions:

1. don't use "make program" to program the micro. I'd rather not have to
memorise the procedure for programming the micro, though.
2. Maybe there's something in the linker script that I can use. I'll
have to research linker scripts anyway (see "use specifin RAM location"
thread), so I think this is where I'll try to find a solution.

I'll let the list know of any results I come up with.

Matthew van de Werken - Electronics Engineer
CSIRO E&M - Rock Mass Characterisation - 1 Technology Court - Pullenvale
- 4069
p: (07) 3327 4142 * f: (07) 3327 4455 * e: address@hidden
"We do not inherit the earth from our ancestors, we borrow it from our
-- Native American Proverb

> -----Original Message-----
> From: David Kelly [mailto:address@hidden 
> Sent: Tuesday, 29 November 2005 3:01 PM
> To: Van De Werken, Matt (E&M, QCAT)
> Cc: address@hidden
> Subject: Re: [avr-gcc-list] Adding date/version information 
> to project??
> On Nov 28, 2005, at 10:20 PM, <address@hidden> wrote:
> > Hi all:
> >
> > I am looking for an automated way to update a static string 
> in program 
> > space when my project is built. Is there an easy way to do this,
> > either
> > by adding an extra target to the makefile, or some other way? I'd  
> > prefer
> > not to manually have to change the information, and I'd 
> also prefer  
> > for
> > it to NOT change when none of the other source files 
> change. That is,
> > the requirement is as follows:
> Incomplete, but this could get you started:
> Research the ability to run a script or executable from within  
> Windows gmake. Copy stdout into a Make variable something like this:
> CFLAGS += -DThe_Date_Is=`date`
> Create a project file named something like makedate.c and tweak the  
> Make rules so that makedate.c must be built for the situations you  
> wish the date to be updated.
> makedate.c would look something like:
> const char My_Build_Date[] = "The_Date_Is";
> gcc already has a bluzillion predefined environment variables. I  
> wouldn't be surprised that one contains date and time stamp, 
> lets check:
> % touch foo.h ; avr-cpp -dM foo.h
> Nope, didn't see a timestamp.
> --
> David Kelly N4HHE, address@hidden 
> ==============================================================
> ==========
> Whom computers would destroy, they must first drive mad.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]