Skip to content

Commit b3b492f

Browse files
authored
Tasmota changes
1 parent f15a15e commit b3b492f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+484
-8722
lines changed

.github/workflows/release_zips.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create zip file with recursive source clone for release
1+
name: Create tar.xz archive with recursive source clone for release
22

33
on:
44
push:
@@ -7,12 +7,11 @@ on:
77

88
jobs:
99
release_zips:
10-
name: Create release zip file
11-
runs-on: ubuntu-24.04
10+
name: Create release tar.xz archive
11+
runs-on: ubuntu-latest
1212
steps:
13-
- name: Create a recursive clone source zip
14-
uses: espressif/release-zips-action@v1
15-
with:
16-
github_token: ${{ secrets.GITHUB_TOKEN }}
17-
release_project_name: ESP-IDF
18-
git_extra_args: --shallow-since="1 year ago"
13+
- name: Create a recursive clone source and stripped archive
14+
uses: Jason2866/github-actions/release_zips@tar_xz
15+
env:
16+
RELEASE_PROJECT_NAME: ESP-IDF
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitmodules

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@
3737
sbom-description = A small and fast ECDH and ECDSA implementation for 8-bit, 32-bit, and 64-bit processors
3838
sbom-hash = 24c60e243580c7868f4334a1ba3123481fe1aa48
3939

40-
[submodule "components/spiffs/spiffs"]
41-
path = components/spiffs/spiffs
42-
url = ../../pellepl/spiffs.git
43-
sbom-version = 0.2-255-g0dbb3f71c5f6
44-
sbom-supplier = Person: Peter Andersson
45-
sbom-url = https://github.com/pellepl/spiffs
46-
sbom-description = Wear-leveled SPI flash file system for embedded devices
47-
sbom-hash = 0dbb3f71c5f6fae3747a9d935372773762baf852
48-
4940
[submodule "components/json/cJSON"]
5041
path = components/json/cJSON
5142
url = ../../DaveGamble/cJSON.git

CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.22)
2+
project(esp-idf C CXX ASM)
23

34
if(CMAKE_CURRENT_LIST_DIR STREQUAL CMAKE_SOURCE_DIR)
45
message(FATAL_ERROR "Current directory '${CMAKE_CURRENT_LIST_DIR}' is not buildable. "
@@ -197,6 +198,14 @@ if(NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 8.0.0)
197198
endif()
198199
endif()
199200

201+
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 15.0)
202+
list(APPEND c_compile_options "-fzero-init-padding-bits=all" "-fno-malloc-dce")
203+
endif()
204+
205+
# if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 15.0 AND CONFIG_IDF_TARGET_ARCH_RISCV)
206+
# list(APPEND compile_options "-mespv-spec=2p1") # Use xespv2p1 instruction set
207+
# endif()
208+
200209
if(CONFIG_COMPILER_DISABLE_GCC12_WARNINGS)
201210
list(APPEND compile_options "-Wno-address"
202211
"-Wno-use-after-free")
@@ -209,6 +218,25 @@ if(CONFIG_COMPILER_DISABLE_GCC13_WARNINGS)
209218
"-Wno-dangling-reference")
210219
endif()
211220

