1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-18 19:13:51 +01:00

pkg/esp32_sdk: remove patches for ESP-IDF v4.4

This commit is contained in:
Gunar Schorcht 2025-03-01 17:43:30 +01:00
parent 8905f8b980
commit 5013610de5
38 changed files with 0 additions and 2441 deletions

View File

@ -1,222 +0,0 @@
From f3c3f97504da7d0bf25fa1e59d0350d130ca6eec Mon Sep 17 00:00:00 2001
From: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Date: Fri, 3 Jun 2022 00:02:07 +0200
Subject: [PATCH] esp_hw_support: rename rtc_init
Rename `rtc_init` to `rtc_init_module` due to name conflicts with RIOT `periph/rtc` module.
---
components/esp_hw_support/port/esp32/rtc_init.c | 2 +-
components/esp_hw_support/port/esp32c3/rtc_init.c | 2 +-
components/esp_hw_support/port/esp32h2/rtc_init.c | 2 +-
components/esp_hw_support/port/esp32s2/rtc_init.c | 2 +-
components/esp_hw_support/port/esp32s3/rtc_init.c | 2 +-
components/esp_system/port/soc/esp32/clk.c | 2 +-
components/esp_system/port/soc/esp32c3/clk.c | 2 +-
components/esp_system/port/soc/esp32h2/clk.c | 2 +-
components/esp_system/port/soc/esp32s2/clk.c | 2 +-
components/esp_system/port/soc/esp32s3/clk.c | 2 +-
components/soc/esp32/include/soc/rtc.h | 2 +-
components/soc/esp32c3/include/soc/rtc.h | 2 +-
components/soc/esp32h2/include/soc/rtc.h | 2 +-
components/soc/esp32s2/include/soc/rtc.h | 2 +-
components/soc/esp32s3/include/soc/rtc.h | 2 +-
15 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/components/esp_hw_support/port/esp32/rtc_init.c b/components/esp_hw_support/port/esp32/rtc_init.c
index e66a493b..7f1d1915 100644
--- a/components/esp_hw_support/port/esp32/rtc_init.c
+++ b/components/esp_hw_support/port/esp32/rtc_init.c
@@ -14,7 +14,7 @@
#include "soc/gpio_periph.h"
-void rtc_init(rtc_config_t cfg)
+void rtc_init_module(rtc_config_t cfg)
{
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU | RTC_CNTL_TXRF_I2C_PU |
RTC_CNTL_RFRX_PBUS_PU | RTC_CNTL_CKGEN_I2C_PU | RTC_CNTL_PLL_I2C_PU);
diff --git a/components/esp_hw_support/port/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c
index 388399f1..f6fdc692 100644
--- a/components/esp_hw_support/port/esp32c3/rtc_init.c
+++ b/components/esp_hw_support/port/esp32c3/rtc_init.c
@@ -25,7 +25,7 @@ static void set_ocode_by_efuse(int calib_version);
static void calibrate_ocode(void);
static void set_rtc_dig_dbias(void);
-void rtc_init(rtc_config_t cfg)
+void rtc_init_module(rtc_config_t cfg)
{
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_DIG_REG, 0);
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_RTC_REG, 0);
diff --git a/components/esp_hw_support/port/esp32h2/rtc_init.c b/components/esp_hw_support/port/esp32h2/rtc_init.c
index 7b684d3d..ff0b5f49 100644
--- a/components/esp_hw_support/port/esp32h2/rtc_init.c
+++ b/components/esp_hw_support/port/esp32h2/rtc_init.c
@@ -27,7 +27,7 @@ void pmu_ctl(void);
void dcdc_ctl(uint32_t mode);
void regulator_slt(regulator_config_t regula_cfg);
-void rtc_init(rtc_config_t cfg)
+void rtc_init_module(rtc_config_t cfg)
{
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU);
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_PLL_BUF_WAIT, cfg.pll_wait);
diff --git a/components/esp_hw_support/port/esp32s2/rtc_init.c b/components/esp_hw_support/port/esp32s2/rtc_init.c
index 7932a89a..8910f7a2 100644
--- a/components/esp_hw_support/port/esp32s2/rtc_init.c
+++ b/components/esp_hw_support/port/esp32s2/rtc_init.c
@@ -24,7 +24,7 @@ __attribute__((unused)) static const char *TAG = "rtc_init";
static void set_ocode_by_efuse(int calib_version);
static void calibrate_ocode(void);
-void rtc_init(rtc_config_t cfg)
+void rtc_init_module(rtc_config_t cfg)
{
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU);
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_PLL_BUF_WAIT, cfg.pll_wait);
diff --git a/components/esp_hw_support/port/esp32s3/rtc_init.c b/components/esp_hw_support/port/esp32s3/rtc_init.c
index ed44fd7b..f0b7f5c8 100644
--- a/components/esp_hw_support/port/esp32s3/rtc_init.c
+++ b/components/esp_hw_support/port/esp32s3/rtc_init.c
@@ -31,7 +31,7 @@ static const char *TAG = "rtcinit";
static void set_ocode_by_efuse(int calib_version);
static void calibrate_ocode(void);
-void rtc_init(rtc_config_t cfg)
+void rtc_init_module(rtc_config_t cfg)
{
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_RTC_REG, 0);
REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_XPD_DIG_REG, 0);
diff --git a/components/esp_system/port/soc/esp32/clk.c b/components/esp_system/port/soc/esp32/clk.c
index 3b3f2b73..c891224a 100644
--- a/components/esp_system/port/soc/esp32/clk.c
+++ b/components/esp_system/port/soc/esp32/clk.c
@@ -115,7 +115,7 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk)
__attribute__((weak)) void esp_clk_init(void)
{
rtc_config_t cfg = RTC_CONFIG_DEFAULT();
- rtc_init(cfg);
+ rtc_init_module(cfg);
#if (CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS || CONFIG_ESP32_APP_INIT_CLK)
/* Check the bootloader set the XTAL frequency.
diff --git a/components/esp_system/port/soc/esp32c3/clk.c b/components/esp_system/port/soc/esp32c3/clk.c
index d2181b58..36ab8a40 100644
--- a/components/esp_system/port/soc/esp32c3/clk.c
+++ b/components/esp_system/port/soc/esp32c3/clk.c
@@ -72,7 +72,7 @@ static const char *TAG = "clk";
if (rst_reas == RESET_REASON_CHIP_POWER_ON) {
cfg.cali_ocode = 1;
}
- rtc_init(cfg);
+ rtc_init_module(cfg);
assert(rtc_clk_xtal_freq_get() == RTC_XTAL_FREQ_40M);
diff --git a/components/esp_system/port/soc/esp32h2/clk.c b/components/esp_system/port/soc/esp32h2/clk.c
index 7ea2dde1..0061e39b 100644
--- a/components/esp_system/port/soc/esp32h2/clk.c
+++ b/components/esp_system/port/soc/esp32h2/clk.c
@@ -71,7 +71,7 @@ static const char *TAG = "clk";
if (rst_reas == RESET_REASON_CHIP_POWER_ON) {
cfg.cali_ocode = 1;
}
- rtc_init(cfg);
+ rtc_init_module(cfg);
assert(rtc_clk_xtal_freq_get() == RTC_XTAL_FREQ_32M);
diff --git a/components/esp_system/port/soc/esp32s2/clk.c b/components/esp_system/port/soc/esp32s2/clk.c
index 68ad39c1..4fa1aac0 100644
--- a/components/esp_system/port/soc/esp32s2/clk.c
+++ b/components/esp_system/port/soc/esp32s2/clk.c
@@ -72,7 +72,7 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk);
if (rst_reas == RESET_REASON_CHIP_POWER_ON) {
cfg.cali_ocode = 1;
}
- rtc_init(cfg);
+ rtc_init_module(cfg);
rtc_clk_fast_freq_set(RTC_FAST_FREQ_8M);
diff --git a/components/esp_system/port/soc/esp32s3/clk.c b/components/esp_system/port/soc/esp32s3/clk.c
index 15610ae9..a5b2ddf3 100644
--- a/components/esp_system/port/soc/esp32s3/clk.c
+++ b/components/esp_system/port/soc/esp32s3/clk.c
@@ -73,7 +73,7 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk);
if (rst_reas == RESET_REASON_CHIP_POWER_ON) {
cfg.cali_ocode = 1;
}
- rtc_init(cfg);
+ rtc_init_module(cfg);
assert(rtc_clk_xtal_freq_get() == RTC_XTAL_FREQ_40M);
diff --git a/components/soc/esp32/include/soc/rtc.h b/components/soc/esp32/include/soc/rtc.h
index bbbf3c75..3b983466 100644
--- a/components/soc/esp32/include/soc/rtc.h
+++ b/components/soc/esp32/include/soc/rtc.h
@@ -685,7 +685,7 @@ typedef struct rtc_config_s {
* Initialize RTC clock and power control related functions
* @param cfg configuration options as rtc_config_t
*/
-void rtc_init(rtc_config_t cfg);
+void rtc_init_module(rtc_config_t cfg);
#define RTC_VDDSDIO_TIEH_1_8V 0 //!< TIEH field value for 1.8V VDDSDIO
#define RTC_VDDSDIO_TIEH_3_3V 1 //!< TIEH field value for 3.3V VDDSDIO
diff --git a/components/soc/esp32c3/include/soc/rtc.h b/components/soc/esp32c3/include/soc/rtc.h
index dccd7a07..f4b4aa44 100644
--- a/components/soc/esp32c3/include/soc/rtc.h
+++ b/components/soc/esp32c3/include/soc/rtc.h
@@ -831,7 +831,7 @@ typedef struct {
* Initialize RTC clock and power control related functions
* @param cfg configuration options as rtc_config_t
*/
-void rtc_init(rtc_config_t cfg);
+void rtc_init_module(rtc_config_t cfg);
/**
* Structure describing vddsdio configuration
diff --git a/components/soc/esp32h2/include/soc/rtc.h b/components/soc/esp32h2/include/soc/rtc.h
index 5585986e..7a1dd718 100644
--- a/components/soc/esp32h2/include/soc/rtc.h
+++ b/components/soc/esp32h2/include/soc/rtc.h
@@ -925,7 +925,7 @@ typedef struct {
* Initialize RTC clock and power control related functions
* @param cfg configuration options as rtc_config_t
*/
-void rtc_init(rtc_config_t cfg);
+void rtc_init_module(rtc_config_t cfg);
/**
* Structure describing vddsdio configuration
diff --git a/components/soc/esp32s2/include/soc/rtc.h b/components/soc/esp32s2/include/soc/rtc.h
index 11b13fb6..73caf339 100644
--- a/components/soc/esp32s2/include/soc/rtc.h
+++ b/components/soc/esp32s2/include/soc/rtc.h
@@ -854,7 +854,7 @@ typedef struct {
* Initialize RTC clock and power control related functions
* @param cfg configuration options as rtc_config_t
*/
-void rtc_init(rtc_config_t cfg);
+void rtc_init_module(rtc_config_t cfg);
/**
* Structure describing vddsdio configuration
diff --git a/components/soc/esp32s3/include/soc/rtc.h b/components/soc/esp32s3/include/soc/rtc.h
index aa09874f..eb8bbed6 100644
--- a/components/soc/esp32s3/include/soc/rtc.h
+++ b/components/soc/esp32s3/include/soc/rtc.h
@@ -849,7 +849,7 @@ typedef struct {
* Initialize RTC clock and power control related functions
* @param cfg configuration options as rtc_config_t
*/
-void rtc_init(rtc_config_t cfg);
+void rtc_init_module(rtc_config_t cfg);
/**
* Structure describing vddsdio configuration
--
2.34.1

View File

@ -1,570 +0,0 @@
From a8a3c2c751dda987fb94a1afbd771134bcbd7f04 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 08:07:23 +0100
Subject: [PATCH 02/12] wpa_supplicant: add prefix wpa_ to crypto functions
Prefix `_wpa` added to crypto functions of `wpa_suppplicant` to avoid name conflicts with RIOT modules `crypto` and `hashes`.
---
components/wpa_supplicant/src/common/dpp.c | 2 +-
components/wpa_supplicant/src/common/sae.c | 2 +-
.../wpa_supplicant/src/common/wpa_common.c | 2 +-
components/wpa_supplicant/src/crypto/aes-cbc.c | 4 ++--
components/wpa_supplicant/src/crypto/aes-ccm.c | 18 +++++++++---------
components/wpa_supplicant/src/crypto/aes-ctr.c | 2 +-
components/wpa_supplicant/src/crypto/aes-gcm.c | 6 +++---
.../src/crypto/aes-internal-dec.c | 2 +-
.../src/crypto/aes-internal-enc.c | 2 +-
.../wpa_supplicant/src/crypto/aes-omac1.c | 6 +++---
.../wpa_supplicant/src/crypto/aes-unwrap.c | 2 +-
.../wpa_supplicant/src/crypto/aes-wrap.c | 2 +-
components/wpa_supplicant/src/crypto/aes.h | 4 ++--
components/wpa_supplicant/src/crypto/crypto.h | 4 ++--
.../src/crypto/crypto_internal-cipher.c | 4 ++--
.../src/crypto/crypto_internal.c | 8 ++++----
.../wpa_supplicant/src/crypto/crypto_mbedtls.c | 6 +++---
.../wpa_supplicant/src/crypto/crypto_ops.c | 4 ++--
.../src/crypto/sha256-internal.c | 4 ++--
.../wpa_supplicant/src/crypto/sha256-tlsprf.c | 2 +-
components/wpa_supplicant/src/crypto/sha256.c | 2 +-
components/wpa_supplicant/src/crypto/sha256.h | 2 +-
.../wpa_supplicant/src/crypto/sha256_i.h | 2 +-
.../wpa_supplicant/src/wps/wps_attr_build.c | 2 +-
.../wpa_supplicant/src/wps/wps_attr_process.c | 2 +-
components/wpa_supplicant/src/wps/wps_common.c | 4 ++--
26 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/components/wpa_supplicant/src/common/dpp.c b/components/wpa_supplicant/src/common/dpp.c
index 899e0c06c4..c97399d88c 100644
--- a/components/wpa_supplicant/src/common/dpp.c
+++ b/components/wpa_supplicant/src/common/dpp.c
@@ -153,7 +153,7 @@ static int dpp_hmac(size_t hash_len, const u8 *key, size_t key_len,
const u8 *data, size_t data_len, u8 *mac)
{
if (hash_len == 32)
- return hmac_sha256(key, key_len, data, data_len, mac);
+ return wpa_hmac_sha256(key, key_len, data, data_len, mac);
#ifndef ESP_SUPPLICANT
if (hash_len == 48)
return hmac_sha384(key, key_len, data, data_len, mac);
diff --git a/components/wpa_supplicant/src/common/sae.c b/components/wpa_supplicant/src/common/sae.c
index ec65605337..00eb2f6c21 100644
--- a/components/wpa_supplicant/src/common/sae.c
+++ b/components/wpa_supplicant/src/common/sae.c
@@ -827,7 +827,7 @@ static int sae_derive_keys(struct sae_data *sae, const u8 *k)
*/
os_memset(null_key, 0, sizeof(null_key));
- hmac_sha256(null_key, sizeof(null_key), k, sae->tmp->prime_len,
+ wpa_hmac_sha256(null_key, sizeof(null_key), k, sae->tmp->prime_len,
keyseed);
wpa_hexdump_key(MSG_DEBUG, "SAE: keyseed", keyseed, sizeof(keyseed));
diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c
index 070ba0887e..36b230a9cc 100644
--- a/components/wpa_supplicant/src/common/wpa_common.c
+++ b/components/wpa_supplicant/src/common/wpa_common.c
@@ -467,7 +467,7 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver,
#endif /* CONFIG_WPA3_SAE */
#ifdef CONFIG_SUITEB
case WPA_KEY_MGMT_IEEE8021X_SUITE_B:
- if (hmac_sha256(key, key_len, buf, len, hash))
+ if (wpa_hmac_sha256(key, key_len, buf, len, hash))
return -1;
os_memcpy(mic, hash, MD5_MAC_LEN);
break;
diff --git a/components/wpa_supplicant/src/crypto/aes-cbc.c b/components/wpa_supplicant/src/crypto/aes-cbc.c
index 0835f2cfb7..fa01d4083a 100644
--- a/components/wpa_supplicant/src/crypto/aes-cbc.c
+++ b/components/wpa_supplicant/src/crypto/aes-cbc.c
@@ -40,7 +40,7 @@ int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
for (i = 0; i < blocks; i++) {
for (j = 0; j < AES_BLOCK_SIZE; j++)
cbc[j] ^= pos[j];
- aes_encrypt(ctx, cbc, cbc);
+ wpa_aes_encrypt(ctx, cbc, cbc);
os_memcpy(pos, cbc, AES_BLOCK_SIZE);
pos += AES_BLOCK_SIZE;
}
@@ -75,7 +75,7 @@ int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
blocks = data_len / AES_BLOCK_SIZE;
for (i = 0; i < blocks; i++) {
os_memcpy(tmp, pos, AES_BLOCK_SIZE);
- aes_decrypt(ctx, pos, pos);
+ wpa_aes_decrypt(ctx, pos, pos);
for (j = 0; j < AES_BLOCK_SIZE; j++)
pos[j] ^= cbc[j];
os_memcpy(cbc, tmp, AES_BLOCK_SIZE);
diff --git a/components/wpa_supplicant/src/crypto/aes-ccm.c b/components/wpa_supplicant/src/crypto/aes-ccm.c
index e5bb94ca08..2a837463be 100644
--- a/components/wpa_supplicant/src/crypto/aes-ccm.c
+++ b/components/wpa_supplicant/src/crypto/aes-ccm.c
@@ -42,7 +42,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len);
wpa_hexdump_key(MSG_DEBUG, "CCM B_0", b, AES_BLOCK_SIZE);
- aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
+ wpa_aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
if (!aad_len)
return;
@@ -52,12 +52,12 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len);
xor_aes_block(aad_buf, x);
- aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
+ wpa_aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
if (aad_len > AES_BLOCK_SIZE - 2) {
xor_aes_block(&aad_buf[AES_BLOCK_SIZE], x);
/* X_3 = E(K, X_2 XOR B_2) */
- aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x);
+ wpa_aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x);
}
}
@@ -71,13 +71,13 @@ static void aes_ccm_auth(void *aes, const u8 *data, size_t len, u8 *x)
/* X_i+1 = E(K, X_i XOR B_i) */
xor_aes_block(x, data);
data += AES_BLOCK_SIZE;
- aes_encrypt(aes, x, x);
+ wpa_aes_encrypt(aes, x, x);
}
if (last) {
/* XOR zero-padded last block */
for (i = 0; i < last; i++)
x[i] ^= *data++;
- aes_encrypt(aes, x, x);
+ wpa_aes_encrypt(aes, x, x);
}
}
@@ -100,14 +100,14 @@ static void aes_ccm_encr(void *aes, size_t L, const u8 *in, size_t len, u8 *out,
for (i = 1; i <= len / AES_BLOCK_SIZE; i++) {
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
/* S_i = E(K, A_i) */
- aes_encrypt(aes, a, out);
+ wpa_aes_encrypt(aes, a, out);
xor_aes_block(out, in);
out += AES_BLOCK_SIZE;
in += AES_BLOCK_SIZE;
}
if (last) {
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
- aes_encrypt(aes, a, out);
+ wpa_aes_encrypt(aes, a, out);
/* XOR zero-padded last block */
for (i = 0; i < last; i++)
*out++ ^= *in++;
@@ -123,7 +123,7 @@ static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth)
wpa_hexdump_key(MSG_DEBUG, "CCM T", x, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
- aes_encrypt(aes, a, tmp);
+ wpa_aes_encrypt(aes, a, tmp);
for (i = 0; i < M; i++)
auth[i] = x[i] ^ tmp[i];
wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M);
@@ -138,7 +138,7 @@ static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t)
wpa_hexdump_key(MSG_DEBUG, "CCM U", auth, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
- aes_encrypt(aes, a, tmp);
+ wpa_aes_encrypt(aes, a, tmp);
for (i = 0; i < M; i++)
t[i] = auth[i] ^ tmp[i];
wpa_hexdump_key(MSG_DEBUG, "CCM T", t, M);
diff --git a/components/wpa_supplicant/src/crypto/aes-ctr.c b/components/wpa_supplicant/src/crypto/aes-ctr.c
index 8ce05b894d..0647706306 100644
--- a/components/wpa_supplicant/src/crypto/aes-ctr.c
+++ b/components/wpa_supplicant/src/crypto/aes-ctr.c
@@ -37,7 +37,7 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce,
os_memcpy(counter, nonce, AES_BLOCK_SIZE);
while (left > 0) {
- aes_encrypt(ctx, counter, buf);
+ wpa_aes_encrypt(ctx, counter, buf);
len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE;
for (j = 0; j < len; j++)
diff --git a/components/wpa_supplicant/src/crypto/aes-gcm.c b/components/wpa_supplicant/src/crypto/aes-gcm.c
index 84294d2d10..9b2f18df02 100644
--- a/components/wpa_supplicant/src/crypto/aes-gcm.c
+++ b/components/wpa_supplicant/src/crypto/aes-gcm.c
@@ -155,7 +155,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
os_memcpy(cb, icb, AES_BLOCK_SIZE);
/* Full blocks */
for (i = 0; i < n; i++) {
- aes_encrypt(aes, cb, ypos);
+ wpa_aes_encrypt(aes, cb, ypos);
xor_block(ypos, xpos);
xpos += AES_BLOCK_SIZE;
ypos += AES_BLOCK_SIZE;
@@ -165,7 +165,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
last = x + xlen - xpos;
if (last) {
/* Last, partial block */
- aes_encrypt(aes, cb, tmp);
+ wpa_aes_encrypt(aes, cb, tmp);
for (i = 0; i < last; i++)
*ypos++ = *xpos++ ^ tmp[i];
}
@@ -182,7 +182,7 @@ static void * aes_gcm_init_hash_subkey(const u8 *key, size_t key_len, u8 *H)
/* Generate hash subkey H = AES_K(0^128) */
os_memset(H, 0, AES_BLOCK_SIZE);
- aes_encrypt(aes, H, H);
+ wpa_aes_encrypt(aes, H, H);
wpa_hexdump_key(MSG_EXCESSIVE, "Hash subkey H for GHASH",
H, AES_BLOCK_SIZE);
return aes;
diff --git a/components/wpa_supplicant/src/crypto/aes-internal-dec.c b/components/wpa_supplicant/src/crypto/aes-internal-dec.c
index 7482295949..f72742cf59 100644
--- a/components/wpa_supplicant/src/crypto/aes-internal-dec.c
+++ b/components/wpa_supplicant/src/crypto/aes-internal-dec.c
@@ -148,7 +148,7 @@ d##3 = TD0(s##3) ^ TD1(s##2) ^ TD2(s##1) ^ TD3(s##0) ^ rk[4 * i + 3]
}
-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
+int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
u32 *rk = ctx;
rijndaelDecrypt(ctx, rk[AES_PRIV_NR_POS], crypt, plain);
diff --git a/components/wpa_supplicant/src/crypto/aes-internal-enc.c b/components/wpa_supplicant/src/crypto/aes-internal-enc.c
index baeffcaf63..a856dc9f3f 100644
--- a/components/wpa_supplicant/src/crypto/aes-internal-enc.c
+++ b/components/wpa_supplicant/src/crypto/aes-internal-enc.c
@@ -116,7 +116,7 @@ void * aes_encrypt_init(const u8 *key, size_t len)
}
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
+int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
u32 *rk = ctx;
rijndaelEncrypt(ctx, rk[AES_PRIV_NR_POS], plain, crypt);
diff --git a/components/wpa_supplicant/src/crypto/aes-omac1.c b/components/wpa_supplicant/src/crypto/aes-omac1.c
index 8642516340..21ba314ae0 100644
--- a/components/wpa_supplicant/src/crypto/aes-omac1.c
+++ b/components/wpa_supplicant/src/crypto/aes-omac1.c
@@ -82,12 +82,12 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
}
}
if (left > AES_BLOCK_SIZE)
- aes_encrypt(ctx, cbc, cbc);
+ wpa_aes_encrypt(ctx, cbc, cbc);
left -= AES_BLOCK_SIZE;
}
os_memset(pad, 0, AES_BLOCK_SIZE);
- aes_encrypt(ctx, pad, pad);
+ wpa_aes_encrypt(ctx, pad, pad);
gf_mulx(pad);
if (left || total_len == 0) {
@@ -111,7 +111,7 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
for (i = 0; i < AES_BLOCK_SIZE; i++)
pad[i] ^= cbc[i];
- aes_encrypt(ctx, pad, mac);
+ wpa_aes_encrypt(ctx, pad, mac);
aes_encrypt_deinit(ctx);
return 0;
}
diff --git a/components/wpa_supplicant/src/crypto/aes-unwrap.c b/components/wpa_supplicant/src/crypto/aes-unwrap.c
index ec793d9dbf..08aedc12de 100644
--- a/components/wpa_supplicant/src/crypto/aes-unwrap.c
+++ b/components/wpa_supplicant/src/crypto/aes-unwrap.c
@@ -58,7 +58,7 @@ int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher,
b[4] ^= t >> 24;
os_memcpy(b + 8, r, 8);
- aes_decrypt(ctx, b, b);
+ wpa_aes_decrypt(ctx, b, b);
os_memcpy(a, b, 8);
os_memcpy(r, b + 8, 8);
r -= 8;
diff --git a/components/wpa_supplicant/src/crypto/aes-wrap.c b/components/wpa_supplicant/src/crypto/aes-wrap.c
index 7ed34e803e..49621d2231 100644
--- a/components/wpa_supplicant/src/crypto/aes-wrap.c
+++ b/components/wpa_supplicant/src/crypto/aes-wrap.c
@@ -53,7 +53,7 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
for (i = 1; i <= n; i++) {
os_memcpy(b, a, 8);
os_memcpy(b + 8, r, 8);
- aes_encrypt(ctx, b, b);
+ wpa_aes_encrypt(ctx, b, b);
os_memcpy(a, b, 8);
t = n * j + i;
a[7] ^= t;
diff --git a/components/wpa_supplicant/src/crypto/aes.h b/components/wpa_supplicant/src/crypto/aes.h
index 8ab3de2ee8..fe04fc4b2b 100644
--- a/components/wpa_supplicant/src/crypto/aes.h
+++ b/components/wpa_supplicant/src/crypto/aes.h
@@ -12,10 +12,10 @@
#define AES_BLOCK_SIZE 16
void * aes_encrypt_init(const u8 *key, size_t len);
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
+int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
void aes_encrypt_deinit(void *ctx);
void * aes_decrypt_init(const u8 *key, size_t len);
-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
+int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
void aes_decrypt_deinit(void *ctx);
#endif /* AES_H */
diff --git a/components/wpa_supplicant/src/crypto/crypto.h b/components/wpa_supplicant/src/crypto/crypto.h
index 9a43c9bfd9..f87a21872b 100644
--- a/components/wpa_supplicant/src/crypto/crypto.h
+++ b/components/wpa_supplicant/src/crypto/crypto.h
@@ -125,7 +125,7 @@ void * aes_encrypt_init(const u8 *key, size_t len);
* @crypt: Buffer for the encrypted data (16 bytes)
* Returns: 0 on success, -1 on failure
*/
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
+int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
/**
* aes_encrypt_deinit - Deinitialize AES encryption
@@ -148,7 +148,7 @@ void * aes_decrypt_init(const u8 *key, size_t len);
* @plain: Buffer for the decrypted data (16 bytes)
* Returns: 0 on success, -1 on failure
*/
-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
+int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
/**
* aes_decrypt_deinit - Deinitialize AES decryption
diff --git a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c
index ad0930a5a9..4887fd36c6 100644
--- a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c
+++ b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c
@@ -120,7 +120,7 @@ int crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain,
for (i = 0; i < blocks; i++) {
for (j = 0; j < AES_BLOCK_SIZE; j++)
ctx->u.aes.cbc[j] ^= plain[j];
- aes_encrypt(ctx->u.aes.ctx_enc, ctx->u.aes.cbc,
+ wpa_aes_encrypt(ctx->u.aes.ctx_enc, ctx->u.aes.cbc,
ctx->u.aes.cbc);
os_memcpy(crypt, ctx->u.aes.cbc, AES_BLOCK_SIZE);
plain += AES_BLOCK_SIZE;
@@ -183,7 +183,7 @@ int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt,
blocks = len / AES_BLOCK_SIZE;
for (i = 0; i < blocks; i++) {
os_memcpy(tmp, crypt, AES_BLOCK_SIZE);
- aes_decrypt(ctx->u.aes.ctx_dec, crypt, plain);
+ wpa_aes_decrypt(ctx->u.aes.ctx_dec, crypt, plain);
for (j = 0; j < AES_BLOCK_SIZE; j++)
plain[j] ^= ctx->u.aes.cbc[j];
os_memcpy(ctx->u.aes.cbc, tmp, AES_BLOCK_SIZE);
diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c
index 3d14babe5a..d1426a8feb 100644
--- a/components/wpa_supplicant/src/crypto/crypto_internal.c
+++ b/components/wpa_supplicant/src/crypto/crypto_internal.c
@@ -57,7 +57,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
break;
#ifdef CONFIG_SHA256
case CRYPTO_HASH_ALG_SHA256:
- sha256_init(&ctx->u.sha256);
+ wpa_sha256_init(&ctx->u.sha256);
break;
#endif /* CONFIG_SHA256 */
#ifdef CONFIG_INTERNAL_SHA384
@@ -111,7 +111,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
#ifdef CONFIG_SHA256
case CRYPTO_HASH_ALG_HMAC_SHA256:
if (key_len > sizeof(k_pad)) {
- sha256_init(&ctx->u.sha256);
+ wpa_sha256_init(&ctx->u.sha256);
sha256_process(&ctx->u.sha256, key, key_len);
sha256_done(&ctx->u.sha256, tk);
key = tk;
@@ -125,7 +125,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
os_memset(k_pad + key_len, 0, sizeof(k_pad) - key_len);
for (i = 0; i < sizeof(k_pad); i++)
k_pad[i] ^= 0x36;
- sha256_init(&ctx->u.sha256);
+ wpa_sha256_init(&ctx->u.sha256);
sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad));
break;
#endif /* CONFIG_SHA256 */
@@ -295,7 +295,7 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
sizeof(k_pad) - ctx->key_len);
for (i = 0; i < sizeof(k_pad); i++)
k_pad[i] ^= 0x5c;
- sha256_init(&ctx->u.sha256);
+ wpa_sha256_init(&ctx->u.sha256);
sha256_process(&ctx->u.sha256, k_pad, sizeof(k_pad));
sha256_process(&ctx->u.sha256, mac, 32);
sha256_done(&ctx->u.sha256, mac);
diff --git a/components/wpa_supplicant/src/crypto/crypto_mbedtls.c b/components/wpa_supplicant/src/crypto/crypto_mbedtls.c
index d640a64189..d32321657a 100644
--- a/components/wpa_supplicant/src/crypto/crypto_mbedtls.c
+++ b/components/wpa_supplicant/src/crypto/crypto_mbedtls.c
@@ -239,7 +239,7 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
len, mac);
}
-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
+int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac);
@@ -312,7 +312,7 @@ void *aes_encrypt_init(const u8 *key, size_t len)
return aes_crypt_init(MBEDTLS_AES_ENCRYPT, key, len);
}
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
+int wpa_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
return aes_crypt(ctx, MBEDTLS_AES_ENCRYPT, plain, crypt);
}
@@ -327,7 +327,7 @@ void * aes_decrypt_init(const u8 *key, size_t len)
return aes_crypt_init(MBEDTLS_AES_DECRYPT, key, len);
}
-int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
+int wpa_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
return aes_crypt(ctx, MBEDTLS_AES_DECRYPT, crypt, plain);
}
diff --git a/components/wpa_supplicant/src/crypto/crypto_ops.c b/components/wpa_supplicant/src/crypto/crypto_ops.c
index d4aff08787..16b1364373 100644
--- a/components/wpa_supplicant/src/crypto/crypto_ops.c
+++ b/components/wpa_supplicant/src/crypto/crypto_ops.c
@@ -28,12 +28,12 @@ static int esp_aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain)
static void esp_aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
- aes_encrypt(ctx, plain, crypt);
+ wpa_aes_encrypt(ctx, plain, crypt);
}
static void esp_aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
- aes_decrypt(ctx, crypt, plain);
+ wpa_aes_decrypt(ctx, crypt, plain);
}
static int esp_aes_gmac(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len,
diff --git a/components/wpa_supplicant/src/crypto/sha256-internal.c b/components/wpa_supplicant/src/crypto/sha256-internal.c
index ff1e2ba168..d763fa6f06 100644
--- a/components/wpa_supplicant/src/crypto/sha256-internal.c
+++ b/components/wpa_supplicant/src/crypto/sha256-internal.c
@@ -31,7 +31,7 @@ int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len,
if (TEST_FAIL())
return -1;
- sha256_init(&ctx);
+ wpa_sha256_init(&ctx);
for (i = 0; i < num_elem; i++)
if (sha256_process(&ctx, addr[i], len[i]))
return -1;
@@ -124,7 +124,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
/* Initialize the hash state */
-void sha256_init(struct sha256_state *md)
+void wpa_sha256_init(struct sha256_state *md)
{
md->curlen = 0;
md->length = 0;
diff --git a/components/wpa_supplicant/src/crypto/sha256-tlsprf.c b/components/wpa_supplicant/src/crypto/sha256-tlsprf.c
index 9045cd36b4..4d0c57e79e 100644
--- a/components/wpa_supplicant/src/crypto/sha256-tlsprf.c
+++ b/components/wpa_supplicant/src/crypto/sha256-tlsprf.c
@@ -57,7 +57,7 @@ int tls_prf_sha256(const u8 *secret, size_t secret_len, const char *label,
while (pos < outlen) {
if (hmac_sha256_vector(secret, secret_len, 3, addr, len, P) <
0 ||
- hmac_sha256(secret, secret_len, A, SHA256_MAC_LEN, A) < 0)
+ wpa_hmac_sha256(secret, secret_len, A, SHA256_MAC_LEN, A) < 0)
return -1;
clen = outlen - pos;
diff --git a/components/wpa_supplicant/src/crypto/sha256.c b/components/wpa_supplicant/src/crypto/sha256.c
index 17af964ad0..0fac0dd52d 100644
--- a/components/wpa_supplicant/src/crypto/sha256.c
+++ b/components/wpa_supplicant/src/crypto/sha256.c
@@ -97,7 +97,7 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
* @mac: Buffer for the hash (32 bytes)
* Returns: 0 on success, -1 on failure
*/
-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
+int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac);
diff --git a/components/wpa_supplicant/src/crypto/sha256.h b/components/wpa_supplicant/src/crypto/sha256.h
index 8054bbe5c5..7ce7ddebe9 100644
--- a/components/wpa_supplicant/src/crypto/sha256.h
+++ b/components/wpa_supplicant/src/crypto/sha256.h
@@ -13,7 +13,7 @@
int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac);
-int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
+int wpa_hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac);
int sha256_prf(const u8 *key, size_t key_len, const char *label,
const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
diff --git a/components/wpa_supplicant/src/crypto/sha256_i.h b/components/wpa_supplicant/src/crypto/sha256_i.h
index a502d2ba5d..c53558abd8 100644
--- a/components/wpa_supplicant/src/crypto/sha256_i.h
+++ b/components/wpa_supplicant/src/crypto/sha256_i.h
@@ -17,7 +17,7 @@ struct sha256_state {
u8 buf[SHA256_BLOCK_SIZE];
};
-void sha256_init(struct sha256_state *md);
+void wpa_sha256_init(struct sha256_state *md);
int sha256_process(struct sha256_state *md, const unsigned char *in,
unsigned long inlen);
int sha256_done(struct sha256_state *md, unsigned char *out);
diff --git a/components/wpa_supplicant/src/wps/wps_attr_build.c b/components/wpa_supplicant/src/wps/wps_attr_build.c
index c61114bdb2..ce74875dab 100644
--- a/components/wpa_supplicant/src/wps/wps_attr_build.c
+++ b/components/wpa_supplicant/src/wps/wps_attr_build.c
@@ -324,7 +324,7 @@ int wps_build_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg)
u8 hash[SHA256_MAC_LEN];
wpa_printf(MSG_DEBUG, "WPS: * Key Wrap Authenticator");
- hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg),
+ wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg),
wpabuf_len(msg), hash);
wpabuf_put_be16(msg, ATTR_KEY_WRAP_AUTH);
wpabuf_put_be16(msg, WPS_KWA_LEN);
diff --git a/components/wpa_supplicant/src/wps/wps_attr_process.c b/components/wpa_supplicant/src/wps/wps_attr_process.c
index c298df3f69..880cacd8ae 100644
--- a/components/wpa_supplicant/src/wps/wps_attr_process.c
+++ b/components/wpa_supplicant/src/wps/wps_attr_process.c
@@ -68,7 +68,7 @@ int wps_process_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg,
return -1;
}
- hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, head, len, hash);
+ wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, head, len, hash);
if (os_memcmp(hash, key_wrap_auth, WPS_KWA_LEN) != 0) {
wpa_printf(MSG_DEBUG, "WPS: Invalid KWA");
return -1;
diff --git a/components/wpa_supplicant/src/wps/wps_common.c b/components/wpa_supplicant/src/wps/wps_common.c
index ead31af3e0..dcbf39aff8 100644
--- a/components/wpa_supplicant/src/wps/wps_common.c
+++ b/components/wpa_supplicant/src/wps/wps_common.c
@@ -139,10 +139,10 @@ void wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd,
{
u8 hash[SHA256_MAC_LEN];
- hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd,
+ wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, dev_passwd,
(dev_passwd_len + 1) / 2, hash);
os_memcpy(wps->psk1, hash, WPS_PSK_LEN);
- hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN,
+ wpa_hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN,
dev_passwd + (dev_passwd_len + 1) / 2,
dev_passwd_len / 2, hash);
os_memcpy(wps->psk2, hash, WPS_PSK_LEN);
--
2.17.1

