esp_efuse_table.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. /*
  2. * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include "sdkconfig.h"
  7. #include "esp_efuse.h"
  8. #include <assert.h>
  9. #include "esp_efuse_table.h"
  10. // md5_digest_table af57e8a6a405ebf239cc552f713c91d0
  11. // This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
  12. // If you want to change some fields, you need to change esp_efuse_table.csv file
  13. // then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
  14. // To show efuse_table run the command 'show_efuse_table'.
  15. static const esp_efuse_desc_t WR_DIS[] = {
  16. {EFUSE_BLK0, 0, 8}, // Write protection,
  17. };
  18. static const esp_efuse_desc_t WR_DIS_KEY0_RD_DIS[] = {
  19. {EFUSE_BLK0, 0, 1}, // Write protection for KEY0_RD_DIS,
  20. };
  21. static const esp_efuse_desc_t WR_DIS_GROUP_1[] = {
  22. {EFUSE_BLK0, 1, 1}, // Write protection for WDT_DELAY DIS_PAD_JTAG DIS_DOWNLOAD_ICACHE,
  23. };
  24. static const esp_efuse_desc_t WR_DIS_GROUP_2[] = {
  25. {EFUSE_BLK0, 2, 1}, // Write protection for DOWNLOAD_DIS_MANUAL_ENCRYPT SPI_BOOT_CRYPT_CNT XTS_KEY_LENGTH_256 SECURE_BOOT_EN,
  26. };
  27. static const esp_efuse_desc_t WR_DIS_SPI_BOOT_CRYPT_CNT[] = {
  28. {EFUSE_BLK0, 2, 1}, // Write protection for DOWNLOAD_DIS_MANUAL_ENCRYPT [SPI_BOOT_CRYPT_CNT] XTS_KEY_LENGTH_256 SECURE_BOOT_EN,
  29. };
  30. static const esp_efuse_desc_t WR_DIS_GROUP_3[] = {
  31. {EFUSE_BLK0, 3, 1}, // Write protection for UART_PRINT_CONTROL FORCE_SEND_RESUME DIS_DOWNLOAD_MODE DIS_DIRECT_BOOT ENABLE_SECURITY_DOWNLOAD FLASH_TPUW,
  32. };
  33. static const esp_efuse_desc_t WR_DIS_BLK0_RESERVED[] = {
  34. {EFUSE_BLK0, 4, 1}, // Write protection for BLK0_RESERVED,
  35. };
  36. static const esp_efuse_desc_t WR_DIS_SYS_DATA_PART0[] = {
  37. {EFUSE_BLK0, 5, 1}, // Write protection for EFUSE_BLK1. SYS_DATA_PART0,
  38. };
  39. static const esp_efuse_desc_t WR_DIS_SYS_DATA_PART1[] = {
  40. {EFUSE_BLK0, 6, 1}, // Write protection for EFUSE_BLK2. SYS_DATA_PART2,
  41. };
  42. static const esp_efuse_desc_t WR_DIS_KEY0[] = {
  43. {EFUSE_BLK0, 7, 1}, // Write protection for EFUSE_BLK3. whole KEY0,
  44. };
  45. static const esp_efuse_desc_t RD_DIS[] = {
  46. {EFUSE_BLK0, 32, 2}, // Read protection,
  47. };
  48. static const esp_efuse_desc_t RD_DIS_KEY0[] = {
  49. {EFUSE_BLK0, 32, 2}, // Read protection for EFUSE_BLK3. KEY0,
  50. };
  51. static const esp_efuse_desc_t RD_DIS_KEY0_LOW[] = {
  52. {EFUSE_BLK0, 32, 1}, // Read protection for EFUSE_BLK3. KEY0 lower 128-bit key,
  53. };
  54. static const esp_efuse_desc_t RD_DIS_KEY0_HI[] = {
  55. {EFUSE_BLK0, 33, 1}, // Read protection for EFUSE_BLK3. KEY0 higher 128-bit key,
  56. };
  57. static const esp_efuse_desc_t WDT_DELAY_SEL[] = {
  58. {EFUSE_BLK0, 34, 2}, // RTC WDT timeout threshold,
  59. };
  60. static const esp_efuse_desc_t DIS_PAD_JTAG[] = {
  61. {EFUSE_BLK0, 36, 1}, // Hardware Disable JTAG permanently,
  62. };
  63. static const esp_efuse_desc_t DIS_DOWNLOAD_ICACHE[] = {
  64. {EFUSE_BLK0, 37, 1}, // Disable ICache in Download mode,
  65. };
  66. static const esp_efuse_desc_t DIS_DOWNLOAD_MANUAL_ENCRYPT[] = {
  67. {EFUSE_BLK0, 38, 1}, // Disable flash encryption in Download boot mode,
  68. };
  69. static const esp_efuse_desc_t SPI_BOOT_CRYPT_CNT[] = {
  70. {EFUSE_BLK0, 39, 3}, // Enable SPI boot encrypt/decrypt. Odd number: enable; even number: disable,
  71. };
  72. static const esp_efuse_desc_t XTS_KEY_LENGTH_256[] = {
  73. {EFUSE_BLK0, 42, 1}, // Select XTS_AES key length. 1: 256-bit of whole block3; 0: Lower 128-bit of block3,
  74. };
  75. static const esp_efuse_desc_t UART_PRINT_CONTROL[] = {
  76. {EFUSE_BLK0, 43, 2}, // Set UART boot message output mode. 00: Force print; 01: Low-level print controlled by GPIO 8; 10: High-level print controlled by GPIO 8; 11: Print force disabled,
  77. };
  78. static const esp_efuse_desc_t FORCE_SEND_RESUME[] = {
  79. {EFUSE_BLK0, 45, 1}, // Force ROM code to send an SPI flash resume command during SPI boot,
  80. };
  81. static const esp_efuse_desc_t DIS_DOWNLOAD_MODE[] = {
  82. {EFUSE_BLK0, 46, 1}, // Disable all download boot modes,
  83. };
  84. static const esp_efuse_desc_t DIS_DIRECT_BOOT[] = {
  85. {EFUSE_BLK0, 47, 1}, // Disable direct_boot mode,
  86. };
  87. static const esp_efuse_desc_t ENABLE_SECURITY_DOWNLOAD[] = {
  88. {EFUSE_BLK0, 48, 1}, // Enable secure UART download mode,
  89. };
  90. static const esp_efuse_desc_t FLASH_TPUW[] = {
  91. {EFUSE_BLK0, 49, 4}, // Configure flash startup delay after SoC being powered up (the unit is ms/2). When the value is 15 delay will be 7.5 ms,
  92. };
  93. static const esp_efuse_desc_t SECURE_BOOT_EN[] = {
  94. {EFUSE_BLK0, 53, 1}, // Enable secure boot,
  95. };
  96. static const esp_efuse_desc_t SECURE_VERSION[] = {
  97. {EFUSE_BLK0, 54, 4}, // Secure version for anti-rollback,
  98. };
  99. static const esp_efuse_desc_t USER_DATA[] = {
  100. {EFUSE_BLK1, 0, 88}, // User data block,
  101. };
  102. static const esp_efuse_desc_t USER_DATA_MAC_CUSTOM[] = {
  103. {EFUSE_BLK1, 0, 48}, // Custom MAC addr,
  104. };
  105. static const esp_efuse_desc_t MAC_FACTORY[] = {
  106. {EFUSE_BLK2, 40, 8}, // Factory MAC addr [0],
  107. {EFUSE_BLK2, 32, 8}, // Factory MAC addr [1],
  108. {EFUSE_BLK2, 24, 8}, // Factory MAC addr [2],
  109. {EFUSE_BLK2, 16, 8}, // Factory MAC addr [3],
  110. {EFUSE_BLK2, 8, 8}, // Factory MAC addr [4],
  111. {EFUSE_BLK2, 0, 8}, // Factory MAC addr [5],
  112. };
  113. static const esp_efuse_desc_t WAFER_VERSION[] = {
  114. {EFUSE_BLK2, 48, 3}, // EFUSE_WAFER_VERSION,
  115. };
  116. static const esp_efuse_desc_t PKG_VERSION[] = {
  117. {EFUSE_BLK2, 51, 3}, // EFUSE_PKG_VERSION,
  118. };
  119. static const esp_efuse_desc_t BLOCK2_VERSION[] = {
  120. {EFUSE_BLK2, 54, 3}, // EFUSE_BLOCK2_VERSION,
  121. };
  122. static const esp_efuse_desc_t RF_REF_I_BIAS_CONFIG[] = {
  123. {EFUSE_BLK2, 57, 4}, // EFUSE_RF_REF_I_BIAS_CONFIG,
  124. };
  125. static const esp_efuse_desc_t LDO_VOL_BIAS_CONFIG_LOW[] = {
  126. {EFUSE_BLK2, 61, 3}, // EFUSE_LDO_VOL_BIAS_CONFIG_LOW,
  127. };
  128. static const esp_efuse_desc_t LDO_VOL_BIAS_CONFIG_HIGH[] = {
  129. {EFUSE_BLK2, 64, 27}, // EFUSE_LDO_VOL_BIAS_CONFIG_HIGH,
  130. };
  131. static const esp_efuse_desc_t PVT_LOW[] = {
  132. {EFUSE_BLK2, 91, 5}, // EFUSE_PVT_LOW,
  133. };
  134. static const esp_efuse_desc_t PVT_HIGH[] = {
  135. {EFUSE_BLK2, 96, 10}, // EFUSE_PVT_HIGH,
  136. };
  137. static const esp_efuse_desc_t ADC_CALIBRATION_0[] = {
  138. {EFUSE_BLK2, 106, 22}, // EFUSE_ADC_CALIBRATION_0,
  139. };
  140. static const esp_efuse_desc_t ADC_CALIBRATION_1[] = {
  141. {EFUSE_BLK2, 128, 32}, // EFUSE_ADC_CALIBRATION_1,
  142. };
  143. static const esp_efuse_desc_t ADC_CALIBRATION_2[] = {
  144. {EFUSE_BLK2, 160, 32}, // EFUSE_ADC_CALIBRATION_2,
  145. };
  146. static const esp_efuse_desc_t KEY0[] = {
  147. {EFUSE_BLK3, 0, 256}, // [256bit FE key] or [128bit FE key and 128key SB key] or [user data],
  148. };
  149. static const esp_efuse_desc_t KEY0_FE_256BIT[] = {
  150. {EFUSE_BLK3, 0, 256}, // [256bit FE key],
  151. };
  152. static const esp_efuse_desc_t KEY0_FE_128BIT[] = {
  153. {EFUSE_BLK3, 0, 128}, // [128bit FE key],
  154. };
  155. static const esp_efuse_desc_t KEY0_SB_128BIT[] = {
  156. {EFUSE_BLK3, 128, 128}, // [128bit SB key],
  157. };
  158. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS[] = {
  159. &WR_DIS[0], // Write protection
  160. NULL
  161. };
  162. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0_RD_DIS[] = {
  163. &WR_DIS_KEY0_RD_DIS[0], // Write protection for KEY0_RD_DIS
  164. NULL
  165. };
  166. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_1[] = {
  167. &WR_DIS_GROUP_1[0], // Write protection for WDT_DELAY DIS_PAD_JTAG DIS_DOWNLOAD_ICACHE
  168. NULL
  169. };
  170. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_2[] = {
  171. &WR_DIS_GROUP_2[0], // Write protection for DOWNLOAD_DIS_MANUAL_ENCRYPT SPI_BOOT_CRYPT_CNT XTS_KEY_LENGTH_256 SECURE_BOOT_EN
  172. NULL
  173. };
  174. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SPI_BOOT_CRYPT_CNT[] = {
  175. &WR_DIS_SPI_BOOT_CRYPT_CNT[0], // Write protection for DOWNLOAD_DIS_MANUAL_ENCRYPT [SPI_BOOT_CRYPT_CNT] XTS_KEY_LENGTH_256 SECURE_BOOT_EN
  176. NULL
  177. };
  178. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_3[] = {
  179. &WR_DIS_GROUP_3[0], // Write protection for UART_PRINT_CONTROL FORCE_SEND_RESUME DIS_DOWNLOAD_MODE DIS_DIRECT_BOOT ENABLE_SECURITY_DOWNLOAD FLASH_TPUW
  180. NULL
  181. };
  182. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK0_RESERVED[] = {
  183. &WR_DIS_BLK0_RESERVED[0], // Write protection for BLK0_RESERVED
  184. NULL
  185. };
  186. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART0[] = {
  187. &WR_DIS_SYS_DATA_PART0[0], // Write protection for EFUSE_BLK1. SYS_DATA_PART0
  188. NULL
  189. };
  190. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[] = {
  191. &WR_DIS_SYS_DATA_PART1[0], // Write protection for EFUSE_BLK2. SYS_DATA_PART2
  192. NULL
  193. };
  194. const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0[] = {
  195. &WR_DIS_KEY0[0], // Write protection for EFUSE_BLK3. whole KEY0
  196. NULL
  197. };
  198. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS[] = {
  199. &RD_DIS[0], // Read protection
  200. NULL
  201. };
  202. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY0[] = {
  203. &RD_DIS_KEY0[0], // Read protection for EFUSE_BLK3. KEY0
  204. NULL
  205. };
  206. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY0_LOW[] = {
  207. &RD_DIS_KEY0_LOW[0], // Read protection for EFUSE_BLK3. KEY0 lower 128-bit key
  208. NULL
  209. };
  210. const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY0_HI[] = {
  211. &RD_DIS_KEY0_HI[0], // Read protection for EFUSE_BLK3. KEY0 higher 128-bit key
  212. NULL
  213. };
  214. const esp_efuse_desc_t* ESP_EFUSE_WDT_DELAY_SEL[] = {
  215. &WDT_DELAY_SEL[0], // RTC WDT timeout threshold
  216. NULL
  217. };
  218. const esp_efuse_desc_t* ESP_EFUSE_DIS_PAD_JTAG[] = {
  219. &DIS_PAD_JTAG[0], // Hardware Disable JTAG permanently
  220. NULL
  221. };
  222. const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_ICACHE[] = {
  223. &DIS_DOWNLOAD_ICACHE[0], // Disable ICache in Download mode
  224. NULL
  225. };
  226. const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT[] = {
  227. &DIS_DOWNLOAD_MANUAL_ENCRYPT[0], // Disable flash encryption in Download boot mode
  228. NULL
  229. };
  230. const esp_efuse_desc_t* ESP_EFUSE_SPI_BOOT_CRYPT_CNT[] = {
  231. &SPI_BOOT_CRYPT_CNT[0], // Enable SPI boot encrypt/decrypt. Odd number: enable; even number: disable
  232. NULL
  233. };
  234. const esp_efuse_desc_t* ESP_EFUSE_XTS_KEY_LENGTH_256[] = {
  235. &XTS_KEY_LENGTH_256[0], // Select XTS_AES key length. 1: 256-bit of whole block3; 0: Lower 128-bit of block3
  236. NULL
  237. };
  238. const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[] = {
  239. &UART_PRINT_CONTROL[0], // Set UART boot message output mode. 00: Force print; 01: Low-level print controlled by GPIO 8; 10: High-level print controlled by GPIO 8; 11: Print force disabled
  240. NULL
  241. };
  242. const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[] = {
  243. &FORCE_SEND_RESUME[0], // Force ROM code to send an SPI flash resume command during SPI boot
  244. NULL
  245. };
  246. const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MODE[] = {
  247. &DIS_DOWNLOAD_MODE[0], // Disable all download boot modes
  248. NULL
  249. };
  250. const esp_efuse_desc_t* ESP_EFUSE_DIS_DIRECT_BOOT[] = {
  251. &DIS_DIRECT_BOOT[0], // Disable direct_boot mode
  252. NULL
  253. };
  254. const esp_efuse_desc_t* ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD[] = {
  255. &ENABLE_SECURITY_DOWNLOAD[0], // Enable secure UART download mode
  256. NULL
  257. };
  258. const esp_efuse_desc_t* ESP_EFUSE_FLASH_TPUW[] = {
  259. &FLASH_TPUW[0], // Configure flash startup delay after SoC being powered up (the unit is ms/2). When the value is 15 delay will be 7.5 ms
  260. NULL
  261. };
  262. const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_EN[] = {
  263. &SECURE_BOOT_EN[0], // Enable secure boot
  264. NULL
  265. };
  266. const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[] = {
  267. &SECURE_VERSION[0], // Secure version for anti-rollback
  268. NULL
  269. };
  270. const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[] = {
  271. &USER_DATA[0], // User data block
  272. NULL
  273. };
  274. const esp_efuse_desc_t* ESP_EFUSE_USER_DATA_MAC_CUSTOM[] = {
  275. &USER_DATA_MAC_CUSTOM[0], // Custom MAC addr
  276. NULL
  277. };
  278. const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[] = {
  279. &MAC_FACTORY[0], // Factory MAC addr [0]
  280. &MAC_FACTORY[1], // Factory MAC addr [1]
  281. &MAC_FACTORY[2], // Factory MAC addr [2]
  282. &MAC_FACTORY[3], // Factory MAC addr [3]
  283. &MAC_FACTORY[4], // Factory MAC addr [4]
  284. &MAC_FACTORY[5], // Factory MAC addr [5]
  285. NULL
  286. };
  287. const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION[] = {
  288. &WAFER_VERSION[0], // EFUSE_WAFER_VERSION
  289. NULL
  290. };
  291. const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[] = {
  292. &PKG_VERSION[0], // EFUSE_PKG_VERSION
  293. NULL
  294. };
  295. const esp_efuse_desc_t* ESP_EFUSE_BLOCK2_VERSION[] = {
  296. &BLOCK2_VERSION[0], // EFUSE_BLOCK2_VERSION
  297. NULL
  298. };
  299. const esp_efuse_desc_t* ESP_EFUSE_RF_REF_I_BIAS_CONFIG[] = {
  300. &RF_REF_I_BIAS_CONFIG[0], // EFUSE_RF_REF_I_BIAS_CONFIG
  301. NULL
  302. };
  303. const esp_efuse_desc_t* ESP_EFUSE_LDO_VOL_BIAS_CONFIG_LOW[] = {
  304. &LDO_VOL_BIAS_CONFIG_LOW[0], // EFUSE_LDO_VOL_BIAS_CONFIG_LOW
  305. NULL
  306. };
  307. const esp_efuse_desc_t* ESP_EFUSE_LDO_VOL_BIAS_CONFIG_HIGH[] = {
  308. &LDO_VOL_BIAS_CONFIG_HIGH[0], // EFUSE_LDO_VOL_BIAS_CONFIG_HIGH
  309. NULL
  310. };
  311. const esp_efuse_desc_t* ESP_EFUSE_PVT_LOW[] = {
  312. &PVT_LOW[0], // EFUSE_PVT_LOW
  313. NULL
  314. };
  315. const esp_efuse_desc_t* ESP_EFUSE_PVT_HIGH[] = {
  316. &PVT_HIGH[0], // EFUSE_PVT_HIGH
  317. NULL
  318. };
  319. const esp_efuse_desc_t* ESP_EFUSE_ADC_CALIBRATION_0[] = {
  320. &ADC_CALIBRATION_0[0], // EFUSE_ADC_CALIBRATION_0
  321. NULL
  322. };
  323. const esp_efuse_desc_t* ESP_EFUSE_ADC_CALIBRATION_1[] = {
  324. &ADC_CALIBRATION_1[0], // EFUSE_ADC_CALIBRATION_1
  325. NULL
  326. };
  327. const esp_efuse_desc_t* ESP_EFUSE_ADC_CALIBRATION_2[] = {
  328. &ADC_CALIBRATION_2[0], // EFUSE_ADC_CALIBRATION_2
  329. NULL
  330. };
  331. const esp_efuse_desc_t* ESP_EFUSE_KEY0[] = {
  332. &KEY0[0], // [256bit FE key] or [128bit FE key and 128key SB key] or [user data]
  333. NULL
  334. };
  335. const esp_efuse_desc_t* ESP_EFUSE_KEY0_FE_256BIT[] = {
  336. &KEY0_FE_256BIT[0], // [256bit FE key]
  337. NULL
  338. };
  339. const esp_efuse_desc_t* ESP_EFUSE_KEY0_FE_128BIT[] = {
  340. &KEY0_FE_128BIT[0], // [128bit FE key]
  341. NULL
  342. };
  343. const esp_efuse_desc_t* ESP_EFUSE_KEY0_SB_128BIT[] = {
  344. &KEY0_SB_128BIT[0], // [128bit SB key]
  345. NULL
  346. };