mirror of
https://github.com/esphome/esphome.git
synced 2025-01-18 20:10:55 +00:00
[debug] Add ESP32 partition table logging to dump_config
(#8012)
This commit is contained in:
parent
aa1879082c
commit
fef50afef8
@ -50,6 +50,10 @@ void DebugComponent::dump_config() {
|
|||||||
this->reset_reason_->publish_state(get_reset_reason_());
|
this->reset_reason_->publish_state(get_reset_reason_());
|
||||||
}
|
}
|
||||||
#endif // USE_TEXT_SENSOR
|
#endif // USE_TEXT_SENSOR
|
||||||
|
|
||||||
|
#ifdef USE_ESP32
|
||||||
|
this->log_partition_info_(); // Log partition information for ESP32
|
||||||
|
#endif // USE_ESP32
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugComponent::loop() {
|
void DebugComponent::loop() {
|
||||||
|
@ -55,6 +55,20 @@ class DebugComponent : public PollingComponent {
|
|||||||
#endif // USE_ESP32
|
#endif // USE_ESP32
|
||||||
#endif // USE_SENSOR
|
#endif // USE_SENSOR
|
||||||
|
|
||||||
|
#ifdef USE_ESP32
|
||||||
|
/**
|
||||||
|
* @brief Logs information about the device's partition table.
|
||||||
|
*
|
||||||
|
* This function iterates through the ESP32's partition table and logs details
|
||||||
|
* about each partition, including its name, type, subtype, starting address,
|
||||||
|
* and size. The information is useful for diagnosing issues related to flash
|
||||||
|
* memory or verifying the partition configuration dynamically at runtime.
|
||||||
|
*
|
||||||
|
* Only available when compiled for ESP32 platforms.
|
||||||
|
*/
|
||||||
|
void log_partition_info_();
|
||||||
|
#endif // USE_ESP32
|
||||||
|
|
||||||
#ifdef USE_TEXT_SENSOR
|
#ifdef USE_TEXT_SENSOR
|
||||||
text_sensor::TextSensor *device_info_{nullptr};
|
text_sensor::TextSensor *device_info_{nullptr};
|
||||||
text_sensor::TextSensor *reset_reason_{nullptr};
|
text_sensor::TextSensor *reset_reason_{nullptr};
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <esp_heap_caps.h>
|
#include <esp_heap_caps.h>
|
||||||
#include <esp_system.h>
|
#include <esp_system.h>
|
||||||
#include <esp_chip_info.h>
|
#include <esp_chip_info.h>
|
||||||
|
#include <esp_partition.h>
|
||||||
|
|
||||||
#if defined(USE_ESP32_VARIANT_ESP32)
|
#if defined(USE_ESP32_VARIANT_ESP32)
|
||||||
#include <esp32/rom/rtc.h>
|
#include <esp32/rom/rtc.h>
|
||||||
@ -28,6 +29,19 @@ namespace debug {
|
|||||||
|
|
||||||
static const char *const TAG = "debug";
|
static const char *const TAG = "debug";
|
||||||
|
|
||||||
|
void DebugComponent::log_partition_info_() {
|
||||||
|
ESP_LOGCONFIG(TAG, "Partition table:");
|
||||||
|
ESP_LOGCONFIG(TAG, " %-12s %-4s %-8s %-10s %-10s", "Name", "Type", "Subtype", "Address", "Size");
|
||||||
|
esp_partition_iterator_t it = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||||
|
while (it != NULL) {
|
||||||
|
const esp_partition_t *partition = esp_partition_get(it);
|
||||||
|
ESP_LOGCONFIG(TAG, " %-12s %-4d %-8d 0x%08X 0x%08X", partition->label, partition->type, partition->subtype,
|
||||||
|
partition->address, partition->size);
|
||||||
|
it = esp_partition_next(it);
|
||||||
|
}
|
||||||
|
esp_partition_iterator_release(it);
|
||||||
|
}
|
||||||
|
|
||||||
std::string DebugComponent::get_reset_reason_() {
|
std::string DebugComponent::get_reset_reason_() {
|
||||||
std::string reset_reason;
|
std::string reset_reason;
|
||||||
switch (esp_reset_reason()) {
|
switch (esp_reset_reason()) {
|
||||||
|
1
tests/components/debug/test.esp32-s2-ard.yaml
Normal file
1
tests/components/debug/test.esp32-s2-ard.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<<: !include common.yaml
|
1
tests/components/debug/test.esp32-s2-idf.yaml
Normal file
1
tests/components/debug/test.esp32-s2-idf.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<<: !include common.yaml
|
1
tests/components/debug/test.esp32-s3-ard.yaml
Normal file
1
tests/components/debug/test.esp32-s3-ard.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<<: !include common.yaml
|
1
tests/components/debug/test.esp32-s3-idf.yaml
Normal file
1
tests/components/debug/test.esp32-s3-idf.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<<: !include common.yaml
|
Loading…
x
Reference in New Issue
Block a user