| BlueNRG-1 HAL drivers APIs

- Main Page
- Classes
- Files

- File List
- File Members

Macros | Functions | Variables
OTA_btl.h File Reference

BlueNRG-1 OTA Bootloader header file. More...

Go to the source code of this file.

## Macros

#define | PRINTF(...)
#define | FLASH_PAGE_SIZE 2048
| Flash erase basic unit. More...
#define | RESET_MANAGER_FLASH_BASE_ADDRESS (0x10040000)
| Reset manager base address. More...
#define | RESET_MANAGER_FLASH_BASE_OFFSET (0x800)
| Reset manager size: it defines the lower application base address (and the OTA Service Manger base address) More...
#define | OTA_BASIC_APPLICATION_BASE_OFFSET (0x10000)
| OTA Service Manager size: address offset for BLE application using OTA Service Manager. More...
#define | HIGHER_APPLICATION_BASE_OFFSET (0x13800)
| Address offset for BLE application with OTA service based on Higher Flash Location. More...
#define | OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS 38 /* 38 * 2048 = 76K */
| Numbers of sectors for Lower & Higher Application. More...
#define | OTA_RESET_MANAGER_PAGE_NUMBER_START 0
| OTA Reset manager page numbers start and numbers of pages): don't change them. More...
#define | OTA_RESET_MANAGER_PAGE_NUMBERS (RESET_MANAGER_FLASH_BASE_OFFSET/FLASH_PAGE_SIZE)
#define | OTA_LOWER_APPLICATION_PAGE_NUMBER_START (OTA_RESET_MANAGER_PAGE_NUMBER_START + OTA_RESET_MANAGER_PAGE_NUMBERS)
| OTA Lower application page numbers start, end, start address and end boundary: don't change them. More...
#define | OTA_LOWER_APPLICATION_PAGE_NUMBER_END (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS)
#define | APP_LOWER_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + RESET_MANAGER_FLASH_BASE_OFFSET)
#define | APP_LOWER_ADDRESS_END APP_LOWER_ADDRESS + (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS*FLASH_PAGE_SIZE)
#define | OTA_HIGHER_APPLICATION_PAGE_NUMBER_START (OTA_LOWER_APPLICATION_PAGE_NUMBER_END + 1)
| OTA Higher application page numbers start, end, start address and end boundary: don't change them. More...
#define | OTA_HIGHER_APPLICATION_PAGE_NUMBER_END (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS*2)
#define | APP_HIGHER_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + HIGHER_APPLICATION_BASE_OFFSET)
#define | APP_HIGHER_ADDRESS_END APP_HIGHER_ADDRESS + (((OTA_HIGHER_APPLICATION_PAGE_NUMBER_END - OTA_HIGHER_APPLICATION_PAGE_NUMBER_START)+1)*FLASH_PAGE_SIZE)
#define | APP_OTA_SERVICE_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS)
| OTA Service Manager application address,page numbers start, end: don't change them. More...
#define | APP_WITH_OTA_SERVICE_PAGE_NUMBER_START (OTA_BASIC_APPLICATION_BASE_OFFSET)/FLASH_PAGE_SIZE
#define | APP_WITH_OTA_SERVICE_PAGE_NUMBER_END (OTA_HIGHER_APPLICATION_PAGE_NUMBER_END + 1)
#define | APP_WITH_OTA_SERVICE_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + OTA_BASIC_APPLICATION_BASE_OFFSET)
| OTA application with OTA Service manager address: don't change them. More...
#define | OTA_NO_OPERATION (0x11)
| OTA application validity tags: don't change them. More...
#define | OTA_APP_SWITCH_OP_CODE_NO_OPERATION (0xb0014211)
#define | OTA_APP_SWITCH_OP_CODE_GO_TO_LOWER_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*2))
#define | OTA_APP_SWITCH_OP_CODE_GO_TO_HIGHER_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*3))
#define | OTA_APP_SWITCH_OP_CODE_GO_TO_OTA_SERVICE_MANAGER (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*4))
#define | OTA_APP_SWITCH_OP_CODE_GO_TO_NEW_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*5))
#define | OTA_SERVICE_MANAGER_RAM_LOCATION (0x20000004)
| Compiler/Linker options to be used on project preprocessor options based on specific application scenario: don't change them. More...
#define | OTA_SET_SERVICE_MANAGER_RAM_LOCATION (*(uint32_t *)(OTA_SERVICE_MANAGER_RAM_LOCATION))
| OTA Service Manager utility to set the magic location value: don't change it. More...
#define | OTA_TAG_VECTOR_TABLE_ENTRY_INDEX (4)
| Vector table entry used to register OTA application validity tag. More...
#define | OTA_TAG_VECTOR_TABLE_ENTRY_OFFSET (OTA_TAG_VECTOR_TABLE_ENTRY_INDEX * 4)
| Address offset for vector table entry used to register OTA application validity tag. More...
#define | OTA_IN_PROGRESS_TAG (0xFFFFFFFF)
| Application flag values to register application validity on OTA_TAG_VECTOR_TABLE_ENTRY_INDEX as consequence of an OTA upgrade: More...
#define | OTA_INVALID_OLD_TAG (0x00000000)
| OTA invalid, old tag: it tags old application as invalid/old (OTA upgrade done and jump to new application) More...
#define | OTA_VALID_TAG (0xAA5555AA)
| OTA valid tag: it tags new application as valid (It is done after a OTA upgrade process is completed with success: as consequence of a SW reset to OTA Reset Manager) More...
#define | OTA_SERVICE_MANAGER_TAG (0xAABBCCDD)
| OTA Service Manager valid tag: It tags OTA Service manager as valid. More...