View File

@ -1,91 +0,0 @@
From 8b8faf52093843560c029759722e3f290aa57084 Mon Sep 17 00:00:00 2001
From: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Date: Thu, 2 Jun 2022 23:42:40 +0200
Subject: [PATCH] wpa_supplicant: declare variables in header files as extern
The definition of variables in header files lead to multiple defined
symbols if these header files are included multiple times.
Variables in header files are therefore declared as extern.
---
.../esp_supplicant/include/esp_wpa.h | 4 +-
components/wpa_supplicant/src/eap_peer/eap.h | 42 +++++++++----------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h
index f448b737..cdfd7abc 100644
--- a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h
+++ b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h
@@ -42,9 +42,9 @@ extern "C" {
* @{
*/
/* Crypto callback functions */
-const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
+extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
/* Mesh crypto callback functions */
-const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
+extern const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
/**
* @brief Supplicant initialization
diff --git a/components/wpa_supplicant/src/eap_peer/eap.h b/components/wpa_supplicant/src/eap_peer/eap.h
index f787e35d..90d1f845 100644
--- a/components/wpa_supplicant/src/eap_peer/eap.h
+++ b/components/wpa_supplicant/src/eap_peer/eap.h
@@ -19,33 +19,33 @@ struct eap_method_type {
EapType method;
};
-u8 *g_wpa_anonymous_identity;
-int g_wpa_anonymous_identity_len;
-u8 *g_wpa_username;
-int g_wpa_username_len;
-const u8 *g_wpa_client_cert;
-int g_wpa_client_cert_len;
-const u8 *g_wpa_private_key;
-int g_wpa_private_key_len;
-const u8 *g_wpa_private_key_passwd;
-int g_wpa_private_key_passwd_len;
+extern u8 *g_wpa_anonymous_identity;
+extern int g_wpa_anonymous_identity_len;
+extern u8 *g_wpa_username;
+extern int g_wpa_username_len;
+extern const u8 *g_wpa_client_cert;
+extern int g_wpa_client_cert_len;
+extern const u8 *g_wpa_private_key;
+extern int g_wpa_private_key_len;
+extern const u8 *g_wpa_private_key_passwd;
+extern int g_wpa_private_key_passwd_len;
-const u8 *g_wpa_ca_cert;
-int g_wpa_ca_cert_len;
+extern const u8 *g_wpa_ca_cert;
+extern int g_wpa_ca_cert_len;
-u8 *g_wpa_password;
-int g_wpa_password_len;
+extern u8 *g_wpa_password;
+extern int g_wpa_password_len;
-u8 *g_wpa_new_password;
-int g_wpa_new_password_len;
+extern u8 *g_wpa_new_password;
+extern int g_wpa_new_password_len;
-char *g_wpa_ttls_phase2_type;
-char *g_wpa_phase1_options;
+extern char *g_wpa_ttls_phase2_type;
+extern char *g_wpa_phase1_options;
-u8 *g_wpa_pac_file;
-int g_wpa_pac_file_len;
+extern u8 *g_wpa_pac_file;
+extern int g_wpa_pac_file_len;
-bool g_wpa_suiteb_certification;
+extern bool g_wpa_suiteb_certification;
const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len);
void eap_deinit_prev_method(struct eap_sm *sm, const char *txt);
--
2.34.1

View File

@ -1,40 +0,0 @@
From 2d1c948beb9411128674a76cc5d8054476da1c7c Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 10:36:17 +0100
Subject: [PATCH 04/12] wpa_supplicant: replace obsolete c functions
---
components/wpa_supplicant/port/include/os.h | 2 +-
components/wpa_supplicant/port/os_xtensa.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/components/wpa_supplicant/port/include/os.h b/components/wpa_supplicant/port/include/os.h
index 74e1e349e9..823eb0d35d 100644
--- a/components/wpa_supplicant/port/include/os.h
+++ b/components/wpa_supplicant/port/include/os.h
@@ -221,7 +221,7 @@ char * os_readfile(const char *name, size_t *len);
#endif
#ifndef os_bzero
-#define os_bzero(s, n) bzero(s, n)
+#define os_bzero(s, n) memset(s, 0, n)
#endif
diff --git a/components/wpa_supplicant/port/os_xtensa.c b/components/wpa_supplicant/port/os_xtensa.c
index 53ed080ca8..cf92aeb5e4 100644
--- a/components/wpa_supplicant/port/os_xtensa.c
+++ b/components/wpa_supplicant/port/os_xtensa.c
@@ -57,7 +57,8 @@ void os_sleep(os_time_t sec, os_time_t usec)
sleep(sec);
}
if (usec) {
- usleep(usec);
+ struct timespec delay = { 0, usec * 1000 };
+ nanosleep(&delay, NULL);
}
}
--
2.17.1

View File

@ -1,26 +0,0 @@
From f935f3912142ca013e0dc9c6e14aab3d16664874 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 17:01:16 +0100
Subject: [PATCH 05/12] wpa_supplicant: do not require mbedtls
---
components/wpa_supplicant/port/os_xtensa.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/wpa_supplicant/port/os_xtensa.c b/components/wpa_supplicant/port/os_xtensa.c
index cf92aeb5e4..a384a97d2e 100644
--- a/components/wpa_supplicant/port/os_xtensa.c
+++ b/components/wpa_supplicant/port/os_xtensa.c
@@ -29,7 +29,9 @@
#include <sys/time.h>
#include "esp_system.h"
#include "utils/common.h"
+#ifdef USE_MBEDTLS_CRYPTO
#include "mbedtls/platform_util.h"
+#endif
int os_get_time(struct os_time *t)
{
--
2.17.1

View File

@ -1,63 +0,0 @@
From 0647c9d01c3e433d1b3abaf4774523ac0ef90a3c Mon Sep 17 00:00:00 2001
From: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Date: Thu, 2 Jun 2022 23:45:01 +0200
Subject: [PATCH] compilation: include missing header files
---
components/efuse/src/esp_efuse_api.c | 1 +
components/esp_hw_support/regi2c_ctrl.c | 1 +
components/esp_hw_support/sleep_modes.c | 1 +
components/nvs_flash/src/nvs_encrypted_partition.cpp | 1 +
4 files changed, 4 insertions(+)
diff --git a/components/efuse/src/esp_efuse_api.c b/components/efuse/src/esp_efuse_api.c
index a89205fc..1b90deaf 100644
--- a/components/efuse/src/esp_efuse_api.c
+++ b/components/efuse/src/esp_efuse_api.c
@@ -19,6 +19,7 @@ const static char *TAG = "efuse";
#else
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
+#include <string.h>
#include <sys/lock.h>
static _lock_t s_efuse_lock;
#define EFUSE_LOCK_ACQUIRE_RECURSIVE() _lock_acquire_recursive(&s_efuse_lock)
diff --git a/components/esp_hw_support/regi2c_ctrl.c b/components/esp_hw_support/regi2c_ctrl.c
index 6ce93cc5..a40b821e 100644
--- a/components/esp_hw_support/regi2c_ctrl.c
+++ b/components/esp_hw_support/regi2c_ctrl.c
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
+#include "esp_attr.h"
#include "regi2c_ctrl.h"
#include "esp_attr.h"
#include <stdint.h>
diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c
index f5a6b292..6f9fd2b1 100644
--- a/components/esp_hw_support/sleep_modes.c
+++ b/components/esp_hw_support/sleep_modes.c
@@ -26,6 +26,7 @@
#include "driver/uart.h"
#include "soc/cpu.h"
+#include "soc/soc_memory_types.h"
#include "soc/rtc.h"
#include "soc/soc_caps.h"
#include "regi2c_ctrl.h"
diff --git a/components/nvs_flash/src/nvs_encrypted_partition.cpp b/components/nvs_flash/src/nvs_encrypted_partition.cpp
index 26e8a331..4de077b9 100644
--- a/components/nvs_flash/src/nvs_encrypted_partition.cpp
+++ b/components/nvs_flash/src/nvs_encrypted_partition.cpp
@@ -13,6 +13,7 @@
// limitations under the License.
#include <cstring>
+#include "nvs.hpp"
#include "nvs_encrypted_partition.hpp"
#include "nvs_types.hpp"
--
2.34.1

View File

@ -1,46 +0,0 @@
From effe2aba65640d2906991341b0a080b568c8e77a Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 08:17:13 +0100
Subject: [PATCH 07/12] compilation: avoid multiple definitions of macros
---
components/wpa_supplicant/src/utils/common.h | 3 +++
components/xtensa/include/xtensa/xtruntime-frames.h | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/components/wpa_supplicant/src/utils/common.h b/components/wpa_supplicant/src/utils/common.h
index 0596b6ab4f..f6dd346e44 100644
--- a/components/wpa_supplicant/src/utils/common.h
+++ b/components/wpa_supplicant/src/utils/common.h
@@ -440,7 +440,10 @@ struct wpa_freq_range_list {
unsigned int num;
};
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
#ifndef TEST_FAIL
#define TEST_FAIL() 0
#endif
diff --git a/components/xtensa/include/xtensa/xtruntime-frames.h b/components/xtensa/include/xtensa/xtruntime-frames.h
index d0eb368735..de5aab9e41 100644
--- a/components/xtensa/include/xtensa/xtruntime-frames.h
+++ b/components/xtensa/include/xtensa/xtruntime-frames.h
@@ -29,6 +29,13 @@
#include <xtensa/config/core.h>
+#ifdef STRUCT_BEGIN
+#undef STRUCT_BEGIN
+#undef STRUCT_FIELD
+#undef STRUCT_AFIELD
+#undef STRUCT_END
+#endif
+
/* Macros that help define structures for both C and assembler: */
#if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__)
#define STRUCT_BEGIN .pushsection .text; .struct 0
--
2.17.1

View File

@ -1,34 +0,0 @@
From e24009b2ff743a90d123816280437ecc0a755847 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 08:17:34 +0100
Subject: [PATCH 08/12] esp_log: use RIOT version of log module
---
components/log/include/esp_log.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h
index 0e3148f62d..5419a623e2 100644
--- a/components/log/include/esp_log.h
+++ b/components/log/include/esp_log.h
@@ -155,6 +155,8 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
*/
void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args);
+#if !defined(RIOT_VERSION)
+
/** @cond */
#include "esp_log_internal.h"
@@ -498,6 +500,8 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
#endif // !(defined(__cplusplus) && (__cplusplus > 201703L))
/** @endcond */
+#endif /* !defined(RIOT_VERSION) */
+
#ifdef __cplusplus
}
#endif
--
2.17.1