221+
if(CONFIG_COMPILER_DISABLE_GCC14_WARNINGS)
222+
list(APPEND compile_options "-Wno-calloc-transposed-args")
223+
endif()
224+
225+
if(CONFIG_COMPILER_DISABLE_GCC15_WARNINGS)
226+
list(APPEND c_compile_options "-Wno-unterminated-string-initialization")
227+
list(APPEND c_compile_options "-Wno-header-guard")
228+
list(APPEND cxx_compile_options "-Wno-self-move")
229+
list(APPEND cxx_compile_options "-Wno-template-body")
230+
list(APPEND cxx_compile_options "-Wno-dangling-reference")
231+
list(APPEND cxx_compile_options "-Wno-defaulted-function-deleted")
232+
endif()
233+
234+
if(CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS)
235+
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
236+
idf_build_replace_option_from_property(COMPILE_OPTIONS "-Werror" "-Werror=all")
237+
endif()
238+
endif()
239+
212240
# GCC-specific options
213241
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
214242
list(APPEND compile_options "-fstrict-volatile-bitfields"

components/esp_driver_dac/dac_continuous.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,17 @@ static esp_err_t s_dac_wait_to_load_dma_data(dac_continuous_handle_t handle, uin
555555
DAC_STAILQ_REMOVE(&handle->head, desc, lldesc_s, qe);
556556
}
557557

558-
static bool split_flag = false;
558+
// TASMOTA: remove split because it does some harm and I'm not sure why it was there in the first place. No such code in 4.x
559+
// static bool split_flag = false;
559560
uint8_t *dma_buf = (uint8_t *)desc->buf;
560-
if (buf_size * DAC_16BIT_ALIGN_COEFF < 2 * handle->cfg.buf_size) {
561-
if (!split_flag) {
562-
buf_size >>= 1;
563-
split_flag = true;
564-
} else {
565-
split_flag = false;
566-
}
567-
}
561+
// if (buf_size * DAC_16BIT_ALIGN_COEFF < 2 * handle->cfg.buf_size) {
562+
// if (!split_flag) {
563+
// buf_size >>= 1;
564+
// split_flag = true;
565+
// } else {
566+
// split_flag = false;
567+
// }
568+
// }
568569
size_t load_bytes = s_dac_load_data_into_buf(handle, dma_buf, handle->cfg.buf_size, buf, buf_size);
569570
lldesc_config(desc, LLDESC_HW_OWNED, 1, 0, load_bytes);
570571
desc->size = load_bytes;

components/esp_eth/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ if(CONFIG_ETH_ENABLED)
3434
"src/phy/esp_eth_phy_ip101.c"
3535
"src/phy/esp_eth_phy_ksz80xx.c"
3636
"src/phy/esp_eth_phy_lan87xx.c"
37-
"src/phy/esp_eth_phy_rtl8201.c")
37+
"src/phy/esp_eth_phy_rtl8201.c"
38+
"src/phy/esp_eth_phy_jl1101.c")
3839
endif()
3940

4041
if(CONFIG_ETH_SPI_ETHERNET_DM9051)

components/esp_eth/include/esp_eth_phy.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ esp_eth_phy_t *esp_eth_phy_new_dp83848(const eth_phy_config_t *config);
352352
*/
353353
esp_eth_phy_t *esp_eth_phy_new_ksz80xx(const eth_phy_config_t *config);
354354