## Functions

void | OTA_Write_Request_CB (uint16_t attr_handle, uint8_t data_length, uint8_t *att_data)
| This function handles the OTA bootloader updgrade. It is called on the aci_gatt_attribute_modified_event() callback context for handling the the specific characteristic wirte coming from the OTA Client. More...
uint8_t | OTA_Add_Btl_Service (void)
| Add the 'OTABootloader' service. More...
uint8_t | OTA_Tick (void)
| It returns the OTA upgrade fw status. More...
void | OTA_Jump_To_New_Application (void)
| It jumps to the new upgraded application. More...
void | OTA_Jump_To_Service_Manager_Application (void)
| It jumps to the OTA Service Manager application. More...

## Variables

uint8_t | BTLServiceUUID4Scan []
| OTA Service UUID. More...

## Detailed Description

BlueNRG-1 OTA Bootloader header file.

Author
  AMS - VMA RF Application team

Version
  V1.0.0

Date
  30-November-2015

Attention

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

##
© COPYRIGHT 2015 STMicroelectronics

Definition in file OTA_btl.h.

## Macro Definition Documentation

#define APP_HIGHER_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + HIGHER_APPLICATION_BASE_OFFSET)

Definition at line 75 of file OTA_btl.h.

#define APP_HIGHER_ADDRESS_END APP_HIGHER_ADDRESS + (((OTA_HIGHER_APPLICATION_PAGE_NUMBER_END - OTA_HIGHER_APPLICATION_PAGE_NUMBER_START)+1)*FLASH_PAGE_SIZE)

Definition at line 76 of file OTA_btl.h.

#define APP_LOWER_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + RESET_MANAGER_FLASH_BASE_OFFSET)

Definition at line 69 of file OTA_btl.h.

#define APP_LOWER_ADDRESS_END APP_LOWER_ADDRESS + (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS*FLASH_PAGE_SIZE)

Definition at line 70 of file OTA_btl.h.

#define APP_OTA_SERVICE_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS)

OTA Service Manager application address,page numbers start, end: don't change them.

Definition at line 79 of file OTA_btl.h.

#define APP_WITH_OTA_SERVICE_ADDRESS (RESET_MANAGER_FLASH_BASE_ADDRESS + OTA_BASIC_APPLICATION_BASE_OFFSET)

