Merge branch 'feature/support_efuses_esp32p4_eco5' into 'master'

feat(efuse): Support efuses for ESP32-P4 ECO5

Closes IDF-13512 and IDF-13562

See merge request espressif/esp-idf!41607
This commit is contained in:
Konstantin Kondrashov
2025-10-16 17:31:59 +08:00
14 changed files with 5599 additions and 6025 deletions
@@ -452,8 +452,31 @@ static inline bool ecdsa_ll_is_deterministic_mode_supported(void)
*/
__attribute__((always_inline)) static inline void ecdsa_ll_set_ecdsa_key_blk(ecdsa_curve_t curve, int efuse_blk)
{
#ifdef EFUSE_CFG_ECDSA_BLK
(void) curve;
EFUSE.conf.cfg_ecdsa_blk = efuse_blk;
#else
uint8_t efuse_blk_low = 0;
uint8_t efuse_blk_high = 0;
switch (curve) {
case ECDSA_CURVE_SECP192R1:
EFUSE.ecdsa.cfg_ecdsa_p192_blk = efuse_blk;
break;
case ECDSA_CURVE_SECP256R1:
EFUSE.ecdsa.cfg_ecdsa_p256_blk = efuse_blk;
break;
case ECDSA_CURVE_SECP384R1:
// ECDSA-p384 uses two efuse blocks to store the key. These two blocks are stored in a single integer
// where the least significant 4 bits store the low key block number and the next 4 more significant bits store the high key block number.
HAL_ECDSA_EXTRACT_KEY_BLOCKS(efuse_blk, efuse_blk_high, efuse_blk_low);
EFUSE.ecdsa.cfg_ecdsa_p384_h_blk = efuse_blk_high;
EFUSE.ecdsa.cfg_ecdsa_p384_l_blk = efuse_blk_low;
break;
default:
HAL_ASSERT(false && "Unsupported curve");
break;
}
#endif
}
/**
@@ -15,6 +15,7 @@
#include "hal/pmu_types.h"
#include "soc/pmu_struct.h"
#include "soc/efuse_struct.h"
#include "hal/config.h"
#ifdef __cplusplus
extern "C" {
@@ -270,10 +270,14 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate)
*/
static inline int temperature_sensor_ll_load_calib_param(void)
{
#ifdef EFUSE_TEMPERATURE_SENSOR
uint32_t cal_temp = EFUSE.rd_sys_part2_data3.temperature_sensor;
// BIT(8) stands for sign: 1: negative, 0: positive
int tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return tsens_cal;
#else
return 0;
#endif
}
#ifdef __cplusplus