Device Firmware Update (DFU) Middleware Library 5.1
Application Management

General Description

DFU Functions for application management.

Functions

void Cy_DFU_ExecuteApp (uint32_t appId)
 This function transfers control from the current application to another application. More...
 
void Cy_DFU_OnResetApp0 (void)
 This function is used in an App0 firmware image in Reset_Handler() only. More...
 
uint32_t Cy_DFU_GetRunningApp (void)
 This function reports the application number of the currently running application. More...
 
cy_en_dfu_status_t Cy_DFU_SwitchToApp (uint32_t appId)
 This function switches to the application through the jump instruction. More...
 
cy_en_dfu_status_t Cy_DFU_CopyApp (uint32_t destAddress, uint32_t srcAddress, uint32_t length, uint32_t rowSize, cy_stc_dfu_params_t *params)
 This function copies an application from a temporary location in flash to its destination location in flash. More...
 
cy_en_dfu_status_t Cy_DFU_ValidateApp (uint32_t appId, cy_stc_dfu_params_t *params)
 This function reports whether or not metadata and the specified application is valid. More...
 

Function Documentation

◆ Cy_DFU_ExecuteApp()

void Cy_DFU_ExecuteApp ( uint32_t  appId)

This function transfers control from the current application to another application.

The function performs switching via software reset. In case if application need to switch without reset, for example if it needs to enable some peripheral during and after the application switching, use Cy_DFU_SwitchToApp(). The function does not return.

Note
It is assumed appId is a valid application number.
Parameters
appIdAn application number of the application to switch to.

◆ Cy_DFU_OnResetApp0()

void Cy_DFU_OnResetApp0 ( void  )

This function is used in an App0 firmware image in Reset_Handler() only.

Checks if switching to the other application is scheduled with Cy_DFU_ExecuteApp().
If the switch is scheduled, then it validates the application and transfers control to it.

◆ Cy_DFU_GetRunningApp()

uint32_t Cy_DFU_GetRunningApp ( void  )

This function reports the application number of the currently running application.

Returns
application number

◆ Cy_DFU_SwitchToApp()

cy_en_dfu_status_t Cy_DFU_SwitchToApp ( uint32_t  appId)

This function switches to the application through the jump instruction.

The function should be used when an application switching must be done without a software reset. Possible reason is a need to enable some peripheral during and after the application switching. In other case use Cy_DFU_ExecuteApp().

Before calling this function, ensure all the peripherals and bus masters are in a known state. User is responsible to disable peripherals and to set MCU internal state before or after an application switching.

Note
It is assumed appId is a valid application number.
Parameters
appIdAn application number of the application to switch to.
Returns
It doesn't return if succeeds. If failed, returns the status code. See cy_en_dfu_status_t.

◆ Cy_DFU_CopyApp()

cy_en_dfu_status_t Cy_DFU_CopyApp ( uint32_t  destAddress,
uint32_t  srcAddress,
uint32_t  length,
uint32_t  rowSize,
cy_stc_dfu_params_t params 
)

This function copies an application from a temporary location in flash to its destination location in flash.

This function is typically called when updating an application used as part of an update process, for example updating a BLE stack.

Note
This API is only for demonstration purpose, use it only when copying from internal flash to internal flash. For other user cases, implement a custom, more general function.
Parameters
destAddressThe start address of the application to copy to.
srcAddressThe start address of the copy of the application to be copied.
lengthThe number of bytes to copy.
rowSizeThe size of a flash row in bytes.
paramsThe pointer to a DFU parameters structure. See cy_stc_dfu_params_t .
Returns
See cy_en_dfu_status_t.

◆ Cy_DFU_ValidateApp()

cy_en_dfu_status_t Cy_DFU_ValidateApp ( uint32_t  appId,
cy_stc_dfu_params_t params 
)

This function reports whether or not metadata and the specified application is valid.

It checks:

  • checksum for applications without format;
  • application signature for Cypress Standard User Application format.

This is a weak function and the user may override it in the user's code by providing a function with the same name.

Note
It is assumed appId is a valid application number.
Parameters
appIdThe application number of the application to be validated.
paramsThe pointer to a DFU parameters structure. See cy_stc_dfu_params_t .
Returns
See cy_en_dfu_status_t.