MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ROM_API

Overview

Files

file  rom_aes.h
 
file  rom_api.h
 
file  rom_isp.h
 
file  rom_lowpower.h
 
file  rom_mpu.h
 
file  rom_pmc.h
 
file  rom_psector.h
 
file  rom_secure.h
 

Data Structures

struct  IMAGE_DATA_T
 IMAGE_DATA_T image node : element of single link chained list of images found in flash. More...
 
struct  ISP_MEM_FUNC_T
 ISP_MEM_FUNC_T structure of ops method pointers instantiated per memory type. More...
 
struct  ISP_MEM_INFO_T
 ISP_MEM_INFO_T structure of memory characteristics. More...
 
struct  ISP_ENC_STATE_T
 ISP_ENC_STATE_T ISP structure for ciphering options : TODO check poorly tested should we advertise this ? More...
 
struct  ISP_STATE_T
 ISP_STATE_T structure holding the context the the curent ISP command. More...
 
struct  LPC_LOWPOWER_T
 Low Power Main Structure. More...
 
struct  LPC_LOWPOWER_LDOVOLTAGE_T
 Low Power Main Structure. More...
 
struct  MPU_Settings_t
 MPU_Settings_t structure in RAM to retrieve current MPU configuration see . More...
 
struct  image_directory_entry_t
 image_directory_entry_t image directory found in PAGE0 (PSECT) when SSBL is involved in the loading process More...
 
struct  psector_header_t
 psector_header_t psector header. More...
 
struct  IMAGE_CERT_T
 IMAGE_CERT_T structure. More...
 

Macros

#define AES_INB_FSEL(n)   ((n) << 16)
 n->1=Input Text, n->2=Holding, n->3=Input Text XOR Holding
 
#define AES_HOLD_FSEL(n)   ((n) << 20)
 n->0=Counter, n->1=Input Text, n->2=Output Block, n->3=Input Text XOR Output Block
 
#define AES_OUTT_FSEL(n)   ((n) << 24)
 n->0=OUTT, n->1=Output Block XOR Input Text, n->2=Output Block XOR Holding
 
#define ISP_INVALID_EXTENSION   (0)
 Each ISP extension function invalid : 0 corresponds to a NULL pointer.
 
#define ISP_FLAG_HAS_CRC32   (1 << 0)
 Each ISP command is preceded by a 'flag' byte that tell how to verify the command. More...
 
#define ISP_FLAG_SIGNED   (1 << 1)
 tells that command is RSA signed and authentication is checked, if unset, the SHA256 is computed and compared against the one held in the message, which guarantees integrity
 
#define ISP_FLAG_HAS_NEXT_HASH   (1 << 2)
 tells to hold the computed hash
 
#define LOWPOWER_CFG_MODE_ACTIVE   0
 ACTIVE mode.
 
#define LOWPOWER_CFG_MODE_DEEPSLEEP   1
 DEEP SLEEP mode.
 
#define LOWPOWER_CFG_MODE_POWERDOWN   2
 POWER DOWN mode.
 
#define LOWPOWER_CFG_MODE_DEEPPOWERDOWN   3
 DEEP POWER DOWN mode.
 
#define LOWPOWER_CFG_XTAL32MSTART_DISABLE   0
 Disable Crystal 32 MHz automatic start when waking up from POWER DOWN and DEEP POWER DOWN modes.
 
#define LOWPOWER_CFG_XTAL32MSTART_ENABLE   1
 Enable Crystal 32 MHz automatic start when waking up from POWER DOWN and DEEP POWER DOWN modes.
 
#define LOWPOWER_CFG_FLASHPWDNMODE_FLASHPWND   0
 Power down the Flash only (send CMD_POWERDOWN to Flash controller). More...
 
