CANopen Bootloader Documentation
Version 4.10.00
Loading...
Searching...
No Matches
mc_iap.h File Reference

Detailed Description

This file contains prototypes for In-Application Programming (IAP) functions. The IAP provides an interface to exchange data between the CANopen Bootloader and an application, as depicted in the following picture.

Data exchange between CANopen Bootloader and application

The functions declared in this header file are mutuallay exclusive used by the CANopen bootloader or the application. The Backup Register are intended to store values for data exchange between the CANopen Bootloader and the application. Since the functions are hardware platform dependent, the file mc_iap.c provides only dummy functions.

CANopen bootloader Application Description
McIapAppSizeLimit() - Maximum size of memory for application
McIapClearBootLock() - Clear CANopen bootloader locking
McIapGetBitrate() McIapSetBitrate() Configure bit-rate of CANopen bootloader
McIapSetModuleUid() McIapGetModuleUid() Configure hardware platform UID
McIapGetNodeId() McIapSetNodeId() Configure node-ID of CANopen bootloader
McIapIsBootLocked() McIapSetBootLock() Lock CANopen bootloader upon start
McIapJumpToApp() McIapJumpToBoot() Jump to application or CANopen bootloader
+ Include dependency graph for mc_iap.h:

Enumerations

enum  IAP_APP_e {
  eIAP_APP_INVALID_LEN = 0 ,
  eIAP_APP_INVALID_CRC ,
  eIAP_APP_VALID ,
  eIAP_APP_AUTOSTART
}
 

Functions

uint32_t McIapAppSizeLimit (void)
 
void McIapClearBootLock (void)
 
uint8_t McIapGetBitrate (void)
 
uint32_t McIapGetModuleUid (void)
 
uint8_t McIapGetNodeId (void)
 
uint8_t McIapIsAppValid (void)
 
bool_t McIapIsBootLocked (void)
 
void McIapJumpToApp (void)
 
void McIapJumpToBoot (void)
 
void McIapSetAppValid (bool btAppIsValidV)
 
void McIapSetBitrate (uint8_t ubBitrateSelV)
 
void McIapSetBootLock (void)
 
void McIapSetModuleUid (uint32_t ulModuleUidV)
 
void McIapSetNodeId (uint8_t ubNodeIdV)
 

Enumeration Type Documentation

◆ IAP_APP_e

enum IAP_APP_e

This enumeration defines values to mark an application as valid or not valid. The values are returned by the function McIapIsAppValid().

Enumerator
eIAP_APP_INVALID_LEN 

Application is not valid, because of wrong length

eIAP_APP_INVALID_CRC 

Application is not valid, because of wrong CRC

eIAP_APP_VALID 

Application is valid

eIAP_APP_AUTOSTART 

Start application automatically from bootloader

Function Documentation

◆ McIapAppSizeLimit()

uint32_t McIapAppSizeLimit ( void  )
Returns
Size in byte

This function returns the total number of available bytes for the application.

◆ McIapClearBootLock()

void McIapClearBootLock ( void  )

This function clears the boot-lock flag.

◆ McIapGetBitrate()

uint8_t McIapGetBitrate ( void  )
Returns
Nominal bit-rate value
See also
McIapSetBitrate

This function returns the nominal bit-rate value that was configured by the application. The value is defined by the enumeration CpBitrate_e. The CANopen bootloader uses this bit-rate value for CAN initialisation.

◆ McIapGetModuleUid()

uint32_t McIapGetModuleUid ( void  )
Returns
Unique module identification
See also
McIapSetModuleUid

This function returns the unique module identification, i.e. a hardware platform identifier. The value is used by the application in order to identify the hardware platform.

◆ McIapGetNodeId()

uint8_t McIapGetNodeId ( void  )
Returns
node-ID
See also
McIapSetNodeId

This function returns the node-ID value that was configured by the application. A valid value is in the range from 1 to 127. The bootloader uses this node-ID value for CAN initialisation.

◆ McIapIsAppValid()

uint8_t McIapIsAppValid ( void  )
Returns
Validation code
See also
McIapSetAppValid

This functions checks if the application is valid and returns an appropriate code. Possible return values are listed in the IAP_APP_e enumeration.

◆ McIapIsBootLocked()

bool_t McIapIsBootLocked ( void  )
Returns
Boot-lock value
See also
McIapSetBootLock

A boot-lock indicates that the bootloader needs to be started after power up, e.g. for a firmware update. The boot-lock prevents the start of an valid application. Possible return values are true or false.

◆ McIapJumpToApp()

void McIapJumpToApp ( void  )
See also
McIapJumpToBoot

This function starts the application. It is responsible for:

  • checking the application is valid
  • setting up the application stack
  • setting up the application interrupt vectors

◆ McIapJumpToBoot()

void McIapJumpToBoot ( void  )
See also
McIapJumpToApp

This function performs a jump to the CANopen bootloader. It is used by the application.

◆ McIapSetAppValid()

void McIapSetAppValid ( bool  btAppIsValidV)
Parameters
[in]btAppIsValidVvalidation flag
See also
McIapIsAppValid

The function is used to indicate if a stored application is valid. A value of true for parameter btAppIsValidV indicates that the application is a valid firmware and it can be executed. A value of false shall mark the application as invalid for execution.

◆ McIapSetBitrate()

void McIapSetBitrate ( uint8_t  ubBitrateSelV)
Parameters
[in]ubBitrateSelVbit-rate selection
See also
McIapGetBitrate

This function stores the parameter ubBitrateSelV value in non-volatile memory in order to be available by the bootloader after an IAP jump (McIapJumpToBoot()). The bootloader will use that bit-rate for CAN initialisation.

◆ McIapSetBootLock()

void McIapSetBootLock ( void  )
See also
McIapClearBootLock McIapIsBootLocked

A boot-lock indicates that the bootloader has to be started after a reset, e.g. for a firmware update.

This function is called by the application. The boot-lock value must be stored in a way that it is available for the bootloader (refer to McIapIsBootLocked()).

◆ McIapSetModuleUid()

void McIapSetModuleUid ( uint32_t  ulModuleUidV)
Parameters
[in]ulModuleUidVUnique ID for module
See also
McIapGetModuleUid

This function sets the unique module identification, i.e. a hardware platform identifier. The value is configured by the CANopen bootloader.

◆ McIapSetNodeId()

void McIapSetNodeId ( uint8_t  ubNodeIdV)
Parameters
ubNodeIdV- Node ID (1..127)
See also
McIapGetNodeId

This function shall store the parameter ubNodeIdV in non-volatile memory in order to be available by the CANopen bootloader after an IAP jump (McIapJumpToBoot()). The CANopen bootloader will use this node-ID value for CAN initialisation.