OTA application with OTA Service manager address: don't change them.

Definition at line 85 of file OTA_btl.h.

#define APP_WITH_OTA_SERVICE_PAGE_NUMBER_END (OTA_HIGHER_APPLICATION_PAGE_NUMBER_END + 1)

Definition at line 81 of file OTA_btl.h.

#define APP_WITH_OTA_SERVICE_PAGE_NUMBER_START (OTA_BASIC_APPLICATION_BASE_OFFSET)/FLASH_PAGE_SIZE

Definition at line 80 of file OTA_btl.h.

#define FLASH_PAGE_SIZE 2048

Flash erase basic unit.

Definition at line 42 of file OTA_btl.h.

#define HIGHER_APPLICATION_BASE_OFFSET (0x13800)

Address offset for BLE application with OTA service based on Higher Flash Location.

Definition at line 57 of file OTA_btl.h.

#define OTA_APP_SWITCH_OP_CODE_GO_TO_HIGHER_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*3))

Definition at line 92 of file OTA_btl.h.

#define OTA_APP_SWITCH_OP_CODE_GO_TO_LOWER_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*2))

Definition at line 91 of file OTA_btl.h.

#define OTA_APP_SWITCH_OP_CODE_GO_TO_NEW_APP (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*5))

Definition at line 94 of file OTA_btl.h.

#define OTA_APP_SWITCH_OP_CODE_GO_TO_OTA_SERVICE_MANAGER (OTA_APP_SWITCH_OP_CODE_NO_OPERATION + (OTA_NO_OPERATION*4))

Definition at line 93 of file OTA_btl.h.

#define OTA_APP_SWITCH_OP_CODE_NO_OPERATION (0xb0014211)

Definition at line 90 of file OTA_btl.h.

#define OTA_BASIC_APPLICATION_BASE_OFFSET (0x10000)

OTA Service Manager size: address offset for BLE application using OTA Service Manager.

Definition at line 54 of file OTA_btl.h.

#define OTA_HIGHER_APPLICATION_PAGE_NUMBER_END (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS*2)

Definition at line 74 of file OTA_btl.h.

#define OTA_HIGHER_APPLICATION_PAGE_NUMBER_START (OTA_LOWER_APPLICATION_PAGE_NUMBER_END + 1)

OTA Higher application page numbers start, end, start address and end boundary: don't change them.

Definition at line 73 of file OTA_btl.h.

#define OTA_IN_PROGRESS_TAG (0xFFFFFFFF)

Application flag values to register application validity on OTA_TAG_VECTOR_TABLE_ENTRY_INDEX as consequence of an OTA upgrade:

OTA in progress tag: it is sets on vector table during OTA upgrade

Definition at line 176 of file OTA_btl.h.

#define OTA_INVALID_OLD_TAG (0x00000000)

OTA invalid, old tag: it tags old application as invalid/old (OTA upgrade done and jump to new application)

Definition at line 181 of file OTA_btl.h.

#define OTA_LOWER_APPLICATION_PAGE_NUMBER_END (OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS)

Definition at line 68 of file OTA_btl.h.

#define OTA_LOWER_APPLICATION_PAGE_NUMBER_START (OTA_RESET_MANAGER_PAGE_NUMBER_START + OTA_RESET_MANAGER_PAGE_NUMBERS)

OTA Lower application page numbers start, end, start address and end boundary: don't change them.

Definition at line 67 of file OTA_btl.h.

#define OTA_LOWER_HIGHER_APPLICATION_AVAILABLE_SECTORS_NUMBERS 38 /* 38 * 2048 = 76K */

Numbers of sectors for Lower & Higher Application.

Definition at line 60 of file OTA_btl.h.

#define OTA_NO_OPERATION (0x11)

OTA application validity tags: don't change them.

Definition at line 89 of file OTA_btl.h.

#define OTA_RESET_MANAGER_PAGE_NUMBER_START 0

