upgrade to IDF v6.0.1

This commit is contained in:
Ricardo (XenGi) Band 2026-05-30 18:42:03 +02:00
commit d626619c20
No known key found for this signature in database
13 changed files with 1298 additions and 326 deletions

94
.gitignore vendored
View file

@ -1,5 +1,93 @@
# Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,direnv
# Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv,clion+all
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,direnv,clion+all
### CLion+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### CLion+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### direnv ###
.direnv
@ -78,4 +166,4 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv
# End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv,clion+all

1
firmware/.gitignore vendored
View file

@ -1,4 +1,5 @@
build/
managed_components/
# Created by https://www.toptal.com/developers/gitignore/api/cmake,c++
# Edit at https://www.toptal.com/developers/gitignore?templates=cmake,c++

View file

@ -3,4 +3,6 @@
cmake_minimum_required(VERSION 3.22)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
#idf_build_set_property(MINIMAL_BUILD ON)
project(inet_mon)

12
firmware/README.md Normal file
View file

@ -0,0 +1,12 @@
# GPIOs
| ESP32-S3 | W5500 |
| ------- |-------|
| GPIO12 | SCLK |
| GPIO11 | MOSI |
| GPIO13 | MISO |
| GPIO10 | SCS |
| GPIO09 | RST |
| GPIO14 | INT |
| 3V3 | 3V3 |
| GND | GND |

View file

@ -0,0 +1,21 @@
dependencies:
espressif/w5500:
component_hash: e6e47022a1f509d1d1197652a554aea84a8cd4d99161061e187ecf4b78a7f6ca
dependencies:
- name: idf
require: private
version: '>=6.0'
source:
registry_url: https://components.espressif.com/
type: service
version: 1.0.1
idf:
source:
type: idf
version: 6.0.1
direct_dependencies:
- espressif/w5500
- idf
manifest_hash: c4bad2fb618779164783fe779b8924d7a6d94e582838878b2cc5d584eab2d703
target: esp32s3
version: 3.0.0

View file

@ -1,2 +1,11 @@
idf_component_register(SRCS "inet_mon.c"
INCLUDE_DIRS ".")
idf_component_register(
SRCS "inet_mon_main.cpp"
PRIV_REQUIRES spi_flash
REQUIRES
esp_event
esp_netif
esp_eth
driver
nvs_flash
INCLUDE_DIRS ""
)

View file

@ -0,0 +1,17 @@
## IDF Component Manager Manifest File
dependencies:
## Required IDF version
idf:
version: '>=5.5.4'
# # Put list of dependencies here
# # For components maintained by Espressif:
# component: "~1.0.0"
# # For 3rd party components:
# username/component: ">=1.0.0,<2.0.0"
# username2/component2:
# version: "~1.0.0"
# # For transient dependencies `public` flag can be set.
# # `public` flag doesn't have an effect dependencies of the `main` component.
# # All dependencies of `main` are public by default.
# public: true
espressif/w5500: ^1.0.1

View file

@ -1,6 +0,0 @@
#include <stdio.h>
void app_main(void)
{
}

View file