355+
/**
356+
* @brief Create a PHY instance of JL1101
357+
*
358+
* @param[in] config: configuration of PHY
359+
*
360+
* @return
361+
* - instance: create PHY instance successfully
362+
* - NULL: create PHY instance failed because some error occurred
363+
*/
364+
esp_eth_phy_t *esp_eth_phy_new_jl1101(const eth_phy_config_t *config);
365+
355366
#if CONFIG_ETH_SPI_ETHERNET_DM9051
356367
/**
357368
* @brief Create a PHY instance of DM9051
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <string.h>
8+
#include <stdlib.h>
9+
#include <sys/cdefs.h>
10+
#include "esp_log.h"
11+
#include "esp_check.h"
12+
#include "esp_eth_phy_802_3.h"
13+
14+
static const char *TAG = "jl1101";
15+
16+
/***************Vendor Specific Register***************/
17+
18+
/**
19+
* @brief PSMR(Power Saving Mode Register)
20+
*
21+
*/
22+
typedef union {
23+
struct {
24+
uint16_t reserved : 15; /* Reserved */
25+
uint16_t en_pwr_save : 1; /* Enable power saving mode */
26+
};
27+
uint16_t val;
28+
} psmr_reg_t;
29+
30+
/**
31+
* @brief PSR(Page Select Register)
32+
*
33+
*/
34+
typedef union {
35+
struct {
36+
uint16_t page_select : 8; /* Select register page, default is 0 */
37+
uint16_t reserved : 8; /* Reserved */
38+
};
39+
uint16_t val;
40+
} psr_reg_t;
41+
#define ETH_PHY_PSR_REG_ADDR (0x1F)
42+
43+
typedef struct {
44+
phy_802_3_t phy_802_3;
45+
} phy_jl1101_t;
46+
47+
static esp_err_t jl1101_page_select(phy_jl1101_t *jl1101, uint32_t page)
48+
{
49+
esp_err_t ret = ESP_OK;
50+
esp_eth_mediator_t *eth = jl1101->phy_802_3.eth;
51+
psr_reg_t psr = {
52+
.page_select = page
53+
};
54+
ESP_GOTO_ON_ERROR(eth->phy_reg_write(eth, jl1101->phy_802_3.addr, ETH_PHY_PSR_REG_ADDR, psr.val), err, TAG, "write PSR failed");
55+
return ESP_OK;
56+
err:
57+
return ret;
58+
}
59+
60+
static esp_err_t jl1101_update_link_duplex_speed(phy_jl1101_t *jl1101)
61+
{
62+
esp_err_t ret = ESP_OK;
63+
esp_eth_mediator_t *eth = jl1101->phy_802_3.eth;
64+
uint32_t addr = jl1101->phy_802_3.addr;
65+
eth_speed_t speed = ETH_SPEED_10M;
66+
eth_duplex_t duplex = ETH_DUPLEX_HALF;
67+
bmcr_reg_t bmcr;
68+
bmsr_reg_t bmsr;
69+
uint32_t peer_pause_ability = false;
70+
anlpar_reg_t anlpar;
71+
ESP_GOTO_ON_ERROR(jl1101_page_select(jl1101, 0), err, TAG, "select page 0 failed");
72+
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMSR_REG_ADDR, &(bmsr.val)), err, TAG, "read BMSR failed");
73+
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_ANLPAR_REG_ADDR, &(anlpar.val)), err, TAG, "read ANLPAR failed");
74+
eth_link_t link = bmsr.link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
75+
/* check if link status changed */
76+
if (jl1101->phy_802_3.link_status != link) {
77+
/* when link up, read negotiation result */
78+
if (link == ETH_LINK_UP) {
79+
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
80+
if (bmcr.speed_select) {
81+
speed = ETH_SPEED_100M;
82+
} else {
83+
speed = ETH_SPEED_10M;
84+
}
85+
if (bmcr.duplex_mode) {
86+
duplex = ETH_DUPLEX_FULL;
87+
} else {
88+
duplex = ETH_DUPLEX_HALF;
89+
}
90+
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed");
91+
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed");
92+
/* if we're in duplex mode, and peer has the flow control ability */
93+
if (duplex == ETH_DUPLEX_FULL && anlpar.symmetric_pause) {
94+
peer_pause_ability = 1;
95+
} else {
96+
peer_pause_ability = 0;
97+
}
98+
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_PAUSE, (void *)peer_pause_ability), err, TAG, "change pause ability failed");
99+
}
100+
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_LINK, (void *)link), err, TAG, "change link failed");
101+
jl1101->phy_802_3.link_status = link;
102+
}
103+
return ESP_OK;
104+
err:
105+
return ret;
106+
}
107+
108+
static esp_err_t jl1101_get_link(esp_eth_phy_t *phy)
109+
{
110+
esp_err_t ret = ESP_OK;
111+
phy_jl1101_t *jl1101 = __containerof(esp_eth_phy_into_phy_802_3(phy), phy_jl1101_t, phy_802_3);
112+
/* Updata information about link, speed, duplex */
113+
ESP_GOTO_ON_ERROR(jl1101_update_link_duplex_speed(jl1101), err, TAG, "update link duplex speed failed");
114+
return ESP_OK;
115+
err:
116+
return ret;
117+
}
118+
119+
static esp_err_t jl1101_autonego_ctrl(esp_eth_phy_t *phy, eth_phy_autoneg_cmd_t cmd, bool *autonego_en_stat)
120+
{
121+
esp_err_t ret = ESP_OK;
122+
phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy);
123+
esp_eth_mediator_t *eth = phy_802_3->eth;
124+
if (cmd == ESP_ETH_PHY_AUTONEGO_EN) {
125+
bmcr_reg_t bmcr;
126+
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, phy_802_3->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
127+
ESP_GOTO_ON_FALSE(bmcr.en_loopback == 0, ESP_ERR_INVALID_STATE, err, TAG, "Autonegotiation can't be enabled while in loopback operation");
128+
}
129+
return esp_eth_phy_802_3_autonego_ctrl(phy_802_3, cmd, autonego_en_stat);
130+
err:
131+
return ret;
132+
}
133+
134+
static esp_err_t jl1101_loopback(esp_eth_phy_t *phy, bool enable)
135+
{
136+
esp_err_t ret = ESP_OK;
137+
phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy);
138+
bool auto_nego_en;
139+
ESP_GOTO_ON_ERROR(jl1101_autonego_ctrl(phy, ESP_ETH_PHY_AUTONEGO_G_STAT, &auto_nego_en), err, TAG, "get status of autonegotiation failed");
140+
ESP_GOTO_ON_FALSE(!(auto_nego_en && enable), ESP_ERR_INVALID_STATE, err, TAG, "Unable to set loopback while autonegotiation is enabled. Disable it to use loopback");
141+
return esp_eth_phy_802_3_loopback(phy_802_3, enable);
142+
err:
143+
return ret;
144+
}
145+
146+
static esp_err_t jl1101_init(esp_eth_phy_t *phy)
147+
{
148+
esp_err_t ret = ESP_OK;
149+
phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy);
150+
151+
/* Basic PHY init */
152+
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_basic_phy_init(phy_802_3), err, TAG, "failed to init PHY");
153+
154+
/* Check PHY ID */
155+
uint32_t oui;
156+
uint8_t model;
157+
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_oui(phy_802_3, &oui), err, TAG, "read OUI failed");
158+
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_manufac_info(phy_802_3, &model, NULL), err, TAG, "read manufacturer's info failed");
159+
ESP_GOTO_ON_FALSE(oui == 0x24DF10 && model == 0x2, ESP_FAIL, err, TAG, "wrong chip ID");
160+
161+
return ESP_OK;
162+
err:
163+
return ret;
164+
}
165+
166+
esp_eth_phy_t *esp_eth_phy_new_jl1101(const eth_phy_config_t *config)
167+
{
168+
esp_eth_phy_t *ret = NULL;
169+
phy_jl1101_t *jl1101 = calloc(1, sizeof(phy_jl1101_t));
170+
ESP_GOTO_ON_FALSE(jl1101, NULL, err, TAG, "calloc jl1101 failed");
171+
ESP_GOTO_ON_FALSE(esp_eth_phy_802_3_obj_config_init(&jl1101->phy_802_3, config) == ESP_OK,
172+
NULL, err, TAG, "configuration initialization of PHY 802.3 failed");
173+
174+
// redefine functions which need to be customized for sake of jl1101
175+
jl1101->phy_802_3.parent.init = jl1101_init;
176+
jl1101->phy_802_3.parent.get_link = jl1101_get_link;
177+
jl1101->phy_802_3.parent.autonego_ctrl = jl1101_autonego_ctrl;
178+
jl1101->phy_802_3.parent.loopback = jl1101_loopback;
179+
180+
return &jl1101->phy_802_3.parent;
181+
err:
182+
if (jl1101 != NULL) {
183+
free(jl1101);
184+
}
185+
return ret;
186+
}