View File

@ -1,33 +0,0 @@
From 360ab12956685b45ea0720f44d193224db12afed Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 08:36:34 +0100
Subject: [PATCH 09/12] hal: conditional definition of gpio_mode_t
Define type `gpio_mode_t` only if it is not yet defined by RIOT `periph/gpio`. When this header is used during the compilation of RIOT source, this type definition isn't required and leads to name conflicts with RIOT's `gpio_mode_t` definition. The definition of `gpio_mode_t` in this header is only required when ESP-IDF source code is compiled. In that case RIOT's `gpio_mode_t` isn't defined.
---
components/hal/include/hal/gpio_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/hal/include/hal/gpio_types.h b/components/hal/include/hal/gpio_types.h
index a9b56f7c6a..8a15b8e396 100644
--- a/components/hal/include/hal/gpio_types.h
+++ b/components/hal/include/hal/gpio_types.h
@@ -369,6 +369,7 @@ typedef enum {
#define GPIO_MODE_DEF_OD (BIT2) ///< bit mask for OD mode
/** @endcond */
+#ifndef HAVE_GPIO_MODE_T
typedef enum {
GPIO_MODE_DISABLE = GPIO_MODE_DEF_DISABLE, /*!< GPIO mode : disable input and output */
GPIO_MODE_INPUT = GPIO_MODE_DEF_INPUT, /*!< GPIO mode : input only */
@@ -377,6 +378,7 @@ typedef enum {
GPIO_MODE_INPUT_OUTPUT_OD = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT) | (GPIO_MODE_DEF_OD)), /*!< GPIO mode : output and input with open-drain mode*/
GPIO_MODE_INPUT_OUTPUT = ((GPIO_MODE_DEF_INPUT) | (GPIO_MODE_DEF_OUTPUT)), /*!< GPIO mode : output and input mode */
} gpio_mode_t;
+#endif
typedef enum {
GPIO_PULLUP_DISABLE = 0x0, /*!< Disable GPIO pull-up resistor */
--
2.17.1

View File

@ -1,51 +0,0 @@
From 5285a8f5898074d38d71054010cf912c2d7ffb2d Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 09:50:50 +0100
Subject: [PATCH 10/12] spi_flash: disable functions not required or not
supported
- Various cache utility functions are neither required nor can they be supported by the means of RIOT. For example, it is not possible to change the priority of a thread. They have to be therefore disabled in RIOT.
- Add alternative implementations for `spi_flash_disable_interrupts_caches_and_other_cpu` and `spi_flash_enable_interrupts_caches_and_other_cpu` if compiled for RIOT
---
components/spi_flash/cache_utils.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/components/spi_flash/cache_utils.c b/components/spi_flash/cache_utils.c
index 7715900055..d7d750abdd 100644
--- a/components/spi_flash/cache_utils.c
+++ b/components/spi_flash/cache_utils.c
@@ -67,6 +67,8 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta
static uint32_t s_flash_op_cache_state[2];
+#ifndef RIOT_VERSION
+
#ifndef CONFIG_FREERTOS_UNICORE
static SemaphoreHandle_t s_flash_op_mutex;
static volatile bool s_flash_op_can_start = false;
@@ -293,6 +295,22 @@ void IRAM_ATTR spi_flash_enable_interrupts_caches_no_os(void)
#endif // CONFIG_FREERTOS_UNICORE
+#else /* RIOT_VERSION */
+
+void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void)
+{
+ irq_disable();
+ spi_flash_disable_cache(0, &s_flash_op_cache_state[0]);
+}
+
+void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu(void)
+{
+ spi_flash_restore_cache(0, s_flash_op_cache_state[0]);
+ irq_enable();
+}
+
+#endif /* RIOT_VERSION */
+
/**
* The following two functions are replacements for Cache_Read_Disable and Cache_Read_Enable
* function in ROM. They are used to work around a bug where Cache_Read_Disable requires a call to
--
2.17.1

View File

@ -1,43 +0,0 @@
From 51ef344603e2f1bfdaf8da49d6c4e0384f242a5e Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 30 Jan 2022 11:27:00 +0100
Subject: [PATCH 11/12] esp_system: conditional compilation of functions
These functions are either not required in RIOT or should only be compiled in if module `esp_idf_heap` is usd.
---
components/esp_system/esp_system.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/components/esp_system/esp_system.c b/components/esp_system/esp_system.c
index 8d2457b2c0..abdc3f558c 100644
--- a/components/esp_system/esp_system.c
+++ b/components/esp_system/esp_system.c
@@ -103,6 +103,7 @@ void IRAM_ATTR esp_restart(void)
esp_restart_noos();
}
+#ifdef MODULE_ESP_IDF_HEAP
uint32_t esp_get_free_heap_size( void )
{
return heap_caps_get_free_size( MALLOC_CAP_DEFAULT );
@@ -112,6 +113,7 @@ uint32_t esp_get_free_internal_heap_size( void )
{
return heap_caps_get_free_size( MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL );
}
+#endif
uint32_t esp_get_minimum_free_heap_size( void )
{
@@ -123,7 +125,9 @@ const char *esp_get_idf_version(void)
return IDF_VER;
}
+#ifndef RIOT_VERSION
void __attribute__((noreturn)) esp_system_abort(const char *details)
{
panic_abort(details);
}
+#endif
--
2.17.1

View File

@ -1,99 +0,0 @@
From d508afaa544cfc5750ed6b3e81e78c02988f97ad Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Mon, 31 Jan 2022 17:34:19 +0100
Subject: [PATCH 12/12] bootloader: allow compilation by RIOT
---
.../subproject/main/ld/esp32/bootloader.ld | 52 +++++++++----------
components/log/include/esp_log.h | 4 +-
2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/components/bootloader/subproject/main/ld/esp32/bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld
index 30e5a79c45..b235f0438a 100644
--- a/components/bootloader/subproject/main/ld/esp32/bootloader.ld
+++ b/components/bootloader/subproject/main/ld/esp32/bootloader.ld
@@ -36,33 +36,33 @@ SECTIONS
_loader_text_start = ABSOLUTE(.);
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
- *liblog.a:(.literal .text .literal.* .text.*)
+ *components/log/*(.literal .text .literal.* .text.*)
*libgcc.a:(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
- *libesp_common.a:fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random)
- *libbootloader_support.a:bootloader_efuse_esp32.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
- *libspi_flash.a:*.*(.literal .text .literal.* .text.*)
- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
- *libefuse.a:*.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
+ *components/esp_common/src/fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random)
+ *components/bootloader_support/*/bootloader_efuse_esp32.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
+ *components/*/micro-ecc/*(.literal .text .literal.* .text.*)
+ *components/spi_flash/*(.literal .text .literal.* .text.*)
+ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*)
+ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*)
+ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*)
+ *components/efuse/*(.literal .text .literal.* .text.*)
*(.fini.literal)
*(.fini)
*(.gnu.version)
diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h
index 5419a623e2..f2b30d7c4c 100644
--- a/components/log/include/esp_log.h
+++ b/components/log/include/esp_log.h
@@ -155,7 +155,7 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
*/
void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args);
-#if !defined(RIOT_VERSION)
+#if !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD)
/** @cond */
@@ -500,7 +500,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
#endif // !(defined(__cplusplus) && (__cplusplus > 201703L))
/** @endcond */
-#endif /* !defined(RIOT_VERSION) */
+#endif /* !defined(RIOT_VERSION) || defined(BOOTLOADER_BUILD) */
#ifdef __cplusplus
}
--
2.17.1

