|
CCS Modul P_LOADFILE |
$Id: p_loadfile.C,v 1.24 2005/09/28 13:52:25 cvs Exp $
---------------------------------------------------------------------
Kurzbeschreibung: Load Files to SG over SKM/PSS
---------------------------------------------------------------------
Projekt: CCS
Sourcefile: p_loadfile.C
Autor: RtW2/TEF72-Wiese (13.09.00)
Zielsystem: HP9000/V743 (HP-RT 3.01)
Sprache: ANSI-C/C++
---------------------------------------------------------------------
Prototyp:
int p_loadfile
(shm_stringpointer *zeilen_wert // <I> Inputfield of INTERPRETERLIST
,long index1 // <I> INDEX in list
,long anzahl) // <I> Number of Elements for Loaddfile
---------------------------------------------------------------------
Aufruf:
error = p_loadfile
(zeilen_wert // <I> Inputfield of INTERPRETERLIST
,index1 // <I> INDEX in list
,anzahl) // <I> Number of Elements for Loaddfile
if (error != 0) // Errordescription ...
{
// Errorhandling ...
}
---------------------------------------------------------------------
Functiondescription:
This modul handel's the communication to the SKM/PSS for programming
SG's over serialcommunicationports. (Dolles Wort :-) )
This modul creates the files for programming by itself. p_loadfile
checks for files with the specified name (see make_flash_path.C in
project libser). If the file dosn'exist, this File will be created.
For creation, the process (vxi_pss/vxi_skm) forks.
The creation of the file could take about 60 Seconds (HEX - file with more
than 4 MB). Please change the Timeout of the Process (vxi_pss, vxi_skm)
in this way.
The long names for the files require a new Version of the firmware
SKM: Version >= 3.0
PSS: Version >= 6.3
The errormessage is F9: "Eingabe fehlerhaft" or "// or || not found...."
The you have to update the firmware.
Input parameter description:1 PRUEFSCHRITT:Step in plist2 POSITION:
Position of step3 CONTAINERTYP:
FSW -> Containertyp of File /hw/flash/%TTNR%/%SWNR& TSW -> Testsoftwarecontainer /hw/flash/tsw/%TSWNR% WP -> Factoryprogrammingcontainer /hw/flash/wp/%WPNR% (not implemented)4 DATEINAME:
Name of the File to be programmed A File with this name and extention ".hex" and ".s19" or with ".nop" has to be in the directory NOP: File with extention ".nop" is searched RBIN: A File with this filename has to exist.5 LADEMODUS:
BIN: Programming a bin-File of the Inputfile
SORTBIN1: Sorting for segmented Programming of Golden OAK
VLB: Variable Lengh File. The protokolls DS2 and K71
are implemented
NECF: Special mode for programming the Bootloader for Phoenix-F from NEC (APA)
NOP: A Nopfile will be convertet an programmed
PCC: Handle a PCC - File (not tested, inputs necessary)
RBIN: Send the File "as is" to the ECU without Protokoll
information.
ALD1: 2Byte Adress - 1 Byte Len - Data Mode: .
ALD2: 3Byte Adress - 1 Byte Len - Data Mode: .
AD1 : 3Byte Adress - Data Mode
DLM : (just for SKMlight) A downloadable "CAN-Restbussimulator" (Download Module, DLM)
is an executable, that can be downloaded into the RAM of the SKMlight at runtime
by the SKMlight firmware. A DLM extends the functionality of the firmware. At
one time, just one DLM can reside in the SKMlight. While a DLM is running, no
further download can be done.
SCRIPT_T32:
Is used for programming the DUT with the Lauterbach Tool
In DATEINAME is the data file name expected, which is needed for
Programming the DUT.
In START_ADR is the script name expected.
The TRACE32 is started and works the given script.
The parameter BLOCKLEN,SEGMENT_LEN must be set to "0".
The parameter SEGMENT_HEADER,SEGMENT_ENDE has to be empty.
The parameter SCHNITTSTELLE has to set to JTAG. The function
SCRIPT_T32 is only supported for this SCHNITTSTELLE.
If the script for the TRACE32 program needs parameters so the first
parameter is given in POSITIVE_RESP and the second is given in DATEINAME.
For IVS the parameters are <checksum> <datafilename>.
So the Command to TRACE32 is:
do "<scriptname> <checksum> <datafilename>"
or if DATEINAME and POSITIVE_RESP empty
do "<scriptname>"
Attention:
Every script must give back an "OK" message or an error message. Only with
an OK message the result of this step will be good.
STORE_<LADEMODUS> with LADEMODUS=BIN,VLB:
Is used to store the data of the file, signed in DATEINAME, in a field signed
in ERGEBNIS_FELD.
So you can work with the data of the file for example with the module p_zerlege_str.
VERIFY01:
The programmed Data will read back from the ECU and compared
with the modified File <DATEINAME> (equal to the <DATEINAME> if you want to program).
The String to the ECU is given with
<SEGMENT_HEADER><3 Byte START_ADR><SEGMENT_ENDE>
| | |
(i.e. 23 000000 10
| | |
Command 3 Byte Startadr. number of Bytes read back
means in KP2000 Read Request: from Adr 0 read back 16 Bytes)
So here <SEGMENT_ENDE> means the number of Date read back from
the ECU.
The START_ADR will incremented with SEGMENT_LEN from loop
to loop. So BLOCKLEN data from START_ADR will be verified.
SEGMENT_LEN must be identical to the data in one comunication block
from the ECU.
VERIFY02: like VERIFY01 but there are only 2 Byte START_ADR
<SEGMENT_HEADER><2 Byte START_ADR><SEGMENT_ENDE>
| | |
(i.e. 23 0000 10
| | |
Command 2 Byte Startadr. number of Bytes read back
VERIFY03 oder VERIFY_ALD2:
The programmed Data will read back from the ECU and compared
with the modified File <DATEINAME> (equal to the <DATEINAME> if you want to program).
The String to the ECU is given with
<SEGMENT_HEADER><3 Byte START_ADR><SEGMENT_LEN>
| | |
(i.e. 23 000000 10
| | |
Command 3 Byte Startadr. number of Bytes read back
means in KP2000 Read Request: from Adr 0 read back 16 Bytes)
The START_ADR will incremented with SEGMENT_LEN from loop
to loop. So BLOCKLEN data from START_ADR will be verified.
At the last block the SEGMENT_LEN will be modified automaticly so,
that only BLOCKLEN data are read back from the ECU.
VERIFY04 oder VERIFY_ALD1: like VERIFY03 but there are only 2 Byte START_ADR
<SEGMENT_HEADER><2 Byte START_ADR><SEGMENT_LEN>
| | |
(i.e. 23 0000 10
| | |
Command 2 Byte Startadr. number of Bytes read back
READ:
This mode is necessary to read back files from the SKM.
You must insert the filename in DATEINAME. The Data are stored
in ERGEBNIS_FELD as a string. You can check the data with
BLOCKINT or p_zerlege_str and m_auswertung.6 START_ADR:Startadress of the binary (hex). Default: 0 Not allowd by NOP, PCC and RBIN7 BLOCKLEN
Len of the Filesegment (dez). 0: the hole file Not allowd by NOP, PCC and RBIN8 SEGMENT_HEADER:
Header of the segment sended to the ECU (i.e. Blocktitle) (hex)9 SEGMENT_ENDE:
Trailer of the segment sended to the ECU (hex)10 SEGMENT_LEN:
Max length of the segment sended to the ECU. (dez)11 POSITIVE_RESP:
Response of the ECU after every segment (hex)12 SCHNITTSTELLE:
Line for kommunikation (only K and JTAG implemented)13 FEHLERFLAG:
Returns 0 for OK and 1 for ERROR14 ERGEBNIS:
Returns an resultstring like FILENAME OK15 ERGEBNIS_FELD:
Returns data into an STRING-Field if in parameter LADEMODUS
STORE_<lademodus> is used.
The Modul searches for Files with the name in DATEINAME.
If it is found, it is preread.
If ther is a 'S' in the beginning, it must be a Motorola - S - Record - File
If there is a ':' in the beginning, it must be a Intelhex - Record - File
If there is a "*STARTNOP" in the beginning of the File, it is a NOPFILE
else the File is used as a binary - File and send to the ecu as is.
If the file dosn't exist, for Files with extention ".s19", ".hex", ".bin" ".nop" is
searched. If it exists, the Filetype is used of the extention.
Mode VLB, NOP, AD1, ALD1 make a File for the SKM in Format VLB or VLB2
The SKM could interpret the File VLB: 1 Byte Len and Number Len - Data
For Files with a segmentlen of > 255 Format VLB2 is used
Since Version SKM V4.3 SKM could interpret VLB2:
1. "VLB2\0" at the top of the File
2. 4 - Byte Len of the following Bytes
3. Number of LEN Data
4. 2 Byte Checksumm - Summation of Block (1 - 3)