#define LOWPOWER_CFG_FLASHPWDNMODE_LDOSHUTOFF   1
 Power down the Flash ((send CMD_POWERDOWN to Flash controller) and shutoff both Flash LDOs (Core and NV) \ \ (only valid in DEEP SLEEP mode)
 
#define LOWPOWER_PMUPWDN_DCDC   (1UL << 0)
 Analog Power Domains (analog components in Power Management Unit) Low Power Modes control. More...
 
#define LOWPOWER_PMUPWDN_BIAS   (1UL << 1)
 Power Down all Bias and references.
 
#define LOWPOWER_PMUPWDN_LDOMEM   (1UL << 2)
 Power Down Memories LDO.
 
#define LOWPOWER_PMUPWDN_BODVBAT   (1UL << 3)
 Power Down VBAT Brown Out Detector.
 
#define LOWPOWER_PMUPWDN_FRO192M   (1UL << 4)
 Power Down FRO 192 MHz.
 
#define LOWPOWER_PMUPWDN_FRO1M   (1UL << 5)
 Power Down FRO 1 MHz.
 
#define LOWPOWER_PMUPWDN_GPADC   (1UL << 22)
 Power Down General Purpose ADC.
 
#define LOWPOWER_PMUPWDN_BODMEM   (1UL << 23)
 Power Down Memories Brown Out Detector.
 
#define LOWPOWER_PMUPWDN_BODCORE   (1UL << 24)
 Power Down Core Logic Brown Out Detector.
 
#define LOWPOWER_PMUPWDN_FRO32K   (1UL << 25)
 Power Down FRO 32 KHz.
 
#define LOWPOWER_PMUPWDN_XTAL32K   (1UL << 26)
 Power Down Crystal 32 KHz.
 
#define LOWPOWER_PMUPWDN_ANACOMP   (1UL << 27)
 Power Down Analog Comparator.
 
#define LOWPOWER_PMUPWDN_XTAL32M   (1UL << 28)
 Power Down Crystal 32 MHz.
 
#define LOWPOWER_PMUPWDN_TEMPSENSOR   (1UL << 29)
 Power Down Temperature Sensor.
 
#define LOWPOWER_DIGPWDN_FLASH   (1UL << 6)
 Digital Power Domains Low Power Modes control. More...
 
#define LOWPOWER_DIGPWDN_COMM0   (1UL << 7)
 Power Down Digital COMM0 power domain (USART0, I2C0 and SPI0)
 
#define LOWPOWER_DIGPWDN_MCU_RET   (1UL << 8)
 Power Down MCU Retention Power Domain (Disable Zigbee IP retention, ES1:Disable CPU retention \ \ flip-flops)
 
#define LOWPOWER_DIGPWDN_ZIGBLE_RET   (1UL << 9)
 Power Down ZIGBEE/BLE retention Power Domain (Disable ZIGBEE/BLE retention flip-flops)
 
#define LOWPOWER_DIGPWDN_SRAM0   (1UL << LOWPOWER_DIGPWDN_SRAM0_INDEX)
 Power Down SRAM 0 instance [Bank 0, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM1   (1UL << 11)
 Power Down SRAM 1 instance [Bank 0, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM2   (1UL << 12)
 Power Down SRAM 2 instance [Bank 0, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM3   (1UL << 13)
 Power Down SRAM 3 instance [Bank 0, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM4   (1UL << 14)
 Power Down SRAM 4 instance [Bank 0, 8 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM5   (1UL << 15)
 Power Down SRAM 5 instance [Bank 0, 8 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM6   (1UL << 16)
 Power Down SRAM 6 instance [Bank 0, 4 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM7   (1UL << 17)
 Power Down SRAM 7 instance [Bank 0, 4 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM8   (1UL << 18)
 Power Down SRAM 8 instance [Bank 1, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM9   (1UL << 19)
 Power Down SRAM 9 instance [Bank 1, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM10   (1UL << 20)
 Power Down SRAM 10 instance [Bank 1, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_SRAM11   (1UL << 21)
 Power Down SRAM 11 instance [Bank 1, 16 KB], (no retention)
 
#define LOWPOWER_DIGPWDN_IO   (1UL << LOWPOWER_DIGPWDN_IO_INDEX)
 Power Down.
 
#define LOWPOWER_DIGPWDN_NTAG_FD   (1UL << LOWPOWER_DIGPWDN_NTAG_FD_INDEX)
 NTAG FD field detect Disable - need the IO source to be set too.
 
#define LOWPOWER_SRAM_LPMODE_MASK   (0xFUL)
 LDO Voltage control in Low Power Modes.
 
#define LOWPOWER_VOLTAGE_LDO_PMU_INDEX   0
 LDO Voltage control in Low Power Modes.
 
#define LOWPOWER_WAKEUPSRCINT0_SYSTEM_IRQ   (1UL << 0)
 Low Power Modes Wake up Interrupt sources. More...
 
#define LOWPOWER_WAKEUPSRCINT0_DMA_IRQ   (1UL << 1)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_GINT_IRQ   (1UL << 2)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_IRBLASTER_IRQ   (1UL << 3)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PINT0_IRQ   (1UL << 4)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PINT1_IRQ   (1UL << 5)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PINT2_IRQ   (1UL << 6)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PINT3_IRQ   (1UL << 7)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_SPIFI_IRQ   (1UL << 8)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_TIMER0_IRQ   (1UL << 9)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_TIMER1_IRQ   (1UL << 10)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_USART0_IRQ   (1UL << 11)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT0_USART1_IRQ   (1UL << 12)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_I2C0_IRQ   (1UL << 13)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT0_I2C1_IRQ   (1UL << 14)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_SPI0_IRQ   (1UL << 15)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT0_SPI1_IRQ   (1UL << 16)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM0_IRQ   (1UL << 17)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM1_IRQ   (1UL << 18)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM2_IRQ   (1UL << 19)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM3_IRQ   (1UL << 20)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM4_IRQ   (1UL << 21)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM5_IRQ   (1UL << 22)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM6_IRQ   (1UL << 23)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM7_IRQ   (1UL << 24)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM8_IRQ   (1UL << 25)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM9_IRQ   (1UL << 26)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_PWM10_IRQ   (1UL << 27)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_I2C2_IRQ   (1UL << 28)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_RTC_IRQ   (1UL << 29)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT0_NFCTAG_IRQ   (1UL << 30)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT0_MAILBOX_IRQ   (1UL << 31)
 Mailbox, Wake-up from DEEP SLEEP and POWER DOWN low power mode [DEEP SLEEP, POWER DOWN].
 
#define LOWPOWER_WAKEUPSRCINT1_ADC_SEQA_IRQ   (1UL << 0)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ADC_SEQB_IRQ   (1UL << 1)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ADC_THCMP_OVR_IRQ   (1UL << 2)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_DMIC_IRQ   (1UL << 3)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_HWVAD_IRQ   (1UL << 4)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_DP_IRQ   (1UL << 5)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_DP0_IRQ   (1UL << 6)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_DP1_IRQ   (1UL << 7)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_DP2_IRQ   (1UL << 8)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_LL_ALL_IRQ   (1UL << 9)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ZIGBEE_MAC_IRQ   (1UL << 10)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ZIGBEE_MODEM_IRQ   (1UL << 11)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_RFP_TMU_IRQ   (1UL << 12)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_RFP_AGC_IRQ   (1UL << 13)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ISO7816_IRQ   (1UL << 14)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_ANA_COMP_IRQ   (1UL << 15)
 [DEEP SLEEP]
 
#define LOWPOWER_WAKEUPSRCINT1_WAKE_UP_TIMER0_IRQ   (1UL << 16)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT1_WAKE_UP_TIMER1_IRQ   (1UL << 17)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_WAKE_TIMER_IRQ   (1UL << 22)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT1_BLE_OSC_EN_IRQ   (1UL << 23)
 [DEEP SLEEP, POWER DOWN]
 
#define LOWPOWER_WAKEUPSRCINT1_IO_IRQ   (1UL << 31)
 [POWER DOWN, DEEP DOWN]
 
#define LOWPOWER_SLEEPPOSTPONE_FORCED   (1UL << 0)
 Sleep Postpone. More...
 
#define LOWPOWER_SLEEPPOSTPONE_PERIPHERALS   (1UL << 1)
 USART0, USART1, SPI0, SPI1, I2C0, I2C1, I2C2 interrupts can postpone power down modes in case an \ \ interrupt is pending when the processor request low power mode.
 
#define LOWPOWER_SLEEPPOSTPONE_DMIC   (1UL << 0)
 DMIC interrupt can postpone power down modes in case an interrupt is pending when the processor \ \ request low power mode.
 
#define LOWPOWER_SLEEPPOSTPONE_SDMA   (1UL << 1)
 System DMA interrupt can postpone power down modes in case an interrupt is pending when the \ \ processor request low power mode.
 
#define LOWPOWER_SLEEPPOSTPONE_NFCTAG   (1UL << 0)
 NFC Tag interrupt can postpone power down modes in case an interrupt is pending when the \ \ processor request low power mode.
 
#define LOWPOWER_SLEEPPOSTPONE_BLEOSC   (1UL << 1)
 BLE_OSC_EN interrupt can postpone power down modes in case an interrupt is pending when the \ \ processor request low power mode.
 
#define LOWPOWER_WAKEUPIOSRC_PIO0   (1UL << 0)
 Wake up I/O sources.
 
#define LOWPOWER_GPIOLATCH_PIO0   (1UL << 0)
 I/O whose state must be kept in Power Down mode.
 
#define LOWPOWER_TIMERCFG_ENABLE_INDEX   0
 Wake up timers configuration in Low Power Modes.
 
#define LOWPOWER_TIMERCFG_TIMER_ENABLE   1
 Wake Timer Enable.
 
#define LOWPOWER_TIMERCFG_TIMER_WAKEUPTIMER0   0
 Primary Wake up timers configuration in Low Power Modes. More...
 
#define LOWPOWER_TIMERCFG_TIMER_WAKEUPTIMER1   1
 Zigbee Wake up Counter 1 used as wake up source.
 
#define LOWPOWER_TIMERCFG_TIMER_BLEWAKEUPTIMER   2
 BLE Wake up Counter used as wake up source.
 
#define LOWPOWER_TIMERCFG_TIMER_RTC1KHZ   3
 1 KHz Real Time Counter (RTC) used as wake up source
 
#define LOWPOWER_TIMERCFG_TIMER_RTC1HZ   4
 1 Hz Real Time Counter (RTC) used as wake up source
 
#define LOWPOWER_TIMERCFG_2ND_TIMER_WAKEUPTIMER0   0
 Secondary Wake up timers configuration in Low Power Modes. More...
 
#define LOWPOWER_TIMERCFG_2ND_TIMER_WAKEUPTIMER1   1
 Zigbee Wake up Counter 1 used as secondary wake up source.
 
#define LOWPOWER_TIMERCFG_2ND_TIMER_BLEWAKEUPTIMER   2
 BLE Wake up Counter used as secondary wake up source.
 
#define LOWPOWER_TIMERCFG_2ND_TIMER_RTC1KHZ   3
 1 KHz Real Time Counter (RTC) used as secondary wake up source
 
#define LOWPOWER_TIMERCFG_2ND_TIMER_RTC1HZ   4
 1 Hz Real Time Counter (RTC) used as secondary wake up source
 
#define LOWPOWER_TIMERCFG_OSC32K_FRO32KHZ   0
 Wake up Timers uses FRO 32 KHz as clock source.
 
#define LOWPOWER_TIMERCFG_OSC32K_XTAL32KHZ   1
 Wake up Timers uses Chrystal 32 KHz as clock source.
 
#define LOWPOWER_TIMERBLECFG_RADIOEN_INDEX   0
 BLE Wake up timers configuration in Low Power Modes.
 
#define RD_RIGHT   (1 << 0)
 bits for access right
 
#define PSECTOR_PAGE_WORDS   30
 PSECTOR_PAGE_WORDS number of 16 byte words available in page A page is 512 bytes in size. More...
 
#define PSECTOR_PAGE0_MAGIC   0xc51d8ca9
 PSECTOR_PAGE0_MAGIC magic word to identify PAGE0 page in header.
 
#define PSECTOR_PFLASH_MAGIC   0xa7b4353d
 PSECTOR_PFLASH_MAGIC magic word to identify PFLASH page in header.
 
#define IMG_DIRECTORY_MAX_SIZE   8
 IMG_DIRECTORY_MAX_SIZE max number of entries in image directory Concerns Secondary Stage Bootloader only.
 
#define CERTIFICATE_MARKER   (0xCE27CE27)
 CERTIFICATE_MARKER magic value identifying certificate.
 

Typedefs

typedef uint32_t ErrorCode_t
 enum defined in error.h
 
typedef uint32_t(* IMAGE_VERIFY_T )(IMAGE_DATA_T *list_head)
 IMAGE_VERIFY_T function pointer : verification function e.g. More...
 
typedef ISP_STATUS_T(* ISP_EXTENSION_T )(ISP_STATE_T *state, teFlashProgCommand request, uint8_t *in_data, uint16_t in_len, teFlashProgCommand *response, uint8_t *out_data, uint16_t *out_len)
 ISP_EXTENSION_T ISP extension function pointer prototype.
 

Enumerations

enum  AES_MODE_T { , AES_MODE_UNUSED = 0x7FFFFFFF }
 AES setup modes. More...
 
enum  AES_KEY_SIZE_T {
  AES_KEY_128BITS = 0,
  AES_KEY_192BITS,
  AES_KEY_256BITS,
  AES_FVAL = 0x7FFFFFFF
}
 Size of the AES key. More...
 
enum  teFlashProgCommand { ,
  TYPE_SET_RESET_REQUEST = 20,
  TYPE_SET_RESET_RESPONSE ,
  TYPE_FP_RUN_REQUEST,
  TYPE_FP_RUN_RESPONSE ,
  TYPE_FL_SET_BAUD_REQUEST,
  TYPE_FL_SET_BAUD_RESPONSE ,
  TYPE_REG_READ_REQUEST,
  TYPE_REG_READ_RESPONSE,
  TYPE_REG_WRITE_REQUEST,
  TYPE_REG_WRITE_RESPONSE,
  TYPE_GET_CHIP_ID_REQUEST,
  TYPE_GET_CHIP_ID_RESPONSE,
  TYPE_GET_FUSE_SECURED_REQUEST,
  TYPE_GET_FUSE_SECURED_RESPONSE,
  TYPE_MEM_OPEN_REQUEST = 0x40,
  TYPE_MEM_OPEN_RESPONSE,
  TYPE_MEM_ERASE_REQUEST,
  TYPE_MEM_ERASE_RESPONSE,
  TYPE_MEM_BLANK_CHECK_REQUEST,
  TYPE_MEM_BLANK_CHECK_RESPONSE,
  TYPE_MEM_READ_REQUEST,
  TYPE_MEM_READ_RESPONSE,
  TYPE_MEM_WRITE_REQUEST,
  TYPE_MEM_WRITE_RESPONSE,
  TYPE_MEM_CLOSE_REQUEST,
  TYPE_MEM_CLOSE_RESPONSE,
  TYPE_MEM_GET_INFO_REQUEST,
  TYPE_MEM_GET_INFO_RESPONSE,
  TYPE_UNLOCK_ISP_REQUEST,
  TYPE_UNLOCK_ISP_RESPONSE,
  TYPE_USE_CERTIFICATE_REQUEST,
  TYPE_USE_CERTIFICATE_RESPONSE,
  TYPE_START_ENCRYPTION_REQUEST,
  TYPE_START_ENCRYPTION_RESPONSE
}
 ISP Message types Only a subset of message types below is supported. More...
 
enum  ISP_STATUS_T {
  ISP_OK,
  NOT_SUPPORTED = -1,
  WRITE_FAIL = -2,
  INVALID_RESPONSE = -3,
  CRC_ERROR = -4,
  ASSERT_FAIL = -5,
  USER_INTERRUPT = -6,
  READ_FAIL = -7,
  TST_ERR = -8,
  ISP_NOT_AUTHORISED = -9,
  NO_RESPONSE = -10,
  ISP_MEM_INVALID = -11,
  ISP_MEM_NOT_SUPPORTED = -12,
  ISP_MEM_NO_ACCESS = -13,
  ISP_MEM_OUT_OF_RANGE = -14,
  ISP_MEM_TOO_LONG = -15,
  ISP_MEM_BAD_STATE = -16,
  ISP_MEM_INVALID_MODE = -17
}
 ISP Status types. More...
 
enum  ISP_MEMORY_TYPE_E { , ISP_MEM_SPIFI }
 
enum  MpuRegion_t {
  MPU_REGION_0,
  MPU_REGION_1,
  MPU_REGION_2,
  MPU_REGION_3,
  MPU_REGION_4 ,
  MPU_REGION_5,
  MPU_REGION_6,
  MPU_REGION_7
}
 enum MpuRegion_t index of ARM CM4 MPU regions The MPU can describe up to 8 region rules. More...
 
enum  psector_partition_id_t {
  PSECTOR_PAGE0_PART,
  PSECTOR_PFLASH_PART
}
 psector_partition_id_t describes the 2 partitions of psectors. More...
 
enum  psector_page_state_t {
  PAGE_STATE_BLANK,
  PAGE_STATE_ERROR,
  PAGE_STATE_DEGRADED,
  PAGE_STATE_OK
}
 psector_page_state_t describes the possible states of the psector partitions. More...
 
enum  psector_write_status_t {
  WRITE_OK = 0x0,
  WRITE_ERROR_BAD_MAGIC,
  WRITE_ERROR_INVALID_PAGE_NUMBER,
  WRITE_ERROR_BAD_VERSION,
  WRITE_ERROR_BAD_CHECKSUM,
  WRITE_ERROR_INCORRECT_UPDATE_MODE,
  WRITE_ERROR_UPDATE_INVALID,
  WRITE_ERROR_PAGE_ERROR
}
 psector_write_status_t status code of writes to update page. More...
 
enum  AuthMode_t {
  AUTH_NONE = 0,
  AUTH_ON_FW_UPDATE = 1,
  AUTH_ALWAYS = 2
}
 AuthMode_t authentication options. More...
 

Functions

static ErrorCode_t aesInit (void)
 Initialize the AES. More...
 
static void aesWriteByte (uint32_t offset, uint8_t val8)
 AES control function, byte write (useful for writing configuration register) More...
 
static void aesWrite (uint32_t offset, uint32_t val32)
 AES control function, word write. More...
 
static void aesRead (uint32_t offset, uint32_t *pVal32)
 AES control function, word read. More...
 
static void aesWriteBlock (uint32_t offset, uint32_t *pVal32, uint32_t numBytes)
 AES control function, block write (used for multi-register block writes) More...
 
static void aesReadBlock (uint32_t offset, uint32_t *pVal32, uint32_t numBytes)
 AES control function, block read (used for multi-register block read) More...
 
static ErrorCode_t aesMode (AES_MODE_T modeVal, uint32_t flags)
 Sets up the AES mode. More...
 
static ErrorCode_t aesAbort (int wipe)
 Aborts optional AES operation and wipes AES engine. More...
 
static ErrorCode_t aesLoadCounter (uint32_t counter)
 Loads the increment that is used when in counter modes in the AES block. More...
 
static ErrorCode_t aesLoadKeyFromSW (AES_KEY_SIZE_T keySize, uint32_t *key)
 Loads the passed (software) key into the AES block. More...
 
static ErrorCode_t aesLoadIV (uint32_t *pIv)
 Loads the Initialization Vector (IV) into the AES block. More...
 
static ErrorCode_t aesProcess (uint32_t *pBlockIn, uint32_t *pBlockOut, uint32_t numBlocks)
 Process AES blocks (descrypt or encrypt) More...
 
static ErrorCode_t aesWriteYInputGf128 (uint32_t *pYGf128)
 Sets the Y input of the GF128 hash used in GCM mode. More...
 
static ErrorCode_t aesReadGf128Hash (uint32_t *pGf128Hash)
 Reads the results of the GF128(Z) hash used in GCM mode. More...
 
static ErrorCode_t aesReadGcmTag (uint32_t *pGcmTag)
 Reads the GCM tag. More...
 
static uint32_t aesGetDriverVersion (void)
 Returns the version of the AES driver in ROM. More...
 
static ErrorCode_t aesIsSupported (void)
 Returns status of AES IP block (supported or not) More...
 
static uint32_t BOOT_RemapAddress (uint32_t address)
 Convert logical address into physical address, based on SYSCOM MEMORYREMAP register. More...
 
static uint32_t boot_Verify_eScoreImageList (IMAGE_DATA_T *list_head)
 Parse the image chained list and select the first valid entry. More...
 
static uint32_t BOOT_FindImage (uint32_t start_addr, uint32_t end_addr, uint32_t signature, IMAGE_VERIFY_T verify)
 Search for a valid executable image between boundaries in internal flash. More...
 
static uint32_t BOOT_GetStartPowerMode (void)
 Retrieve LPMode value that has been saved previously in retained RAM bank. More...
 
static void BOOT_SetResumeStackPointer (uint32_t stack_pointer)
 Sets the value of stack pointer to be restored on warm boot. More...
 
static void ROM_GetFlash (uint32_t *address, uint32_t *size)
 Retrieve Internal flash address and size. More...
 
static void ROM_GetSRAM0 (uint32_t *address, uint32_t *size)
 Retrieve SRAM0 address and size. More...
 
static void ROM_GetSRAM1 (uint32_t *address, uint32_t *size)
 Retrieve SRAM1 address and size. More...
 
static int ISP_Entry (ISP_EXTENSION_T isp_extension)
 This function is invoked when ISP mode is requested. More...
 
static void Chip_LOWPOWER_SetUpLowPowerModeWakeUpTimer (LPC_LOWPOWER_T *p_lowpower_cfg)
 Configure Wake or RTC timers. used for testing only. More...
 
static int Chip_LOWPOWER_SetSystemFrequency (uint32_t frequency)
 Configure CPU and System Bus clock frequency. More...
 
static int Chip_LOWPOWER_SetMemoryLowPowerMode (uint32_t p_sram_instance, uint32_t p_sram_lp_mode)
 Configure Memory instances Low Power Mode. More...
 
static void Chip_LOWPOWER_GetSystemVoltages (LPC_LOWPOWER_LDOVOLTAGE_T *p_ldo_voltage)
 Get System Voltages. More...
 
static void Chip_LOWPOWER_SetSystemVoltages (LPC_LOWPOWER_LDOVOLTAGE_T *p_ldo_voltage)
 Configure System Voltages. More...
 
static void Chip_LOWPOWER_SetLowPowerMode (LPC_LOWPOWER_T *p_lowpower_cfg)
 Configure and enters in low power mode. More...
 
static void Chip_LOWPOWER_ChipSoftwareReset (void)
 Perform a Full chip reset using Software reset bit in PMC. More...
 
static void Chip_LOWPOWER_ArmSoftwareReset (void)
 Perform a digital System reset. More...
 
static int MPU_pSectorGrantAccessRights (uint32_t addr, size_t sz, MPU_reg_settings_t *save_rule)
 This function is used to grant access to the pSector region. More...
 
static int MPU_pSectorWithdrawAccessRights (MPU_reg_settings_t *save_rule)
 This function is used to withdraw access to the pSector region. More...
 
static void MPU_GetCurrentSettings (MPU_Settings_t *settings)
 This function is used to read the MPU settings into a RAM structure. More...
 
static int MPU_AllocateRegionDesc (void)
 This function is used to select the first available rule. More...
 
static uint32_t pmc_reset_get_cause (void)
 Get the cause of the reset. More...
 
static void pmc_reset_clear_cause (uint32_t mask)
 Clear the cause of the reset. More...
 
static psector_write_status_t psector_WriteUpdatePage (psector_partition_id_t part_index, psector_page_t *page)
 This function is used to validate a page content and write it to the update page. More...
 
static void psector_EraseUpdate (void)
 This function is used to validate a page content and write it to the update page. More...
 
static psector_page_state_t psector_ReadData (psector_partition_id_t part_index, int page_number, uint32_t offset, uint32_t size, void *data)
 This function is used to read data from a psector partition. More...
 
static uint32_t psector_CalculateChecksum (psector_page_t *psector_page)
 This function is used to calculate a page checksum. More...
 
static uint64_t psector_Read_CustomerId (void)
 This function returns the CustomerId field. More...
 
static int psector_Read_RomPatchInfo (uint32_t *patch_region_sz, uint32_t *patch_region_addr, uint32_t *patch_checksum, uint32_t *patch_checksum_valid)
 This function returns the ROM patch information read from the PFLASH. More...
 
static uint16_t psector_Read_ImgAuthLevel (void)
 This function returns the image authentication level from the PFLASH. More...
 
static uint32_t psector_Read_AppSearchGranularity (void)
 This function returns the app search granularity value from the PFLASH. More...
 
static uint32_t psector_Read_QspiAppSearchGranularity (void)
 This function returns the Qspi app search granularity value from the PFLASH. More...
 
static uint64_t psector_Read_DeviceId (void)
 This function returns the DeviceId value from the PFLASH. More...
 
static int psector_Read_UnlockKey (int *valid, uint8_t key[256], bool raw)
 This function returns the unlock key value from the PFLASH. More...
 
static int psector_Read_ISP_protocol_key (uint8_t key[16])
 This function returns the ISP protocol AES key from PFLASH. More...
 
static uint64_t psector_ReadIeee802_15_4_MacId1 (void)
 This function returns the IEEE-802.15.4 Mac address first instance from PFLASH. More...
 
static uint64_t psector_ReadIeee802_15_4_MacId2 (void)
 This function returns the IEEE-802.15.4 Mac address second instance from PFLASH. More...
 
static uint64_t psector_Read_MinDeviceId (void)
 This function returns the Min Device id from PFLASH. More...
 
static uint64_t psector_Read_MaxDeviceId (void)
 This function returns the Max Device id from PFLASH. More...
 
static uint32_t psector_Read_MinVersion (void)
 This function returns the Min Version from PAGE0. More...
 
static psector_write_status_t psector_SetEscoreImageData (uint32_t image_addr, uint32_t min_version)
 This function is used to set the selected image address and MinVersion into PAGE0. More...
 
static psector_page_state_t psector_ReadEscoreImageData (uint32_t *image_addr, uint32_t *min_version)
 This function returns the image address and min version value from PAGE0. More...
 
static int psector_Read_ImagePubKey (int *valid, uint8_t key[256], bool raw)
 This function returns the unlock key value from PAGE0. More...
 
static uint32_t secure_VerifySignature (uint8_t *hash, const uint8_t *signature, const uint32_t *key)
 This function performs an RSA 2048 signature verification. More...
 
static uint32_t secure_VerifyBlock (uint8_t *start, uint32_t length, const uint32_t *key, const uint8_t *signature)
 This function performs an RSA 2048 signature verification over specified data block. More...
 
static uint32_t secure_VerifyCertificate (const IMAGE_CERT_T *certificate, const uint32_t *key, const uint8_t *cert_signature)
 This function performs an RSA 2048 signature verification. More...
 
static uint32_t secure_VerifyImage (uint32_t image_addr, const IMAGE_CERT_T *root_cert)
 This function verifies image authenticity. More...
 

Variables

uint32_t IMAGE_DATA_T::version
 version number found in image
 
uint32_t IMAGE_DATA_T::address
 start address of image
 
struct _image_data_t * IMAGE_DATA_T::next
 pointer on next IMAGE_DATA_T in list
 
uint32_t ISP_MEM_INFO_T::base_address
 base address of memory bank
 
uint32_t ISP_MEM_INFO_T::length
 total size
 
uint32_t ISP_MEM_INFO_T::block_size
 block size : flash page size
 
uint16_t ISP_MEM_INFO_T::flags
 unused
 
ISP_MEMORY_TYPE_E ISP_MEM_INFO_T::type
 memory type : note that EFUSE bank is not a memory as such - SPIFI is unimplemented
 
uint8_t ISP_MEM_INFO_T::access
 bitfield of access rights: More...
 
uint8_t ISP_MEM_INFO_T::auth_access
 similar to access for authenticated commands
 
ISP_MEM_FUNC_TISP_MEM_INFO_T::func
 set of function pointers of this memory type see @ ISP_MEM_FUNC_T
 
const char * ISP_MEM_INFO_T::name
 name of memory bank
 
uint32_t ISP_ENC_STATE_T::mode
 0: none - 1: AES CTR
 
uint32_t ISP_ENC_STATE_T::start
 start address of cipher/decipher operation
 
uint32_t ISP_ENC_STATE_T::end
 end address of cipher/decipher operation
 
uint32_t ISP_ENC_STATE_T::iv [4]
 Initialization vector IV : 16 bytes.
 
uint32_t ISP_ENC_STATE_T::key [8]
 AES Key - key[4..7] unused.
 
ISP_GET_MEMORY_T ISP_STATE_T::get_memory
 Function pointer to get_memory.
 
ISP_EXTENSION_T ISP_STATE_T::extension
 Function pointer to extension.
 
uint32_t * ISP_STATE_T::buffer
 buffer holding command (in stack)
 
ISP_ENC_STATE_T ISP_STATE_T::enc_state
 Embedded ciphering structure see @ ISP_ENC_STATE_T.
 
IMAGE_CERT_T ISP_STATE_T::certificate
 Certificate used to authenticate ISP commands it is composed of the custumer identifier and the unlock public key found in PFLASH.
 
uint8_t ISP_STATE_T::stored_hash [32]
 SHA=256 hash storage.
 
uint8_t ISP_STATE_T::mode
 mode 0x00: inactive More...
 
uint8_t ISP_STATE_T::isp_level
 ISP level as restrained by EFUSE configuation and PFLASH parameter.
 
uint16_t ISP_STATE_T::buffer_size
 size of buffer : normally 1024
 
uint8_t ISP_STATE_T::unlock_disable
 unlock forbidden by EFUSE
 
uint8_t ISP_STATE_T::SWD_disable
 SWD Debug interface disabled.
 
uint32_t MPU_Settings_t::ctrl
 MPU Ctrl register.
 
uint32_t MPU_Settings_t::rbar [8]
 MPU RBAR array for the 8 rules.
 
uint32_t MPU_Settings_t::rasr [8]
 MPU RASR array for the 8 rules.
 
uint32_t image_directory_entry_t::img_base_addr
 image start address in internal Flash or QSPI flash
 
uint16_t image_directory_entry_t::img_nb_pages
 image number of 512 byte pages
 
uint8_t image_directory_entry_t::flags
 IMG_FLAG_BOOTABLE : bit 0, other TBD.
 
uint8_t image_directory_entry_t::img_type
 image type
 
uint32_t psector_header_t::checksum
 page checksum
 
uint32_t psector_header_t::magic
 magic: PSECTOR_PAGE0_MAGIC or PSECTOR_PFLASH_MAGIC
 
uint16_t psector_header_t::page_number
 should be 0 because both partitions contain a single page
 
struct {
}   psector_page_data_t::page0_v2
 Deprecated form kept for backward compatibility.
 
uint32_t   psector_page_data_t::SelectedImageAddress
 Address of image to be loaded by boot ROM offset 0x20.
 
uint32_t   psector_page_data_t::preferred_app_index
 for use with SSBL: index of application to select from image directory value 0..8 offset 0x24
 
image_directory_entry_t   psector_page_data_t::ota_entry
 New image written by OTA : SSBL to check validity and authentication offset 0x28.
 
uint32_t   psector_page_data_t::MinVersion
 Minimum version accepted : application's version number must be greater than this one to be accepted. More...
 
uint32_t   psector_page_data_t::img_pk_valid
 Image public key valid offset 0x34.
 
uint32_t   psector_page_data_t::flash_audit_done
 Flash audit done: already sought for wrongly initialized pages offset 0x38.
 
uint32_t   psector_page_data_t::RESERVED1
 padding reserved word
 
uint8_t   psector_page_data_t::image_pubkey [256]
 RSA Public Key to be used to verify authenticity offset 0x40.
 
uint8_t   psector_page_data_t::zigbee_install_code [36]
 Zigbee install code offset 0x140.
 
uint32_t   psector_page_data_t::RESERVED3 [3]
 padding reserved wordes
 
uint8_t   psector_page_data_t::zigbee_password [16]
 Zigbee password offset 0x170.
 
image_directory_entry_t   psector_page_data_t::img_directory [IMG_DIRECTORY_MAX_SIZE]
 < Image directory entries array, used by OTA process to locate images and/or blobs offset 0x180
 
uint32_t   psector_page_data_t::rom_patch_region_addr
 ROM patch entry point address. More...
 
uint32_t   psector_page_data_t::rom_patch_checksum_valid
 ROM patch checksum valid: 0 means invalid Any other value means valid.
 
uint32_t   psector_page_data_t::ISP_access_level
 ISP access level: 0 means full access, unsecure 0x01010101 means full access, secure 0x02020202 means write only, unsecure 0x03030303 means write only, secure 0x04040404 means locked Any other value means disabled.
 
uint16_t   psector_page_data_t::application_flash_sz
 Application flash size, in kilobytes. More...
 
uint16_t   psector_page_data_t::image_authentication_level
 Image authentication level: 0 means check only header validity 1 means check signature of whole image if image has changed 2 means check signature of whole image on every cold start.
 
uint16_t   psector_page_data_t::unlock_key_valid
 0: unlock key is not valid, >= 1: is present
 
uint16_t   psector_page_data_t::ram1_bank_sz
 RAM bank 1 size, in kilobytes. More...
 
uint32_t   psector_page_data_t::app_search_granularity
 Application search granularity (increment), in bytes. More...
 
uint8_t   psector_page_data_t::ISP_protocol_key [16]
 ISP protocol key: key used to encrypt messages over ISP UART with secure access level.
 
uint64_t   psector_page_data_t::ieee_mac_id1
 IEEE_MAC_ID_1 (Used to over-ride MAC ID_1 in N-2 page)
 
uint64_t   psector_page_data_t::ieee_mac_id2
 IEEE_MAC_ID_2 if second MAC iID is required.
 
uint64_t   psector_page_data_t::ble_mac_id
 BLE device address : only 6 LSB bytes are significant.
 
uint8_t   psector_page_data_t::reserved2 [104]
 Reserved for future use.
 
uint64_t   psector_page_data_t::customer_id
 Customer ID, used for secure handshake.
 
uint64_t   psector_page_data_t::min_device_id
 Min Device ID, used for secure handshake - Certificate compatibility.
 
uint64_t   psector_page_data_t::device_id
 Device ID, used for secure handshake.
 
uint64_t   psector_page_data_t::max_device_id
 Max Device ID, used for secure handshake - Certificate compatibility.
 
uint8_t   psector_page_data_t::unlock_key [256]
 2048-bit public key for secure handshake (equivalent to ‘unlock’ key). More...
 
uint32_t IMAGE_CERT_T::certificate_marker
 Certificate marker: magic see @ CERTIFICATE_MARKER.
 
uint32_t IMAGE_CERT_T::certificate_id
 Certificate id.
 
uint32_t IMAGE_CERT_T::usage_flags
 Usage flags: mostly used in the unlocking procedure.
 
uint64_t IMAGE_CERT_T::customer_id
 Customer Id: customer chosen identifier.
 
uint64_t IMAGE_CERT_T::min_device_id
 Min device id: min device version from which certificate applies.
 
uint64_t IMAGE_CERT_T::max_device_id
 Max device id: max device version up to which certificate applies.
 
uint32_t IMAGE_CERT_T::public_key [SIGNATURE_LEN/4]
 RSA-2048 public key.
 
IMAGE_CERT_T ImageAuthTrailer_t::certificate
 The certificate see @ IMAGE_CERT_T.
 
uint8_t ImageAuthTrailer_t::cert_signature [SIGNATURE_LEN]
 The signature of the certificate.
 
uint8_t ImageAuthTrailer_t::img_signature [SIGNATURE_LEN]
 The image siganture.
 

Data Structure Documentation

struct IMAGE_DATA_T

Data Fields

uint32_t version
 version number found in image
 
uint32_t address
 start address of image
 
struct _image_data_t * next
 pointer on next IMAGE_DATA_T in list
 
struct ISP_MEM_FUNC_T
struct ISP_MEM_INFO_T

Data Fields

uint32_t base_address
 base address of memory bank
 
uint32_t length
 total size
 
uint32_t block_size
 block size : flash page size
 
uint16_t flags
 unused
 
ISP_MEMORY_TYPE_E type
 memory type : note that EFUSE bank is not a memory as such - SPIFI is unimplemented
 
uint8_t access
 bitfield of access rights: More...
 
uint8_t auth_access
 similar to access for authenticated commands
 
ISP_MEM_FUNC_Tfunc
 set of function pointers of this memory type see @ ISP_MEM_FUNC_T
 
const char * name
 name of memory bank
 
struct ISP_ENC_STATE_T

Data Fields

uint32_t mode
 0: none - 1: AES CTR
 
uint32_t start
 start address of cipher/decipher operation
 
uint32_t end
 end address of cipher/decipher operation
 
uint32_t iv [4]
 Initialization vector IV : 16 bytes.
 
uint32_t key [8]
 AES Key - key[4..7] unused.
 
struct ISP_STATE_T

Note: this context is held in RAM is the stack so is lost after ISP_Entry is exited.

Data Fields

ISP_GET_MEMORY_T get_memory
 Function pointer to get_memory.
 
ISP_EXTENSION_T extension
 Function pointer to extension.
 
uint32_t * buffer
 buffer holding command (in stack)
 
ISP_ENC_STATE_T enc_state
 Embedded ciphering structure see @ ISP_ENC_STATE_T.
 
IMAGE_CERT_T certificate
 Certificate used to authenticate ISP commands it is composed of the custumer identifier and the unlock public key found in PFLASH.
 
uint8_t stored_hash [32]
 SHA=256 hash storage.
 
uint8_t mode
 mode 0x00: inactive More...
 
uint8_t isp_level
 ISP level as restrained by EFUSE configuation and PFLASH parameter.
 
uint16_t buffer_size
 size of buffer : normally 1024
 
uint8_t unlock_disable
 unlock forbidden by EFUSE
 
uint8_t SWD_disable
 SWD Debug interface disabled.
 
struct LPC_LOWPOWER_T

Data Fields

uint32_t CFG
 Low Power Mode Configuration, and miscallenous options.
 
uint32_t PMUPWDN
 Analog Power Domains (analog components in Power Management Unit) Low Power Modes.
 
uint32_t DIGPWDN
 Digital Power Domains Low Power Modes.
 
uint32_t VOLTAGE
 LDO Voltage control in Low Power Modes.
 
uint32_t WAKEUPSRCINT0
 Wake up sources Interrupt control.
 
uint32_t WAKEUPSRCINT1
 Wake up sources Interrupt control.
 
uint32_t SLEEPPOSTPONE
 Interrupt that can postpone power down modes in case an interrupt is pending when the processor request deepsleep.
 
uint32_t WAKEUPIOSRC
 Wake up I/O sources.
 
uint32_t GPIOLATCH
 I/Os which outputs level must be kept (in Power Down mode)
 
uint32_t TIMERCFG
 Wake up timers configuration.
 
uint32_t TIMERBLECFG
 BLE wake up timer configuration (OSC_EN and RADIO_EN)
 
uint32_t TIMERCOUNTLSB
 Wake up Timer LSB.
 
uint32_t TIMERCOUNTMSB
 Wake up Timer MSB.
 
uint32_t TIMER2NDCOUNTLSB
 Second Wake up Timer LSB.
 
uint32_t TIMER2NDCOUNTMSB
 Second Wake up Timer MSB.
 
struct LPC_LOWPOWER_LDOVOLTAGE_T

Data Fields

uint8_t LDOPMU
 Always-ON domain LDO voltage configuration.
 
uint8_t LDOPMUBOOST
 Always-ON domain LDO Boost voltage configuration.
 
uint8_t LDOMEM
 Memories LDO voltage configuration.
 
uint8_t LDOMEMBOOST
 Memories LDO Boost voltage configuration.
 
uint8_t LDOCORE
 Core Logic domain LDO voltage configuration.
 
uint8_t LDOFLASHNV
 Flash NV domain LDO voltage configuration.
 
uint8_t LDOFLASHCORE
 Flash Core domain LDO voltage configuration.
 
uint8_t LDOADC
 General Purpose ADC LDO voltage configuration.
 
uint8_t LDOPMUBOOST_ENABLE
 Force Boost activation on LDOPMU.
 
struct MPU_Settings_t

Data Fields

uint32_t ctrl
 MPU Ctrl register.
 
uint32_t rbar [8]
 MPU RBAR array for the 8 rules.
 
uint32_t rasr [8]
 MPU RASR array for the 8 rules.
 
struct image_directory_entry_t

Data Fields

uint32_t img_base_addr
 image start address in internal Flash or QSPI flash
 
uint16_t img_nb_pages
 image number of 512 byte pages
 
uint8_t flags
 IMG_FLAG_BOOTABLE : bit 0, other TBD.
 
uint8_t img_type
 image type
 
struct psector_header_t

Data Fields

uint32_t checksum
 page checksum
 
uint32_t magic
 magic: PSECTOR_PAGE0_MAGIC or PSECTOR_PFLASH_MAGIC
 
uint16_t page_number
 should be 0 because both partitions contain a single page
 
struct IMAGE_CERT_T

Data Fields

uint32_t certificate_marker
 Certificate marker: magic see @ CERTIFICATE_MARKER.
 
uint32_t certificate_id
 Certificate id.
 
uint32_t usage_flags
 Usage flags: mostly used in the unlocking procedure.
 
uint64_t customer_id
 Customer Id: customer chosen identifier.
 
uint64_t min_device_id
 Min device id: min device version from which certificate applies.
 
uint64_t max_device_id
 Max device id: max device version up to which certificate applies.
 
uint32_t public_key [SIGNATURE_LEN/4]
 RSA-2048 public key.
 

Macro Definition Documentation

#define ISP_FLAG_HAS_CRC32   (1 << 0)

CRC32 Now deprecated

#define LOWPOWER_CFG_FLASHPWDNMODE_FLASHPWND   0

Only valid in DEEP SLEEP mode

#define LOWPOWER_PMUPWDN_DCDC   (1UL << 0)

Power Down DCDC Converter

#define LOWPOWER_DIGPWDN_FLASH   (1UL << 6)

Power Down Flash Power Domain (Flash Macro, Flash Controller and/or FLash LDOs, depending on \ \ LOWPOWER_CFG_FLASHPWDNMODE parameter)

#define LOWPOWER_WAKEUPSRCINT0_SYSTEM_IRQ   (1UL << 0)

BOD, Watchdog Timer, Flash controller, Firewall [DEEP SLEEP] BOD [POWER_DOWN]

#define LOWPOWER_SLEEPPOSTPONE_FORCED   (1UL << 0)

Forces postpone of power down modes in case the processor request low power mode

#define LOWPOWER_TIMERCFG_TIMER_WAKEUPTIMER0   0

Zigbee Wake up Counter 0 used as wake up source

#define LOWPOWER_TIMERCFG_2ND_TIMER_WAKEUPTIMER0   0

Zigbee Wake up Counter 0 used as secondary wake up source

#define PSECTOR_PAGE_WORDS   30

That is 32x16 bytes. The first 32 bytes contain the page header, which leaves 30x16bytes for storage. Thence the 30.

Typedef Documentation

typedef uint32_t(* IMAGE_VERIFY_T)(IMAGE_DATA_T *list_head)

boot_Verify_eScoreImageList

Enumeration Type Documentation

enum AES_MODE_T
Enumerator
AES_MODE_UNUSED 

Not used, but forces enum to 32-bit size.

Enumerator
AES_KEY_128BITS 

KEY size 128 bits.

AES_KEY_192BITS 

KEY size 192 bits.

AES_KEY_256BITS 

KEY size 256 bits.

AES_FVAL 

Not used, but forces enum to 32-bit size and unsigned.

Enumerator
TYPE_SET_RESET_REQUEST 

ISP Set Reset request.

TYPE_SET_RESET_RESPONSE 

ISP Set Reset response.

TYPE_FP_RUN_REQUEST 

ISP FP Run request : jump to address if ISP access level and authentication allow it.

TYPE_FP_RUN_RESPONSE 

ISP FP Run response.

TYPE_FL_SET_BAUD_REQUEST 

ISP FL Set Baud request : set UART speed.

TYPE_FL_SET_BAUD_RESPONSE 

ISP FL Set Baud response.

TYPE_REG_READ_REQUEST 

not implemented

TYPE_REG_READ_RESPONSE 

not implemented

TYPE_REG_WRITE_REQUEST 

not implemented

TYPE_REG_WRITE_RESPONSE 

not implemented

TYPE_GET_CHIP_ID_REQUEST 

ISP chip id request.

TYPE_GET_CHIP_ID_RESPONSE 

ISP chip id response.

TYPE_GET_FUSE_SECURED_REQUEST 

not implemented

TYPE_GET_FUSE_SECURED_RESPONSE 

not implemented

TYPE_MEM_OPEN_REQUEST 

ISP memory open request.

TYPE_MEM_OPEN_RESPONSE 

ISP memory open response.

TYPE_MEM_ERASE_REQUEST 

ISP memory erase request, applies to internal flash only.

TYPE_MEM_ERASE_RESPONSE 

ISP memory erase response.

TYPE_MEM_BLANK_CHECK_REQUEST 

ISP memory blank check request, applies to internal flash only.

TYPE_MEM_BLANK_CHECK_RESPONSE 

ISP memory blank check response to request.

TYPE_MEM_READ_REQUEST 

ISP memory read request, applies to all memory types.

TYPE_MEM_READ_RESPONSE 

ISP memory read response.

TYPE_MEM_WRITE_REQUEST 

ISP memory write request, applies to all memory types except EFUSE.

TYPE_MEM_WRITE_RESPONSE 

ISP memory read response.

TYPE_MEM_CLOSE_REQUEST 

ISP memory close request.

TYPE_MEM_CLOSE_RESPONSE 

ISP memory close response.

TYPE_MEM_GET_INFO_REQUEST 

ISP memory get information of memory geometry and accessibility.

TYPE_MEM_GET_INFO_RESPONSE 

ISP memory get information response.

TYPE_UNLOCK_ISP_REQUEST 

ISP unlock request: reset a locked device to its pristine state.

TYPE_UNLOCK_ISP_RESPONSE 

ISP unlock response.

TYPE_USE_CERTIFICATE_REQUEST 

ISP Use Certificate request.

TYPE_USE_CERTIFICATE_RESPONSE 

ISP Use Certificate response.

TYPE_START_ENCRYPTION_REQUEST 

ISP Start Encryption request.

TYPE_START_ENCRYPTION_RESPONSE 

ISP Start Encryption response.

Enumerator
ISP_OK 

ISP operation successful.

NOT_SUPPORTED 

ISP operation not supported.

WRITE_FAIL 

ISP write failure when writing to FLASH, PSECT,r PFLASH.

INVALID_RESPONSE 

ISP invalid response : not used.

CRC_ERROR 

ISP command received CRC incorrect.

ASSERT_FAIL 

ISP received too long a message.

USER_INTERRUPT 

ISP User aborted operation: not used.

READ_FAIL 

ISP Flash blank check error or Flash excessive ECC errors.

TST_ERR 

not used

ISP_NOT_AUTHORISED 

ISP order authentification failure.

NO_RESPONSE 

not used

ISP_MEM_INVALID 

ISP message malformed : addressed to non existant memory.

ISP_MEM_NOT_SUPPORTED 

ISP order not supported for memory.

ISP_MEM_NO_ACCESS 

ISP access level insufficient.

ISP_MEM_OUT_OF_RANGE 

ISP order addressing memory outisde the intended range.

ISP_MEM_TOO_LONG 

ISP buffer insufficient to read requested amount of memory.

ISP_MEM_BAD_STATE 

Memory in a state that cannot support operation e.g.

opening an errored PSECT or PFLASH, closing a memory that was not opened

ISP_MEM_INVALID_MODE 

ISP order is malformed : mode incorrect.

Enumerator
ISP_MEM_SPIFI 

Unused SPIFI not handled by ISP.

This function is used to set access rights to a region.

Note that a higher order rule prevails over the lower ones. The boot ROM makes use of upper order rules : 5 .. 7. Rule 0 is a 'background' rule that opens the whole memory plane.

Parameters
region_id,:0 .. 7 see
addr,:address of region
sz,:region size
rwx_rights,:bit field RD_RIGHT(0) - WR_RIGHT(1) - X_RIGHT(2)
save_rule,:save a copy of previous rule
Returns
-1 if failure, if succesful return the size of the region.

Called after previous call to see

Parameters
region_id,:0 .. 7 see
save_rule,:saved copy of previous rule to be restored. if this parameter is NULL, RBAR and RASR of the given region_id are cleared.
Returns
-1 if failure, if succesful return the size of the region.
Enumerator
MPU_REGION_0 

Boot Reserved: background rule

MPU_REGION_1 

General purpose rule

MPU_REGION_2 

General purpose rule

MPU_REGION_3 

General purpose rule

MPU_REGION_4 

General purpose rule

MPU_REGION_5 

Boot Reserved

MPU_REGION_6 

Boot Reserved

MPU_REGION_7 

Boot Reserved

Note: PAGE0 is termed PSECT in the FlashProgrammer, whereas PFLASH remains PFLASH.

Enumerator
PSECTOR_PAGE0_PART 

Page0 partition : termed PSECT by FLashProgramemr tool Image related data.

PSECTOR_PFLASH_PART 

PFLASH : Custommer configuration data.

Enumerator
PAGE_STATE_BLANK 

Page has never been programmed or has been erased.

PAGE_STATE_ERROR 

Both subpages constituting the psector contain unrecoverable errors that ECC/parity cannot mend.

PAGE_STATE_DEGRADED 

One subpage contains unrecoverable errors or is blank.

PAGE_STATE_OK 

Both subpages are correct.

Enumerator
WRITE_OK 

Succeded in writing page.

WRITE_ERROR_BAD_MAGIC 

Magic word incorrect in page header.

WRITE_ERROR_INVALID_PAGE_NUMBER 

Invalid page number (higher than partition size)

WRITE_ERROR_BAD_VERSION 

Invalid version number: must increment monotonically.

WRITE_ERROR_BAD_CHECKSUM 

Invalid checksum.

WRITE_ERROR_INCORRECT_UPDATE_MODE 

Update mode incorrect.

WRITE_ERROR_UPDATE_INVALID 

Update invalid.

WRITE_ERROR_PAGE_ERROR 

Failure to program page in flash.

enum AuthMode_t
Enumerator
AUTH_NONE 

no authentication is performed

AUTH_ON_FW_UPDATE 

authentication is performed on firmware update

AUTH_ALWAYS 

authentication is performed at each Cold boot

Function Documentation

static ErrorCode_t aesInit ( void  )
inlinestatic
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
Note
Driver does not enable AES clock, power, or perform reset peripheral (if needed).
static void aesWriteByte ( uint32_t  offset,
uint8_t  val8 
)
inlinestatic

offset : Register offset in AES, 32-bit aligned value val8 : 8-bit value to write

Returns
Nothing
Note
This is an obfuscated function available from the ROM API as a 2nd level API call. An application can used it perform byte level write access to a register. This function is not meant to be public.
static void aesWrite ( uint32_t  offset,
uint32_t  val32 
)
inlinestatic

offset : Register offset in AES, 32-bit aligned value val32 : 32-bit value to write

Returns
Nothing
Note
This is an obfuscated function available from the ROM API as a 2nd level API call. An application can used it for write access to a register. This function is not meant to be public.
static void aesRead ( uint32_t  offset,
uint32_t *  pVal32 
)
inlinestatic

offset : Register offset in AES, 32-bit aligned value pVal32 : Pointer to 32-bit area to read into

Returns
Nothing
Note
This is an obfuscated function available from the ROM API as a 2nd level API call. An application can used it for read access to a register. This function is not meant to be public.
static void aesWriteBlock ( uint32_t  offset,
uint32_t *  pVal32,
uint32_t  numBytes 
)
inlinestatic

offset : Register offset in AES, 32-bit aligned value pVal32 : Pointer to 32-bit array to write numBytes : Number of bytes to write, must be 32-bit aligned

Returns
Nothing
Note
This is an obfuscated function available from the ROM API as a 2nd level API call. An application can used it for write access to a register. This function is not meant to be public. Writes occur in 32-bit chunks.
static void aesReadBlock ( uint32_t  offset,
uint32_t *  pVal32,
uint32_t  numBytes 
)
inlinestatic

offset : Register offset in AES, 32-bit aligned value pVal32 : Pointer to 32-bit array to read into numBytes : Number of bytes to read, must be 32-bit aligned

Returns
Nothing
Note
This is an obfuscated function available from the ROM API as a 2nd level API call. An application can used it for read access to a register. This function is not meant to be public. Reads occur in 32-bit chunks. Read data if undefined if AES not present.
static ErrorCode_t aesMode ( AES_MODE_T  modeVal,
uint32_t  flags 
)
inlinestatic
Parameters
wipe: use true to invalidate AES key and disable cipher
flags: Applies extra flags (Or'ed in config), normally should be 0, useful for swap bits only
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
static ErrorCode_t aesAbort ( int  wipe)
inlinestatic
Parameters
wipe: use true to invalidate AES key and disable cipher
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
static ErrorCode_t aesLoadCounter ( uint32_t  counter)
inlinestatic
Parameters
counter: 32-bit initial increment counter value
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
static ErrorCode_t aesLoadKeyFromSW ( AES_KEY_SIZE_T  keySize,
uint32_t *  key 
)
inlinestatic
Parameters
keySize: 0 = 128-bits, 1 = 192-bits, 2 = 256-bits, all other values are invalid (AES_KEY_SIZE_T)
key: Pointer to up to a 256-bit key array
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
static ErrorCode_t aesLoadIV ( uint32_t *  pIv)
inlinestatic
Parameters
iv: 32-bit initialization vector
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
static ErrorCode_t aesProcess ( uint32_t *  pBlockIn,
uint32_t *  pBlockOut,
uint32_t  numBlocks 
)
inlinestatic
Parameters
pBlockIn: 32-bit aligned pointer to input block of data
pBlockOut: 32-bit aligned pointer to output block of data
numBlocks: Number of blocks to process, block size = 128 bits
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
Note
The AES mode and key must be setup prior to calling this function. For encryption. the plain text is used as the input and encrypted text is output. For descryption, plain text is output while encrypted text is input.
static ErrorCode_t aesWriteYInputGf128 ( uint32_t *  pYGf128)
inlinestatic
Parameters
pYGf128: Y input of GF128 hash (4x32-bit words)
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
Note
Calling this function will reset the hash logic.
static ErrorCode_t aesReadGf128Hash ( uint32_t *  pGf128Hash)
inlinestatic
Parameters
pGf128Hash: Array of 4x32-bit words to read hash into
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
Note
Value is undefined if AES is not present.
static ErrorCode_t aesReadGcmTag ( uint32_t *  pGcmTag)
inlinestatic
Parameters
pGcmTag: Array of 4x32-bit words to read GCM tage into
Returns
LPC_OK on success, or an error code (ERRORCODE_T) on failure
Note
The GCM tage is an XOR value of the Output Text and GF128(Z) hash value. Value is undefined if AES is not present.
static uint32_t aesGetDriverVersion ( void  )
inlinestatic
Returns
Driver version, example 0x00000100 = v1.0
static ErrorCode_t aesIsSupported ( void  )
inlinestatic
Returns
LPC_OK if enabled, ERR_SEC_AES_NOT_SUPPORTED if not supported
static uint32_t BOOT_RemapAddress ( uint32_t  address)
inlinestatic

The chip has a remapping capability that allows to remap internal flash areas. This feature is part of the firmware update mechanism (OTA).

Parameters
addresslogical address to convert
Returns
physical address
static uint32_t boot_Verify_eScoreImageList ( IMAGE_DATA_T list_head)
inlinestatic

The image list is already sorted by version number. Compare image version against Min version read from PSECT. If it is greater than or equal to Min version, perform the RSA authentication over the image using the ket found in PFLASH if any. see IMAGE_VERIFY_T

Parameters
list_headsorted list of images
Returns
selected image start address
static uint32_t BOOT_FindImage ( uint32_t  start_addr,
uint32_t  end_addr,
uint32_t  signature,
IMAGE_VERIFY_T  verify 
)
inlinestatic

This function is involved in the search of a bootable image. It is called by the boot ROM on Cold boot but can be called by the Selective OTA.

The application granularity parameter is read from the PSECT, this is used as the increment used to hop to next position in case of failure. The function builds up a chained list of image descriptors that it sorts by version number. The intent is that the most recent version is at the head of the list.

Parameters
start_addraddress from which to start search
end_addraddress from which to start search
signaturemagic identifier : constant 0x98447902
IMAGE_VERIFY_Tverification function pointer (see ) This parameter cannot be NULL. The implementer may opt for a version that simply returns the head of the chained list.
Returns
image address if valid, IMAGE_INVALID_ADDR (0xffffffff) otherwise
static uint32_t BOOT_GetStartPowerMode ( void  )
inlinestatic

This is mostly used to determine in which power mode the PMC was before reset, i.e. whether is is a cold or warm reset. This is to be invoked from ResetISR2

Parameters
none
Returns
LPMode
static void BOOT_SetResumeStackPointer ( uint32_t  stack_pointer)
inlinestatic
Parameters
stack_pointeraddress to be written in retained RAM bank so that boot ROM restores value on warm start
Returns
none
static void ROM_GetFlash ( uint32_t *  address,
uint32_t *  size 
)
inlinestatic

The internal flash start address is necessarily 0. Its size may vary depending on chip options. The size returned is the number of bytes usable for program and data. The maximum possible value is 0x9dc00.

Parameters
addresspointer on location to store returned address
sizepointer on location to store returned size
Returns
*address is 0x00000000UL and *size is up to 0x9dc00
static void ROM_GetSRAM0 ( uint32_t *  address,
uint32_t *  size 
)
inlinestatic
Parameters
addresspointer on location to store returned address
sizepointer on location to store returned size
Returns
*address is 0x04000000UL and *size is 88k (0x16000)
static void ROM_GetSRAM1 ( uint32_t *  address,
uint32_t *  size 
)
inlinestatic
   SRAM1 presence is optional depending on chip variant
Parameters
addresspointer on location to store returned address
sizepointer on location to store returned size
Returns
if SRAM1 not present *address is 0 and *size is 0, otherwise *address is 0x04020000UL and *size is up to 64k (0x10000)
static int ISP_Entry ( ISP_EXTENSION_T  isp_extension)
inlinestatic

The ISP mode is requested when GPIO 5 is held down on rest or when no valid image can be found in the in the internal flash.

Parameters
isp_extensionfunction pointer on extension function. ISP_INVALID_EXTENSION (0) : no extension requested is the only implemented choice Note: ISP_Entry reads from vector table [13] in order to find a possible extension funcion. The boot ROM has a 0 value at that location.
Returns
status 0: ISP entered successfully, otherwise error was detected (ISP disabled)
static void Chip_LOWPOWER_SetUpLowPowerModeWakeUpTimer ( LPC_LOWPOWER_T p_lowpower_cfg)
inlinestatic
Parameters
p_lowpower_cfg,:pointer to a structure that contains all low power mode parameters
Returns
Nothing
static int Chip_LOWPOWER_SetSystemFrequency ( uint32_t  frequency)
inlinestatic
Parameters
Frequency:
Returns
Nothing
static int Chip_LOWPOWER_SetMemoryLowPowerMode ( uint32_t  p_sram_instance,
uint32_t  p_sram_lp_mode 
)
inlinestatic
Parameters
p_sram_instance,:SRAM instance number, between 0 and 11.
p_sram_lp_mode: Low power mode : LOWPOWER_SRAM_LPMODE_ACTIVE, LOWPOWER_SRAM_LPMODE_SLEEP, LOWPOWER_SRAM_LPMODE_DEEPSLEEP, LOWPOWER_SRAM_LPMODE_SHUTDOWN
Returns
Status code
static void Chip_LOWPOWER_GetSystemVoltages ( LPC_LOWPOWER_LDOVOLTAGE_T p_ldo_voltage)
inlinestatic
Parameters
p_ldo_voltage,:pointer to a structure to fill with current voltages on the chip
Returns
Nothing
static void Chip_LOWPOWER_SetSystemVoltages ( LPC_LOWPOWER_LDOVOLTAGE_T p_ldo_voltage)
inlinestatic
Parameters
p_ldo_voltage,:pointer to a structure that contains new voltages to be applied
Returns
Nothing
static void Chip_LOWPOWER_SetLowPowerMode ( LPC_LOWPOWER_T p_lowpower_cfg)
inlinestatic
Parameters
p_lowpower_cfg,:pointer to a structure that contains all low power mode parameters
Returns
Nothing
static void Chip_LOWPOWER_ChipSoftwareReset ( void  )
inlinestatic

Power down the flash then perform the full chip reset as POR or Watchdog do, The reset includes JTAG debugger, Digital units and Analog modules. Use the Software reset bit in PMC

Returns
Nothing
static void Chip_LOWPOWER_ArmSoftwareReset ( void  )
inlinestatic

Power down the flash then perform the Full chip reset as POR or Watchdog, The reset includes the digital units but excludes the JTAG debugger, and the analog modules. Use the system reset bit in PMC and ARM reset

Returns
Nothing
static int MPU_pSectorGrantAccessRights ( uint32_t  addr,
size_t  sz,
MPU_reg_settings_t *  save_rule 
)
inlinestatic

Note: The pSector region is 'special' because counter intuitively it requires Write access in order to be able to read from it using the flash controller indirect method. The previosuly applied policy. pSector region is protected under rule 7 (highest precedence). The previous rule 7 is saved in RAM before changing it.

Parameters
addr,:address of area to grant access to.
sz,:size in number of bytes of area.
save_rule,:save a copy of previous rule
Returns
-1 if failure, if succesful return the size of the region.
static int MPU_pSectorWithdrawAccessRights ( MPU_reg_settings_t *  save_rule)
inlinestatic

The pSector region is 'special' because counter intuitively it requires Write access in order to be able to read from it using the flash controller indirect method.

Parameters
save_rule,:pointer on RAM MPU_reg_settings_t structure saved by MPU_pSectorGrantAccessRights used to restore previous settings of region 7 and restrict access to pSector.
Returns
-1 if failure, if succesful return the size of the region.
static void MPU_GetCurrentSettings ( MPU_Settings_t settings)
inlinestatic
Parameters
settings,:pointer of structure to receive the MPU register valkues.
Returns
none
static int MPU_AllocateRegionDesc ( void  )
inlinestatic

Checks if rules have their RASR enable bit set. This for the application to find free riules that were left unused by the ROM code. Implicitly MPU_ClearRegionSetting releases an allocate rule.

Parameters
none
Returns
-1 if none free, value between 1..4 if succesful.
static uint32_t pmc_reset_get_cause ( void  )
inlinestatic
Returns
Reset cause value.
Return values
0x1POR - The last chip reset was caused by a Power On Reset.
0x2PADRESET - The last chip reset was caused by a Pad Reset.
0x4BODRESET - The last chip reset was caused by a Brown Out Detector.
0x8SYSTEMRESET - The last chip reset was caused by a System Reset requested by the ARM CPU.
0x10WDTRESET - The last chip reset was caused by the Watchdog Timer.
0x20WAKEUPIORESET - The last chip reset was caused by a Wake-up I/O (GPIO or internal NTAG FD INT).
0x40WAKEUPPWDNRESET - The last CPU reset was caused by a Wake-up from Power down (many sources possible: timer, IO, ...).
0x80SWRRESET - The last chip reset was caused by a Software.
static void pmc_reset_clear_cause ( uint32_t  mask)
inlinestatic
Parameters
maskThe mask of reset cause which you want to clear.
Returns
none
static psector_write_status_t psector_WriteUpdatePage ( psector_partition_id_t  part_index,
psector_page_t *  page 
)
inlinestatic

The actual write to the partition will be effective after a reset only. Among other checks, the page must have a correct magic, a correct checksum

Parameters
part_index,:PSECTOR_PAGE0_PART or PFLASH_PAGE0_PART.
page,:psector_page_t RAM buffer to be written to update page
Returns
status code see @ psector_write_status_t.
static void psector_EraseUpdate ( void  )
inlinestatic

The actual write to the partition will be effective after a reset only.

Parameters
part_index,:PSECTOR_PAGE0_PART or PFLASH_PAGE0_PART.
page,:psector_page_t RAM buffer to be written to update page
Returns
status code see @ psector_write_status_t.
static psector_page_state_t psector_ReadData ( psector_partition_id_t  part_index,
int  page_number,
uint32_t  offset,
uint32_t  size,
void *  data 
)
inlinestatic
Parameters
part_index,:PSECTOR_PAGE0_PART or PFLASH_PAGE0_PART.
page_number,:necessarily 0 since partitions now contain 1 single page.
offset,:offset of data from which data is to be read
size,:number of bytes to be read
data,:pointer on RAM buffer used to copy retrived data.
Returns
status code see @ psector_page_state_t if PAGE_STATE_DEGRADED or PAGE_STATE_OK, data is available. if PAGE_STATE_ERROR or PAGE_STATE_BLANK, no data was read
static uint32_t psector_CalculateChecksum ( psector_page_t *  psector_page)
inlinestatic

It is essential to recalculate the checksum when performing a psector page update, failing to update this field, the write operation would be rejected.

Parameters
psector_page,:pointer on page over which computation is required.
Returns
checksum value to be checked or to replace checksum field of psector header
static uint64_t psector_Read_CustomerId ( void  )
inlinestatic
Parameters
none
Returns
CustomerId on 64 bit word
static int psector_Read_RomPatchInfo ( uint32_t *  patch_region_sz,
uint32_t *  patch_region_addr,
uint32_t *  patch_checksum,
uint32_t *  patch_checksum_valid 
)
inlinestatic
Parameters
patch_region_sz,:pointer on unsigned long to return ROM patch size
patch_region_addr,:pointer on unsigned long to return ROM patch address
patch_checksum,:pointer on unsigned long to return ROM patch checksum value
patch_checksum_valid,:pointer on unsigned long to return ROM patch checksum validity (0..1)
Returns
-1 if erro is found (any of the input parameters is NULL) or PFLASH is unreadable.
static uint16_t psector_Read_ImgAuthLevel ( void  )
inlinestatic
Parameters
none.
Returns
AUH_NONE if PFLASH unreadable, or the image_authentication_level field value if readable.
static uint32_t psector_Read_AppSearchGranularity ( void  )
inlinestatic
Parameters
none.
Returns
0 if PFLASH unreadable, or the app_search_granularity field value if not 0 or 4096 if 0.
static uint32_t psector_Read_QspiAppSearchGranularity ( void  )
inlinestatic
Parameters
none.
Returns
0 if PFLASH unreadable, or the qspi_app_search_granularity field value.
static uint64_t psector_Read_DeviceId ( void  )
inlinestatic
Parameters
none.
Returns
0 if PFLASH unreadable, or the device_id field value.
static int psector_Read_UnlockKey ( int *  valid,
uint8_t  key[256],
bool  raw 
)
inlinestatic
Parameters
valid,:pointer on int to store validity of key (unlock_key_valid field)
key,:pointer on 256 byte storage to receive the key read from PFLASH
raw,:raw if raw is not requested (0), the key is deciphered using the internal AES fused key.
Returns
-1 if read error occurred, 0 otherwise
static int psector_Read_ISP_protocol_key ( uint8_t  key[16])
inlinestatic
Parameters
key,:pointer on 16 byte storage to receive the key read from PFLASH.
Returns
-1 if read error occurred, 0 otherwise
static uint64_t psector_ReadIeee802_15_4_MacId1 ( void  )
inlinestatic
Parameters
none.
Returns
64 bit word 0 if field unreadable, otherwise MAC address contained in ieee_mac_id1 field.
static uint64_t psector_ReadIeee802_15_4_MacId2 ( void  )
inlinestatic
Parameters
none.
Returns
64 bit word 0 if field unreadable, otherwise MAC address contained in ieee_mac_id2 field.
static uint64_t psector_Read_MinDeviceId ( void  )
inlinestatic
Parameters
none.
Returns
0 if PFLASH unreadable, otherwise min_device_id field content.
static uint64_t psector_Read_MaxDeviceId ( void  )
inlinestatic
Parameters
none.
Returns
0 if PFLASH unreadable, otherwise max_device_id field content.
static uint32_t psector_Read_MinVersion ( void  )
inlinestatic
Parameters
none.
Returns
if PAGE0 unreadable, otherwise MinVersion field content.
static psector_write_status_t psector_SetEscoreImageData ( uint32_t  image_addr,
uint32_t  min_version 
)
inlinestatic
Parameters
image_addr,:32 bit value to be written to SelectImageAddress.
min_version,:32 bit value to be written to MinVersion.
Returns
psector_write_status_t status of operation see
static psector_page_state_t psector_ReadEscoreImageData ( uint32_t *  image_addr,
uint32_t *  min_version 
)
inlinestatic
Parameters
image_addr,:pointer on 32 bit word to receive SelectImageAddress value.
min_versionm,:pointer on 32 bit word to receive SelectImageAddress value.
Returns
-1 if read error occurred, 0 otherwise
static int psector_Read_ImagePubKey ( int *  valid,
uint8_t  key[256],
bool  raw 
)
inlinestatic
Parameters
valid,:pointer on int to store validity of key (img_pk_valid field)
key,:pointer on 256 byte storage to receive the key read from PAGE0
raw,:raw if raw is not requested (0), the key is deciphered using the internal AES fused key.
Returns
-1 if read error occurred, 0 otherwise
static uint32_t secure_VerifySignature ( uint8_t *  hash,
const uint8_t *  signature,
const uint32_t *  key 
)
inlinestatic

Verify a signature by encrypting it using the provided public key and validating the output matches the provided hash resulting from the SHA-256

Parameters
hash,:pointer on computed SHA-256 hash
signature,:pointer on RSA-2048 signature to be checked
key,:pointer on public key
Returns
1: if correct, 0: otherwise.
static uint32_t secure_VerifyBlock ( uint8_t *  start,
uint32_t  length,
const uint32_t *  key,
const uint8_t *  signature 
)
inlinestatic

Verify a data block with appended signature. Computes the SHA-256 hash. calls see

Parameters
start,:pointer on start of data block
length,:length of data block
key,:pointer on public key
signature,:pointer on RSA-2048 signature to be checked
Returns
1: if correct, 0: otherwise.
static uint32_t secure_VerifyCertificate ( const IMAGE_CERT_T certificate,
const uint32_t *  key,
const uint8_t *  cert_signature 
)
inlinestatic

Verify certificate is valid for this device and is authentic. Certificate is checked for validity against customer and device ID stored in PFLASH.

Parameters
certificate,:pointer on computed SHA-256 hash
key,:pointer on public key
cert_signature,:pointer on RSA-2048 signature to be checked
Returns
1: if certificate is valid, 0: otherwise.
static uint32_t secure_VerifyImage ( uint32_t  image_addr,
const IMAGE_CERT_T root_cert 
)
inlinestatic

The function retrieves the certificate pointed by the boot block certificate offset field. If present it has to be verified using the root certificate.

Parameters
image_addr,:pointer on start of image to be checked.
root_cert,:pointer on root certificate (that contains a public key). If the root certificate is present the key is gotten from it.
Returns
1: if certificate is valid, 0: otherwise.

Variable Documentation

uint8_t ISP_MEM_INFO_T::access
  • bit 0: Read access
  • bit 1: Write access
  • bit 2: Erase right
  • bit 3: Erase all right
  • bit 4: blank check right A value of 0 denotes that access is closed
uint8_t ISP_STATE_T::mode
  • 0x01: Default ISP mode
  • 0x7f: unlock mode
  • 0x80 or higher: treated by extension function if any
uint32_t psector_page_data_t::MinVersion

offset 0x30

uint32_t { ... } ::MinVersion

offset 0x30

uint32_t psector_page_data_t::rom_patch_region_addr

A value outside of the address range used to store the ROM patch binary shall be deemed invalid

uint32_t { ... } ::rom_patch_region_addr

A value outside of the address range used to store the ROM patch binary shall be deemed invalid

uint16_t psector_page_data_t::application_flash_sz

0 is interpreted as maximum (640). This is intended to provide an alternative way of restricting the flash size on a device, and to greater granularity, than the eFuse bit. The actual level of granularity that can be obtained is dependent upon the MPU region configuration

uint16_t { ... } ::application_flash_sz

0 is interpreted as maximum (640). This is intended to provide an alternative way of restricting the flash size on a device, and to greater granularity, than the eFuse bit. The actual level of granularity that can be obtained is dependent upon the MPU region configuration

uint16_t psector_page_data_t::ram1_bank_sz

This is intended to provide an alternative way of restricting the RAM size on a device, and to greater granularity, than the eFuse bit. The actual level of granularity that can be obtained is dependent upon the MPU region configuration

uint16_t { ... } ::ram1_bank_sz

This is intended to provide an alternative way of restricting the RAM size on a device, and to greater granularity, than the eFuse bit. The actual level of granularity that can be obtained is dependent upon the MPU region configuration

uint32_t psector_page_data_t::app_search_granularity

Value of 0 shall be equated to 4096. Other values are to be used directly; configurations that are not using hardware remapping do not require hard restrictions

uint32_t { ... } ::app_search_granularity

Value of 0 shall be equated to 4096. Other values are to be used directly; configurations that are not using hardware remapping do not require hard restrictions

uint8_t psector_page_data_t::unlock_key[256]

Stored encrypted, using the AES key in eFuse

uint8_t { ... } ::unlock_key[256]

Stored encrypted, using the AES key in eFuse