OTA Reset manager page numbers start and numbers of pages): don't change them.

Definition at line 63 of file OTA_btl.h.

#define OTA_RESET_MANAGER_PAGE_NUMBERS (RESET_MANAGER_FLASH_BASE_OFFSET/FLASH_PAGE_SIZE)

Definition at line 64 of file OTA_btl.h.

#define OTA_SERVICE_MANAGER_RAM_LOCATION (0x20000004)

Compiler/Linker options to be used on project preprocessor options based on specific application scenario: don't change them.

Options for Higher Application with OTA: Compiler option: ST_OTA_HIGHER_APPLICATION=1 Linker Option: ST_OTA_HIGHER_APPLICATION=1OTA Service Manager defines values magic location in RAM: don't change it

Definition at line 162 of file OTA_btl.h.

#define OTA_SERVICE_MANAGER_TAG (0xAABBCCDD)

OTA Service Manager valid tag: It tags OTA Service manager as valid.

Definition at line 190 of file OTA_btl.h.

#define OTA_SET_SERVICE_MANAGER_RAM_LOCATION (*(uint32_t *)(OTA_SERVICE_MANAGER_RAM_LOCATION))

OTA Service Manager utility to set the magic location value: don't change it.

Definition at line 164 of file OTA_btl.h.

#define OTA_TAG_VECTOR_TABLE_ENTRY_INDEX (4)

Vector table entry used to register OTA application validity tag.

Definition at line 167 of file OTA_btl.h.

#define OTA_TAG_VECTOR_TABLE_ENTRY_OFFSET (OTA_TAG_VECTOR_TABLE_ENTRY_INDEX * 4)

Address offset for vector table entry used to register OTA application validity tag.

Definition at line 169 of file OTA_btl.h.

#define OTA_VALID_TAG (0xAA5555AA)

OTA valid tag: it tags new application as valid (It is done after a OTA upgrade process is completed with success: as consequence of a SW reset to OTA Reset Manager)

Definition at line 186 of file OTA_btl.h.

#define PRINTF | ( |  | ... | ) |

Definition at line 34 of file OTA_btl.h.

#define RESET_MANAGER_FLASH_BASE_ADDRESS (0x10040000)

Reset manager base address.

Definition at line 45 of file OTA_btl.h.

#define RESET_MANAGER_FLASH_BASE_OFFSET (0x800)

Reset manager size: it defines the lower application base address (and the OTA Service Manger base address)

Definition at line 51 of file OTA_btl.h.

## Function Documentation

uint8_t OTA_Add_Btl_Service | ( | void |  | ) |

Add the 'OTABootloader' service.

Parameters

  None. |

Return values

  Value | indicating success or error code.

Note
  The API code could be subject to change in future releases.

void OTA_Jump_To_New_Application | ( | void |  | ) |

It jumps to the new upgraded application.

Parameters

  None |

Return values

  None |

Note
  The API code could be subject to change in future releases.

void OTA_Jump_To_Service_Manager_Application | ( | void |  | ) |

It jumps to the OTA Service Manager application.

Parameters

  None |

Return values

  None |

Note
  The API code could be subject to change in future releases.

uint8_t OTA_Tick | ( | void |  | ) |

It returns the OTA upgrade fw status.

Parameters

  None |

Return values

  1 | if OTA upgrade session has been completed; 0 otherwise

Note
  The API code could be subject to change in future releases.

void OTA_Write_Request_CB | ( | uint16_t | attr_handle,
|  | uint8_t | data_length,
|  | uint8_t * | att_data
| ) |  |

This function handles the OTA bootloader updgrade. It is called on the aci_gatt_attribute_modified_event() callback context for handling the the specific characteristic wirte coming from the OTA Client.

Parameters

  attr_handle | Handle of the OTA attribute that was modified.
  data_length | Length of att_data in octets
  att_data | The modified value

Return values

  None |

## Variable Documentation

uint8_t BTLServiceUUID4Scan[]

OTA Service UUID.