next up previous contents
Next: 4 Operation Up: 3 ADS Firmware Previous: 3.14 Science Data   Contents


3.15 Patching

To generate a patch file, you need the original source code (the QM SW is compiled from the RCS snapshot qm1 source). Now you have to write the new and the changed definitions in the file patch.fth.

patch.fth is the very last file included in the config file because the new definitions have to be added to the end of the dictionary. The changed words will replace the original ones. I add -P to the end of the new word (this is not needed but a good practice). Here I want to replace TC-Open-V1 by TC-Open-V1-P:

: TC-Open-V1-P ( a -- )
    [ serialio? ] IF( ." TC Open-V1, Hallo Tobias!" CR )ENDIF
    DROP
    Open-V1
;

To replace the original word by the new one you have to do the following:

' Dummy 2+ @ ' TC-Open-V1 2+ !
ASSIGN TC-Open-V1-P TO-DO TC-Open-V1
' TC-Open-V1 4 Write-Record

It is also easy to replace values of constants (only CREATE pseudo constants and not CONSTANT and EQU). In this example the patch change the constants Open_Landing and Repeat_Landing. There is no new directory entry needed.

1000 Open_Landing !             \ thrust [ms], new 1000 ms
Open_Landing
2 Write-Record

5 Repeat_Landing !              \ repeated thrusts for landing, only 5
Repeat_Landing
2 Write-Record

You can not replace an empty or very short colon definition, the definition has to be at least two words long (the definition : Plus + ; is only one word long, because the RET is included in the ADD). The patch-records (patch.txt) are automaticly generated by the compiler. The file patch.txt consists of records like this:

[address] [count (inbytes)] [words (max. 28)] [checksum]

the last record is an empty one. The checksum is the inverted sum of the address, the count, and all words. The last row is the count of all patches (in bytes). The count is needed for the TCs Apply Patches and Save Patches to test the consistency. patch.txt Example (Open_Landing and Repeat_Landing as defined before for qm1):

1252 0002 03E8 E9C3
1254 0002 0005 EDA4
0000 0000 FFFF
0016

These records will be sent by the telecommand Patch Record.

The generated binary is already changed and ready for testing. Therefore it is not needed to load and apply patches in the test phase.


next up previous contents
Next: 4 Operation Up: 3 ADS Firmware Previous: 3.14 Science Data   Contents
Peter Schmid 2001-05-18