components/esp_hw_support/mac_addr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ static esp_err_t get_efuse_factory_mac(uint8_t *mac)
287287
uint32_t mac_low = ((uint32_t)mac[2] << 24) | ((uint32_t)mac[3] << 16) | ((uint32_t)mac[4] << 8) | mac[5];
288288
if (((mac_high & 0xFFFF) == 0x18fe) && (mac_low >= 0x346a85c7) && (mac_low <= 0x346a85f8)) {
289289
return ESP_OK;
290+
} else if (esp_efuse_get_pkg_ver() == 3) {
291+
return ESP_OK; // override for Xiaomi SOC's and maybe others too
290292
} else {
291293
ESP_LOGE(TAG, "Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc);
292294
#ifdef CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR

components/esp_psram/esp32/esp_psram_impl_quad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ esp_err_t IRAM_ATTR esp_psram_impl_enable(void) //psram init
903903
psram_io.psram_cs_io = D0WDR2_V3_PSRAM_CS_IO;
904904
} else {
905905
ESP_EARLY_LOGE(TAG, "Not a valid or known package id: %" PRIu32, pkg_ver);
906-
abort();
906+
return ESP_FAIL;
907907
}
908908
s_psram_cs_io = psram_io.psram_cs_io;
909909

components/newlib/realpath.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -9,6 +9,7 @@
99
#include <string.h>
1010
#include <stdlib.h>
1111
#include <assert.h>
12+
#include <dirent.h>
1213
#include <sys/param.h>
1314

1415
/* realpath logic:
@@ -122,3 +123,20 @@ int chdir(const char *path)
122123
errno = ENOSYS;
123124
return -1;
124125
}
126+
127+
/* std::filesystem functions call chmod and exit with an exception if it fails,
128+
* so not failing with ENOSYS seems a better solution.
129+
*/
130+
int chmod(const char *path, mode_t mode)
131+
{
132+
return 0;
133+
}
134+
135+
/* As a workaround for libstdc++ being built with _GLIBCXX_HAVE_DIRFD,
136+
* we have to provide at least a stub for dirfd function.
137+
*/
138+
int dirfd(DIR *dirp)
139+
{
140+
errno = ENOSYS;
141+
return -1;
142+
}

0 commit comments

Comments
 (0)