DCM#1: Jump To Boot
The process of handling Jump to Boot request for serivce $10 DiagnosticSessionControl in Diagnostic Communication Manager module.
Let us first look at some of the DCM Config Parameters related to Jump To Boot process.
1. DcmDspSessionForBoot
This configuration parameter serves the following purposes
- Configures a diagnostic session as the one that needs to transition to boot.
- Further, it can identify two separate bootloaders. One for the OEM and one for the Supplier. Its use depends on the desing of the BSW for the ECU.
- Also, it specifies the source of the final positive response. This is can be either the application itself or the bootloader.
2. DcmSendRespPendOnTransToBoot
In case a response NRC_RCRRP_0x78 is needed to be sent before the jump to bootloader operation is performed, it can be enabled using this configuration. This done to ensure that the P2*Server timeout does not occur.
3. ModeDeclarationGroupPrototype DcmEcuReset
DcmEcuReset is the BswM ModeDeclarationGroupPrototype that is updated this operation. When the operation is requested the BswM mode is first switched to JUMPTOBOOTLOADER or JUMPTOSYSSUPPLIERBOOTLOADER and then to EXECUTE once all the checks are performed and the ECU is ready for reset.
Different possible cases
DCM supports 4 different implementations for the jump to boot operation. These implementations differ in the sequence in which sending the final positive response, sending the response pending negative response and the ECU Reset operation is performed.
Process of Jump to Boot in DCM
Step1: Switch mode of DcmEcuReset to trigger the BswM
In this step, mode of ModeDeclarationGroupPrototype DcmEcuReset is changed to JUMPTOBOOTLOADER or JUMPTOSYSSUPPLIERBOOTLOADER depending on value of DcmDspSessionForBoot. If the configuration parameter DcmDspSessionForBoot is set to DCM_OEM_BOOT or DCM_OEM_BOOT_RESPAPP then the DcmEcuReset is set to JUMPTOBOOTLOADER. This indicates that the jump will be performed to OEM bootloader. If the configuration parameter DcmDspSessionForBoot is set to DCM_SYS_BOOT or DCM_SYS_BOOT_RESPAPP then the DcmEcuReset is set to JUMPTOSYSSUPPLIERBOOTLOADER. This indicates that the jump will be performed to OEM bootloader.
If this step fails, DCM will terminate the current jump to bootloader operation and send a negative response with NRC_CNC_0x22.
If step is executed successfully, DCM moved on to the next step.
Step2: Send the response pending negative response
This is the step where the response pending negative response (NRC_RCRRP_0x78) is sent if the configuration parameter DcmSendRespPendOnTransToBoot is set to TRUE.
If this step fails, then the jump to bootloader process will be aborted and the diagnostic buffer will be unlocked, for the next request.
If this step is executed successfully, DCM will move on to the next step.
NOTE : If the request for session transition is made with the suppressPosRspMsgIndicationBit = 1 and this DcmSendRespPendOnTransToBoot is set to TRUE then the final positive response will be sent.
The positive response suppression is ignored when a response pending negative response (NRC_RCRRP_0x78) has been sent.
Step3: Send the final positive response
This step is applicable only when the DcmDspSessionForBoot is set to either DCM_SYS_BOOT_RESPAPP or DCM_OEM_BOOT_RESPAPP. This is the step where the final positive response will be sent by DCM before the ECU is reset for the jump to bootloader.
If the execution of this step fails, DCM will terminate the operation.
If this step is executed successfully, DCM will move on to the next step.
Step4: Call Dcm_SetProgConditions()
This step allows the Application to store relevant information prior to jumping to bootloader.
If a call to this function returns E_OK, DCM moves on to the next step. But if the call returns E_NOT_OK then the jump to bootloader operation will be terminated with negative response Condition not correct, NRC_CNC_0x22.
Step5: Mode Switch DcmEcuReset to EXECUTE
Now that all the checks are complete and any required responses are sent, the mode of the ModeDeclarationGroupPrototype DcmEcuReset is changed to EXECUTE. Application is not ready to perform the ECU reset operation.
Step6: Perform ECU Reset
This is part where actual reset is performed. Reset can be triggered by the forcing the execution of program from the first instruction or by letting the watchdog reset the controller.
Step7: In Boot
If the configuration parameter DcmDspSessionForBoot was set to DCM_OEM_BOOT or DCM_SYS_BOOT then the boot is expected to send the final positive response now.
In case the suppressPosRspMsgIndicationBit = 1 was set in the session control request sent to application, it is upto the implementation to honour the request here. There can be different ways to do this. The application needs to share the information with the boot via a shared memory location or a specific CPU register.