Spin compiler request - date/time stamp & eeprom defaults
Peter Jakacki
Posts: 10,193
I have a simple request to make as an enhancement to the Spin compiler. I like to embed my version number in my compiled code with a date/time stamp as is possible in other compilers.
At present I have to update this stamp manually, I use a MSB to LSB stamp that is "YYMMDDHHmm" like this:
I would like to automate the stamp in a manner simiilar to this:
While I am on the subject of the compiler sometimes I like to place data in specific locations relative to the EEPROM as I also use it for configuration parameters. It would be nice to be able to define the addresses and the default contents in the Spin source in a similar manner to PASM.
That also means that I can reference the variable in hub memory with a simple long[noparse][[/noparse]@eebaud] rather than creating another variable and copying it.
*Peter*
P.S. make that long[noparse][[/noparse]eebaud]
Post Edited (Peter Jakacki) : 2/17/2009 1:32:02 AM GMT
At present I have to update this stamp manually, I use a MSB to LSB stamp that is "YYMMDDHHmm" like this:
byte " FIRMWARE: MODBUS SERIAL-TCP BRIDGE V1.0-0902171050",$0d,$0a,0
I would like to automate the stamp in a manner simiilar to this:
byte " FIRMWARE: MODBUS SERIAL-TCP BRIDGE V1.0",DATE,TIME,$0d,$0a,0
While I am on the subject of the compiler sometimes I like to place data in specific locations relative to the EEPROM as I also use it for configuration parameters. It would be nice to be able to define the addresses and the default contents in the Spin source in a similar manner to PASM.
EEPROM $7F00 eebaud long 9600 eeID long 4
That also means that I can reference the variable in hub memory with a simple long[noparse][[/noparse]@eebaud] rather than creating another variable and copying it.
*Peter*
P.S. make that long[noparse][[/noparse]eebaud]
Post Edited (Peter Jakacki) : 2/17/2009 1:32:02 AM GMT
Comments
Getting a bit more clever it could monitor the update time of your eeprom file and bump the version number or a build number to be included in the string.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
But it certainly would do the trick, I'll look into it.
Any ideas about the eeprom? I'm just defining it as constants at present and accessing them as long[noparse][[/noparse]eebaud] etc but it would probably be good if I didn't have to worry about the eeprom address at all. Maybe I could just define them as normal variables but use the @variable when I go to read or write it from eeprom like this -> i2c.write(@baud,baud). This means that the eeprom variables may be anywhere in the eeprom but it doesn't really matter although some applications use a LOAD/SAVE block for backup. These still leaves the requirement that variables be preset from eeprom at compile time. Ah, maybe next version.....
*Peter*
So It looks like it should work. Trying this out confirms that I can simply refer to the address of a variable to update that variable in eeprom. It will automatically be preset next time the Prop boots!
i2c.eewr(@baud,baud) ' updates the variable baud in it's corresponding location in the eeprom so that it is preset on boot
Still not preset at compile time but good enough and keeps the code simple.
*Peter*