View File

@ -1,25 +0,0 @@
From 5907e2e9a98e73b303eac29781b100d988f9575b Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 8 Mar 2022 11:36:33 +0100
Subject: [PATCH 13/17] newlib: add sys/uio.h from toolchain
---
components/newlib/platform_include/sys/uio.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/newlib/platform_include/sys/uio.h b/components/newlib/platform_include/sys/uio.h
index 3ff3eba8716..388fed3d663 100644
--- a/components/newlib/platform_include/sys/uio.h
+++ b/components/newlib/platform_include/sys/uio.h
@@ -6,6 +6,8 @@
#pragma once
+#include_next <sys/uio.h>
+
#include <stdint.h>
#include <sys/types.h>
--
2.17.1

View File

@ -1,54 +0,0 @@
From bff534413fa6a09e8363b914ca8f12df73c93b2c Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 8 Mar 2022 11:27:40 +0100
Subject: [PATCH 14/17] wpa_supplicant: add prefix wpa_ to crypto functions
Prefix `_wpa` added to further crypto functions of `wpa_suppplicant` to avoid name conflicts with RIOT modules `crypto` and `hashes`.
---
components/wpa_supplicant/src/crypto/aes-internal-dec.c | 2 +-
components/wpa_supplicant/src/crypto/aes-internal-enc.c | 2 +-
components/wpa_supplicant/src/crypto/aes-internal.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/components/wpa_supplicant/src/crypto/aes-internal-dec.c b/components/wpa_supplicant/src/crypto/aes-internal-dec.c
index f72742cf590..70a40696943 100644
--- a/components/wpa_supplicant/src/crypto/aes-internal-dec.c
+++ b/components/wpa_supplicant/src/crypto/aes-internal-dec.c
@@ -31,7 +31,7 @@ static int rijndaelKeySetupDec(u32 rk[], const u8 cipherKey[], int keyBits)
u32 temp;
/* expand the cipher key: */
- Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
+ Nr = wpa_rijndaelKeySetupEnc(rk, cipherKey, keyBits);
if (Nr < 0)
return Nr;
/* invert the order of the round keys: */
diff --git a/components/wpa_supplicant/src/crypto/aes-internal-enc.c b/components/wpa_supplicant/src/crypto/aes-internal-enc.c
index a856dc9f3f8..1bedc885368 100644
--- a/components/wpa_supplicant/src/crypto/aes-internal-enc.c
+++ b/components/wpa_supplicant/src/crypto/aes-internal-enc.c
@@ -106,7 +106,7 @@ void * aes_encrypt_init(const u8 *key, size_t len)
rk = os_malloc(AES_PRIV_SIZE);
if (rk == NULL)
return NULL;
- res = rijndaelKeySetupEnc(rk, key, len * 8);
+ res = wpa_rijndaelKeySetupEnc(rk, key, len * 8);
if (res < 0) {
os_free(rk);
return NULL;
diff --git a/components/wpa_supplicant/src/crypto/aes-internal.c b/components/wpa_supplicant/src/crypto/aes-internal.c
index bd4535d2096..6b646027c8c 100644
--- a/components/wpa_supplicant/src/crypto/aes-internal.c
+++ b/components/wpa_supplicant/src/crypto/aes-internal.c
@@ -776,7 +776,7 @@ const u8 rcons[] = {
*
* @return the number of rounds for the given cipher key size.
*/
-int rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits)
+int wpa_rijndaelKeySetupEnc(u32 rk[], const u8 cipherKey[], int keyBits)
{
int i;
u32 temp;
--
2.17.1

View File

@ -1,38 +0,0 @@
From 25509b8b61b329d3c4ae5b3874704dae55d62ccd Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 8 Mar 2022 11:34:13 +0100
Subject: [PATCH 15/17] driver/i2c: remove the include gpio.h in i2c.h header
Including driver/i2c.h by RIOT code leads to type conflicts with RIOT gpio_t type.
---
components/driver/i2c.c | 1 +
components/driver/include/driver/i2c.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/driver/i2c.c b/components/driver/i2c.c
index 438d1efc12d..be26fdeffc3 100644
--- a/components/driver/i2c.c
+++ b/components/driver/i2c.c
@@ -21,6 +21,7 @@
#include "hal/i2c_hal.h"
#include "hal/gpio_hal.h"
#include "soc/i2c_periph.h"
+#include "driver/gpio.h"
#include "driver/i2c.h"
#include "driver/periph_ctrl.h"
#include "esp_rom_gpio.h"
diff --git a/components/driver/include/driver/i2c.h b/components/driver/include/driver/i2c.h
index 22dcc8ab241..e668bba2acd 100644
--- a/components/driver/include/driver/i2c.h
+++ b/components/driver/include/driver/i2c.h
@@ -19,7 +19,6 @@ extern "C" {
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/ringbuf.h"
-#include "driver/gpio.h"
#include "soc/soc_caps.h"
#include "hal/i2c_types.h"
--
2.17.1

View File

@ -1,34 +0,0 @@
From cd8688a55e62094cb6605ee8594985f862d57a95 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 8 Mar 2022 11:35:11 +0100
Subject: [PATCH 16/17] driver/i2c.h: expose i2c_hw_fsm_reset to RIOT code
---
components/driver/i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/driver/i2c.c b/components/driver/i2c.c
index be26fdeffc3..cff410b9d1b 100644
--- a/components/driver/i2c.c
+++ b/components/driver/i2c.c
@@ -209,7 +209,7 @@ static i2c_clk_alloc_t i2c_clk_alloc[I2C_SCLK_MAX] = {
static i2c_obj_t *p_i2c_obj[I2C_NUM_MAX] = {0};
static void i2c_isr_handler_default(void *arg);
static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num);
-static esp_err_t IRAM_ATTR i2c_hw_fsm_reset(i2c_port_t i2c_num);
+esp_err_t IRAM_ATTR i2c_hw_fsm_reset(i2c_port_t i2c_num);
static void i2c_hw_disable(i2c_port_t i2c_num)
{
@@ -595,7 +595,7 @@ static esp_err_t i2c_master_clear_bus(i2c_port_t i2c_num)
* If we remove the power supply for the slave during I2C is reading, or directly connect SDA or SCL to ground,
* this would cause the I2C FSM get stuck in wrong state, all we can do is to reset the I2C hardware in this case.
**/
-static esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num)
+esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num)
{
#if !SOC_I2C_SUPPORT_HW_FSM_RST
int scl_low_period, scl_high_period;
--
2.17.1

View File

@ -1,24 +0,0 @@
From 15b1302039495a979c749fbdc464960901c68684 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 8 Mar 2022 11:36:06 +0100
Subject: [PATCH 17/17] esp_phy: add missing header includes
---
components/esp_phy/src/phy_init.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c
index 7fd5b2c1247..f915b0e1b8f 100644
--- a/components/esp_phy/src/phy_init.c
+++ b/components/esp_phy/src/phy_init.c
@@ -11,6 +11,7 @@
#include <sys/lock.h>
#include "soc/rtc.h"
+#include "soc/soc_caps.h"
#include "esp_err.h"
#include "esp_phy_init.h"
#include "esp_system.h"
--
2.17.1

View File

@ -1,80 +0,0 @@
From 2ed829c7fdd2f31290094c1fe83267c7ca82330c Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Thu, 10 Mar 2022 12:38:51 +0100
Subject: [PATCH 18/20] bootloader: changes for esp32c3
Since RIOT directly links compiled objects, the archive/object file references must be replaced with the corresponding object file paths.
---
.../subproject/main/ld/esp32c3/bootloader.ld | 55 ++++++++++---------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld
index c9b2da7612c..18b939322ba 100644
--- a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld
+++ b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld
@@ -23,34 +23,35 @@ SECTIONS
_loader_text_start = ABSOLUTE(.);
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
- *liblog.a:(.literal .text .literal.* .text.*)
+ *components/log/*(.literal .text .literal.* .text.*)
*libgcc.a:(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
- *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
- *libbootloader_support.a:bootloader_efuse_esp32c3.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
- *libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
- *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
- *libspi_flash.a:*.*(.literal .text .literal.* .text.*)
- *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
- *libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
- *libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
- *libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
- *libefuse.a:*.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_clock_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_common_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_flash.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_random.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
+ *components/bootloader_support/*/bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
+ *components/esp_common/src/fpga_overrides.*(.literal.bootloader_fill_random .text.bootloader_fill_random)
+ *components/bootloader_support/*/bootloader_efuse_esp32c3.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_utility.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_sha.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_console_loader.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_panic.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/bootloader_soc.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/esp_image_format.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_encrypt.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/flash_partitions.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot_secure_features.*(.literal .text .literal.* .text.*)
+ *components/bootloader_support/*/secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
+ *components/*/micro-ecc/*(.literal .text .literal.* .text.*)
+ *components/spi_flash/*(.literal .text .literal.* .text.*)
+ *components/hal/wdt_hal_iram.*(.literal .text .literal.* .text.*)
+ *components/esp_hw_support/*/rtc_clk.*(.literal .text .literal.* .text.*)
+ *components/esp_hw_support/*/rtc_time.*(.literal .text .literal.* .text.*)
+ *components/esp_hw_support/*/regi2c_ctrl.*(.literal .text .literal.* .text.*)
+ *components/efuse/*(.literal .text .literal.* .text.*)
*(.fini.literal)
*(.fini)
*(.gnu.version)
--
2.17.1

View File

@ -1,34 +0,0 @@
From 367e4268b81a30c243628f8c99e94550bd291ec0 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Thu, 10 Mar 2022 12:39:51 +0100
Subject: [PATCH 19/20] hal: fix spi_ll compilation errors for riscv32
---
components/hal/esp32c3/include/hal/spi_ll.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/hal/esp32c3/include/hal/spi_ll.h b/components/hal/esp32c3/include/hal/spi_ll.h
index 38e1676d041..a9154c4600a 100644
--- a/components/hal/esp32c3/include/hal/spi_ll.h
+++ b/components/hal/esp32c3/include/hal/spi_ll.h
@@ -332,7 +332,7 @@ static inline void spi_ll_dma_set_rx_eof_generation(spi_dev_t *hw, bool enable)
*/
static inline void spi_ll_write_buffer(spi_dev_t *hw, const uint8_t *buffer_to_send, size_t bitlen)
{
- for (int x = 0; x < bitlen; x += 32) {
+ for (size_t x = 0; x < bitlen; x += 32) {
//Use memcpy to get around alignment issues for txdata
uint32_t word;
memcpy(&word, &buffer_to_send[x / 8], 4);
@@ -384,7 +384,7 @@ static inline void spi_ll_write_buffer_byte(spi_dev_t *hw, int byte_id, uint8_t
*/
static inline void spi_ll_read_buffer(spi_dev_t *hw, uint8_t *buffer_to_rcv, size_t bitlen)
{
- for (int x = 0; x < bitlen; x += 32) {
+ for (size_t x = 0; x < bitlen; x += 32) {
//Do a memcpy to get around possible alignment issues in rx_buffer
uint32_t word = hw->data_buf[x / 32];
int len = bitlen - x;
--
2.17.1

View File

@ -1,66 +0,0 @@
From ae4c3076113b0b746bea04206d0186bce99fb4d1 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Thu, 10 Mar 2022 13:10:23 +0100
Subject: [PATCH 20/20] freertos/portasm: changes for RIOT for riscv32
A number of symbols that are used by assembler code have to be mapped to existing symbols in RIOT implementation. Furthermore, the ISR stack `port_IntStack`has to be allocated.
---
components/freertos/port/riscv/portasm.S | 27 ++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/components/freertos/port/riscv/portasm.S b/components/freertos/port/riscv/portasm.S
index 20c094b7a68..8aeabb3dedc 100644
--- a/components/freertos/port/riscv/portasm.S
+++ b/components/freertos/port/riscv/portasm.S
@@ -12,6 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifdef RIOT_VERSION
+#include "cpu_conf.h"
+
+#define pxCurrentTCB sched_active_thread
+#define uxSchedulerRunning sched_num_threads
+#define xPortSwitchFlag sched_context_switch_request
+#define vTaskSwitchContext sched_run
+#define uxInterruptNesting irq_interrupt_nesting
+#define configISR_STACK_SIZE ESP_ISR_STACKSIZE
+
+.extern sched_active_thread
+.extern sched_num_threads
+.extern sched_context_switch_request
+.extern irq_interrupt_nesting
+#endif
+
.global uxInterruptNesting
.global uxSchedulerRunning
.global xIsrStackTop
@@ -19,6 +35,14 @@
.global vTaskSwitchContext
.global xPortSwitchFlag
+ .data
+ .align 16
+ .global port_IntStack
+port_IntStack:
+ .space configISR_STACK_SIZE
+ .global port_IntStackTop
+port_IntStackTop:
+
.section .text
/**
@@ -50,7 +74,10 @@ rtos_int_enter:
/* Save current TCB and load the ISR stack */
lw t0, pxCurrentTCB
+ beq t0, zero, rtos_enter_isr_stack
sw t2, 0x0(t0)
+
+rtos_enter_isr_stack:
lw sp, xIsrStackTop
rtos_enter_end:
--
2.17.1

View File

@ -1,27 +0,0 @@
From 1cb888fc95a0374523e164d513952681e4e5847c Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Fri, 8 Apr 2022 16:45:44 +0200
Subject: [PATCH 21/23] spi_flash: changes for RIOT for esp32s3
Define ARRAY_SIZE in `component/spi_flash/spi_flash_timing_tuning.c` only if it is not yet defined by RIOT macros.
---
components/spi_flash/spi_flash_timing_tuning.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/spi_flash/spi_flash_timing_tuning.c b/components/spi_flash/spi_flash_timing_tuning.c
index 8b2efd1450..de8a0a60e9 100644
--- a/components/spi_flash/spi_flash_timing_tuning.c
+++ b/components/spi_flash/spi_flash_timing_tuning.c
@@ -20,7 +20,9 @@
#include "esp32s3/rom/cache.h"
#endif
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
+#endif
#if SPI_TIMING_FLASH_NEEDS_TUNING || SPI_TIMING_PSRAM_NEEDS_TUNING
const static char *TAG = "MSPI Timing";
--
2.17.1

View File

@ -1,27 +0,0 @@
From ff70fdaa8c4c11e060772c47195c271188b7bf01 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Fri, 27 May 2022 15:29:14 +0200
Subject: [PATCH 22/23] driver/gpio: fix undefined reference to
rtc_gpio_force_hold_all
Fix the undefined reference to `rtc_gpio_force_hold_en_all` in `components/driver/gpio.c`
---
components/driver/gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/driver/gpio.c b/components/driver/gpio.c
index db27ab45ab..0c696f0d9f 100644
--- a/components/driver/gpio.c
+++ b/components/driver/gpio.c
@@ -682,7 +682,7 @@ void gpio_deep_sleep_hold_dis(void)
esp_err_t gpio_force_hold_all()
{
#if SOC_RTCIO_HOLD_SUPPORTED
- rtc_gpio_force_hold_all();
+ rtc_gpio_force_hold_en_all();
#endif
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
gpio_hal_force_hold_all(gpio_context.gpio_hal);
--
2.17.1

View File

@ -1,24 +0,0 @@
From c6789a3f627915ff7d9f6909c2202eac2cb9db0c Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 31 May 2022 22:32:47 +0200
Subject: [PATCH 23/23] bootloader: remove compile time from banner
---
components/bootloader_support/src/bootloader_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/bootloader_support/src/bootloader_init.c b/components/bootloader_support/src/bootloader_init.c
index 1d73f5dc26..9e45b1d415 100644
--- a/components/bootloader_support/src/bootloader_init.c
+++ b/components/bootloader_support/src/bootloader_init.c
@@ -91,5 +91,7 @@ void bootloader_enable_random(void)
void bootloader_print_banner(void)
{
ESP_LOGI(TAG, "ESP-IDF %s 2nd stage bootloader", IDF_VER);
+#if 0 /* not used in RIOT */
ESP_LOGI(TAG, "compile time " __TIME__);
+#endif
}
--
2.17.1

View File

@ -1,26 +0,0 @@
From 612d6db5386a9a599fe66cfae9ad526c5dfb7372 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Thu, 11 Aug 2022 01:44:44 +0200
Subject: [PATCH 24/26] bt: RIOT uses another version of vendor function
The xt_ints_on function version used by RIOT returns an integer value, the old mask. Using this function instead of void version, doesn't lead to any problem.
---
components/bt/controller/esp32/bt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c
index 8ed126f867..f967c5b238 100644
--- a/components/bt/controller/esp32/bt.c
+++ b/components/bt/controller/esp32/bt.c
@@ -125,7 +125,7 @@ typedef struct {
struct osi_funcs_t {
uint32_t _version;
xt_handler (*_set_isr)(int n, xt_handler f, void *arg);
- void (*_ints_on)(unsigned int mask);
+ unsigned int (*_ints_on)(unsigned int mask);
void (*_interrupt_disable)(void);
void (*_interrupt_restore)(void);
void (*_task_yield)(void);
--
2.17.1

View File

@ -1,32 +0,0 @@
From b02c4c62bd162472a49f2cd133683a043eeb939a Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 17 Jul 2022 16:06:34 +0200
Subject: [PATCH 26/26] hal: conditional definition of gpio_pull_mode_t
Define type `gpio_pull_mode_t` only if it is not yet defined by RIOT `periph/gpio`. When this header is used during the compilation of RIOT source, this type definition isn't required and leads to name conflicts with RIOT's `gpio_pull_t` and `GPIO_FLOATING` definition. The definition of `gpio_pull_mode_t` in this header is only required when ESP-IDF source code is compiled. In that case RIOT's `gpio_pull_t` isn't defined.
---
components/hal/include/hal/gpio_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/hal/include/hal/gpio_types.h b/components/hal/include/hal/gpio_types.h
index 8a15b8e396c..0b60f7284a8 100644
--- a/components/hal/include/hal/gpio_types.h
+++ b/components/hal/include/hal/gpio_types.h
@@ -401,12 +401,14 @@ typedef struct {
gpio_int_type_t intr_type; /*!< GPIO interrupt type */
} gpio_config_t;
+#ifndef HAVE_GPIO_PULL_T
typedef enum {
GPIO_PULLUP_ONLY, /*!< Pad pull up */
GPIO_PULLDOWN_ONLY, /*!< Pad pull down */
GPIO_PULLUP_PULLDOWN, /*!< Pad pull up + pull down*/
GPIO_FLOATING, /*!< Pad floating */
} gpio_pull_mode_t;
+#endif
typedef enum {
GPIO_DRIVE_CAP_0 = 0, /*!< Pad drive capability: weak */
--
2.17.1

View File

@ -1,30 +0,0 @@
From abfd0f5fc57a8948aaef0f5ba7c1632bc5ebe3df Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 17 Jul 2022 18:21:25 +0200
Subject: [PATCH 27/27] hal: conditional definition of gpio_port_t
Define type `gpio_port_t` only if it is not yet defined by RIOT `periph/gpio`. When this header is used during the compilation of RIOT source, this type definition isn't required and leads to name conflicts with RIOT's `gpio_port_t` definition. The definition of `gpio_port_t` in this header is only required when ESP-IDF source code is compiled. In that case RIOT's `gpio_port_t` isn't defined.
---
components/hal/include/hal/gpio_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/hal/include/hal/gpio_types.h b/components/hal/include/hal/gpio_types.h
index 0b60f7284a8..a5258525801 100644
--- a/components/hal/include/hal/gpio_types.h
+++ b/components/hal/include/hal/gpio_types.h
@@ -21,10 +21,12 @@
extern "C" {
#endif
+#ifndef HAVE_GPIO_PORT_T
typedef enum {
GPIO_PORT_0 = 0,
GPIO_PORT_MAX,
} gpio_port_t;
+#endif
#define GPIO_SEL_0 (BIT(0)) /*!< Pin 0 selected */
#define GPIO_SEL_1 (BIT(1)) /*!< Pin 1 selected */
--
2.17.1

View File

@ -1,25 +0,0 @@
From 19f7ed9aaab8be94571779fc8b738d3479e0aa23 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 4 Apr 2023 09:55:00 +0200
Subject: [PATCH 28/29] hal: cast esp interrupt type to riscv interrupt type
---
components/hal/esp32c3/include/hal/interrupt_controller_ll.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/hal/esp32c3/include/hal/interrupt_controller_ll.h b/components/hal/esp32c3/include/hal/interrupt_controller_ll.h
index 70afe314cfe..3c3ef3b953e 100644
--- a/components/hal/esp32c3/include/hal/interrupt_controller_ll.h
+++ b/components/hal/esp32c3/include/hal/interrupt_controller_ll.h
@@ -124,7 +124,7 @@ static inline void intr_cntrl_ll_set_int_level(int intr, int level)
*/
static inline void intr_cntrl_ll_set_int_type(int intr, int_type_t type)
{
- esprv_intc_int_set_type(BIT(intr), type);
+ esprv_intc_int_set_type(BIT(intr), (enum intr_type)type);
}
#ifdef __cplusplus
--
2.34.1

View File

@ -1,24 +0,0 @@
From 0e52f50f9c53eac78f5c70aed1f140b8ba3a3031 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 4 Apr 2023 09:55:45 +0200
Subject: [PATCH 29/29] nfs_flash: include stddef.h for size_t deklaration
---
components/nvs_flash/src/intrusive_list.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/nvs_flash/src/intrusive_list.h b/components/nvs_flash/src/intrusive_list.h
index bb580502ec7..695020c415f 100644
--- a/components/nvs_flash/src/intrusive_list.h
+++ b/components/nvs_flash/src/intrusive_list.h
@@ -14,6 +14,7 @@
#ifndef intrusive_list_h
#define intrusive_list_h
+#include <stddef.h>
#include <cassert>
#include <unordered_map>
--
2.34.1

View File

@ -1,141 +0,0 @@
From e175ea4902cebfdd5b4edc470feff2dadbec408a Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Wed, 5 Apr 2023 01:17:12 +0200
Subject: [PATCH 30/30] bt/controller/esp32s3: fix return types in functions
Since the size of int and int32_t is the same, changing int to int32_t and vise versa to fix the compilation issue due to function declaration conflict isn't any risk.
---
components/bt/controller/esp32s3/bt.c | 52 +++++++++++++--------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/components/bt/controller/esp32s3/bt.c b/components/bt/controller/esp32s3/bt.c
index 64e10ad4a70..ee68c6b834b 100644
--- a/components/bt/controller/esp32s3/bt.c
+++ b/components/bt/controller/esp32s3/bt.c
@@ -268,7 +268,7 @@ extern char _bt_tmp_bss_end;
*/
static void interrupt_set_wrapper(int32_t cpu_no, int32_t intr_source, int32_t intr_num, int32_t intr_prio);
static void interrupt_clear_wrapper(int32_t intr_source, int32_t intr_num);
-static void interrupt_handler_set_wrapper(int n, void *fn, void *arg);
+static void interrupt_handler_set_wrapper(int32_t n, void *fn, void *arg);
static void IRAM_ATTR interrupt_disable(void);
static void IRAM_ATTR interrupt_restore(void);
static void IRAM_ATTR task_yield_from_isr(void);
@@ -486,28 +486,28 @@ static void semphr_delete_wrapper(void *semphr)
vSemaphoreDelete(semphr);
}
-static int IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
+static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
- return (int)xSemaphoreTakeFromISR(semphr, hptw);
+ return xSemaphoreTakeFromISR(semphr, hptw);
}
-static int IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
+static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
- return (int)xSemaphoreGiveFromISR(semphr, hptw);
+ return xSemaphoreGiveFromISR(semphr, hptw);
}
-static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
+static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
- return (int)xSemaphoreTake(semphr, portMAX_DELAY);
+ return xSemaphoreTake(semphr, portMAX_DELAY);
} else {
- return (int)xSemaphoreTake(semphr, block_time_ms / portTICK_PERIOD_MS);
+ return xSemaphoreTake(semphr, block_time_ms / portTICK_PERIOD_MS);
}
}
-static int semphr_give_wrapper(void *semphr)
+static int32_t semphr_give_wrapper(void *semphr)
{
- return (int)xSemaphoreGive(semphr);
+ return xSemaphoreGive(semphr);
}
static void *mutex_create_wrapper(void)
@@ -520,14 +520,14 @@ static void mutex_delete_wrapper(void *mutex)
vSemaphoreDelete(mutex);
}
-static int mutex_lock_wrapper(void *mutex)
+static int32_t mutex_lock_wrapper(void *mutex)
{
- return (int)xSemaphoreTake(mutex, portMAX_DELAY);
+ return xSemaphoreTake(mutex, portMAX_DELAY);
}
-static int mutex_unlock_wrapper(void *mutex)
+static int32_t mutex_unlock_wrapper(void *mutex)
{
- return (int)xSemaphoreGive(mutex);
+ return xSemaphoreGive(mutex);
}
static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
@@ -540,37 +540,37 @@ static void queue_delete_wrapper(void *queue)
vQueueDelete(queue);
}
-static int queue_send_wrapper(void *queue, void *item, uint32_t block_time_ms)
+static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_ms)
{
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
- return (int)xQueueSend(queue, item, portMAX_DELAY);
+ return xQueueSend(queue, item, portMAX_DELAY);
} else {
- return (int)xQueueSend(queue, item, block_time_ms / portTICK_PERIOD_MS);
+ return xQueueSend(queue, item, block_time_ms / portTICK_PERIOD_MS);
}
}
-static int IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
+static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
{
return (int)xQueueSendFromISR(queue, item, hptw);
}
-static int queue_recv_wrapper(void *queue, void *item, uint32_t block_time_ms)
+static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_ms)
{
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
- return (int)xQueueReceive(queue, item, portMAX_DELAY);
+ return xQueueReceive(queue, item, portMAX_DELAY);
} else {
- return (int)xQueueReceive(queue, item, block_time_ms / portTICK_PERIOD_MS);
+ return xQueueReceive(queue, item, block_time_ms / portTICK_PERIOD_MS);
}
}
-static int IRAM_ATTR queue_recv_from_isr_wrapper(void *queue, void *item, void *hptw)
+static int32_t IRAM_ATTR queue_recv_from_isr_wrapper(void *queue, void *item, void *hptw)
{
- return (int)xQueueReceiveFromISR(queue, item, hptw);
+ return xQueueReceiveFromISR(queue, item, hptw);
}
-static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
+static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
{
- return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
+ return xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
}
static void task_delete_wrapper(void *task_handle)
@@ -592,7 +592,7 @@ static void *malloc_internal_wrapper(size_t size)
return p;
}
-static int IRAM_ATTR read_mac_wrapper(uint8_t mac[6])
+static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6])
{
int ret = esp_read_mac(mac, ESP_MAC_BT);
ESP_LOGI(BT_LOG_TAG, "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
--
2.34.1

View File

@ -1,48 +0,0 @@
From b00693f50e7f4b8239384c7b06ef1dd5a85f2ca9 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 27 Jun 2023 16:24:27 +0200
Subject: [PATCH 31/31] driver/sdmmc: avoid type definition conflicts
---
components/driver/include/driver/sdmmc_types.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/components/driver/include/driver/sdmmc_types.h b/components/driver/include/driver/sdmmc_types.h
index cbb796fdbb3..c3d27bec18d 100644
--- a/components/driver/include/driver/sdmmc_types.h
+++ b/components/driver/include/driver/sdmmc_types.h
@@ -29,6 +29,7 @@
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
+#if !defined(RIOT_VERSION)
/**
* Decoded values from SD card Card Specific Data register
*/
@@ -69,6 +70,8 @@ typedef struct {
uint8_t power_class; /*!< Power class used by the card */
} sdmmc_ext_csd_t;
+#endif /* !defined(RIOT_VERSION) */
+
/**
* SD/MMC command response buffer
*/
@@ -160,6 +163,7 @@ typedef struct {
int command_timeout_ms; /*!< timeout, in milliseconds, of a single command. Set to 0 to use the default value. */
} sdmmc_host_t;
+#if !defined(RIOT_VERSION)
/**
* SD/MMC card information structure
*/
@@ -185,5 +189,6 @@ typedef struct {
uint32_t reserved : 23; /*!< Reserved for future expansion */
} sdmmc_card_t;
+#endif /* !defined(RIOT_VERSION) */
#endif // _SDMMC_TYPES_H_
--
2.34.1

View File

@ -1,24 +0,0 @@
From 5117abbc20cad093f4f8285ecd2dea737df7be23 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Wed, 2 Aug 2023 13:18:40 +0200
Subject: [PATCH 32/32] hal/gdma: include stddef.h for NULL
---
components/hal/esp32s3/include/hal/gdma_ll.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/hal/esp32s3/include/hal/gdma_ll.h b/components/hal/esp32s3/include/hal/gdma_ll.h
index 4035c76934c..a3d1436b9bc 100644
--- a/components/hal/esp32s3/include/hal/gdma_ll.h
+++ b/components/hal/esp32s3/include/hal/gdma_ll.h
@@ -5,6 +5,7 @@
*/
#pragma once
+#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "soc/soc_caps.h"
--
2.34.1

View File

@ -1,62 +0,0 @@
From 241861e24ad628946e3257317549a70c6f90aeec Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Tue, 10 Oct 2023 17:54:52 +0200
Subject: [PATCH 33/33] wpa_supplicant: add prefix wpa_ to sha512_init
Prefix `_wpa` added to `sha512_init` function of `wpa_suppplicant` to avoid name conflicts with RIOT modules `crypto` and `hashes`.
---
components/wpa_supplicant/src/crypto/crypto_internal.c | 2 +-
components/wpa_supplicant/src/crypto/sha512-internal.c | 4 ++--
components/wpa_supplicant/src/crypto/sha512_i.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c
index d1426a8feb7..7ff588cbb40 100644
--- a/components/wpa_supplicant/src/crypto/crypto_internal.c
+++ b/components/wpa_supplicant/src/crypto/crypto_internal.c
@@ -67,7 +67,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
#endif /* CONFIG_INTERNAL_SHA384 */
#ifdef CONFIG_INTERNAL_SHA512
case CRYPTO_HASH_ALG_SHA512:
- sha512_init(&ctx->u.sha512);
+ wpa_sha512_init(&ctx->u.sha512);
break;
#endif /* CONFIG_INTERNAL_SHA512 */
case CRYPTO_HASH_ALG_HMAC_MD5:
diff --git a/components/wpa_supplicant/src/crypto/sha512-internal.c b/components/wpa_supplicant/src/crypto/sha512-internal.c
index c0263941c12..1e816867faf 100644
--- a/components/wpa_supplicant/src/crypto/sha512-internal.c
+++ b/components/wpa_supplicant/src/crypto/sha512-internal.c
@@ -27,7 +27,7 @@ int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len,
struct sha512_state ctx;
size_t i;
- sha512_init(&ctx);
+ wpa_sha512_init(&ctx);
for (i = 0; i < num_elem; i++)
if (sha512_process(&ctx, addr[i], len[i]))
return -1;
@@ -161,7 +161,7 @@ static int sha512_compress(struct sha512_state *md, unsigned char *buf)
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
-void sha512_init(struct sha512_state *md)
+void wpa_sha512_init(struct sha512_state *md)
{
md->curlen = 0;
md->length = 0;
diff --git a/components/wpa_supplicant/src/crypto/sha512_i.h b/components/wpa_supplicant/src/crypto/sha512_i.h
index 108958911ef..e451e48fcfd 100644
--- a/components/wpa_supplicant/src/crypto/sha512_i.h
+++ b/components/wpa_supplicant/src/crypto/sha512_i.h
@@ -17,7 +17,7 @@ struct sha512_state {
u8 buf[SHA512_BLOCK_SIZE];
};
-void sha512_init(struct sha512_state *md);
+void wpa_sha512_init(struct sha512_state *md);
int sha512_process(struct sha512_state *md, const unsigned char *in,
unsigned long inlen);
int sha512_done(struct sha512_state *md, unsigned char *out);
--
2.34.1

View File

@ -1,25 +0,0 @@
From 2957d710a61c11d20e9f9fea10a8fb5d7ef94e15 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Date: Tue, 13 Feb 2024 13:31:10 +0100
Subject: [PATCH] components/efuse: fix incorrect forward declaration
---
components/efuse/private_include/esp_efuse_utility.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/efuse/private_include/esp_efuse_utility.h b/components/efuse/private_include/esp_efuse_utility.h
index 3016d55d..630a3a32 100644
--- a/components/efuse/private_include/esp_efuse_utility.h
+++ b/components/efuse/private_include/esp_efuse_utility.h
@@ -119,7 +119,7 @@ uint32_t esp_efuse_utility_read_reg(esp_efuse_block_t blk, unsigned int num_reg)
/**
* @brief Writing efuse register with checking of repeated programming of programmed bits.
*/
-esp_err_t esp_efuse_utility_write_reg(unsigned int num_reg, esp_efuse_block_t efuse_block, uint32_t reg_to_write);
+esp_err_t esp_efuse_utility_write_reg(esp_efuse_block_t efuse_block, unsigned int num_reg, uint32_t reg_to_write);
/* @brief Reset efuse write registers
*
--
2.43.1

View File

@ -1,63 +0,0 @@
From 1a3bd2c8020d9d8e36312f0a64adf9d3bf45f462 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikolai=20G=C3=BCtschow?= <mikolai.guetschow@tu-dresden.de>
Date: Fri, 22 Mar 2024 07:54:19 +0100
Subject: [PATCH] wpa_supplicant: add prefix wpa_ to sha384_init
Prefix `wpa_` added to `sha384_init` function of `wpa_suppplicant` to avoid name conflicts with RIOT module `sys/hashes`.
---
components/wpa_supplicant/src/crypto/crypto_internal.c | 2 +-
components/wpa_supplicant/src/crypto/sha384-internal.c | 4 ++--
components/wpa_supplicant/src/crypto/sha384_i.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c
index 7ff588cb..bda80730 100644
--- a/components/wpa_supplicant/src/crypto/crypto_internal.c
+++ b/components/wpa_supplicant/src/crypto/crypto_internal.c
@@ -62,7 +62,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
#endif /* CONFIG_SHA256 */
#ifdef CONFIG_INTERNAL_SHA384
case CRYPTO_HASH_ALG_SHA384:
- sha384_init(&ctx->u.sha384);
+ wpa_sha384_init(&ctx->u.sha384);
break;
#endif /* CONFIG_INTERNAL_SHA384 */
#ifdef CONFIG_INTERNAL_SHA512
diff --git a/components/wpa_supplicant/src/crypto/sha384-internal.c b/components/wpa_supplicant/src/crypto/sha384-internal.c
index 646f7297..5cefa825 100644
--- a/components/wpa_supplicant/src/crypto/sha384-internal.c
+++ b/components/wpa_supplicant/src/crypto/sha384-internal.c
@@ -27,7 +27,7 @@ int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len,
struct sha384_state ctx;
size_t i;
- sha384_init(&ctx);
+ wpa_sha384_init(&ctx);
for (i = 0; i < num_elem; i++)
if (sha384_process(&ctx, addr[i], len[i]))
return -1;
@@ -49,7 +49,7 @@ int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len,
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
-void sha384_init(struct sha384_state *md)
+void wpa_sha384_init(struct sha384_state *md)
{
md->curlen = 0;
md->length = 0;
diff --git a/components/wpa_supplicant/src/crypto/sha384_i.h b/components/wpa_supplicant/src/crypto/sha384_i.h
index a00253ff..57860bdf 100644
--- a/components/wpa_supplicant/src/crypto/sha384_i.h
+++ b/components/wpa_supplicant/src/crypto/sha384_i.h
@@ -15,7 +15,7 @@
#define sha384_state sha512_state
-void sha384_init(struct sha384_state *md);
+void wpa_sha384_init(struct sha384_state *md);
int sha384_process(struct sha384_state *md, const unsigned char *in,
unsigned long inlen);
int sha384_done(struct sha384_state *md, unsigned char *out);
--
2.39.2

View File

@ -1,24 +0,0 @@
From a9d2537cb0a3f0967588b625f44a32dcdef2af52 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Date: Sat, 1 Jun 2024 09:31:50 +0200
Subject: [PATCH] components/wpa_supplicant: add missing include
---
components/wpa_supplicant/port/include/os.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/wpa_supplicant/port/include/os.h b/components/wpa_supplicant/port/include/os.h
index d00bd6f6..5a67c4e3 100644
--- a/components/wpa_supplicant/port/include/os.h
+++ b/components/wpa_supplicant/port/include/os.h
@@ -18,6 +18,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include "esp_err.h"
#include "supplicant_opt.h"
--
2.45.1

View File

@ -1,105 +0,0 @@
From 3062316cd717b4df3099f40587e37c133195e9ca Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Date: Sat, 1 Jun 2024 09:59:40 +0200
Subject: [PATCH] components: fix calls to calloc()
The first argument is the number of array members, the second the
member size, not the other way round.
This fixes compilation with `-Werror=calloc-transposed-args`
---
components/app_update/esp_ota_ops.c | 2 +-
components/esp_hw_support/port/esp32/esp_himem.c | 10 +++++-----
components/esp_phy/src/phy_init.c | 2 +-
components/spi_flash/partition.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/components/app_update/esp_ota_ops.c b/components/app_update/esp_ota_ops.c
index c81dff19..664dd7b3 100644
--- a/components/app_update/esp_ota_ops.c
+++ b/components/app_update/esp_ota_ops.c
@@ -156,7 +156,7 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
}
}
- new_entry = (ota_ops_entry_t *) calloc(sizeof(ota_ops_entry_t), 1);
+ new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
if (new_entry == NULL) {
return ESP_ERR_NO_MEM;
}
diff --git a/components/esp_hw_support/port/esp32/esp_himem.c b/components/esp_hw_support/port/esp32/esp_himem.c
index 061b2661..45d07f6e 100644
--- a/components/esp_hw_support/port/esp32/esp_himem.c
+++ b/components/esp_hw_support/port/esp32/esp_himem.c
@@ -144,8 +144,8 @@ void __attribute__((constructor)) esp_himem_init(void)
int paddr_end = maxram;
s_ramblockcnt = ((paddr_end - paddr_start) / CACHE_BLOCKSIZE);
//Allocate data structures
- s_ram_descriptor = calloc(sizeof(ramblock_t), s_ramblockcnt);
- s_range_descriptor = calloc(sizeof(rangeblock_t), SPIRAM_BANKSWITCH_RESERVE);
+ s_ram_descriptor = calloc(s_ramblockcnt, sizeof(ramblock_t));
+ s_range_descriptor = calloc(SPIRAM_BANKSWITCH_RESERVE, sizeof(rangeblock_t));
if (s_ram_descriptor == NULL || s_range_descriptor == NULL) {
ESP_EARLY_LOGE(TAG, "Cannot allocate memory for meta info. Not initializing!");
free(s_ram_descriptor);
@@ -188,11 +188,11 @@ esp_err_t esp_himem_alloc(size_t size, esp_himem_handle_t *handle_out)
return ESP_ERR_INVALID_SIZE;
}
int blocks = size / CACHE_BLOCKSIZE;
- esp_himem_ramdata_t *r = calloc(sizeof(esp_himem_ramdata_t), 1);
+ esp_himem_ramdata_t *r = calloc(1, sizeof(esp_himem_ramdata_t));
if (!r) {
goto nomem;
}
- r->block = calloc(sizeof(uint16_t), blocks);
+ r->block = calloc(blocks, sizeof(uint16_t));
if (!r->block) {
goto nomem;
}
@@ -239,7 +239,7 @@ esp_err_t esp_himem_alloc_map_range(size_t size, esp_himem_rangehandle_t *handle
ESP_RETURN_ON_FALSE(s_ram_descriptor != NULL, ESP_ERR_INVALID_STATE, TAG, "Himem not available!");
ESP_RETURN_ON_FALSE(size % CACHE_BLOCKSIZE == 0, ESP_ERR_INVALID_SIZE, TAG, "requested size not aligned to blocksize");
int blocks = size / CACHE_BLOCKSIZE;
- esp_himem_rangedata_t *r = calloc(sizeof(esp_himem_rangedata_t), 1);
+ esp_himem_rangedata_t *r = calloc(1, sizeof(esp_himem_rangedata_t));
if (!r) {
return ESP_ERR_NO_MEM;
}
diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c
index 5be0fa91..71ece1bb 100644
--- a/components/esp_phy/src/phy_init.c
+++ b/components/esp_phy/src/phy_init.c
@@ -625,7 +625,7 @@ void esp_phy_load_cal_and_init(void)
phy_eco_version_sel(esp_efuse_get_chip_ver());
#endif
esp_phy_calibration_data_t* cal_data =
- (esp_phy_calibration_data_t*) calloc(sizeof(esp_phy_calibration_data_t), 1);
+ (esp_phy_calibration_data_t*) calloc(1, sizeof(esp_phy_calibration_data_t));
if (cal_data == NULL) {
ESP_LOGE(TAG, "failed to allocate memory for RF calibration data");
abort();
diff --git a/components/spi_flash/partition.c b/components/spi_flash/partition.c
index d1140ad0..dcd00324 100644
--- a/components/spi_flash/partition.c
+++ b/components/spi_flash/partition.c
@@ -211,7 +211,7 @@ static esp_err_t load_partitions(void)
#endif
// allocate new linked list item and populate it with data from partition table
- partition_list_item_t* item = (partition_list_item_t*) calloc(sizeof(partition_list_item_t), 1);
+ partition_list_item_t* item = (partition_list_item_t*) calloc(1, sizeof(partition_list_item_t));
if (item == NULL) {
err = ESP_ERR_NO_MEM;
break;
@@ -326,7 +326,7 @@ esp_err_t esp_partition_register_external(esp_flash_t* flash_chip, size_t offset
return err;
}
- partition_list_item_t* item = (partition_list_item_t*) calloc(sizeof(partition_list_item_t), 1);
+ partition_list_item_t* item = (partition_list_item_t*) calloc(1, sizeof(partition_list_item_t));
if (item == NULL) {
return ESP_ERR_NO_MEM;
}
--
2.45.1

View File

@ -1,30 +0,0 @@
From d9443415cc1e10526a265601cd98374988660101 Mon Sep 17 00:00:00 2001
From: Jongmin Kim <jmkim@debian.org>
Date: Mon, 14 Apr 2025 15:03:34 +0900
Subject: [PATCH 1/2] driver/rtc_io: correct declaration of renamed function
rtc_gpio_force_hold_en_all
The implementation of `rtc_gpio_force_hold_all()` was renamed to`rtc_gpio_force_hold_en_all()`
in the patch `0022-driver-gpio-fix-undefined-reference-to-rtc_gpio_forc.patch`.
This patch corrects the function declaration to match the renamed implementation.
---
components/driver/include/driver/rtc_io.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/driver/include/driver/rtc_io.h b/components/driver/include/driver/rtc_io.h
index cbf32c4f..766bde11 100644
--- a/components/driver/include/driver/rtc_io.h
+++ b/components/driver/include/driver/rtc_io.h
@@ -269,7 +269,7 @@ esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num);
* Force hold signal is enabled before going into deep sleep for pins which
* are used for EXT1 wakeup.
*/
-esp_err_t rtc_gpio_force_hold_all(void);
+esp_err_t rtc_gpio_force_hold_en_all(void);
/**
* @brief Disable force hold signal for all RTC IOs
--
2.49.0

View File

@ -1,31 +0,0 @@
From 87cf66f13900f4609ac6e1fa4b4c8046232268bd Mon Sep 17 00:00:00 2001
From: Jongmin Kim <jmkim@debian.org>
Date: Mon, 14 Apr 2025 15:08:58 +0900
Subject: [PATCH 2/2] newlib: avoid sys/uio.h inclusion outside of RIOT
The RIOT header `<sys/uio.h>` is not available when using the bundled ESP-IDF
outside of RIOT.
This patch ensures that `<sys/uio.h>` is only included when `RIOT_VERSION` is
defined.
---
components/newlib/platform_include/sys/uio.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/newlib/platform_include/sys/uio.h b/components/newlib/platform_include/sys/uio.h
index 388fed3d..5a8652a7 100644
--- a/components/newlib/platform_include/sys/uio.h
+++ b/components/newlib/platform_include/sys/uio.h
@@ -6,7 +6,9 @@
#pragma once
+#ifdef RIOT_VERSION
#include_next <sys/uio.h>
+#endif /* RIOT_VERSION */
#include <stdint.h>
#include <sys/types.h>
--
2.49.0