StandardEcuReprogramming Part4 BootloaderMechanisms
StandardEcuReprogramming Part4 BootloaderMechanisms
0001-4 2009/01/29
Nissan
Version Page 1/17
Peugeot Citroën Automobile 1.0
Comment:
This document describes internal mechanisms of the boot-loader used for the programming procedure.
AUTHORS(S)
Name :
Gilles Michard (Renault SAS)
Cédric Meunier (Peugeot Citroën Automobile)
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 2/17
1 Revision summary
th
1.0 January 29 , 2009 First edition
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 3/17
2 Content
3 PURPOSE
This document is a part of Standard ECU reprogramming specification package. This package is
divided into five parts, consistent to each others.
Zone ...
Zone ...
Application specific
Hardware specific
BOOT
Tool
Lower layers
Lower layers (Boot)
(Application)
E²PROM
Hardware FLASH
RAM
The Standard ECU reprogramming package contains specification on boot, how it interfere with
application (application reprogramming and launch), with tool (how to reprogram an application,
conformity test) and means to test the boot.
This part is related to internal boot-loader mechanisms. It specifies how standard boot-loader reacts
on its input/output stimulation.
BOOT_PROG_SESSION
BOOT_SA_UNLOCK_REQ
BOOT_WRITE_DIGEST
BOOT_REQ_DOWNLOAD
Boot/Tool
BOOT_TRANSFER_DATA
BOOT_RUNDTCTEST
BOOT_GET_LOGICALBLOCK_INFO
Boot/Lower layer
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 6/17
4 APPLICABLE DOCUMENTS
5 TERMINOLOGY
5.1 Glossary
5.3 Conventions
A requirement can be followed by two row, a rationale and a comment that can help the reader to
understand the requirement.
For an easy identification of the requirement scope, the following method has been adopted: STD-
DIAG-TS.nnnn(V)
where:
STD : For standard requirement
PRG : For programming related requirement.
4 : For part 4 related requirement.
TS : For technical specifications
nnnn : Requirement Identifier number (from 0000 à 9999)
V : Requirement version number
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 8/17
6 REQUIREMENTS
6.1 General
STD-PRG4-TS.0300(1) The boot-loader must support reset at any time.
Rationale A loss of power supply must not cause the loss of the ECU.
Comment
STD-PRG4-TS.0301(1) The boot-loader must contain no other procedures than described into this
document to modify data contained in the Logical Blocks.
Rationale Avoid to provide backdoors that could be use for ECU hacking.
Comment
Code that is able to modify memory must be protected against unexpected execution.
STD-PRG4-TS.0003(1) Some Logical Blocks are associated with DTC(Logical Block ID, system
internal failures/General memory failure).. This DTC provides information on
the integrity of physical memory. Its ISO 15031-6 failure type is 0x42
Rationale -
Comment This subtype is used by the control module to indicate that the ECU is subject
to a memory hardware failure.
STD-PRG4-TS.0004(1) Each DTC provides the information that it has not been tested since last clear.
Rationale -
Comment Each DTC of the Boot-loader must support the status
testNotCompletedSinceLastClear-
STD-PRG4-TS.0005(1) If applicable, the Boot-loader implements a DTC that gives information on its
general failure state.
Rationale -
Comment -
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 9/17
6.2.2 Counters
STD-PRG4-TS.0010 (1) In case the Logical Block is contained into a memory with a programming limit,
the DTC(Logical Block ID, system internal failures/General memory failure)
must be supported.
Note: A Logical Block can be based on several memory types (several segments) with several
programming limit. LOGICAL_BLOK_REPROG_CNTR(Logical Block ID) must reflect the lowest limit.
Into the following example, the Logical Block is composed of 3 segments of memory.
STD-PRG4-TS.0011(1) In case the Logical Block is contained into a memory with a programming limit,
for each Logical Block, when the LOGICAL_BLOK_REPROG_CNTR(Logical
Block ID) reach the value 0, BOOT_REQ_DOWNLOAD is refused.
Rationale -
Comment In this case, NRC 0x70 should be used.
STD-PRG4-TS.0012(1) In case the Logical Block is contained into a memory without a programming
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 10/17
Boot-loader activity diagram is represented into Figure 2 - Boot-loader activity diagram part #1and
Figure 3 - Boot-loader activity diagram part #2.
Application Boot
PWR
External power up
On
STD-PRG4-
TS.0101(1)
HW Initialization
STD-PRG4-
TS.0102(1)
Boot Initialization
STD-PRG4-
TS.0103(1)
programming module
DTC testFail or not
STD-PRG4- completed?
No
TS.0104(1)
Yes
STD-PRG4-
TS.0105(1)
Application initialization
Application Boot
Default Session Default Session
STD-PRG4-
TS.0106(1)
A
Initialize memory Hanlder
STD-PRG4-TS.0101(1) After external ECU power up, Boot-loader starts its hardware initialization
Rationale -
Comment -
STD-PRG4-TS.0102(1) After ECU's hardware initialization, the Boot-loader starts its software
initialization. The Boot-loader initialization contains only the steps necessary to
handle the subsequent decision step of starting application.
Rationale -
Comment -
STD-PRG4-TS.0103(1) After ECU's software Boot-loader initialization, the Boot-loader checks the
status of its DTCs
Rationale -
Comment -
STD-PRG4-TS.0104(1) After Boot-loader DTC status check, if every DTC are tested and every tests
returns no error, Boot-loader enable application running.
Rationale Checking DTC ensure that each Logical Block contains data that correspond
to there associated digests
Ref: 0001-4 Standard ECU reprogramming Part 4 - Boot-loader mechanisms Page 12/17
Comment The mean of switching to the application is not described into this
specification.
STD-PRG4-TS.0105(1) After Boot-loader DTC status check, if at least a DTC is not tested or indicate
an error, the Boot-loader goes into its Default Session. Any remaining boot-
loader initialization must be performed at this step.
Rationale If a DTC indicates that a test is not passed or returns an error, Boot-loader
must not enable application running.
Comment -
STD-PRG4-TS.0108(1)
Rationale
Comment
STD-PRG4-TS.0220(1)
Rationale
Comment
STD-PRG4-TS. 0203(1) Each Logical Block is associated to a 16 bits DataIdentifier. Its datatRecord
contains the Digest expected value. The value of the Dataidentifier is the 16
highest bits of the associated programmed/not programmed DTC.
Rationale This simplify communication between tool and Boot-loader
Comment -
STD-PRG4-TS.0212(1) When writing digest procedure is over, the Boot-loader goes back to its Idle
states.
Rationale -
Comment -
STD-PRG4-TS.0214(1) When preparing scratchpad download procedure is over, the Boot-loader goes
back to its Idle states.
Rationale
Comment -
download, Logical Block DTC's states are tested. In case the associated DTC
is not tested or indicates an error:
• The associated DTC state is cleared, this mean that its states
indicates that the test has not been passed.
• The memory handler is initialized accordingly.
MEMORY_HDLR_STATE goes into OPEN state.
When all the above steps are accomplished, the positive response to
BOOT_REQ_DOWNLOAD is returned.
Rationale If an ECU Logical Block is operational (DTC indicates no error), it must be
unlocked to be modified.
If it's not operational, no unlocking is requested.
This prevent unauthorized user to invalidate a Logical Block by modify its
Digest.
Comment Once Logical Block digest is written, the BOOT_REQ_DOWNLOAD can later
be performed without any BOOT_SA_UNLOCK_REQ.
STD-PRG4-TS.0215(1) When preparing download procedure is over, the Boot-loader goes back to its
Idle states.
Rationale -
Comment -
STD-PRG4-TS.0217(1) When transfer data procedure is over, the Boot-loader goes back to its Idle
states.
Rationale -
Comment If transfer data was related to scratchpad, authenticity check can be
performed. If it's not ok, transferred are erased.
STD-PRG4-TS.0218(1) When autocontrol procedure is over, the Boot-loader goes back to its Idle
states.
Rationale -
Comment -
If reprogrammable memory needs erasing before being written, this operation can be triggered on
BOOT_REQ_DOWNLOAD.
STD-PRG4-TS.0400(1) Logical Block's segments address and size are statically defined.
Rationale -
Comment -
STD-PRG4-TS.0403(1) For a Logical Block, data that are not transferred using the
BOOT_TRANSFER_DATA interface must be known by the tool.
Rationale ECU must ensure that the Digest can be also processed by the tool. This
implies that for a Logical Block, bytes that haven't been transferred by
BOOT_TRANSFER_DATA are all known by the tool.
Comment This can be performed by an erasing of the entire Logical Block before being
programmed.
Rationale -
Comment -
STD-PRG4-TS.0502(1) ECU must check if signature of scratchpad match with authorized signature
when close procedure of RAM Handler is called.
Rationale -
Comment System supplier is responsible for providing signed memory handling routines.
STD-PRG4-TS.0503(1) If scratchpad signature does not match with authorized signature, default
memory handler is reload into scratchpad.
Rationale -
Comment -
Interface implementations:
- Default Handler: resident in boot. Stub (returns NRC 22 on Open)
- Flash write capable routines (resident or contained in Scratchpad).
- RAM Handler: resident in boot, write into Scratchpad.