Infineon MOTIX™ MCU TLE988x/9x Device Family SDK
bootrom.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * The applicable license agreement can be found at this pack's installation directory in the file
8  * license/IFX_SW_Licence_MOTIX_LITIX.txt
9  *
10  **********************************************************************************************************************/
26 /*******************************************************************************
27 ** Author(s) Identity **
28 ********************************************************************************
29 ** Initials Name **
30 ** ---------------------------------------------------------------------------**
31 ** DM Daniel Mysliwitz **
32 ** BG Blandine Guillot **
33 ** JO Julia Ott **
34 ** PS Patrik Schwarz **
35 *******************************************************************************/
36 
37 /*******************************************************************************
38 ** Revision Control History **
39 ********************************************************************************
40 ** V0.1.0: 2020-08-14, JO: Initial version **
41 ** V0.1.1: 2020-11-12, JO: EP-590: Added end of group for doxygen **
42 ** V0.1.2: 2020-11-27, BG: EP-610: Corrected MISRA 2012 errors **
43 ** V0.1.3: 2020-11-27, JO: EP-624: Removed internal APIs **
44 ** V0.1.4: 2021-02-10, JO: EP-696: Changed from anonymous to named typedefs **
45 ** to prevent MISRA warning **
46 ** V0.2.0: 2021-04-23, JO: EP-696: Added artifacts for AB design step **
47 ** V0.2.1: 2021-07-12, BG: EP-829: Added API documentation **
48 ** V0.2.2: 2021-07-30, BG: EP-877: Corrected MISRA 2012 errors **
49 ** V0.2.3: 2021-11-12, JO: EP-937: Updated copyright and branding **
50 ** V0.3.0: 2021-11-30, BG: EP-875: Added artifacts for AK design step **
51 ** Removed error codes for AA and AB design steps **
52 ** V0.3.1: 2022-06-23, JO: EP-1150: Removed ARMCC V6.18 warnings **
53 ** V0.3.2: 2023-03-23, JO: EP-1427: Corrected doxygen inconsistency **
54 ** V0.3.3: 2023-04-04, PS: EP-1141: Correct MISRA warnings **
55 ** V0.3.4: 2024-11-05, JO: EP-1494: Updated license **
56 *******************************************************************************/
57 
58 #ifndef _BOOTROM_H
59 #define _BOOTROM_H
60 
61 /*******************************************************************************
62 ** Includes **
63 *******************************************************************************/
64 
65 #include "types.h"
66 #include "RTE_Components.h"
67 
68 /*******************************************************************************
69 ** Entry points into the BootROM **
70 *******************************************************************************/
71 
72 #define addr_user_nvm_isr_handler (0xc1u)
73 #define addr_user_cid_get (0xc5u)
74 #define addr_user_ram_mbist (0xc9u)
75 #define addr_user_nvm_udata_temp_protect_clear (0xd1u)
76 #define addr_user_nvm_ucode_temp_protect_clear (0xd5u)
77 #define addr_user_nvm_udata_temp_protect_set (0xd9u)
78 #define addr_user_nvm_ucode_temp_protect_set (0xddu)
79 #define addr_user_nvm_temp_protect_get (0xe1u)
80 #define addr_user_nvm_ecc_addr_get (0xe5u)
81 #define addr_user_nvm_ecc_check (0xe9u)
82 #define addr_user_nvm_100tp_read (0xedu)
83 #define addr_user_nvm_100tp_write (0xf1u)
84 #define addr_user_nvm_100tp_erase (0xf5u)
85 #define addr_user_nvm_config_get (0xf9u)
86 #define addr_user_nvm_page_erase (0xfdu)
87 #define addr_user_nvm_sector_erase (0x101u)
88 #define addr_user_nvm_page_write (0x105u)
89 #define addr_user_nvm_mapram_init (0x109u)
90 #define addr_user_nvm_mapram_recover (0x10du)
91 #define addr_user_nvm_service_algorithm (0x111u)
92 #define addr_user_crypto_aes_cmac_generate_start (0x115u)
93 #define addr_user_crypto_aes_cmac_generate_update (0x119u)
94 #define addr_user_crypto_aes_cmac_generate_finish (0x11du)
95 #define addr_user_crypto_aes_cmac_verify_start (0x121u)
96 #define addr_user_crypto_aes_cmac_verify_update (0x125u)
97 #define addr_user_crypto_aes_cmac_verify_finish (0x129u)
98 #define addr_user_crypto_aes_start (0x12du)
99 #define addr_user_crypto_aes_update (0x131u)
100 #define addr_user_crypto_aes_finish (0x135u)
101 #define addr_user_crypto_key_write (0x139u)
102 #define addr_user_crypto_key_erase (0x13du)
103 #define addr_user_crypto_key_verify (0x141u)
104 #define addr_user_nvm_reg_write (0x145u)
105 #define addr_user_nvm_reg_read (0x149u)
106 #define addr_user_secure_download_start (0x14du)
107 #define addr_user_secure_download_update (0x151u)
108 #define addr_user_secure_download_finish (0x155u)
109 #define addr_user_cache_operation (0x159u)
110 #define addr_user_ubsl_size_restore (0x15du)
111 #define addr_user_nvm_perm_protect_set (0x161u)
112 #define addr_user_nvm_ubsl_temp_protect_clear (0x201u)
113 #define addr_user_nvm_ubsl_temp_protect_set (0x205u)
114 #define addr_user_secure_dualboot (0x209u)
115 
116 /*******************************************************************************
117 ** Global Constant Declarations **
118 *******************************************************************************/
119 
121 #define USER_KEY_SIZE_128 (0x10u)
122 
124 #define USER_KEY_SIZE_256 (0x20u)
125 
127 #define USER_KEY_SIZE_MAX (USER_KEY_SIZE_256)
128 
130 #define USER_KEY_PARAM_SIZE (0x40u)
131 
133 #define USER_CMAC_SIGNATURE_SIZE (0x10u)
134 
136 #define USER_KEY_WRITE_BUFFER_SIZE (0x30u)
137 
139 #define USER_KEY_MAX_ID (12u)
140 
142 #define USER_KEY_MIN_ID (1u)
143 
145 #define IFX_KEY_ID (0u)
146 
147 /*******************************************************************************
148 ** Global Type Declarations **
149 *******************************************************************************/
150 
151 typedef struct user_100tp_read_t
152 {
153  uint32_t offset;
154  uint8_t *data;
155  uint16_t nbyte;
157 
158 typedef struct user_100tp_write_t
159 {
160  uint32_t offset;
161  uint8_t *data;
162  uint8_t nbyte;
163  uint8_t counter;
165 
167 typedef struct user_key_t
168 {
170  uint16_t version;
171  uint8_t length;
172  uint8_t protection;
174 
175 typedef enum user_crypto_fid_t
176 {
182 
183 typedef struct user_crypto_inp_buf_t
184 {
185  uint8_t *buffer;
186  uint32_t length;
188 
189 typedef struct user_crypto_out_buf_t
190 {
191  uint8_t *buffer;
192  uint32_t *length;
194 
195 typedef struct user_crypto_io_buf_t
196 {
200 
201 typedef struct user_crypto_cmac_t
202 {
206 
207 typedef struct user_crypto_cbc_t
208 {
209  void *iv;
210  uint32_t iv_length;
212 
213 
215 {
217  uint16_t target_key_id;
218  uint16_t encrypt_key_id;
220 
221 
222 typedef struct user_key_write_t
223 {
227 
229 {
230  uint16_t target_key_id;
231  uint16_t version;
233 
234 
235 typedef struct user_key_erase_t
236 {
240 
241 typedef struct user_nvm_page_write_t
242 {
243  uint8_t *data;
244  uint32_t nbyte;
245  uint32_t options;
247 
248 typedef enum user_cache_op_t
249 {
257  CACHE_OP_DIS = 7
259 
261 typedef enum user_nvm_segment_t
262 {
268 
269 /*******************************************************************************
270 ** Global Macro Declarations **
271 *******************************************************************************/
272 
273 /*******************************************************************************
274 ** Global Function Declarations **
275 *******************************************************************************/
276 
287 #define user_cid_get ( (int32_t(*)(uint32_t *)) addr_user_cid_get )
288 
304 #define user_ram_mbist ( (int32_t(*)(uint32_t, uint32_t)) addr_user_ram_mbist )
305 
318 #define user_nvm_udata_temp_protect_clear ( (int32_t(*)(uint32_t)) addr_user_nvm_udata_temp_protect_clear )
319 
332 #define user_nvm_ucode_temp_protect_clear ( (int32_t(*)(uint32_t)) addr_user_nvm_ucode_temp_protect_clear )
333 
346 #define user_nvm_udata_temp_protect_set ( (int32_t(*)(uint32_t)) addr_user_nvm_udata_temp_protect_set )
347 
360 #define user_nvm_ucode_temp_protect_set ( (int32_t(*)(uint32_t)) addr_user_nvm_ucode_temp_protect_set )
361 
371 #define user_nvm_temp_protect_get ( (uint32_t(*)(user_nvm_segment_t)) addr_user_nvm_temp_protect_get )
372 
391 #define user_nvm_perm_protect_set ( (int32_t(*)(uint32_t)) addr_user_nvm_perm_protect_set )
392 
415 #define user_nvm_ecc_addr_get ( (int32_t(*)(uint32_t, uint32_t *)) addr_user_nvm_ecc_addr_get )
416 
435 #define user_nvm_ecc_check ( (int32_t(*)(uint32_t)) addr_user_nvm_ecc_check )
436 
455 #define user_nvm_100tp_read ( (int32_t(*)(uint32_t, user_100tp_read_t *)) addr_user_nvm_100tp_read )
456 
481 #define user_nvm_100tp_write ( (int32_t(*)(uint32_t, user_100tp_write_t *)) addr_user_nvm_100tp_write )
482 
501 #define user_nvm_100tp_erase ( (int32_t(*)(uint32_t)) addr_user_nvm_100tp_erase )
502 
515 #define user_nvm_config_get ( (int32_t(*)(uint32_t *, uint32_t *, uint32_t *)) addr_user_nvm_config_get )
516 
543 #define user_nvm_page_erase ( (int32_t(*)(uint32_t, uint32_t)) addr_user_nvm_page_erase )
544 
570 #define user_nvm_sector_erase ( (int32_t(*)(uint32_t, uint32_t)) addr_user_nvm_sector_erase )
571 
608 #define user_nvm_page_write ( (int32_t(*)(uint32_t, user_nvm_page_write_t *)) addr_user_nvm_page_write )
609 #define user_nvm_write user_nvm_page_write
610 
625 #define user_nvm_mapram_init ( (int32_t(*)(uint32_t)) addr_user_nvm_mapram_init )
626 
644 #define user_nvm_mapram_recover ( (int32_t(*)(uint32_t)) addr_user_nvm_mapram_recover )
645 
660 #define user_nvm_service_algorithm ( (int32_t(*)(uint32_t)) addr_user_nvm_service_algorithm )
661 
676 #define user_nvm_reg_write ( (int32_t(*)(uint32_t, uint32_t )) addr_user_nvm_reg_write )
677 
693 #define user_nvm_reg_read ( (int32_t(*)(uint32_t, uint32_t *)) addr_user_nvm_reg_read )
694 
720 #define user_secure_download_start ( (int32_t(*)(uint8_t, uint8_t, uint8_t *)) addr_user_secure_download_start )
721 
746 #define user_secure_download_update ( (int32_t(*)(uint32_t, uint8_t *)) addr_user_secure_download_update )
747 
763 #define user_secure_download_finish ( (int32_t(*)(void)) addr_user_secure_download_finish )
764 
775 #define user_cache_operation ( (int32_t(*)(user_cache_op_t, uint32_t)) addr_user_cache_operation )
776 
783 #define user_ubsl_size_restore ( (void(*)(void)) addr_user_ubsl_size_restore )
784 
802 #define user_crypto_aes_cmac_generate_start ( (int32_t(*)(uint32_t)) addr_user_crypto_aes_cmac_generate_start )
803 
823 #define user_crypto_aes_cmac_generate_update ( (int32_t(*)(user_crypto_inp_buf_t *)) addr_user_crypto_aes_cmac_generate_update)
824 
844 #define user_crypto_aes_cmac_generate_finish ( (int32_t(*)(user_crypto_io_buf_t *, bool)) addr_user_crypto_aes_cmac_generate_finish)
845 
863 #define user_crypto_aes_cmac_verify_start ( (int32_t(*)(uint32_t)) addr_user_crypto_aes_cmac_verify_start )
864 
884 #define user_crypto_aes_cmac_verify_update ( (int32_t(*)(user_crypto_inp_buf_t *)) addr_user_crypto_aes_cmac_verify_update )
885 
905 #define user_crypto_aes_cmac_verify_finish ( (int32_t(*)(user_crypto_cmac_t *)) addr_user_crypto_aes_cmac_verify_finish )
906 
927 #define user_crypto_aes_start ( (int32_t(*)(user_crypto_fid_t, uint32_t, user_crypto_cbc_t *)) addr_user_crypto_aes_start )
928 
949 #define user_crypto_aes_update ( (int32_t(*)(user_crypto_io_buf_t *)) addr_user_crypto_aes_update )
950 
970 #define user_crypto_aes_finish ( (int32_t(*)(user_crypto_io_buf_t *)) addr_user_crypto_aes_finish )
971 
996 #define user_crypto_key_write ( (int32_t(*)(user_key_write_t *)) addr_user_crypto_key_write )
997 
1021 #define user_crypto_key_erase ( (int32_t(*)(user_key_erase_t *)) addr_user_crypto_key_erase )
1022 
1044 #define user_crypto_key_verify ( (int32_t(*)(uint8_t, bool)) addr_user_crypto_key_verify )
1045 
1046 /* User API extension, callable from UBSL segment only */
1059 #define user_nvm_ubsl_temp_protect_clear ( (int32_t(*)(uint32_t)) addr_user_nvm_ubsl_temp_protect_clear )
1060 
1073 #define user_nvm_ubsl_temp_protect_set ( (int32_t(*)(uint32_t)) addr_user_nvm_ubsl_temp_protect_set )
1074 
1089 #define user_secure_dualboot ( (int32_t(*)(uint32_t)) addr_user_secure_dualboot )
1090 
1091 /*******************************************************************************
1092 ** Global Inline Function Definitions **
1093 *******************************************************************************/
1094 
1097 #endif /* _BOOTROM_H */
struct user_100tp_write_t user_100tp_write_t
struct user_crypto_io_buf_t user_crypto_io_buf_t
struct user_crypto_out_buf_t user_crypto_out_buf_t
user_cache_op_t
Definition: bootrom.h:249
struct user_crypto_inp_buf_t user_crypto_inp_buf_t
struct user_crypto_cmac_t user_crypto_cmac_t
#define USER_CMAC_SIGNATURE_SIZE
cmac signature size 16 bytes
Definition: bootrom.h:133
struct user_key_write_params_t user_key_write_params_t
struct user_key_t user_key_t
Key data structure aligned with CFS page (ignored reserved bytes)
#define USER_KEY_SIZE_MAX
Maximum length for a key value to read/store.
Definition: bootrom.h:127
struct user_key_write_t user_key_write_t
struct user_key_erase_t user_key_erase_t
struct user_crypto_cbc_t user_crypto_cbc_t
user_crypto_fid_t
Definition: bootrom.h:176
struct user_100tp_read_t user_100tp_read_t
struct user_nvm_page_write_t user_nvm_page_write_t
#define USER_KEY_PARAM_SIZE
encrypted key parameter size 64 bytes
Definition: bootrom.h:130
struct user_key_erase_params_t user_key_erase_params_t
user_nvm_segment_t
Definition: bootrom.h:262
@ CACHE_OP_BU
Cache block unlock operation.
Definition: bootrom.h:255
@ CACHE_OP_AC
Cache all clean operation.
Definition: bootrom.h:250
@ CACHE_OP_BT
Cache block touch operation.
Definition: bootrom.h:253
@ CACHE_OP_SC
Cache set clean operation.
Definition: bootrom.h:251
@ CACHE_OP_BL
Cache block lock operation.
Definition: bootrom.h:254
@ CACHE_OP_BC
Cache block clean operation.
Definition: bootrom.h:252
@ CACHE_OP_DIS
Cache disable operation.
Definition: bootrom.h:257
@ CACHE_OP_EN
Cache enable operation.
Definition: bootrom.h:256
@ CRYPTO_ECB_DECRYPT
Definition: bootrom.h:178
@ CRYPTO_CBC_DECRYPT
Definition: bootrom.h:180
@ CRYPTO_CBC_ENCRYPT
Definition: bootrom.h:179
@ CRYPTO_ECB_ENCRYPT
Definition: bootrom.h:177
@ NVM_PASSWORD_SEGMENT_DATA
NVM password for customer data mapped segment (NVM FLASH0).
Definition: bootrom.h:265
@ NVM_PASSWORD_SEGMENT_BOOT
NVM password for customer segment, used for customer bootloader (NVM FLASH0).
Definition: bootrom.h:263
@ NVM_PASSWORD_SEGMENT_CODE
NVM password for customer code segment, which is not used by the customer bootloader (NVM FLASH1).
Definition: bootrom.h:264
@ NVM_PASSWORD_SEGMENT_TOTAL
Can be ignored and should not be used.
Definition: bootrom.h:266
Definition: bootrom.h:152
uint32_t offset
Byte offset inside the selected page address, where to start reading. Maximum is 127 bytes.
Definition: bootrom.h:153
uint16_t nbyte
Amount of data bytes to read. If nbyte is zero, there is no read operation done and an error code is ...
Definition: bootrom.h:155
uint8_t * data
Data pointer where to write data into. Pointer plus valid count must be within valid RAM range or an ...
Definition: bootrom.h:154
Definition: bootrom.h:159
uint8_t counter
Counter value to update internal 100TP counter (only updates if value is greater than current,...
Definition: bootrom.h:163
uint8_t nbyte
Amount of data bytes to write. If nbyte is zero, there is no write operation done and an error code i...
Definition: bootrom.h:162
uint32_t offset
Byte offset inside the selected page address, where to start writing. Maximum is 123 bytes.
Definition: bootrom.h:160
uint8_t * data
Data pointer where to read the data to write. Pointer plus valid count must be within valid RAM range...
Definition: bootrom.h:161
Definition: bootrom.h:208
uint32_t iv_length
Definition: bootrom.h:210
void * iv
Definition: bootrom.h:209
Definition: bootrom.h:202
user_crypto_inp_buf_t mac
CMAC generate output buffer.
Definition: bootrom.h:204
user_crypto_inp_buf_t inp
CMAC generate input buffer.
Definition: bootrom.h:203
Definition: bootrom.h:184
uint8_t * buffer
Crypto algorithm input buffer address.
Definition: bootrom.h:185
uint32_t length
Crypto algorithm input buffer length.
Definition: bootrom.h:186
Definition: bootrom.h:196
user_crypto_out_buf_t out
Crypto algorithm output buffer.
Definition: bootrom.h:198
user_crypto_inp_buf_t inp
Crypto algorithm input buffer.
Definition: bootrom.h:197
Definition: bootrom.h:190
uint8_t * buffer
Crypto algorithm output buffer address.
Definition: bootrom.h:191
uint32_t * length
Crypto algorithm output buffer length.
Definition: bootrom.h:192
Definition: bootrom.h:229
uint16_t target_key_id
Key slot ID for parameter decryption.
Definition: bootrom.h:230
uint16_t version
New key version number.
Definition: bootrom.h:231
Definition: bootrom.h:236
uint8_t signature[USER_CMAC_SIGNATURE_SIZE]
CMAC signature.
Definition: bootrom.h:238
user_key_erase_params_t params
Input parameters (signature checked).
Definition: bootrom.h:237
Key data structure aligned with CFS page (ignored reserved bytes)
Definition: bootrom.h:168
uint8_t key[USER_KEY_SIZE_MAX]
Key value
Definition: bootrom.h:169
uint8_t protection
Key protection
Definition: bootrom.h:172
uint8_t length
Key size in bytes [16|32].
Definition: bootrom.h:171
uint16_t version
New key version number
Definition: bootrom.h:170
Definition: bootrom.h:215
uint8_t encrypted_key_buf[USER_KEY_PARAM_SIZE]
Encrypted buffer with new key parameters.
Definition: bootrom.h:216
uint16_t target_key_id
Key slot ID for parameter decryption.
Definition: bootrom.h:217
uint16_t encrypt_key_id
Key slot ID used for the new key parameters.
Definition: bootrom.h:218
Definition: bootrom.h:223
uint8_t signature[USER_CMAC_SIGNATURE_SIZE]
New key CMAC signature.
Definition: bootrom.h:225
user_key_write_params_t params
Input parameters (signature checked).
Definition: bootrom.h:224
Definition: bootrom.h:242
uint32_t options
NVM programming options (for example NVM_OPTIONS_CORR_ACT or NVM_OPTIONS_NO_FAILPAGE_ERASE).
Definition: bootrom.h:245
uint32_t nbyte
Amount of bytes to program. Range from 1-128 bytes.
Definition: bootrom.h:244
uint8_t * data
Pointer to the data where to read the programming data. Pointer must be within valid RAM range or an ...
Definition: bootrom.h:243
General type declarations.