@ -0,0 +1,226 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include "esp_log.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "nvs_flash.h"
#include "driver/spi_master.h"
#include "esp_eth.h"
#include "esp_eth_mac.h"
#include "esp_eth_phy.h"
#include "esp_eth_com.h"
#include "esp_eth_mac_w5500.h"
#include "esp_eth_phy_w5500.h"
static const char *TAG = "INETMON";
// -------------------- PIN CONFIG --------------------
#define PIN_SCK 12
#define PIN_MOSI 11
#define PIN_MISO 13
#define PIN_CS 10
#define PIN_RST 9
#define PIN_INT 14
static esp_eth_handle_t eth_handle = NULL;
// -------------------- EVENT HANDLER --------------------
static void eth_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
switch (event_id) {
case ETHERNET_EVENT_CONNECTED:
ESP_LOGI(TAG, "Ethernet LINK UP");
break;
case ETHERNET_EVENT_DISCONNECTED:
ESP_LOGI(TAG, "Ethernet LINK DOWN");
break;
case ETHERNET_EVENT_START:
ESP_LOGI(TAG, "Ethernet START");
break;
case ETHERNET_EVENT_STOP:
ESP_LOGI(TAG, "Ethernet STOP");
break;
default:
break;
}
}
static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data)
{
ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data;
ESP_LOGI(
TAG,
"IP: " IPSTR " GW: " IPSTR " MASK: " IPSTR,
IP2STR(&event->ip_info.ip),
IP2STR(&event->ip_info.gw),
IP2STR(&event->ip_info.netmask)
);
}
extern "C" void app_main(void)
{
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
uint32_t flash_size;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
(chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : ""
);
unsigned major_rev = chip_info.revision / 100;
unsigned minor_rev = chip_info.revision % 100;
printf("silicon revision v%d.%d, ", major_rev, minor_rev);
if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
printf("Get flash size failed");
return;
}
printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
fflush(stdout);
ESP_LOGI(TAG, "Starting W5500 Ethernet...");
// NVS + event loop
ESP_ERROR_CHECK(nvs_flash_init());
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &eth_event_handler, NULL);
esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL);
// ---------------- SPI BUS ----------------
spi_bus_config_t buscfg = {};
buscfg.mosi_io_num = PIN_MOSI;
buscfg.miso_io_num = PIN_MISO;
buscfg.sclk_io_num = PIN_SCK;
buscfg.quadwp_io_num = -1;
buscfg.quadhd_io_num = -1;
buscfg.data4_io_num = -1;
buscfg.data5_io_num = -1;
buscfg.data6_io_num = -1;
buscfg.data7_io_num = -1;
buscfg.max_transfer_sz = 0;
buscfg.flags = 0;
buscfg.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO;
buscfg.intr_flags = 0;
ESP_ERROR_CHECK(
spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)
);
// ---------------- SPI DEVICE CONFIG ----------------
spi_device_interface_config_t spi_devcfg = {};
spi_devcfg.command_bits = 16;
spi_devcfg.address_bits = 8;
spi_devcfg.mode = 0;
spi_devcfg.clock_speed_hz = 5 * 1000 * 1000;
spi_devcfg.spics_io_num = PIN_CS;
spi_devcfg.queue_size = 20;
// ---------------- W5500 CONFIG ----------------
eth_w5500_config_t w5500_config =
ETH_W5500_DEFAULT_CONFIG(SPI2_HOST, &spi_devcfg);
w5500_config.int_gpio_num = PIN_INT;
// ---------------- MAC / PHY ----------------
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.reset_gpio_num = PIN_RST;
// ---------------- CREATE MAC + PHY ----------------
esp_eth_mac_t *mac =
esp_eth_mac_new_w5500(&w5500_config, &mac_config);
esp_eth_phy_t *phy =
esp_eth_phy_new_w5500(&phy_config);
esp_eth_config_t eth_config =
ETH_DEFAULT_CONFIG(mac, phy);
ESP_ERROR_CHECK(
esp_eth_driver_install(&eth_config, &eth_handle)
);
uint8_t mac_addr[6];
ESP_ERROR_CHECK(
esp_eth_ioctl(
eth_handle,
ETH_CMD_G_MAC_ADDR,
mac_addr
)
);
ESP_LOGI(
TAG,
"Ethernet MAC: %02X:%02X:%02X:%02X:%02X:%02X",
mac_addr[0],
mac_addr[1],
mac_addr[2],
mac_addr[3],
mac_addr[4],
mac_addr[5]
);
// ---------------- NETWORK INTERFACE ----------------
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
ESP_ERROR_CHECK(
esp_netif_attach(
eth_netif,
esp_eth_new_netif_glue(eth_handle)
)
);
// ---------------- START ETH ----------------
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
ESP_LOGI(TAG, "W5500 init complete, waiting for DHCP...");
while (true) {
vTaskDelay(pdMS_TO_TICKS(2000));
}
// printf("Restarting now.\n");
// esp_restart();
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

11
flake.lock generated
View file

@ -44,15 +44,16 @@
]
},
"locked": {
"lastModified": 1767865407,
"narHash": "sha256-QWF1rZYd+HvNzLIeRS+OEBX7HF0EhWCGeLbMkgtbsIo=",
"owner": "mirrexagon",
"lastModified": 1777553768,
"narHash": "sha256-2J1ZbfbLUGwpXfLpDTCEpiR4wZD1lVFWiup67DSJRuw=",
"owner": "dvdvgt",
"repo": "nixpkgs-esp-dev",
"rev": "5287d6e1ca9e15ebd5113c41b9590c468e1e001b",
"rev": "f9b1e211262a4cc9c1a265b227def56ef01c2d56",
"type": "github"
},
"original": {
"owner": "mirrexagon",
"owner": "dvdvgt",
"ref": "update-v6.0.1",
"repo": "nixpkgs-esp-dev",
"type": "github"
}

View file

@ -4,7 +4,8 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-esp-dev = {
url = "github:mirrexagon/nixpkgs-esp-dev";
#url = "github:mirrexagon/nixpkgs-esp-dev";
url = "github:dvdvgt/nixpkgs-esp-dev/update-v6.0.1";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";