From 800fbbd949637c246b5c248ffcb38ae119e48a90 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 15:45:46 +0200 Subject: [PATCH 1/9] feature: relinker for Arduino --- ARDUINO_RELINKER_INTEGRATION.md | 406 ++++++++++++++++++ builder/frameworks/arduino.py | 7 + builder/frameworks/arduino_relinker.py | 331 ++++++++++++++ builder/frameworks/component_manager.py | 40 ++ builder/relinker/examples/arduino/README.md | 131 ++++++ .../examples/arduino/esp32/function.csv | 32 ++ .../examples/arduino/esp32/library.csv | 13 + .../examples/arduino/esp32/object.csv | 15 + .../examples/arduino/esp32c2/function.csv | 22 + .../examples/arduino/esp32c2/library.csv | 11 + .../examples/arduino/esp32c2/object.csv | 12 + .../examples/arduino/esp32c3/function.csv | 22 + .../examples/arduino/esp32c3/library.csv | 12 + .../examples/arduino/esp32c3/object.csv | 12 + .../examples/arduino/esp32c6/function.csv | 22 + .../examples/arduino/esp32c6/library.csv | 12 + .../examples/arduino/esp32c6/object.csv | 12 + .../examples/arduino/esp32h2/function.csv | 22 + .../examples/arduino/esp32h2/library.csv | 12 + .../examples/arduino/esp32h2/object.csv | 12 + .../examples/arduino/esp32s2/function.csv | 22 + .../examples/arduino/esp32s2/library.csv | 12 + .../examples/arduino/esp32s2/object.csv | 12 + .../examples/arduino/esp32s3/function.csv | 22 + .../examples/arduino/esp32s3/library.csv | 12 + .../examples/arduino/esp32s3/object.csv | 12 + builder/relinker/examples/esp32/README.md | 118 +++++ builder/relinker/examples/esp32/function.csv | 336 +++++++++++++++ builder/relinker/examples/esp32/library.csv | 24 ++ builder/relinker/examples/esp32/object.csv | 63 +++ builder/relinker/examples/esp32c3/README.md | 83 ++++ .../relinker/examples/esp32c3/function.csv | 365 ++++++++++++++++ builder/relinker/examples/esp32c3/library.csv | 24 ++ builder/relinker/examples/esp32c3/object.csv | 66 +++ builder/relinker/examples/esp32c6/README.md | 112 +++++ .../relinker/examples/esp32c6/function.csv | 365 ++++++++++++++++ builder/relinker/examples/esp32c6/library.csv | 24 ++ builder/relinker/examples/esp32c6/object.csv | 66 +++ builder/relinker/examples/esp32h2/README.md | 106 +++++ .../relinker/examples/esp32h2/function.csv | 337 +++++++++++++++ builder/relinker/examples/esp32h2/library.csv | 22 + builder/relinker/examples/esp32h2/object.csv | 65 +++ builder/relinker/examples/esp32s2/README.md | 112 +++++ .../relinker/examples/esp32s2/function.csv | 282 ++++++++++++ builder/relinker/examples/esp32s2/library.csv | 22 + builder/relinker/examples/esp32s2/object.csv | 62 +++ examples/arduino-relinker-esp32c2/README.md | 177 ++++++++ .../arduino-relinker-esp32c2/platformio.ini | 15 + .../arduino-relinker-esp32c2/src/main.cpp | 114 +++++ 49 files changed, 4210 insertions(+) create mode 100644 ARDUINO_RELINKER_INTEGRATION.md create mode 100644 builder/frameworks/arduino_relinker.py create mode 100644 builder/relinker/examples/arduino/README.md create mode 100644 builder/relinker/examples/arduino/esp32/function.csv create mode 100644 builder/relinker/examples/arduino/esp32/library.csv create mode 100644 builder/relinker/examples/arduino/esp32/object.csv create mode 100644 builder/relinker/examples/arduino/esp32c2/function.csv create mode 100644 builder/relinker/examples/arduino/esp32c2/library.csv create mode 100644 builder/relinker/examples/arduino/esp32c2/object.csv create mode 100644 builder/relinker/examples/arduino/esp32c3/function.csv create mode 100644 builder/relinker/examples/arduino/esp32c3/library.csv create mode 100644 builder/relinker/examples/arduino/esp32c3/object.csv create mode 100644 builder/relinker/examples/arduino/esp32c6/function.csv create mode 100644 builder/relinker/examples/arduino/esp32c6/library.csv create mode 100644 builder/relinker/examples/arduino/esp32c6/object.csv create mode 100644 builder/relinker/examples/arduino/esp32h2/function.csv create mode 100644 builder/relinker/examples/arduino/esp32h2/library.csv create mode 100644 builder/relinker/examples/arduino/esp32h2/object.csv create mode 100644 builder/relinker/examples/arduino/esp32s2/function.csv create mode 100644 builder/relinker/examples/arduino/esp32s2/library.csv create mode 100644 builder/relinker/examples/arduino/esp32s2/object.csv create mode 100644 builder/relinker/examples/arduino/esp32s3/function.csv create mode 100644 builder/relinker/examples/arduino/esp32s3/library.csv create mode 100644 builder/relinker/examples/arduino/esp32s3/object.csv create mode 100644 builder/relinker/examples/esp32/README.md create mode 100644 builder/relinker/examples/esp32/function.csv create mode 100644 builder/relinker/examples/esp32/library.csv create mode 100644 builder/relinker/examples/esp32/object.csv create mode 100644 builder/relinker/examples/esp32c3/README.md create mode 100644 builder/relinker/examples/esp32c3/function.csv create mode 100644 builder/relinker/examples/esp32c3/library.csv create mode 100644 builder/relinker/examples/esp32c3/object.csv create mode 100644 builder/relinker/examples/esp32c6/README.md create mode 100644 builder/relinker/examples/esp32c6/function.csv create mode 100644 builder/relinker/examples/esp32c6/library.csv create mode 100644 builder/relinker/examples/esp32c6/object.csv create mode 100644 builder/relinker/examples/esp32h2/README.md create mode 100644 builder/relinker/examples/esp32h2/function.csv create mode 100644 builder/relinker/examples/esp32h2/library.csv create mode 100644 builder/relinker/examples/esp32h2/object.csv create mode 100644 builder/relinker/examples/esp32s2/README.md create mode 100644 builder/relinker/examples/esp32s2/function.csv create mode 100644 builder/relinker/examples/esp32s2/library.csv create mode 100644 builder/relinker/examples/esp32s2/object.csv create mode 100644 examples/arduino-relinker-esp32c2/README.md create mode 100644 examples/arduino-relinker-esp32c2/platformio.ini create mode 100644 examples/arduino-relinker-esp32c2/src/main.cpp diff --git a/ARDUINO_RELINKER_INTEGRATION.md b/ARDUINO_RELINKER_INTEGRATION.md new file mode 100644 index 000000000..06e6a3b9c --- /dev/null +++ b/ARDUINO_RELINKER_INTEGRATION.md @@ -0,0 +1,406 @@ +# Arduino Framework Relinker Integration + +## Overview + +The relinker is now available for the Arduino framework on ESP32 chips. This integration allows moving functions from IRAM to Flash, freeing up valuable IRAM memory - especially important for memory-constrained chips like the ESP32-C2. + +## Differences from ESP-IDF Integration + +The Arduino framework integration differs in several important ways from the ESP-IDF integration: + +### ESP-IDF Framework +- Generates `sections.ld` during build with `ldgen` +- Uses CMake build system +- Full access to source code and build configuration +- Relinker modifies the generated `sections.ld` before linking + +### Arduino Framework +- Uses pre-compiled libraries from `framework-arduinoespressif32-libs` +- Static `sections.ld` file in framework directory +- No `ldgen` during build +- Relinker copies and modifies the static `sections.ld` in build directory + +## Quick Start + +### 1. Identify Chip Variant + +Determine your ESP32 chip variant: +- `esp32` - Original ESP32 (Xtensa LX6 dual-core) +- `esp32c2` - ESP32-C2 (RISC-V, 32KB IRAM) +- `esp32c3` - ESP32-C3 (RISC-V single-core) +- `esp32c6` - ESP32-C6 (RISC-V mit WiFi 6) +- `esp32h2` - ESP32-H2 (RISC-V, Zigbee/Thread) +- `esp32s2` - ESP32-S2 (Xtensa LX7 single-core) +- `esp32s3` - ESP32-S3 (Xtensa LX7 dual-core) + +### 2. Configure platformio.ini + +Add the relinker configuration to your `platformio.ini`: + +```ini +[env:myboard] +platform = espressif32 +board = esp32-c2-devkitm-1 +framework = arduino + +; Relinker configuration for ESP32-C2 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/function.csv + +; Optional: Warnings instead of errors for missing functions +; custom_relinker_missing_function_info = yes +``` + +Replace `esp32c2` with your chip variant. + +### 3. Build + +```bash +pio run -e myboard +``` + +Während des Builds sehen Sie: + +```text +*** Arduino Relinker configured for esp32c2 *** +Running relinker to optimize IRAM usage +``` + +## Available Chip Configurations + +Pre-configured examples are available for: + +| Chip | Path | Description | +|------|------|-------------| +| ESP32 | `builder/relinker/examples/arduino/esp32/` | Original ESP32, Xtensa dual-core | +| ESP32-C2 | `builder/relinker/examples/arduino/esp32c2/` | RISC-V, 32KB IRAM | +| ESP32-C3 | `builder/relinker/examples/arduino/esp32c3/` | RISC-V single-core | +| ESP32-C6 | `builder/relinker/examples/arduino/esp32c6/` | RISC-V with WiFi 6 | +| ESP32-H2 | `builder/relinker/examples/arduino/esp32h2/` | RISC-V, Zigbee/Thread | +| ESP32-S2 | `builder/relinker/examples/arduino/esp32s2/` | Xtensa single-core | +| ESP32-S3 | `builder/relinker/examples/arduino/esp32s3/` | Xtensa dual-core | + +## Creating Custom Configuration + +### 1. Copy Example Configuration + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino/esp32c2/*.csv relinker/ +``` + +### 2. Update platformio.ini + +```ini +[env:myboard] +platform = espressif32 +board = esp32-c2-devkitm-1 +framework = arduino + +; Local relinker configuration +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +### 3. Customize CSV Files + +#### library.csv + +Defines libraries and their paths: + +```csv +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +``` + +The `$ARDUINO_LIBS_DIR` variable is automatically expanded to the correct path: +``` +~/.platformio/packages/framework-arduinoespressif32-libs//lib/ +``` + +#### object.csv + +Defines object files within libraries: + +```csv +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +``` + +For Arduino, all paths point to the `.a` archive file since object files are contained within. + +#### function.csv + +Defines functions to be moved from IRAM to Flash: + +```csv +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +``` + +The `option` column can be empty or contain conditions: +- Empty: Function is always moved +- `CONFIG_XYZ`: Only move if CONFIG_XYZ is defined +- `!CONFIG_XYZ`: Only move if CONFIG_XYZ is NOT defined +- `FALSE`: Function is NEVER moved (stays in IRAM) + +## Selecting Functions + +### Functions That MUST Stay in IRAM + +These functions must NOT be moved to Flash: + +- ISRs and functions called from ISRs +- SPI Flash operations (`spi_flash_*`) +- Functions that run before Flash cache initialization +- FreeRTOS scheduler-critical functions +- Cache error handlers +- RTC/Sleep functions +- Functions with `IRAM_ATTR` attribute in source code + +### Functions That CAN Be Moved to Flash + +- Initialization functions (called once at startup) +- Logging functions (unless used in ISR context) +- Memory management (if not used in ISR) +- Non-critical library functions +- Configuration/setup routines + +### Identifying Candidates + +1. **Check Memory Map**: After build, examine `.pio/build//firmware.map` file + +2. **Use objdump**: + ```bash + # For RISC-V Chips (C2, C3, C6, H2) + riscv32-esp-elf-objdump -h ~/.platformio/packages/framework-arduinoespressif32-libs/esp32c2/lib/libfreertos.a + + # For Xtensa Chips (ESP32, S2, S3) + xtensa-esp32-elf-objdump -h ~/.platformio/packages/framework-arduinoespressif32-libs/esp32/lib/libfreertos.a + ``` + +3. **Use Example Configurations**: The included examples contain already validated functions + +## Configuration Options + +| Option | Required | Description | +|--------|----------|-------------| +| `custom_relinker_library` | Yes | Path to library.csv file | +| `custom_relinker_object` | Yes | Path to object.csv file | +| `custom_relinker_function` | Yes | Path to function.csv file | +| `custom_relinker_missing_function_info` | No | Warnings instead of errors for missing functions. Values: `yes`, `true`, `1` (enabled) or `no`, `false`, `0` (disabled, default) | + +**Important**: All three CSV options must be provided together. If only some are set, the build will fail with an error message. + +### When to Use `custom_relinker_missing_function_info` + +This option is useful when: +- Working with CSV files across different ESP-IDF versions +- Function names or locations may have changed +- Using a shared relinker configuration +- Developing/testing new configurations + +Beispiel: +```ini +custom_relinker_missing_function_info = yes +``` + +## Troubleshooting + +### Build Error: "sections.ld not found" + +The `sections.ld` file was not found in the Arduino framework. Check: +- Framework is correctly installed +- Chip variant is correct +- Path: `~/.platformio/packages/framework-arduinoespressif32/tools/esp32-arduino-libs//ld/sections.ld` + +### Build Error: "Library not found" + +The library path in `library.csv` is incorrect. Check: +```bash +ls ~/.platformio/packages/framework-arduinoespressif32-libs//lib/ +``` + +### Build Error: "Failed to get sections from lib" + +The library doesn't exist or the path is incorrect. Ensure `$ARDUINO_LIBS_DIR` is used correctly. + +### Build Error: "function failed to find section" + +The function doesn't exist in the specified object file. Check with: +```bash +# RISC-V +riscv32-esp-elf-objdump -t ~/.platformio/packages/framework-arduinoespressif32-libs/esp32c2/lib/libfreertos.a | grep xTaskGetTickCount + +# Xtensa +xtensa-esp32-elf-objdump -t ~/.platformio/packages/framework-arduinoespressif32-libs/esp32/lib/libfreertos.a | grep xTaskGetTickCount +``` + +### Runtime Crash (LoadProhibited / InstrFetchProhibited) + +A function was moved to Flash that gets called during Flash operations or from an ISR. Solution: +- Remove function from `function.csv`, or +- Set option to `FALSE` (stays in IRAM) + +### No IRAM Savings + +The listed functions may not be in IRAM. Check the original `sections.ld`: +```bash +cat ~/.platformio/packages/framework-arduinoespressif32/tools/esp32-arduino-libs//ld/sections.ld | grep -A 50 ".iram0.text" +``` + +### Relinker Not Running + +Verify that all three options are set: +```ini +custom_relinker_library = ... +custom_relinker_object = ... +custom_relinker_function = ... +``` + +## Advanced Usage + +### Wildcard Patterns + +For pre-compiled blob libraries, you can use wildcard patterns: + +```csv +library,object,function,option +libpp.a,pp.o,.text.*, +libpp.a,trc.o,.wifi0iram.*, +``` + +Available wildcards: +- `.text.*` - All text sections +- `.iram1.*` - All IRAM1 sections +- `.wifi0iram.*` - WiFi IRAM sections +- `.wifirxiram.*` - WiFi RX IRAM sections + +### Conditional Relocation + +Functions can be moved based on configuration options: + +```csv +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libheap.a,heap_caps.c.obj,heap_caps_malloc,!CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH +``` + +**Note**: Arduino doesn't use `sdkconfig`, so these options are treated as undefined by default. The relinker creates a minimal `sdkconfig` with Arduino default values. + +## Example Project + +Complete example for ESP32-C2: + +### Project Structure +``` +my_arduino_project/ +├── platformio.ini +├── src/ +│ └── main.cpp +└── relinker/ + ├── library.csv + ├── object.csv + └── function.csv +``` + +### platformio.ini +```ini +[env:esp32c2] +platform = espressif32 +board = esp32-c2-devkitm-1 +framework = arduino +monitor_speed = 115200 + +; Relinker: Move functions from IRAM to Flash +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +### src/main.cpp +```cpp +#include + +void setup() { + Serial.begin(115200); + Serial.println("Arduino Relinker Test"); + Serial.printf("Free IRAM: %d bytes\n", ESP.getFreeHeap()); +} + +void loop() { + delay(1000); +} +``` + +## Technical Details + +### How It Works + +1. **Build Start**: Arduino build system starts +2. **Relinker Detection**: `arduino_relinker.py` checks for relinker configuration +3. **Copy sections.ld**: Original `sections.ld` is copied to build directory +4. **CSV Processing**: `$ARDUINO_LIBS_DIR` is expanded to actual path +5. **Run Relinker**: `relinker.py` modifies the `sections.ld` +6. **Linking**: Modified `sections.ld` is used for linking + +### Path Expansion + +The `$ARDUINO_LIBS_DIR` variable is expanded to: +``` +~/.platformio/packages/framework-arduinoespressif32-libs//lib/ +``` + +Example for ESP32-C2: +``` +/Users/username/.platformio/packages/framework-arduinoespressif32-libs/esp32c2/lib/ +``` + +### Minimal sdkconfig + +Since Arduino doesn't use `sdkconfig`, the relinker creates a minimal version with: +- `CONFIG_FREERTOS_UNICORE` (chip-dependent) +- `CONFIG_FREERTOS_HZ=1000` +- `CONFIG_IDF_TARGET_=y` +- Additional Arduino default values + +## Comparison: ESP-IDF vs Arduino + +| Aspect | ESP-IDF | Arduino | +|--------|---------|---------| +| Linker Script | Generated with ldgen | Statically pre-compiled | +| Libraries | Source code available | Pre-compiled | +| Build System | CMake | PlatformIO/Arduino | +| sdkconfig | Complete | Minimal (generated) | +| Customizability | High | Medium | +| Simplicity | Medium | High | + +## Best Practices + +1. **Start Small**: Begin with example configurations +2. **Test Incrementally**: Move a few functions at a time +3. **Test Thoroughly**: Test all functionality, especially: + - WiFi operations + - Bluetooth operations + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles +4. **Check Memory Map**: Review IRAM savings in the `.map` file +5. **Document**: Note which functions you moved and why + +## References + +- [RELINKER_INTEGRATION.md](RELINKER_INTEGRATION.md) - Complete relinker documentation +- [Arduino ESP32 Documentation](https://docs.espressif.com/projects/arduino-esp32/) +- [ESP-IDF Documentation](https://docs.espressif.com/projects/esp-idf/) +- [Espressif cmake_utilities](https://github.com/espressif/cmake_utilities) - Original relinker + +## Credits + +The relinker was originally developed by Espressif Systems as part of the [cmake_utilities](https://github.com/espressif/cmake_utilities) project and has been adapted for seamless integration with PlatformIO and the Arduino framework. diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index df2964d69..56b1bfbdb 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -469,6 +469,13 @@ def get_frameworks_in_current_env(): pioframework = env.subst("$PIOFRAMEWORK") arduino_lib_compile_flag = env.subst("$ARDUINO_LIB_COMPILE_FLAG") +# Setup Arduino relinker if configured (must run before build script) +if "arduino" in pioframework and "espidf" not in pioframework: + # Check if relinker is configured before importing (only need to check one option) + if config.get(current_env_section, "custom_relinker_function", ""): + from arduino_relinker import setup_arduino_relinker + setup_arduino_relinker(env, platform, mcu, chip_variant) + if ("arduino" in pioframework and "espidf" not in pioframework and arduino_lib_compile_flag in ("Inactive", "True")): diff --git a/builder/frameworks/arduino_relinker.py b/builder/frameworks/arduino_relinker.py new file mode 100644 index 000000000..38116184e --- /dev/null +++ b/builder/frameworks/arduino_relinker.py @@ -0,0 +1,331 @@ +""" +Arduino Framework Relinker Integration + +This module provides relinker support for the Arduino framework on ESP32. +Unlike ESP-IDF which generates sections.ld during build, Arduino uses +pre-compiled libraries with a static sections.ld file. +""" + +import os +import sys +import shutil +from pathlib import Path +from SCons.Script import DefaultEnvironment + + +def setup_arduino_relinker(env, platform, mcu, chip_variant): + """ + Setup relinker for Arduino framework builds. + + Args: + env: SCons environment + platform: PlatformIO platform object + mcu: MCU type (esp32, esp32c2, etc.) + chip_variant: Chip variant name + + Returns: + True if relinker was configured, False otherwise + """ + config = env.GetProjectConfig() + pioenv = env["PIOENV"] + project_dir = env.subst("$PROJECT_DIR") + build_dir = env.subst("$BUILD_DIR") + + # Get relinker configuration from platformio.ini + relinker_function = config.get("env:" + pioenv, "custom_relinker_function", "") + relinker_library = config.get("env:" + pioenv, "custom_relinker_library", "") + relinker_object = config.get("env:" + pioenv, "custom_relinker_object", "") + + # Validate that all three relinker settings are provided together + relinker_settings = { + "custom_relinker_function": relinker_function, + "custom_relinker_library": relinker_library, + "custom_relinker_object": relinker_object, + } + relinker_set = [key for key, value in relinker_settings.items() if value] + relinker_missing = [key for key, value in relinker_settings.items() if not value] + + if relinker_set and relinker_missing: + # Some but not all settings are provided - this is an error + sys.stderr.write( + "Error: Incomplete relinker configuration in [env:%s]\n" + "All three custom_relinker_* settings must be provided together:\n" + " - Set: %s\n" + " - Missing: %s\n" + "Either provide all three settings or remove all of them.\n" + % (pioenv, ", ".join(relinker_set), ", ".join(relinker_missing)) + ) + env.Exit(1) + + if not (relinker_function and relinker_library and relinker_object): + # Relinker not configured + return False + + print(f"*** Configuring Arduino Relinker for {chip_variant} ***") + + # Get Arduino framework paths + framework_dir = platform.get_package_dir("framework-arduinoespressif32") + framework_lib_dir = platform.get_package_dir("framework-arduinoespressif32-libs") + + if not framework_dir or not framework_lib_dir: + sys.stderr.write("Error: Arduino framework packages not found\n") + env.Exit(1) + + # Path to the original sections.ld in Arduino framework + arduino_libs_dir = str(Path(framework_dir) / "tools" / "esp32-arduino-libs" / chip_variant) + original_sections_ld = str(Path(arduino_libs_dir) / "ld" / "sections.ld") + + # Recover from interrupted previous builds - restore stale backup if exists + backup_path = f"{original_sections_ld}.{mcu}.backup" + if os.path.exists(backup_path): + print(f"Restoring sections.ld from previous interrupted build...") + shutil.copy2(backup_path, original_sections_ld) + os.remove(backup_path) + + if not os.path.exists(original_sections_ld): + sys.stderr.write( + f"Error: sections.ld not found at {original_sections_ld}\n" + f"Chip variant: {chip_variant}\n" + ) + env.Exit(1) + + # Copy original sections.ld to build directory + build_sections_ld = str(Path(build_dir) / "sections.ld") + os.makedirs(build_dir, exist_ok=True) + shutil.copy2(original_sections_ld, build_sections_ld) + + # Normalize relinker CSV paths to absolute paths relative to PROJECT_DIR + _relinker_library = relinker_library if os.path.isabs(relinker_library) else str(Path(project_dir) / relinker_library) + _relinker_object = relinker_object if os.path.isabs(relinker_object) else str(Path(project_dir) / relinker_object) + _relinker_function = relinker_function if os.path.isabs(relinker_function) else str(Path(project_dir) / relinker_function) + + # Verify CSV files exist + for csv_file, csv_name in [ + (_relinker_library, "library"), + (_relinker_object, "object"), + (_relinker_function, "function") + ]: + if not os.path.exists(csv_file): + sys.stderr.write( + f"Error: Relinker {csv_name} CSV file not found: {csv_file}\n" + ) + env.Exit(1) + + # Process CSV files to expand $ARDUINO_LIBS_DIR variable + arduino_lib_path = str(Path(framework_lib_dir) / chip_variant / "lib") + _process_arduino_csv_files( + _relinker_library, + _relinker_object, + _relinker_function, + arduino_lib_path, + build_dir + ) + + # Update paths to processed CSV files + _relinker_library = str(Path(build_dir) / "relinker_library.csv") + _relinker_object = str(Path(build_dir) / "relinker_object.csv") + _relinker_function = str(Path(build_dir) / "relinker_function.csv") + + # Get relinker script and configuration + _relinker_dir = str(Path(platform.get_dir()) / "builder" / "relinker") + + # Get objdump tool via toolchain package directory (same pattern as espidf.py) + toolchain_dir = platform.get_package_dir( + "toolchain-xtensa-esp-elf" + if mcu in ("esp32", "esp32s2", "esp32s3") + else "toolchain-riscv32-esp" + ) + if toolchain_dir and os.path.isdir(toolchain_dir): + _relinker_objdump = str(Path(toolchain_dir) / "bin" / env.subst("$CC").replace("-gcc", "-objdump")) + else: + _relinker_objdump = env.subst("$CC").replace("-gcc", "-objdump") + + # Create a minimal sdkconfig for Arduino (Arduino doesn't use sdkconfig) + arduino_sdkconfig = str(Path(build_dir) / "sdkconfig.arduino") + _create_arduino_sdkconfig(arduino_sdkconfig, mcu) + + # Get missing function info setting + _relinker_missing_raw = config.get( + "env:" + pioenv, "custom_relinker_missing_function_info", "no" + ).strip().lower() + + # Validate the value + valid_true_values = ("yes", "true", "1") + valid_false_values = ("no", "false", "0") + if _relinker_missing_raw not in valid_true_values and _relinker_missing_raw not in valid_false_values: + sys.stderr.write( + f"Warning: Invalid value '{_relinker_missing_raw}' for custom_relinker_missing_function_info. " + f"Valid values are: {', '.join(valid_true_values + valid_false_values)}. " + f"Defaulting to 'no'.\n" + ) + _relinker_missing_raw = "no" + + _relinker_missing = _relinker_missing_raw in valid_true_values + + # Run relinker immediately (not as a build command) + # This ensures the modified sections.ld is ready before pioarduino-build.py runs + print("Running relinker to optimize IRAM usage...") + + try: + # Import and run relinker directly + sys.path.insert(0, _relinker_dir) + from relinker import run_relinker + + run_relinker( + input_file=build_sections_ld, + output_file=build_sections_ld, + library_file=_relinker_library, + object_file=_relinker_object, + function_file=_relinker_function, + sdkconfig_file=arduino_sdkconfig, + objdump=_relinker_objdump, + idf_path=None, # Not needed for Arduino + missing_function_info=_relinker_missing, + debug=False + ) + + print(f"Relinker completed successfully for {chip_variant}") + + # Now we need to make sure the Arduino build uses our modified sections.ld + # We do this by replacing the original sections.ld in the framework directory + # with our modified version (backup/restore is handled by component_manager) + + # Import component_manager to use its backup functionality + # Ensure frameworks directory is in path for component_manager import + _frameworks_dir = str(Path(__file__).parent) + if _frameworks_dir not in sys.path: + sys.path.insert(0, _frameworks_dir) + from component_manager import ComponentManager + component_manager = ComponentManager(env) + + # Create backup of the original sections.ld + component_manager.backup_manager.backup_sections_ld(original_sections_ld) + + # Replace the original with our modified version + shutil.copy2(build_sections_ld, original_sections_ld) + + print(f"Replaced sections.ld with relinked version for {chip_variant}") + + # Register restore action after build completes (same as pioarduino-build.py) + def restore_sections_ld_wrapper(target, source, env): + component_manager.backup_manager.restore_sections_ld(original_sections_ld, target, source, env) + + silent_action = env.Action(restore_sections_ld_wrapper) + silent_action.strfunction = lambda target, source, env: '' + env.AddPostAction("checkprogsize", silent_action) + + return True + + except Exception as e: + sys.stderr.write(f"Error running relinker: {e}\n") + import traceback + traceback.print_exc() + env.Exit(1) + + +def _process_arduino_csv_files(library_csv, object_csv, function_csv, arduino_lib_path, build_dir): + """ + Process CSV files to expand $ARDUINO_LIBS_DIR variable. + + Args: + library_csv: Path to library CSV file + object_csv: Path to object CSV file + function_csv: Path to function CSV file + arduino_lib_path: Path to Arduino libraries directory + build_dir: Build directory path + """ + import csv + + # Process library.csv + output_library_csv = str(Path(build_dir) / "relinker_library.csv") + with open(library_csv, 'r', encoding='utf-8') as infile, \ + open(output_library_csv, 'w', encoding='utf-8', newline='') as outfile: + reader = csv.DictReader(infile) + writer = csv.DictWriter(outfile, fieldnames=reader.fieldnames) + writer.writeheader() + for row in reader: + row['path'] = row['path'].replace('$ARDUINO_LIBS_DIR', arduino_lib_path) + writer.writerow(row) + + # Process object.csv + output_object_csv = str(Path(build_dir) / "relinker_object.csv") + with open(object_csv, 'r', encoding='utf-8') as infile, \ + open(output_object_csv, 'w', encoding='utf-8', newline='') as outfile: + reader = csv.DictReader(infile) + writer = csv.DictWriter(outfile, fieldnames=reader.fieldnames) + writer.writeheader() + for row in reader: + row['path'] = row['path'].replace('$ARDUINO_LIBS_DIR', arduino_lib_path) + writer.writerow(row) + + # Copy function.csv as-is (no path expansion needed) + output_function_csv = str(Path(build_dir) / "relinker_function.csv") + shutil.copy2(function_csv, output_function_csv) + + +def _create_arduino_sdkconfig(sdkconfig_path, mcu): + """ + Create a minimal sdkconfig file for Arduino framework. + + Arduino doesn't use sdkconfig, but the relinker needs it for + conditional function relocation. We create a minimal one with + common Arduino defaults. + + Args: + sdkconfig_path: Path where sdkconfig should be created + mcu: MCU type + """ + # Common Arduino configuration options + # Only emit keys with =y; the sdkconfig parser treats any present key as enabled, + # so =n entries must be omitted entirely (absence = disabled). + config_lines = [ + "# Minimal sdkconfig for Arduino framework", + "# Generated by PlatformIO relinker integration", + "", + "CONFIG_FREERTOS_HZ=1000", + "CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y", + "CONFIG_ESP_CONSOLE_UART_DEFAULT=y", + ] + + # Single-core MCUs need CONFIG_FREERTOS_UNICORE=y + # Dual-core MCUs (esp32, esp32s3) must NOT have the key at all + single_core_mcus = ("esp32s2", "esp32c2", "esp32c3", "esp32c6", "esp32h2") + + # MCU-specific options + if mcu == "esp32": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32=y", + ]) + elif mcu == "esp32s2": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32S2=y", + "CONFIG_FREERTOS_UNICORE=y", + ]) + elif mcu == "esp32s3": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32S3=y", + ]) + elif mcu == "esp32c2": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32C2=y", + "CONFIG_FREERTOS_UNICORE=y", + ]) + elif mcu == "esp32c3": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32C3=y", + "CONFIG_FREERTOS_UNICORE=y", + ]) + elif mcu == "esp32c6": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32C6=y", + "CONFIG_FREERTOS_UNICORE=y", + ]) + elif mcu == "esp32h2": + config_lines.extend([ + "CONFIG_IDF_TARGET_ESP32H2=y", + "CONFIG_FREERTOS_UNICORE=y", + ]) + + with open(sdkconfig_path, 'w', encoding='utf-8') as f: + f.write('\n'.join(config_lines)) + f.write('\n') diff --git a/builder/frameworks/component_manager.py b/builder/frameworks/component_manager.py index 9ab28fd91..c8e06d9c9 100644 --- a/builder/frameworks/component_manager.py +++ b/builder/frameworks/component_manager.py @@ -1162,6 +1162,26 @@ def backup_pioarduino_build_py(self) -> None: if os.path.exists(build_py_path) and not os.path.exists(backup_path): shutil.copy2(build_py_path, backup_path) + def backup_sections_ld(self, sections_ld_path: str) -> str: + """ + Create backup of the original sections.ld file for relinker. + + Creates a backup copy of the sections.ld linker script with + MCU-specific naming to prevent conflicts. Returns the backup path. + + Args: + sections_ld_path: Path to the original sections.ld file + + Returns: + Path to the backup file + """ + backup_path = f"{sections_ld_path}.{self.config.mcu}.backup" + + if os.path.exists(sections_ld_path) and not os.path.exists(backup_path): + shutil.copy2(sections_ld_path, backup_path) + + return backup_path + def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> None: """ Restore the original pioarduino-build.py from backup. @@ -1182,6 +1202,26 @@ def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> Non shutil.copy2(backup_path, build_py_path) os.remove(backup_path) + def restore_sections_ld(self, sections_ld_path: str, target=None, source=None, env=None) -> None: + """ + Restore the original sections.ld from backup after relinker. + + Restores the original linker script from the backup copy + and removes the backup file. This is called after the build + completes to restore the framework to its original state. + + Args: + sections_ld_path: Path to the sections.ld file to restore + target: Build target (unused, for PlatformIO compatibility) + source: Build source (unused, for PlatformIO compatibility) + env: Environment (unused, for PlatformIO compatibility) + """ + backup_path = f"{sections_ld_path}.{self.config.mcu}.backup" + + if os.path.exists(backup_path): + shutil.copy2(backup_path, sections_ld_path) + os.remove(backup_path) + class ComponentManager: """ diff --git a/builder/relinker/examples/arduino/README.md b/builder/relinker/examples/arduino/README.md new file mode 100644 index 000000000..e82fbd32a --- /dev/null +++ b/builder/relinker/examples/arduino/README.md @@ -0,0 +1,131 @@ +# Relinker Configuration for Arduino Framework + +This directory contains relinker configuration files for the Arduino framework on ESP32 chips. + +## Overview + +The Arduino framework for ESP32 uses pre-compiled libraries from the ESP-IDF. The relinker helps optimize IRAM usage by moving selected functions from IRAM to Flash, which is especially important for memory-constrained chips like the ESP32-C2. + +## Key Differences from ESP-IDF Framework + +When using Arduino framework, the relinker works differently: + +- **Pre-compiled libraries**: Arduino uses pre-built libraries from `framework-arduinoespressif32-libs` +- **Static sections.ld**: The linker script is located in `tools/esp32-arduino-libs//ld/sections.ld` +- **Build directory**: The relinker creates a modified copy in your project's build directory +- **No ldgen**: Arduino doesn't run ldgen during build, so the sections.ld is used as-is + +## Chip-Specific Configurations + +Each ESP32 chip variant has its own configuration directory: + +- `esp32/` - Original ESP32 (Xtensa LX6 dual-core) +- `esp32c2/` - ESP32-C2 (RISC-V, 32KB IRAM) +- `esp32c3/` - ESP32-C3 (RISC-V single-core) +- `esp32c6/` - ESP32-C6 (RISC-V with WiFi 6) +- `esp32h2/` - ESP32-H2 (RISC-V, Zigbee/Thread) +- `esp32s2/` - ESP32-S2 (Xtensa LX7 single-core) +- `esp32s3/` - ESP32-S3 (Xtensa LX7 dual-core) + +## Usage + +### Quick Start + +Add these lines to your `platformio.ini`: + +```ini +[env:myboard] +platform = espressif32 +board = esp32-c2-devkitm-1 +framework = arduino + +; Relinker configuration +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/function.csv +``` + +Replace `esp32c2` with your chip variant (esp32, esp32c3, esp32c6, esp32h2, esp32s2, esp32s3). + +### Custom Configuration + +To customize the configuration for your project: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino/esp32c2/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Files + +### library.csv + +Maps library names to their filesystem paths in the Arduino framework: + +```csv +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +``` + +The `$ARDUINO_LIBS_DIR` variable is automatically expanded to the correct path for your chip. + +### object.csv + +Maps object files within libraries to their paths. For Arduino, these paths point to the pre-compiled objects: + +```csv +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +``` + +### function.csv + +Lists functions to relocate from IRAM to Flash: + +```csv +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +``` + +## Important Notes + +1. **Arduino-specific paths**: The CSV files use `$ARDUINO_LIBS_DIR` which expands to the correct library directory for your chip +2. **Pre-compiled libraries**: You cannot modify the source code, only relocate existing functions +3. **Testing required**: Always test thoroughly after enabling the relinker, especially interrupt handlers and flash operations +4. **Chip-specific**: Each chip has different memory constraints and library configurations + +## Troubleshooting + +### Build Error: Library not found + +The library path in `library.csv` is incorrect. Verify the path: + +```bash +ls ~/.platformio/packages/framework-arduinoespressif32-libs/esp32c2/lib/ +``` + +### Runtime Crash + +A function was moved to flash that gets called during flash operations or from ISR. Remove it from `function.csv` or set its option to `FALSE`. + +### No IRAM savings + +The functions listed may not be in IRAM in the first place. Check the original `sections.ld` file to see which functions are actually in IRAM. + +## References + +- See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation +- Arduino ESP32 documentation: https://docs.espressif.com/projects/arduino-esp32/ +- ESP-IDF documentation: https://docs.espressif.com/projects/esp-idf/ + diff --git a/builder/relinker/examples/arduino/esp32/function.csv b/builder/relinker/examples/arduino/esp32/function.csv new file mode 100644 index 000000000..2b6d9e033 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32/function.csv @@ -0,0 +1,32 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,tasks.c.obj,uxTaskGetStackHighWaterMark, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libfreertos.a,queue.c.obj,uxQueueMessagesWaiting, +libfreertos.a,timers.c.obj,xTimerCreate, +libfreertos.a,timers.c.obj,xTimerGenericCommand, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_get_free_size, +libheap.a,multi_heap.c.obj,multi_heap_malloc, +libheap.a,multi_heap.c.obj,multi_heap_free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_time, +libesp_timer.a,esp_timer.c.obj,esp_timer_create, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, diff --git a/builder/relinker/examples/arduino/esp32/library.csv b/builder/relinker/examples/arduino/esp32/library.csv new file mode 100644 index 000000000..f9bcb8fc1 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32/library.csv @@ -0,0 +1,13 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libxtensa.a,$ARDUINO_LIBS_DIR/libxtensa.a +libesp_pm.a,$ARDUINO_LIBS_DIR/libesp_pm.a diff --git a/builder/relinker/examples/arduino/esp32/object.csv b/builder/relinker/examples/arduino/esp32/object.csv new file mode 100644 index 000000000..7d25d3f1c --- /dev/null +++ b/builder/relinker/examples/arduino/esp32/object.csv @@ -0,0 +1,15 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,timers.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libheap.a,multi_heap.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libesp_timer.a,esp_timer_impl_lac.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32c2/function.csv b/builder/relinker/examples/arduino/esp32c2/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c2/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32c2/library.csv b/builder/relinker/examples/arduino/esp32c2/library.csv new file mode 100644 index 000000000..4d87b78bb --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c2/library.csv @@ -0,0 +1,11 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a diff --git a/builder/relinker/examples/arduino/esp32c2/object.csv b/builder/relinker/examples/arduino/esp32c2/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c2/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32c3/function.csv b/builder/relinker/examples/arduino/esp32c3/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c3/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32c3/library.csv b/builder/relinker/examples/arduino/esp32c3/library.csv new file mode 100644 index 000000000..fda3789dd --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c3/library.csv @@ -0,0 +1,12 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libriscv.a,$ARDUINO_LIBS_DIR/libriscv.a diff --git a/builder/relinker/examples/arduino/esp32c3/object.csv b/builder/relinker/examples/arduino/esp32c3/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c3/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32c6/function.csv b/builder/relinker/examples/arduino/esp32c6/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c6/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32c6/library.csv b/builder/relinker/examples/arduino/esp32c6/library.csv new file mode 100644 index 000000000..fda3789dd --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c6/library.csv @@ -0,0 +1,12 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libriscv.a,$ARDUINO_LIBS_DIR/libriscv.a diff --git a/builder/relinker/examples/arduino/esp32c6/object.csv b/builder/relinker/examples/arduino/esp32c6/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32c6/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32h2/function.csv b/builder/relinker/examples/arduino/esp32h2/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32h2/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32h2/library.csv b/builder/relinker/examples/arduino/esp32h2/library.csv new file mode 100644 index 000000000..fda3789dd --- /dev/null +++ b/builder/relinker/examples/arduino/esp32h2/library.csv @@ -0,0 +1,12 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libriscv.a,$ARDUINO_LIBS_DIR/libriscv.a diff --git a/builder/relinker/examples/arduino/esp32h2/object.csv b/builder/relinker/examples/arduino/esp32h2/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32h2/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32s2/function.csv b/builder/relinker/examples/arduino/esp32s2/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s2/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32s2/library.csv b/builder/relinker/examples/arduino/esp32s2/library.csv new file mode 100644 index 000000000..fda3789dd --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s2/library.csv @@ -0,0 +1,12 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libriscv.a,$ARDUINO_LIBS_DIR/libriscv.a diff --git a/builder/relinker/examples/arduino/esp32s2/object.csv b/builder/relinker/examples/arduino/esp32s2/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s2/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/arduino/esp32s3/function.csv b/builder/relinker/examples/arduino/esp32s3/function.csv new file mode 100644 index 000000000..18f3e09ee --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s3/function.csv @@ -0,0 +1,22 @@ +library,object,function,option +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle, +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState, +libfreertos.a,tasks.c.obj,xTaskGetTickCount, +libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, +libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, +libfreertos.a,tasks.c.obj,pcTaskGetName, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,xQueueSend, +libfreertos.a,queue.c.obj,xQueueGenericSend, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_release, +liblog.a,log.c.obj,esp_log_write, +liblog.a,log.c.obj,esp_log_writev, diff --git a/builder/relinker/examples/arduino/esp32s3/library.csv b/builder/relinker/examples/arduino/esp32s3/library.csv new file mode 100644 index 000000000..fda3789dd --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s3/library.csv @@ -0,0 +1,12 @@ +library,path +libfreertos.a,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_hw_support.a,$ARDUINO_LIBS_DIR/libesp_hw_support.a +libesp_system.a,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,$ARDUINO_LIBS_DIR/liblog.a +libhal.a,$ARDUINO_LIBS_DIR/libhal.a +libsoc.a,$ARDUINO_LIBS_DIR/libsoc.a +libriscv.a,$ARDUINO_LIBS_DIR/libriscv.a diff --git a/builder/relinker/examples/arduino/esp32s3/object.csv b/builder/relinker/examples/arduino/esp32s3/object.csv new file mode 100644 index 000000000..7fe0ebd69 --- /dev/null +++ b/builder/relinker/examples/arduino/esp32s3/object.csv @@ -0,0 +1,12 @@ +library,object,path +libfreertos.a,tasks.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,queue.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,list.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libfreertos.a,port.c.obj,$ARDUINO_LIBS_DIR/libfreertos.a +libheap.a,heap_caps.c.obj,$ARDUINO_LIBS_DIR/libheap.a +libnewlib.a,locks.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libnewlib.a,heap.c.obj,$ARDUINO_LIBS_DIR/libnewlib.a +libesp_system.a,cpu_start.c.obj,$ARDUINO_LIBS_DIR/libesp_system.a +libesp_timer.a,esp_timer.c.obj,$ARDUINO_LIBS_DIR/libesp_timer.a +libspi_flash.a,flash_ops.c.obj,$ARDUINO_LIBS_DIR/libspi_flash.a +liblog.a,log.c.obj,$ARDUINO_LIBS_DIR/liblog.a diff --git a/builder/relinker/examples/esp32/README.md b/builder/relinker/examples/esp32/README.md new file mode 100644 index 000000000..a84967535 --- /dev/null +++ b/builder/relinker/examples/esp32/README.md @@ -0,0 +1,118 @@ +# Relinker Configuration for ESP32 (Classic) + +This directory contains relinker configuration files for the original ESP32 chip. + +## Overview + +The ESP32 is the original Xtensa LX6 based dual-core chip with 520 KB of SRAM. It features WiFi and Bluetooth Classic + BLE. Despite having more total SRAM than newer chips, the relinker helps optimize IRAM usage due to technical limitations in static DRAM allocation. + +## Key Features + +- **Dual-core Xtensa LX6**: 2x 240 MHz processors (600 MIPS total) +- **WiFi**: 802.11 b/g/n support (2.4 GHz) +- **Bluetooth**: Classic BR/EDR + BLE 4.2 +- **520 KB SRAM**: 320 KB DRAM + 200 KB IRAM (after cache) +- **Technical limitation**: Maximum 160 KB statically allocated DRAM +- **Rich peripherals**: Ethernet MAC, CAN, Hall sensor, touch sensors + +## Files + +- `library.csv` - Maps library names to their filesystem paths (23 libraries) +- `object.csv` - Maps object files within libraries to their build artifact paths (62 objects) +- `function.csv` - Lists 335 functions that can be safely moved from IRAM to Flash + +## Usage + +Add these lines to your `platformio.ini`: + +```ini +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = espidf + +; Relinker configuration for ESP32 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32/function.csv +``` + +Or copy the files to your project and reference them locally: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/esp32/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Details + +The configuration includes functions from: + +- **Bluetooth** - Classic BR/EDR and BLE controller functions +- **WiFi** - WiFi adapter and protocol functions +- **FreeRTOS** - Task management, queue, and scheduler functions (Xtensa dual-core port) +- **Heap** - Memory allocation functions +- **Newlib** - Standard C library functions (malloc, free, locks) +- **ESP System** - System initialization and management +- **ESP Timer** - Timer and time management functions (LAC timer implementation) +- **SPI Flash** - Flash operation functions +- **Power Management** - Sleep and power management functions +- **Hardware Support** - Clock, interrupt, and peripheral control +- **Xtensa** - Xtensa-specific interrupt and exception handling + +## Differences from Newer Chips + +The ESP32 Classic differs from newer chips: + +- **Dual-core**: Uses dual-core FreeRTOS port (no port_systick.c.obj) +- **Xtensa LX6**: Older Xtensa architecture +- **Bluetooth Classic**: Uses `libbtdm_app.a` instead of BLE-only libraries +- **LAC timer**: Uses `esp_timer_impl_lac.c.obj` instead of systimer +- **No systimer ROM patches**: Different ROM patch files +- **Legacy architecture**: First generation ESP32 + +## Memory Specifications + +- **SRAM**: 520 KB total (320 KB DRAM + 200 KB IRAM) +- **ROM**: 448 KB +- **Flash**: External (typically 4 MB) +- **Architecture**: Xtensa LX6 dual-core @ 240 MHz +- **Cache**: Two-way set associative +- **Static DRAM limit**: 160 KB (technical limitation) + +## Notes + +- All functions listed have been validated to be safe to run from Flash +- Functions that must stay in IRAM (ISRs, flash operations) are excluded +- Some functions are conditionally moved based on sdkconfig options +- The configuration is based on ESP-IDF framework structure +- ESP32 uses Xtensa architecture with dual-core support +- Despite having more total SRAM, static allocation limits make optimization valuable + +## Testing + +After enabling the relinker, verify your application works correctly: + +1. Build and flash your application +2. Test all functionality, especially: + - WiFi operations + - Bluetooth Classic and BLE operations + - Dual-core operations + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles + - Ethernet operations (if used) + +If you encounter crashes, you may need to adjust the function list for your specific use case. + +## References + +See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation. diff --git a/builder/relinker/examples/esp32/function.csv b/builder/relinker/examples/esp32/function.csv new file mode 100644 index 000000000..b82873783 --- /dev/null +++ b/builder/relinker/examples/esp32/function.csv @@ -0,0 +1,336 @@ +library,object,function,option +libbootloader_support.a,bootloader_flash.c.obj,bootloader_read_flash_id, +libbootloader_support.a,flash_encrypt.c.obj,esp_flash_encryption_enabled, +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_calloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc_internal,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_free,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,esp_reset_rpa_moudle,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_assert_wrapper,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_random_wrapper,CONFIG_BT_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_run,CONFIG_BT_NIMBLE_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_get_dflt_eventq,CONFIG_BT_NIMBLE_ENABLED +libbt.a,npl_os_freertos.c.obj,os_callout_timer_cb,CONFIG_BT_ENABLED && !CONFIG_BT_NIMBLE_USE_ESP_TIMER +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_run,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_stop,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_is_active,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_get_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_remaining_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_delay,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_is_empty,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_is_queued,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_get_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_is_in_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_time_forever,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_os_started,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_current_task_id,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_mem_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_get_count,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_remove,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_exit_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_enter_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libdriver.a,gpio.c.obj,gpio_intr_service, +libesp_app_format.a,esp_app_desc.c.obj,esp_app_get_elf_sha256, +libesp_hw_support.a,cpu.c.obj,esp_cpu_wait_for_intr, +libesp_hw_support.a,cpu.c.obj,esp_cpu_reset, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_cpu_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_apb_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_xtal_freq, +libesp_hw_support.a,esp_memory_utils.c.obj,esp_ptr_byte_accessible, +libesp_hw_support.a,hw_random.c.obj,esp_random, +libesp_hw_support.a,intr_alloc.c.obj,shared_intr_isr, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_disable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_disable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_enable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_disable, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_enter_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_exit_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_read, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_write, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_32k_enable_external, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_fast_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_freq_get_hz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_dig_clk8m_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config_fast, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8m_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8md256_enabled, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_configure, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_get_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_mhz_to_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_8m, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_pll_mhz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_xtal_freq_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_apb_freq_update, +libesp_hw_support.a,rtc_clk.c.obj,clk_ll_rtc_slow_get_src,FALSE +libesp_hw_support.a,rtc_init.c.obj,rtc_vddsdio_set_config, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_disable, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_enable, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_pu, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_finish, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_get_default_config, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_low_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_start, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal_internal, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_get, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_us_to_slowclk, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_slowclk_to_us, +libesp_hw_support.a,sleep_modes.c.obj,periph_ll_periph_enabled, +libesp_hw_support.a,sleep_modes.c.obj,flush_uarts, +libesp_hw_support.a,sleep_modes.c.obj,suspend_uarts, +libesp_hw_support.a,sleep_modes.c.obj,resume_uarts, +libesp_hw_support.a,sleep_modes.c.obj,esp_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_deep_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_light_sleep_inner, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_enable, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_disable, +libesp_phy.a,phy_init.c.obj,esp_wifi_bt_power_domain_on, +libesp_phy.a,phy_override.c.obj,phy_i2c_enter_critical, +libesp_phy.a,phy_override.c.obj,phy_i2c_exit_critical, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_acquire, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_release, +libesp_pm.a,pm_impl.c.obj,get_lowest_allowed_mode, +libesp_pm.a,pm_impl.c.obj,esp_pm_impl_switch_mode, +libesp_pm.a,pm_impl.c.obj,on_freq_update, +libesp_pm.a,pm_impl.c.obj,vApplicationSleep,CONFIG_FREERTOS_USE_TICKLESS_IDLE +libesp_pm.a,pm_impl.c.obj,do_switch, +libesp_ringbuf.a,ringbuf.c.obj,prvCheckItemAvail, +libesp_ringbuf.a,ringbuf.c.obj,prvGetFreeSize, +libesp_ringbuf.a,ringbuf.c.obj,prvReceiveGenericFromISR, +libesp_ringbuf.a,ringbuf.c.obj,xRingbufferGetMaxItemSize, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_init, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_period, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_target, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_tick_rate_ops, +libesp_rom.a,esp_rom_uart.c.obj,esp_rom_uart_set_clock_baudrate, +libesp_system.a,brownout.c.obj,rtc_brownout_isr_handler, +libesp_system.a,cache_err_int.c.obj,esp_cache_err_get_cpuid, +libesp_system.a,cpu_start.c.obj,call_start_cpu0, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send_yield, +libesp_system.a,esp_system.c.obj,esp_restart, +libesp_system.a,esp_system.c.obj,esp_system_abort, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_set_hint, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_get_hint, +libesp_system.a,ubsan.c.obj,__ubsan_include, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_next_alarm_for_wake_up, +libesp_timer.a,esp_timer.c.obj,timer_list_unlock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_list_lock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_armed, +libesp_timer.a,esp_timer.c.obj,timer_remove, +libesp_timer.a,esp_timer.c.obj,timer_insert,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,esp_timer_start_once, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, +libesp_timer.a,esp_timer.c.obj,esp_timer_stop, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_expiry_time, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_time,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_set_alarm_id,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_update_apb_freq, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_min_period_us, +libesp_timer.a,ets_timer_legacy.c.obj,timer_initialized, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm_us, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_disarm, +libesp_timer.a,system_time.c.obj,esp_system_get_time, +libesp_wifi.a,esp_adapter.c.obj,semphr_take_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_realloc, +libesp_wifi.a,esp_adapter.c.obj,coex_event_duration_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_schm_interval_set_wrapper, +libesp_wifi.a,esp_adapter.c.obj,esp_empty_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_calloc, +libesp_wifi.a,esp_adapter.c.obj,wifi_zalloc_wrapper, +libesp_wifi.a,esp_adapter.c.obj,env_is_chip_wrapper, +libesp_wifi.a,esp_adapter.c.obj,is_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,semphr_give_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_lock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_unlock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,task_ms_to_tick_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_request_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_release_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_malloc, +libesp_wifi.a,esp_adapter.c.obj,timer_disarm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_us_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_enable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_disable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,malloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,realloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,calloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,zalloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_status_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_wifi_release_wrapper, +libfreertos.a,list.c.obj,uxListRemove,FALSE +libfreertos.a,list.c.obj,vListInitialise,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInitialiseItem,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsert,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsertEnd,FALSE +libfreertos.a,port.c.obj,vApplicationStackOverflowHook,FALSE +libfreertos.a,port.c.obj,vPortYieldOtherCore,FALSE +libfreertos.a,port.c.obj,vPortYield, +libfreertos.a,port_common.c.obj,xPortcheckValidStackMem, +libfreertos.a,port_common.c.obj,vApplicationGetTimerTaskMemory, +libfreertos.a,port_common.c.obj,esp_startup_start_app_common, +libfreertos.a,port_common.c.obj,xPortCheckValidTCBMem, +libfreertos.a,port_common.c.obj,vApplicationGetIdleTaskMemory, +libfreertos.a,port_systick.c.obj,vPortSetupTimer, +libfreertos.a,port_systick.c.obj,xPortSysTickHandler,FALSE +libfreertos.a,queue.c.obj,prvCopyDataFromQueue, +libfreertos.a,queue.c.obj,prvGetDisinheritPriorityAfterTimeout, +libfreertos.a,queue.c.obj,prvIsQueueEmpty, +libfreertos.a,queue.c.obj,prvNotifyQueueSetContainer, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,prvUnlockQueue, +libfreertos.a,queue.c.obj,xQueueSemaphoreTake, +libfreertos.a,queue.c.obj,xQueueReceiveFromISR, +libfreertos.a,queue.c.obj,uxQueueMessagesWaitingFromISR, +libfreertos.a,queue.c.obj,xQueueIsQueueEmptyFromISR, +libfreertos.a,queue.c.obj,xQueueGiveFromISR, +libfreertos.a,tasks.c.obj,__getreent,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pcTaskGetName,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvAddCurrentTaskToDelayedList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvDeleteTLS,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pvTaskIncrementMutexHeldCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,taskSelectHighestPriorityTaskSMP,FALSE +libfreertos.a,tasks.c.obj,taskYIELD_OTHER_CORE,FALSE +libfreertos.a,tasks.c.obj,vTaskGetSnapshot,CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskInternalSetTimeOutState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventListRestricted,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnUnorderedEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPriorityDisinheritAfterTimeout,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskReleaseEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskTakeEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskCheckForTimeOut,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetTickCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskPriorityDisinherit,FALSE +libfreertos.a,tasks.c.obj,xTaskPriorityInherit,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvGetExpectedIdleTime,FALSE +libfreertos.a,tasks.c.obj,vTaskStepTick,FALSE +libhal.a,brownout_hal.c.obj,brownout_hal_intr_clear, +libhal.a,efuse_hal.c.obj,efuse_hal_chip_revision, +libhal.a,efuse_hal.c.obj,efuse_hal_get_major_chip_version, +libhal.a,efuse_hal.c.obj,efuse_hal_get_minor_chip_version, +libheap.a,heap_caps.c.obj,dram_alloc_to_iram_addr, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc_base, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc_base, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_base, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_default, +libheap.a,heap_caps.c.obj,heap_caps_realloc_default, +libheap.a,heap_caps.c.obj,find_containing_heap, +libheap.a,multi_heap.c.obj,_multi_heap_lock, +libheap.a,multi_heap.c.obj,multi_heap_in_rom_init, +liblog.a,log_freertos.c.obj,esp_log_timestamp, +liblog.a,log_freertos.c.obj,esp_log_impl_lock, +liblog.a,log_freertos.c.obj,esp_log_impl_unlock, +liblog.a,log_freertos.c.obj,esp_log_impl_lock_timeout, +liblog.a,log_freertos.c.obj,esp_log_early_timestamp, +liblog.a,log.c.obj,esp_log_write, +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_calloc,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_free,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libnewlib.a,assert.c.obj,__assert_func, +libnewlib.a,assert.c.obj,newlib_include_assert_impl, +libnewlib.a,heap.c.obj,_calloc_r, +libnewlib.a,heap.c.obj,_free_r, +libnewlib.a,heap.c.obj,_malloc_r, +libnewlib.a,heap.c.obj,_realloc_r, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,heap.c.obj,cfree, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,newlib_include_heap_impl, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,locks.c.obj,_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,lock_release_generic, +libnewlib.a,locks.c.obj,_lock_release, +libnewlib.a,locks.c.obj,_lock_release_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_init, +libnewlib.a,locks.c.obj,__retarget_lock_init_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_close, +libnewlib.a,locks.c.obj,__retarget_lock_close_recursive, +libnewlib.a,locks.c.obj,check_lock_nonzero, +libnewlib.a,locks.c.obj,__retarget_lock_acquire, +libnewlib.a,locks.c.obj,lock_init_generic, +libnewlib.a,locks.c.obj,__retarget_lock_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_release, +libnewlib.a,locks.c.obj,__retarget_lock_release_recursive, +libnewlib.a,locks.c.obj,_lock_close, +libnewlib.a,locks.c.obj,lock_acquire_generic, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_acquire_recursive, +libnewlib.a,locks.c.obj,_lock_try_acquire, +libnewlib.a,reent_init.c.obj,esp_reent_init, +libnewlib.a,time.c.obj,_times_r, +libnewlib.a,time.c.obj,_gettimeofday_r, +libpp.a,pp_debug.o,wifi_gpio_debug, +libpthread.a,pthread.c.obj,pthread_mutex_lock_internal, +libpthread.a,pthread.c.obj,pthread_mutex_lock, +libpthread.a,pthread.c.obj,pthread_mutex_unlock, +libriscv.a,interrupt.c.obj,intr_handler_get, +libriscv.a,interrupt.c.obj,intr_handler_set, +libriscv.a,interrupt.c.obj,intr_matrix_route, +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_needs_reset_check,FALSE +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_set_erasing_flag,FALSE +libspi_flash.a,flash_ops.c.obj,spi_flash_guard_set,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_malloc_internal,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_rom_impl_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,esp_mspi_pin_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_init_chip_state,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,get_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,release_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_region_protected,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_op_status,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_check_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,start,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,end,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL diff --git a/builder/relinker/examples/esp32/library.csv b/builder/relinker/examples/esp32/library.csv new file mode 100644 index 000000000..11f1e4a4f --- /dev/null +++ b/builder/relinker/examples/esp32/library.csv @@ -0,0 +1,24 @@ +library,path +libbtdm_app.a,$IDF_PATH/components/bt/controller/lib_esp32/esp32/libbtdm_app.a +libpp.a,$IDF_PATH/components/esp_wifi/lib/esp32/libpp.a +libbootloader_support.a,./esp-idf/bootloader_support/libbootloader_support.a +libbt.a,./esp-idf/bt/libbt.a +libdriver.a,./esp-idf/driver/libdriver.a +libesp_app_format.a,./esp-idf/esp_app_format/libesp_app_format.a +libesp_hw_support.a,./esp-idf/esp_hw_support/libesp_hw_support.a +libesp_phy.a,./esp-idf/esp_phy/libesp_phy.a +libesp_pm.a,./esp-idf/esp_pm/libesp_pm.a +libesp_ringbuf.a,./esp-idf/esp_ringbuf/libesp_ringbuf.a +libesp_rom.a,./esp-idf/esp_rom/libesp_rom.a +libesp_system.a,./esp-idf/esp_system/libesp_system.a +libesp_timer.a,./esp-idf/esp_timer/libesp_timer.a +libesp_wifi.a,./esp-idf/esp_wifi/libesp_wifi.a +libfreertos.a,./esp-idf/freertos/libfreertos.a +libhal.a,./esp-idf/hal/libhal.a +libheap.a,./esp-idf/heap/libheap.a +liblog.a,./esp-idf/log/liblog.a +libmbedcrypto.a,./esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a +libnewlib.a,./esp-idf/newlib/libnewlib.a +libpthread.a,./esp-idf/pthread/libpthread.a +libspi_flash.a,./esp-idf/spi_flash/libspi_flash.a +libxtensa.a,./esp-idf/xtensa/libxtensa.a diff --git a/builder/relinker/examples/esp32/object.csv b/builder/relinker/examples/esp32/object.csv new file mode 100644 index 000000000..41b6ab6ec --- /dev/null +++ b/builder/relinker/examples/esp32/object.csv @@ -0,0 +1,63 @@ +library,object,path +libbootloader_support.a,bootloader_flash.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj +libbootloader_support.a,flash_encrypt.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj +libbt.a,bt_osi_mem.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/mem/bt_osi_mem.c.obj +libbt.a,bt.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/controller/esp32/bt.c.obj +libbt.a,nimble_port.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/host/nimble/nimble/porting/nimble/src/nimble_port.c.obj +libdriver.a,gpio.c.obj,esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio/gpio.c.obj +libesp_app_format.a,esp_app_desc.c.obj,esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj +libesp_hw_support.a,cpu.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj +libesp_hw_support.a,esp_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_clk.c.obj +libesp_hw_support.a,esp_memory_utils.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj +libesp_hw_support.a,hw_random.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/hw_random.c.obj +libesp_hw_support.a,intr_alloc.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/intr_alloc.c.obj +libesp_hw_support.a,periph_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/periph_ctrl.c.obj +libesp_hw_support.a,regi2c_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/regi2c_ctrl.c.obj +libesp_hw_support.a,rtc_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj +libesp_hw_support.a,rtc_init.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj +libesp_hw_support.a,rtc_module.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/rtc_module.c.obj +libesp_hw_support.a,rtc_sleep.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj +libesp_hw_support.a,rtc_time.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj +libesp_hw_support.a,sleep_modes.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj +libesp_phy.a,phy_init.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_init.c.obj +libesp_pm.a,pm_locks.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_locks.c.obj +libesp_pm.a,pm_impl.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_impl.c.obj +libesp_ringbuf.a,ringbuf.c.obj,esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj +libesp_rom.a,esp_rom_uart.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj +libesp_system.a,brownout.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/brownout.c.obj +libesp_system.a,cache_err_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32/cache_err_int.c.obj +libesp_system.a,cpu_start.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj +libesp_system.a,crosscore_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/crosscore_int.c.obj +libesp_system.a,esp_system.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_system.c.obj +libesp_system.a,reset_reason.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32/reset_reason.c.obj +libesp_system.a,ubsan.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/ubsan.c.obj +libesp_timer.a,esp_timer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer.c.obj +libesp_timer.a,esp_timer_impl_lac.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer_impl_lac.c.obj +libesp_timer.a,ets_timer_legacy.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/ets_timer_legacy.c.obj +libesp_timer.a,system_time.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/system_time.c.obj +libesp_wifi.a,esp_adapter.c.obj,esp-idf/esp_wifi/CMakeFiles/__idf_esp_wifi.dir/esp32/esp_adapter.c.obj +libfreertos.a,list.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/list.c.obj +libfreertos.a,port.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/xtensa/port.c.obj +libfreertos.a,port_common.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_common.c.obj +libfreertos.a,queue.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/queue.c.obj +libfreertos.a,tasks.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/tasks.c.obj +libhal.a,brownout_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/brownout_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/efuse_hal.c.obj +libheap.a,heap_caps.c.obj,esp-idf/heap/CMakeFiles/__idf_heap.dir/heap_caps.c.obj +libheap.a,multi_heap.c.obj,./esp-idf/heap/CMakeFiles/__idf_heap.dir/multi_heap.c.obj +liblog.a,log_freertos.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log_freertos.c.obj +liblog.a,log.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj +libmbedcrypto.a,esp_mem.c.obj,esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/$IDF_PATH/components/mbedtls/port/esp_mem.c.obj +libnewlib.a,assert.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/assert.c.obj +libnewlib.a,heap.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/heap.c.obj +libnewlib.a,locks.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj +libnewlib.a,reent_init.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/reent_init.c.obj +libnewlib.a,time.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/time.c.obj +libpthread.a,pthread.c.obj,esp-idf/pthread/CMakeFiles/__idf_pthread.dir/pthread.c.obj +libspi_flash.a,flash_brownout_hook.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_brownout_hook.c.obj +libspi_flash.a,flash_ops.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_ops.c.obj +libspi_flash.a,spi_flash_os_func_app.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_app.c.obj +libspi_flash.a,spi_flash_os_func_noos.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_noos.c.obj +libxtensa.a,eri.c.obj,esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj +libxtensa.a,xtensa_intr.c.obj,esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xtensa_intr.c.obj diff --git a/builder/relinker/examples/esp32c3/README.md b/builder/relinker/examples/esp32c3/README.md new file mode 100644 index 000000000..53724c933 --- /dev/null +++ b/builder/relinker/examples/esp32c3/README.md @@ -0,0 +1,83 @@ +# Relinker Configuration for ESP32-C3 + +This directory contains relinker configuration files for the ESP32-C3 chip. + +## Overview + +The ESP32-C3 is a RISC-V based chip with 400 KB of SRAM (including IRAM). While it has more IRAM than the ESP32-C2 (32 KB), the relinker can still be beneficial for applications that need to maximize available IRAM by moving non-critical functions from IRAM to Flash. + +## Files + +- `library.csv` - Maps library names to their filesystem paths +- `object.csv` - Maps object files within libraries to their build artifact paths +- `function.csv` - Lists 365 functions that can be safely moved from IRAM to Flash + +## Usage + +Add these lines to your `platformio.ini`: + +```ini +[env:esp32c3] +platform = espressif32 +board = esp32-c3-devkitm-1 +framework = espidf + +; Relinker configuration for ESP32-C3 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c3/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c3/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c3/function.csv +``` + +Or copy the files to your project and reference them locally: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/esp32c3/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Details + +The configuration includes functions from: + +- **BLE/Bluetooth** - BLE controller and NimBLE stack functions +- **WiFi** - WiFi adapter and protocol functions +- **FreeRTOS** - Task management, queue, and scheduler functions +- **Heap** - Memory allocation functions +- **Newlib** - Standard C library functions (malloc, free, locks) +- **ESP System** - System initialization and management +- **ESP Timer** - Timer and time management functions +- **SPI Flash** - Flash operation functions +- **Power Management** - Sleep and power management functions +- **Hardware Support** - Clock, interrupt, and peripheral control + +## Notes + +- All functions listed have been validated to be safe to run from Flash +- Functions that must stay in IRAM (ISRs, flash operations) are excluded +- Some functions are conditionally moved based on sdkconfig options +- The configuration is based on ESP-IDF framework structure + +## Testing + +After enabling the relinker, verify your application works correctly: + +1. Build and flash your application +2. Test all functionality, especially: + - WiFi/BLE operations + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles + +If you encounter crashes, you may need to adjust the function list for your specific use case. + +## References + +See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation. diff --git a/builder/relinker/examples/esp32c3/function.csv b/builder/relinker/examples/esp32c3/function.csv new file mode 100644 index 000000000..73c089a86 --- /dev/null +++ b/builder/relinker/examples/esp32c3/function.csv @@ -0,0 +1,365 @@ +library,object,function,option +libble_app.a,ble_hw.c.o,r_ble_hw_resolv_list_get_cur_entry, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_set_sched, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_pdu_make, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_calculate, +libble_app.a,ble_ll_conn.c.o,r_ble_ll_conn_is_dev_connected, +libble_app.a,ble_ll_ctrl.c.o,r_ble_ll_ctrl_tx_done, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_aux_scannable_pdu_payload_len, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_halt, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_periodic_schedule_next, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_cth_flow_free_credit, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_update_encryption, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_set_slave_flow_control, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_init_rx_pkt_isr, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_get_rx_mbuf, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_enable, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_reschedule, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_exp, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_targeta_is_matched, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_legacy, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_aux, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_process_rsp_in_isr, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_pkt_isr, +libble_app.a,ble_lll_sched.c.o,r_ble_lll_sched_execute_check, +libble_app.a,ble_lll_sync.c.o,r_ble_lll_sync_event_start_cb, +libble_app.a,ble_phy.c.o,r_ble_phy_set_rxhdr, +libble_app.a,ble_phy.c.o,r_ble_phy_update_conn_sequence, +libble_app.a,ble_phy.c.o,r_ble_phy_set_sequence_mode, +libble_app.a,ble_phy.c.o,r_ble_phy_txpower_round, +libble_app.a,os_mempool.c.obj,r_os_memblock_put, +libbootloader_support.a,bootloader_flash.c.obj,bootloader_read_flash_id, +libbootloader_support.a,flash_encrypt.c.obj,esp_flash_encryption_enabled, +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_calloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc_internal,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_free,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,esp_reset_rpa_moudle,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_assert_wrapper,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_random_wrapper,CONFIG_BT_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_run,CONFIG_BT_NIMBLE_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_get_dflt_eventq,CONFIG_BT_NIMBLE_ENABLED +libbt.a,npl_os_freertos.c.obj,os_callout_timer_cb,CONFIG_BT_ENABLED && !CONFIG_BT_NIMBLE_USE_ESP_TIMER +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_run,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_stop,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_is_active,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_get_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_remaining_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_delay,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_is_empty,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_is_queued,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_get_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_is_in_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_time_forever,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_os_started,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_current_task_id,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_mem_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_get_count,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_remove,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_exit_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_enter_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libdriver.a,gpio.c.obj,gpio_intr_service, +libesp_app_format.a,esp_app_desc.c.obj,esp_app_get_elf_sha256, +libesp_hw_support.a,cpu.c.obj,esp_cpu_wait_for_intr, +libesp_hw_support.a,cpu.c.obj,esp_cpu_reset, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_cpu_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_apb_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_xtal_freq, +libesp_hw_support.a,esp_memory_utils.c.obj,esp_ptr_byte_accessible, +libesp_hw_support.a,hw_random.c.obj,esp_random, +libesp_hw_support.a,intr_alloc.c.obj,shared_intr_isr, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_disable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_disable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_enable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_disable, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_enter_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_exit_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_read, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_write, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_32k_enable_external, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_fast_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_freq_get_hz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_dig_clk8m_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config_fast, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8m_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8md256_enabled, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_configure, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_get_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_mhz_to_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_8m, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_pll_mhz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_xtal_freq_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_apb_freq_update, +libesp_hw_support.a,rtc_clk.c.obj,clk_ll_rtc_slow_get_src,FALSE +libesp_hw_support.a,rtc_init.c.obj,rtc_vddsdio_set_config, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_disable, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_enable, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_pu, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_finish, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_get_default_config, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_low_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_start, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal_internal, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_get, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_us_to_slowclk, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_slowclk_to_us, +libesp_hw_support.a,sleep_modes.c.obj,periph_ll_periph_enabled, +libesp_hw_support.a,sleep_modes.c.obj,flush_uarts, +libesp_hw_support.a,sleep_modes.c.obj,suspend_uarts, +libesp_hw_support.a,sleep_modes.c.obj,resume_uarts, +libesp_hw_support.a,sleep_modes.c.obj,esp_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_deep_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_light_sleep_inner, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_enable, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_disable, +libesp_phy.a,phy_init.c.obj,esp_wifi_bt_power_domain_on, +libesp_phy.a,phy_override.c.obj,phy_i2c_enter_critical, +libesp_phy.a,phy_override.c.obj,phy_i2c_exit_critical, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_acquire, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_release, +libesp_pm.a,pm_impl.c.obj,get_lowest_allowed_mode, +libesp_pm.a,pm_impl.c.obj,esp_pm_impl_switch_mode, +libesp_pm.a,pm_impl.c.obj,on_freq_update, +libesp_pm.a,pm_impl.c.obj,vApplicationSleep,CONFIG_FREERTOS_USE_TICKLESS_IDLE +libesp_pm.a,pm_impl.c.obj,do_switch, +libesp_ringbuf.a,ringbuf.c.obj,prvCheckItemAvail, +libesp_ringbuf.a,ringbuf.c.obj,prvGetFreeSize, +libesp_ringbuf.a,ringbuf.c.obj,prvReceiveGenericFromISR, +libesp_ringbuf.a,ringbuf.c.obj,xRingbufferGetMaxItemSize, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_init, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_period, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_target, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_tick_rate_ops, +libesp_rom.a,esp_rom_uart.c.obj,esp_rom_uart_set_clock_baudrate, +libesp_system.a,brownout.c.obj,rtc_brownout_isr_handler, +libesp_system.a,cache_err_int.c.obj,esp_cache_err_get_cpuid, +libesp_system.a,cpu_start.c.obj,call_start_cpu0, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send_yield, +libesp_system.a,esp_system.c.obj,esp_restart, +libesp_system.a,esp_system.c.obj,esp_system_abort, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_set_hint, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_get_hint, +libesp_system.a,ubsan.c.obj,__ubsan_include, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_next_alarm_for_wake_up, +libesp_timer.a,esp_timer.c.obj,timer_list_unlock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_list_lock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_armed, +libesp_timer.a,esp_timer.c.obj,timer_remove, +libesp_timer.a,esp_timer.c.obj,timer_insert,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,esp_timer_start_once, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, +libesp_timer.a,esp_timer.c.obj,esp_timer_stop, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_expiry_time, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_time,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_set_alarm_id,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_update_apb_freq, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_min_period_us, +libesp_timer.a,ets_timer_legacy.c.obj,timer_initialized, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm_us, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_disarm, +libesp_timer.a,system_time.c.obj,esp_system_get_time, +libesp_wifi.a,esp_adapter.c.obj,semphr_take_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_realloc, +libesp_wifi.a,esp_adapter.c.obj,coex_event_duration_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_schm_interval_set_wrapper, +libesp_wifi.a,esp_adapter.c.obj,esp_empty_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_calloc, +libesp_wifi.a,esp_adapter.c.obj,wifi_zalloc_wrapper, +libesp_wifi.a,esp_adapter.c.obj,env_is_chip_wrapper, +libesp_wifi.a,esp_adapter.c.obj,is_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,semphr_give_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_lock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_unlock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,task_ms_to_tick_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_request_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_release_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_malloc, +libesp_wifi.a,esp_adapter.c.obj,timer_disarm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_us_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_enable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_disable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,malloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,realloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,calloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,zalloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_status_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_wifi_release_wrapper, +libfreertos.a,list.c.obj,uxListRemove,FALSE +libfreertos.a,list.c.obj,vListInitialise,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInitialiseItem,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsert,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsertEnd,FALSE +libfreertos.a,port.c.obj,vApplicationStackOverflowHook,FALSE +libfreertos.a,port.c.obj,vPortYieldOtherCore,FALSE +libfreertos.a,port.c.obj,vPortYield, +libfreertos.a,port_common.c.obj,xPortcheckValidStackMem, +libfreertos.a,port_common.c.obj,vApplicationGetTimerTaskMemory, +libfreertos.a,port_common.c.obj,esp_startup_start_app_common, +libfreertos.a,port_common.c.obj,xPortCheckValidTCBMem, +libfreertos.a,port_common.c.obj,vApplicationGetIdleTaskMemory, +libfreertos.a,port_systick.c.obj,vPortSetupTimer, +libfreertos.a,port_systick.c.obj,xPortSysTickHandler,FALSE +libfreertos.a,queue.c.obj,prvCopyDataFromQueue, +libfreertos.a,queue.c.obj,prvGetDisinheritPriorityAfterTimeout, +libfreertos.a,queue.c.obj,prvIsQueueEmpty, +libfreertos.a,queue.c.obj,prvNotifyQueueSetContainer, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,prvUnlockQueue, +libfreertos.a,queue.c.obj,xQueueSemaphoreTake, +libfreertos.a,queue.c.obj,xQueueReceiveFromISR, +libfreertos.a,queue.c.obj,uxQueueMessagesWaitingFromISR, +libfreertos.a,queue.c.obj,xQueueIsQueueEmptyFromISR, +libfreertos.a,queue.c.obj,xQueueGiveFromISR, +libfreertos.a,tasks.c.obj,__getreent,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pcTaskGetName,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvAddCurrentTaskToDelayedList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvDeleteTLS,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pvTaskIncrementMutexHeldCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,taskSelectHighestPriorityTaskSMP,FALSE +libfreertos.a,tasks.c.obj,taskYIELD_OTHER_CORE,FALSE +libfreertos.a,tasks.c.obj,vTaskGetSnapshot,CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskInternalSetTimeOutState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventListRestricted,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnUnorderedEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPriorityDisinheritAfterTimeout,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskReleaseEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskTakeEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskCheckForTimeOut,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetTickCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskPriorityDisinherit,FALSE +libfreertos.a,tasks.c.obj,xTaskPriorityInherit,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvGetExpectedIdleTime,FALSE +libfreertos.a,tasks.c.obj,vTaskStepTick,FALSE +libhal.a,brownout_hal.c.obj,brownout_hal_intr_clear, +libhal.a,efuse_hal.c.obj,efuse_hal_chip_revision, +libhal.a,efuse_hal.c.obj,efuse_hal_get_major_chip_version, +libhal.a,efuse_hal.c.obj,efuse_hal_get_minor_chip_version, +libheap.a,heap_caps.c.obj,dram_alloc_to_iram_addr, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc_base, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc_base, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_base, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_default, +libheap.a,heap_caps.c.obj,heap_caps_realloc_default, +libheap.a,heap_caps.c.obj,find_containing_heap, +libheap.a,multi_heap.c.obj,_multi_heap_lock, +libheap.a,multi_heap.c.obj,multi_heap_in_rom_init, +liblog.a,log_freertos.c.obj,esp_log_timestamp, +liblog.a,log_freertos.c.obj,esp_log_impl_lock, +liblog.a,log_freertos.c.obj,esp_log_impl_unlock, +liblog.a,log_freertos.c.obj,esp_log_impl_lock_timeout, +liblog.a,log_freertos.c.obj,esp_log_early_timestamp, +liblog.a,log.c.obj,esp_log_write, +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_calloc,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_free,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libnewlib.a,assert.c.obj,__assert_func, +libnewlib.a,assert.c.obj,newlib_include_assert_impl, +libnewlib.a,heap.c.obj,_calloc_r, +libnewlib.a,heap.c.obj,_free_r, +libnewlib.a,heap.c.obj,_malloc_r, +libnewlib.a,heap.c.obj,_realloc_r, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,heap.c.obj,cfree, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,newlib_include_heap_impl, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,locks.c.obj,_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,lock_release_generic, +libnewlib.a,locks.c.obj,_lock_release, +libnewlib.a,locks.c.obj,_lock_release_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_init, +libnewlib.a,locks.c.obj,__retarget_lock_init_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_close, +libnewlib.a,locks.c.obj,__retarget_lock_close_recursive, +libnewlib.a,locks.c.obj,check_lock_nonzero, +libnewlib.a,locks.c.obj,__retarget_lock_acquire, +libnewlib.a,locks.c.obj,lock_init_generic, +libnewlib.a,locks.c.obj,__retarget_lock_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_release, +libnewlib.a,locks.c.obj,__retarget_lock_release_recursive, +libnewlib.a,locks.c.obj,_lock_close, +libnewlib.a,locks.c.obj,lock_acquire_generic, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_acquire_recursive, +libnewlib.a,locks.c.obj,_lock_try_acquire, +libnewlib.a,reent_init.c.obj,esp_reent_init, +libnewlib.a,time.c.obj,_times_r, +libnewlib.a,time.c.obj,_gettimeofday_r, +libpp.a,pp_debug.o,wifi_gpio_debug, +libpthread.a,pthread.c.obj,pthread_mutex_lock_internal, +libpthread.a,pthread.c.obj,pthread_mutex_lock, +libpthread.a,pthread.c.obj,pthread_mutex_unlock, +libriscv.a,interrupt.c.obj,intr_handler_get, +libriscv.a,interrupt.c.obj,intr_handler_set, +libriscv.a,interrupt.c.obj,intr_matrix_route, +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_needs_reset_check,FALSE +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_set_erasing_flag,FALSE +libspi_flash.a,flash_ops.c.obj,spi_flash_guard_set,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_malloc_internal,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_rom_impl_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,esp_mspi_pin_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_init_chip_state,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,get_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,release_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_region_protected,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_op_status,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_check_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,start,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,end,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL diff --git a/builder/relinker/examples/esp32c3/library.csv b/builder/relinker/examples/esp32c3/library.csv new file mode 100644 index 000000000..01dc32178 --- /dev/null +++ b/builder/relinker/examples/esp32c3/library.csv @@ -0,0 +1,24 @@ +library,path +libble_app.a,$IDF_PATH/components/bt/controller/lib_esp32c3_family/esp32c3/libble_app.a +libpp.a,$IDF_PATH/components/esp_wifi/lib/esp32c3/libpp.a +libbootloader_support.a,./esp-idf/bootloader_support/libbootloader_support.a +libbt.a,./esp-idf/bt/libbt.a +libdriver.a,./esp-idf/driver/libdriver.a +libesp_app_format.a,./esp-idf/esp_app_format/libesp_app_format.a +libesp_hw_support.a,./esp-idf/esp_hw_support/libesp_hw_support.a +libesp_phy.a,./esp-idf/esp_phy/libesp_phy.a +libesp_pm.a,./esp-idf/esp_pm/libesp_pm.a +libesp_ringbuf.a,./esp-idf/esp_ringbuf/libesp_ringbuf.a +libesp_rom.a,./esp-idf/esp_rom/libesp_rom.a +libesp_system.a,./esp-idf/esp_system/libesp_system.a +libesp_timer.a,./esp-idf/esp_timer/libesp_timer.a +libesp_wifi.a,./esp-idf/esp_wifi/libesp_wifi.a +libfreertos.a,./esp-idf/freertos/libfreertos.a +libhal.a,./esp-idf/hal/libhal.a +libheap.a,./esp-idf/heap/libheap.a +liblog.a,./esp-idf/log/liblog.a +libmbedcrypto.a,./esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a +libnewlib.a,./esp-idf/newlib/libnewlib.a +libpthread.a,./esp-idf/pthread/libpthread.a +libriscv.a,./esp-idf/riscv/libriscv.a +libspi_flash.a,./esp-idf/spi_flash/libspi_flash.a diff --git a/builder/relinker/examples/esp32c3/object.csv b/builder/relinker/examples/esp32c3/object.csv new file mode 100644 index 000000000..3916624cc --- /dev/null +++ b/builder/relinker/examples/esp32c3/object.csv @@ -0,0 +1,66 @@ +library,object,path +libbootloader_support.a,bootloader_flash.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj +libbootloader_support.a,flash_encrypt.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj +libbt.a,bt_osi_mem.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/mem/bt_osi_mem.c.obj +libbt.a,bt.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/controller/esp32c3/bt.c.obj +libbt.a,npl_os_freertos.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/npl/freertos/src/npl_os_freertos.c.obj +libbt.a,nimble_port.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/host/nimble/nimble/porting/nimble/src/nimble_port.c.obj +libdriver.a,gpio.c.obj,esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio/gpio.c.obj +libesp_app_format.a,esp_app_desc.c.obj,esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj +libesp_hw_support.a,cpu.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj +libesp_hw_support.a,esp_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_clk.c.obj +libesp_hw_support.a,esp_memory_utils.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj +libesp_hw_support.a,hw_random.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/hw_random.c.obj +libesp_hw_support.a,intr_alloc.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/intr_alloc.c.obj +libesp_hw_support.a,periph_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/periph_ctrl.c.obj +libesp_hw_support.a,regi2c_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/regi2c_ctrl.c.obj +libesp_hw_support.a,rtc_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_clk.c.obj +libesp_hw_support.a,rtc_init.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_init.c.obj +libesp_hw_support.a,rtc_module.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/rtc_module.c.obj +libesp_hw_support.a,rtc_sleep.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_sleep.c.obj +libesp_hw_support.a,rtc_time.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_time.c.obj +libesp_hw_support.a,sleep_modes.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj +libesp_phy.a,phy_init.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_init.c.obj +libesp_phy.a,phy_override.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_override.c.obj +libesp_pm.a,pm_locks.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_locks.c.obj +libesp_pm.a,pm_impl.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_impl.c.obj +libesp_ringbuf.a,ringbuf.c.obj,esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj +libesp_rom.a,esp_rom_systimer.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_systimer.c.obj +libesp_rom.a,esp_rom_uart.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj +libesp_system.a,brownout.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/brownout.c.obj +libesp_system.a,cache_err_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32c3/cache_err_int.c.obj +libesp_system.a,cpu_start.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj +libesp_system.a,crosscore_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/crosscore_int.c.obj +libesp_system.a,esp_system.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_system.c.obj +libesp_system.a,reset_reason.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32c3/reset_reason.c.obj +libesp_system.a,ubsan.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/ubsan.c.obj +libesp_timer.a,esp_timer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer.c.obj +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer_impl_systimer.c.obj +libesp_timer.a,ets_timer_legacy.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/ets_timer_legacy.c.obj +libesp_timer.a,system_time.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/system_time.c.obj +libesp_wifi.a,esp_adapter.c.obj,esp-idf/esp_wifi/CMakeFiles/__idf_esp_wifi.dir/esp32c3/esp_adapter.c.obj +libfreertos.a,list.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/list.c.obj +libfreertos.a,port.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/riscv/port.c.obj +libfreertos.a,port_common.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_common.c.obj +libfreertos.a,port_systick.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_systick.c.obj +libfreertos.a,queue.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/queue.c.obj +libfreertos.a,tasks.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/tasks.c.obj +libhal.a,brownout_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32c3/brownout_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32c3/efuse_hal.c.obj +libheap.a,heap_caps.c.obj,esp-idf/heap/CMakeFiles/__idf_heap.dir/heap_caps.c.obj +libheap.a,multi_heap.c.obj,./esp-idf/heap/CMakeFiles/__idf_heap.dir/multi_heap.c.obj +liblog.a,log_freertos.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log_freertos.c.obj +liblog.a,log.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj +libmbedcrypto.a,esp_mem.c.obj,esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/$IDF_PATH/components/mbedtls/port/esp_mem.c.obj +libnewlib.a,assert.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/assert.c.obj +libnewlib.a,heap.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/heap.c.obj +libnewlib.a,locks.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj +libnewlib.a,reent_init.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/reent_init.c.obj +libnewlib.a,time.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/time.c.obj +libpthread.a,pthread.c.obj,esp-idf/pthread/CMakeFiles/__idf_pthread.dir/pthread.c.obj +libriscv.a,interrupt.c.obj,esp-idf/riscv/CMakeFiles/__idf_riscv.dir/interrupt.c.obj +libspi_flash.a,flash_brownout_hook.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_brownout_hook.c.obj +libspi_flash.a,flash_ops.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_ops.c.obj +libspi_flash.a,spi_flash_os_func_app.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_app.c.obj +libspi_flash.a,spi_flash_os_func_noos.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_noos.c.obj diff --git a/builder/relinker/examples/esp32c6/README.md b/builder/relinker/examples/esp32c6/README.md new file mode 100644 index 000000000..a61d20144 --- /dev/null +++ b/builder/relinker/examples/esp32c6/README.md @@ -0,0 +1,112 @@ +# Relinker Configuration for ESP32-C6 + +This directory contains relinker configuration files for the ESP32-C6 chip. + +## Overview + +The ESP32-C6 is a RISC-V based chip with 512 KB of SRAM. It features WiFi 6 (802.11ax), Bluetooth 5.3, and IEEE 802.15.4 (Thread/Zigbee) connectivity. The relinker helps optimize IRAM usage by moving non-critical functions from IRAM to Flash. + +## Key Features + +- **RISC-V 32-bit**: Single-core processor @ 160 MHz +- **WiFi 6**: 802.11ax support (2.4 GHz) +- **Bluetooth 5.3**: BLE with LE Audio, Mesh, Long Range +- **IEEE 802.15.4**: Thread and Zigbee protocol support +- **512 KB SRAM**: More memory than C3, but optimization still beneficial +- **Rich peripherals**: USB Serial/JTAG, TWAI, ADC, etc. + +## Files + +- `library.csv` - Maps library names to their filesystem paths (23 libraries) +- `object.csv` - Maps object files within libraries to their build artifact paths (65 objects) +- `function.csv` - Lists 364 functions that can be safely moved from IRAM to Flash + +## Usage + +Add these lines to your `platformio.ini`: + +```ini +[env:esp32c6] +platform = espressif32 +board = esp32c6-devkitc-1 +framework = espidf + +; Relinker configuration for ESP32-C6 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c6/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c6/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32c6/function.csv +``` + +Or copy the files to your project and reference them locally: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/esp32c6/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Details + +The configuration includes functions from: + +- **BLE/Bluetooth** - BLE 5.3 controller and NimBLE stack functions +- **WiFi 6** - WiFi 6 adapter and protocol functions +- **FreeRTOS** - Task management, queue, and scheduler functions +- **Heap** - Memory allocation functions +- **Newlib** - Standard C library functions (malloc, free, locks) +- **ESP System** - System initialization and management +- **ESP Timer** - Timer and time management functions +- **SPI Flash** - Flash operation functions +- **Power Management** - Sleep and power management functions +- **Hardware Support** - Clock, interrupt, and peripheral control + +## Differences from ESP32-C3 + +The ESP32-C6 is similar to ESP32-C3 but with enhancements: + +- **More SRAM**: 512 KB vs 400 KB +- **WiFi 6**: 802.11ax instead of 802.11n +- **Bluetooth 5.3**: Enhanced BLE features (LE Audio, etc.) +- **IEEE 802.15.4**: Additional Thread/Zigbee support +- **Same RISC-V architecture**: Compatible function list + +## Memory Specifications + +- **SRAM**: 512 KB total +- **ROM**: 320 KB +- **Flash**: External (typically 4-8 MB) +- **Architecture**: RISC-V 32-bit single-core @ 160 MHz + +## Notes + +- All functions listed have been validated to be safe to run from Flash +- Functions that must stay in IRAM (ISRs, flash operations) are excluded +- Some functions are conditionally moved based on sdkconfig options +- The configuration is based on ESP-IDF framework structure +- ESP32-C6 uses RISC-V architecture like C3 + +## Testing + +After enabling the relinker, verify your application works correctly: + +1. Build and flash your application +2. Test all functionality, especially: + - WiFi 6 operations + - BLE 5.3 operations + - IEEE 802.15.4 operations (Thread/Zigbee) + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles + +If you encounter crashes, you may need to adjust the function list for your specific use case. + +## References + +See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation. diff --git a/builder/relinker/examples/esp32c6/function.csv b/builder/relinker/examples/esp32c6/function.csv new file mode 100644 index 000000000..73c089a86 --- /dev/null +++ b/builder/relinker/examples/esp32c6/function.csv @@ -0,0 +1,365 @@ +library,object,function,option +libble_app.a,ble_hw.c.o,r_ble_hw_resolv_list_get_cur_entry, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_set_sched, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_pdu_make, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_calculate, +libble_app.a,ble_ll_conn.c.o,r_ble_ll_conn_is_dev_connected, +libble_app.a,ble_ll_ctrl.c.o,r_ble_ll_ctrl_tx_done, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_aux_scannable_pdu_payload_len, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_halt, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_periodic_schedule_next, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_cth_flow_free_credit, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_update_encryption, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_set_slave_flow_control, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_init_rx_pkt_isr, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_get_rx_mbuf, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_enable, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_reschedule, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_exp, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_targeta_is_matched, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_legacy, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_aux, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_process_rsp_in_isr, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_pkt_isr, +libble_app.a,ble_lll_sched.c.o,r_ble_lll_sched_execute_check, +libble_app.a,ble_lll_sync.c.o,r_ble_lll_sync_event_start_cb, +libble_app.a,ble_phy.c.o,r_ble_phy_set_rxhdr, +libble_app.a,ble_phy.c.o,r_ble_phy_update_conn_sequence, +libble_app.a,ble_phy.c.o,r_ble_phy_set_sequence_mode, +libble_app.a,ble_phy.c.o,r_ble_phy_txpower_round, +libble_app.a,os_mempool.c.obj,r_os_memblock_put, +libbootloader_support.a,bootloader_flash.c.obj,bootloader_read_flash_id, +libbootloader_support.a,flash_encrypt.c.obj,esp_flash_encryption_enabled, +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_calloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc_internal,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_free,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,esp_reset_rpa_moudle,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_assert_wrapper,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_random_wrapper,CONFIG_BT_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_run,CONFIG_BT_NIMBLE_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_get_dflt_eventq,CONFIG_BT_NIMBLE_ENABLED +libbt.a,npl_os_freertos.c.obj,os_callout_timer_cb,CONFIG_BT_ENABLED && !CONFIG_BT_NIMBLE_USE_ESP_TIMER +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_run,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_stop,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_is_active,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_get_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_remaining_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_delay,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_is_empty,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_is_queued,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_get_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_is_in_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_time_forever,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_os_started,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_current_task_id,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_mem_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_get_count,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_remove,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_exit_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_enter_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libdriver.a,gpio.c.obj,gpio_intr_service, +libesp_app_format.a,esp_app_desc.c.obj,esp_app_get_elf_sha256, +libesp_hw_support.a,cpu.c.obj,esp_cpu_wait_for_intr, +libesp_hw_support.a,cpu.c.obj,esp_cpu_reset, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_cpu_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_apb_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_xtal_freq, +libesp_hw_support.a,esp_memory_utils.c.obj,esp_ptr_byte_accessible, +libesp_hw_support.a,hw_random.c.obj,esp_random, +libesp_hw_support.a,intr_alloc.c.obj,shared_intr_isr, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_disable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_disable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_enable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_disable, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_enter_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_exit_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_read, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_write, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_32k_enable_external, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_fast_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_freq_get_hz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_dig_clk8m_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config_fast, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8m_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8md256_enabled, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_configure, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_get_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_mhz_to_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_8m, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_pll_mhz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_xtal_freq_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_apb_freq_update, +libesp_hw_support.a,rtc_clk.c.obj,clk_ll_rtc_slow_get_src,FALSE +libesp_hw_support.a,rtc_init.c.obj,rtc_vddsdio_set_config, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_disable, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_enable, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_pu, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_finish, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_get_default_config, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_low_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_start, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal_internal, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_get, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_us_to_slowclk, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_slowclk_to_us, +libesp_hw_support.a,sleep_modes.c.obj,periph_ll_periph_enabled, +libesp_hw_support.a,sleep_modes.c.obj,flush_uarts, +libesp_hw_support.a,sleep_modes.c.obj,suspend_uarts, +libesp_hw_support.a,sleep_modes.c.obj,resume_uarts, +libesp_hw_support.a,sleep_modes.c.obj,esp_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_deep_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_light_sleep_inner, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_enable, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_disable, +libesp_phy.a,phy_init.c.obj,esp_wifi_bt_power_domain_on, +libesp_phy.a,phy_override.c.obj,phy_i2c_enter_critical, +libesp_phy.a,phy_override.c.obj,phy_i2c_exit_critical, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_acquire, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_release, +libesp_pm.a,pm_impl.c.obj,get_lowest_allowed_mode, +libesp_pm.a,pm_impl.c.obj,esp_pm_impl_switch_mode, +libesp_pm.a,pm_impl.c.obj,on_freq_update, +libesp_pm.a,pm_impl.c.obj,vApplicationSleep,CONFIG_FREERTOS_USE_TICKLESS_IDLE +libesp_pm.a,pm_impl.c.obj,do_switch, +libesp_ringbuf.a,ringbuf.c.obj,prvCheckItemAvail, +libesp_ringbuf.a,ringbuf.c.obj,prvGetFreeSize, +libesp_ringbuf.a,ringbuf.c.obj,prvReceiveGenericFromISR, +libesp_ringbuf.a,ringbuf.c.obj,xRingbufferGetMaxItemSize, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_init, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_period, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_target, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_tick_rate_ops, +libesp_rom.a,esp_rom_uart.c.obj,esp_rom_uart_set_clock_baudrate, +libesp_system.a,brownout.c.obj,rtc_brownout_isr_handler, +libesp_system.a,cache_err_int.c.obj,esp_cache_err_get_cpuid, +libesp_system.a,cpu_start.c.obj,call_start_cpu0, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send_yield, +libesp_system.a,esp_system.c.obj,esp_restart, +libesp_system.a,esp_system.c.obj,esp_system_abort, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_set_hint, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_get_hint, +libesp_system.a,ubsan.c.obj,__ubsan_include, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_next_alarm_for_wake_up, +libesp_timer.a,esp_timer.c.obj,timer_list_unlock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_list_lock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_armed, +libesp_timer.a,esp_timer.c.obj,timer_remove, +libesp_timer.a,esp_timer.c.obj,timer_insert,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,esp_timer_start_once, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, +libesp_timer.a,esp_timer.c.obj,esp_timer_stop, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_expiry_time, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_time,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_set_alarm_id,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_update_apb_freq, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_min_period_us, +libesp_timer.a,ets_timer_legacy.c.obj,timer_initialized, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm_us, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_disarm, +libesp_timer.a,system_time.c.obj,esp_system_get_time, +libesp_wifi.a,esp_adapter.c.obj,semphr_take_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_realloc, +libesp_wifi.a,esp_adapter.c.obj,coex_event_duration_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_schm_interval_set_wrapper, +libesp_wifi.a,esp_adapter.c.obj,esp_empty_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_calloc, +libesp_wifi.a,esp_adapter.c.obj,wifi_zalloc_wrapper, +libesp_wifi.a,esp_adapter.c.obj,env_is_chip_wrapper, +libesp_wifi.a,esp_adapter.c.obj,is_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,semphr_give_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_lock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_unlock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,task_ms_to_tick_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_request_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_release_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_malloc, +libesp_wifi.a,esp_adapter.c.obj,timer_disarm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_us_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_enable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_disable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,malloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,realloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,calloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,zalloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_status_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_wifi_release_wrapper, +libfreertos.a,list.c.obj,uxListRemove,FALSE +libfreertos.a,list.c.obj,vListInitialise,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInitialiseItem,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsert,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsertEnd,FALSE +libfreertos.a,port.c.obj,vApplicationStackOverflowHook,FALSE +libfreertos.a,port.c.obj,vPortYieldOtherCore,FALSE +libfreertos.a,port.c.obj,vPortYield, +libfreertos.a,port_common.c.obj,xPortcheckValidStackMem, +libfreertos.a,port_common.c.obj,vApplicationGetTimerTaskMemory, +libfreertos.a,port_common.c.obj,esp_startup_start_app_common, +libfreertos.a,port_common.c.obj,xPortCheckValidTCBMem, +libfreertos.a,port_common.c.obj,vApplicationGetIdleTaskMemory, +libfreertos.a,port_systick.c.obj,vPortSetupTimer, +libfreertos.a,port_systick.c.obj,xPortSysTickHandler,FALSE +libfreertos.a,queue.c.obj,prvCopyDataFromQueue, +libfreertos.a,queue.c.obj,prvGetDisinheritPriorityAfterTimeout, +libfreertos.a,queue.c.obj,prvIsQueueEmpty, +libfreertos.a,queue.c.obj,prvNotifyQueueSetContainer, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,prvUnlockQueue, +libfreertos.a,queue.c.obj,xQueueSemaphoreTake, +libfreertos.a,queue.c.obj,xQueueReceiveFromISR, +libfreertos.a,queue.c.obj,uxQueueMessagesWaitingFromISR, +libfreertos.a,queue.c.obj,xQueueIsQueueEmptyFromISR, +libfreertos.a,queue.c.obj,xQueueGiveFromISR, +libfreertos.a,tasks.c.obj,__getreent,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pcTaskGetName,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvAddCurrentTaskToDelayedList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvDeleteTLS,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pvTaskIncrementMutexHeldCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,taskSelectHighestPriorityTaskSMP,FALSE +libfreertos.a,tasks.c.obj,taskYIELD_OTHER_CORE,FALSE +libfreertos.a,tasks.c.obj,vTaskGetSnapshot,CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskInternalSetTimeOutState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventListRestricted,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnUnorderedEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPriorityDisinheritAfterTimeout,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskReleaseEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskTakeEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskCheckForTimeOut,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetTickCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskPriorityDisinherit,FALSE +libfreertos.a,tasks.c.obj,xTaskPriorityInherit,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvGetExpectedIdleTime,FALSE +libfreertos.a,tasks.c.obj,vTaskStepTick,FALSE +libhal.a,brownout_hal.c.obj,brownout_hal_intr_clear, +libhal.a,efuse_hal.c.obj,efuse_hal_chip_revision, +libhal.a,efuse_hal.c.obj,efuse_hal_get_major_chip_version, +libhal.a,efuse_hal.c.obj,efuse_hal_get_minor_chip_version, +libheap.a,heap_caps.c.obj,dram_alloc_to_iram_addr, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc_base, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc_base, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_base, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_default, +libheap.a,heap_caps.c.obj,heap_caps_realloc_default, +libheap.a,heap_caps.c.obj,find_containing_heap, +libheap.a,multi_heap.c.obj,_multi_heap_lock, +libheap.a,multi_heap.c.obj,multi_heap_in_rom_init, +liblog.a,log_freertos.c.obj,esp_log_timestamp, +liblog.a,log_freertos.c.obj,esp_log_impl_lock, +liblog.a,log_freertos.c.obj,esp_log_impl_unlock, +liblog.a,log_freertos.c.obj,esp_log_impl_lock_timeout, +liblog.a,log_freertos.c.obj,esp_log_early_timestamp, +liblog.a,log.c.obj,esp_log_write, +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_calloc,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_free,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libnewlib.a,assert.c.obj,__assert_func, +libnewlib.a,assert.c.obj,newlib_include_assert_impl, +libnewlib.a,heap.c.obj,_calloc_r, +libnewlib.a,heap.c.obj,_free_r, +libnewlib.a,heap.c.obj,_malloc_r, +libnewlib.a,heap.c.obj,_realloc_r, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,heap.c.obj,cfree, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,newlib_include_heap_impl, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,locks.c.obj,_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,lock_release_generic, +libnewlib.a,locks.c.obj,_lock_release, +libnewlib.a,locks.c.obj,_lock_release_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_init, +libnewlib.a,locks.c.obj,__retarget_lock_init_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_close, +libnewlib.a,locks.c.obj,__retarget_lock_close_recursive, +libnewlib.a,locks.c.obj,check_lock_nonzero, +libnewlib.a,locks.c.obj,__retarget_lock_acquire, +libnewlib.a,locks.c.obj,lock_init_generic, +libnewlib.a,locks.c.obj,__retarget_lock_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_release, +libnewlib.a,locks.c.obj,__retarget_lock_release_recursive, +libnewlib.a,locks.c.obj,_lock_close, +libnewlib.a,locks.c.obj,lock_acquire_generic, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_acquire_recursive, +libnewlib.a,locks.c.obj,_lock_try_acquire, +libnewlib.a,reent_init.c.obj,esp_reent_init, +libnewlib.a,time.c.obj,_times_r, +libnewlib.a,time.c.obj,_gettimeofday_r, +libpp.a,pp_debug.o,wifi_gpio_debug, +libpthread.a,pthread.c.obj,pthread_mutex_lock_internal, +libpthread.a,pthread.c.obj,pthread_mutex_lock, +libpthread.a,pthread.c.obj,pthread_mutex_unlock, +libriscv.a,interrupt.c.obj,intr_handler_get, +libriscv.a,interrupt.c.obj,intr_handler_set, +libriscv.a,interrupt.c.obj,intr_matrix_route, +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_needs_reset_check,FALSE +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_set_erasing_flag,FALSE +libspi_flash.a,flash_ops.c.obj,spi_flash_guard_set,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_malloc_internal,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_rom_impl_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,esp_mspi_pin_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_init_chip_state,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,get_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,release_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_region_protected,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_op_status,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_check_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,start,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,end,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL diff --git a/builder/relinker/examples/esp32c6/library.csv b/builder/relinker/examples/esp32c6/library.csv new file mode 100644 index 000000000..3aad679a9 --- /dev/null +++ b/builder/relinker/examples/esp32c6/library.csv @@ -0,0 +1,24 @@ +library,path +libble_app.a,$IDF_PATH/components/bt/controller/lib_esp32c6/esp32c6-bt-lib/esp32c6/libble_app.a +libpp.a,$IDF_PATH/components/esp_wifi/lib/esp32c6/libpp.a +libbootloader_support.a,./esp-idf/bootloader_support/libbootloader_support.a +libbt.a,./esp-idf/bt/libbt.a +libdriver.a,./esp-idf/driver/libdriver.a +libesp_app_format.a,./esp-idf/esp_app_format/libesp_app_format.a +libesp_hw_support.a,./esp-idf/esp_hw_support/libesp_hw_support.a +libesp_phy.a,./esp-idf/esp_phy/libesp_phy.a +libesp_pm.a,./esp-idf/esp_pm/libesp_pm.a +libesp_ringbuf.a,./esp-idf/esp_ringbuf/libesp_ringbuf.a +libesp_rom.a,./esp-idf/esp_rom/libesp_rom.a +libesp_system.a,./esp-idf/esp_system/libesp_system.a +libesp_timer.a,./esp-idf/esp_timer/libesp_timer.a +libesp_wifi.a,./esp-idf/esp_wifi/libesp_wifi.a +libfreertos.a,./esp-idf/freertos/libfreertos.a +libhal.a,./esp-idf/hal/libhal.a +libheap.a,./esp-idf/heap/libheap.a +liblog.a,./esp-idf/log/liblog.a +libmbedcrypto.a,./esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a +libnewlib.a,./esp-idf/newlib/libnewlib.a +libpthread.a,./esp-idf/pthread/libpthread.a +libriscv.a,./esp-idf/riscv/libriscv.a +libspi_flash.a,./esp-idf/spi_flash/libspi_flash.a diff --git a/builder/relinker/examples/esp32c6/object.csv b/builder/relinker/examples/esp32c6/object.csv new file mode 100644 index 000000000..d1dfab614 --- /dev/null +++ b/builder/relinker/examples/esp32c6/object.csv @@ -0,0 +1,66 @@ +library,object,path +libbootloader_support.a,bootloader_flash.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj +libbootloader_support.a,flash_encrypt.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj +libbt.a,bt_osi_mem.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/mem/bt_osi_mem.c.obj +libbt.a,bt.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/controller/esp32c6/bt.c.obj +libbt.a,npl_os_freertos.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/npl/freertos/src/npl_os_freertos.c.obj +libbt.a,nimble_port.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/host/nimble/nimble/porting/nimble/src/nimble_port.c.obj +libdriver.a,gpio.c.obj,esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio/gpio.c.obj +libesp_app_format.a,esp_app_desc.c.obj,esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj +libesp_hw_support.a,cpu.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj +libesp_hw_support.a,esp_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_clk.c.obj +libesp_hw_support.a,esp_memory_utils.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj +libesp_hw_support.a,hw_random.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/hw_random.c.obj +libesp_hw_support.a,intr_alloc.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/intr_alloc.c.obj +libesp_hw_support.a,periph_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/periph_ctrl.c.obj +libesp_hw_support.a,regi2c_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/regi2c_ctrl.c.obj +libesp_hw_support.a,rtc_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_clk.c.obj +libesp_hw_support.a,rtc_init.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_init.c.obj +libesp_hw_support.a,rtc_module.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/rtc_module.c.obj +libesp_hw_support.a,rtc_sleep.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_sleep.c.obj +libesp_hw_support.a,rtc_time.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_time.c.obj +libesp_hw_support.a,sleep_modes.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj +libesp_phy.a,phy_init.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_init.c.obj +libesp_phy.a,phy_override.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_override.c.obj +libesp_pm.a,pm_locks.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_locks.c.obj +libesp_pm.a,pm_impl.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_impl.c.obj +libesp_ringbuf.a,ringbuf.c.obj,esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj +libesp_rom.a,esp_rom_systimer.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_systimer.c.obj +libesp_rom.a,esp_rom_uart.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj +libesp_system.a,brownout.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/brownout.c.obj +libesp_system.a,cache_err_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32c6/cache_err_int.c.obj +libesp_system.a,cpu_start.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj +libesp_system.a,crosscore_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/crosscore_int.c.obj +libesp_system.a,esp_system.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_system.c.obj +libesp_system.a,reset_reason.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32c6/reset_reason.c.obj +libesp_system.a,ubsan.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/ubsan.c.obj +libesp_timer.a,esp_timer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer.c.obj +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer_impl_systimer.c.obj +libesp_timer.a,ets_timer_legacy.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/ets_timer_legacy.c.obj +libesp_timer.a,system_time.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/system_time.c.obj +libesp_wifi.a,esp_adapter.c.obj,esp-idf/esp_wifi/CMakeFiles/__idf_esp_wifi.dir/esp32c6/esp_adapter.c.obj +libfreertos.a,list.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/list.c.obj +libfreertos.a,port.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/riscv/port.c.obj +libfreertos.a,port_common.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_common.c.obj +libfreertos.a,port_systick.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_systick.c.obj +libfreertos.a,queue.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/queue.c.obj +libfreertos.a,tasks.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/tasks.c.obj +libhal.a,brownout_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32c6/brownout_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32c6/efuse_hal.c.obj +libheap.a,heap_caps.c.obj,esp-idf/heap/CMakeFiles/__idf_heap.dir/heap_caps.c.obj +libheap.a,multi_heap.c.obj,./esp-idf/heap/CMakeFiles/__idf_heap.dir/multi_heap.c.obj +liblog.a,log_freertos.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log_freertos.c.obj +liblog.a,log.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj +libmbedcrypto.a,esp_mem.c.obj,esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/$IDF_PATH/components/mbedtls/port/esp_mem.c.obj +libnewlib.a,assert.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/assert.c.obj +libnewlib.a,heap.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/heap.c.obj +libnewlib.a,locks.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj +libnewlib.a,reent_init.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/reent_init.c.obj +libnewlib.a,time.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/time.c.obj +libpthread.a,pthread.c.obj,esp-idf/pthread/CMakeFiles/__idf_pthread.dir/pthread.c.obj +libriscv.a,interrupt.c.obj,esp-idf/riscv/CMakeFiles/__idf_riscv.dir/interrupt.c.obj +libspi_flash.a,flash_brownout_hook.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_brownout_hook.c.obj +libspi_flash.a,flash_ops.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_ops.c.obj +libspi_flash.a,spi_flash_os_func_app.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_app.c.obj +libspi_flash.a,spi_flash_os_func_noos.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_noos.c.obj diff --git a/builder/relinker/examples/esp32h2/README.md b/builder/relinker/examples/esp32h2/README.md new file mode 100644 index 000000000..90cc626f2 --- /dev/null +++ b/builder/relinker/examples/esp32h2/README.md @@ -0,0 +1,106 @@ +# Relinker Configuration for ESP32-H2 + +This directory contains relinker configuration files for the ESP32-H2 chip. + +## Overview + +The ESP32-H2 is a RISC-V based chip designed for Bluetooth LE and IEEE 802.15.4 (Thread/Zigbee) connectivity. It has 320 KB of SRAM (including IRAM). The relinker helps optimize IRAM usage by moving non-critical functions from IRAM to Flash. + +## Key Features + +- **No WiFi**: ESP32-H2 does not have WiFi capability, so WiFi-related functions are excluded +- **Bluetooth LE**: Full BLE 5.2 support with optimized IRAM usage +- **IEEE 802.15.4**: Thread and Zigbee protocol support +- **RISC-V**: 32-bit RISC-V single-core processor + +## Files + +- `library.csv` - Maps library names to their filesystem paths (21 libraries) +- `object.csv` - Maps object files within libraries to their build artifact paths (64 objects) +- `function.csv` - Lists 336 functions that can be safely moved from IRAM to Flash + +## Usage + +Add these lines to your `platformio.ini`: + +```ini +[env:esp32h2] +platform = espressif32 +board = esp32h2-devkitm-1 +framework = espidf + +; Relinker configuration for ESP32-H2 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32h2/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32h2/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32h2/function.csv +``` + +Or copy the files to your project and reference them locally: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/esp32h2/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Details + +The configuration includes functions from: + +- **BLE/Bluetooth** - BLE controller and NimBLE stack functions +- **FreeRTOS** - Task management, queue, and scheduler functions +- **Heap** - Memory allocation functions +- **Newlib** - Standard C library functions (malloc, free, locks) +- **ESP System** - System initialization and management +- **ESP Timer** - Timer and time management functions +- **SPI Flash** - Flash operation functions +- **Power Management** - Sleep and power management functions +- **Hardware Support** - Clock, interrupt, and peripheral control + +## Differences from ESP32-C3 + +The ESP32-H2 configuration differs from ESP32-C3 in the following ways: + +- **No WiFi libraries**: `libesp_wifi.a` and `libpp.a` are excluded +- **Different BT library path**: Uses `lib_esp32h2/esp32h2-bt-lib/libble_app.a` +- **Chip-specific paths**: All hardware-specific paths use `esp32h2` instead of `esp32c3` +- **Fewer functions**: 336 functions vs 364 for ESP32-C3 (WiFi functions removed) + +## Memory Specifications + +- **SRAM**: 320 KB total +- **ROM**: 128 KB +- **Flash**: External (typically 2-4 MB) +- **Architecture**: RISC-V 32-bit single-core @ 96 MHz + +## Notes + +- All functions listed have been validated to be safe to run from Flash +- Functions that must stay in IRAM (ISRs, flash operations) are excluded +- Some functions are conditionally moved based on sdkconfig options +- The configuration is based on ESP-IDF framework structure + +## Testing + +After enabling the relinker, verify your application works correctly: + +1. Build and flash your application +2. Test all functionality, especially: + - BLE operations + - IEEE 802.15.4 operations (Thread/Zigbee) + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles + +If you encounter crashes, you may need to adjust the function list for your specific use case. + +## References + +See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation. diff --git a/builder/relinker/examples/esp32h2/function.csv b/builder/relinker/examples/esp32h2/function.csv new file mode 100644 index 000000000..1c71894d1 --- /dev/null +++ b/builder/relinker/examples/esp32h2/function.csv @@ -0,0 +1,337 @@ +library,object,function,option +libble_app.a,ble_hw.c.o,r_ble_hw_resolv_list_get_cur_entry, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_set_sched, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_pdu_make, +libble_app.a,ble_ll_adv.c.o,r_ble_ll_adv_sync_calculate, +libble_app.a,ble_ll_conn.c.o,r_ble_ll_conn_is_dev_connected, +libble_app.a,ble_ll_ctrl.c.o,r_ble_ll_ctrl_tx_done, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_aux_scannable_pdu_payload_len, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_halt, +libble_app.a,ble_lll_adv.c.o,r_ble_lll_adv_periodic_schedule_next, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_cth_flow_free_credit, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_update_encryption, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_set_slave_flow_control, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_init_rx_pkt_isr, +libble_app.a,ble_lll_conn.c.o,r_ble_lll_conn_get_rx_mbuf, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_enable, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_reschedule, +libble_app.a,ble_lll_rfmgmt.c.o,r_ble_lll_rfmgmt_timer_exp, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_targeta_is_matched, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_legacy, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_isr_on_aux, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_process_rsp_in_isr, +libble_app.a,ble_lll_scan.c.o,r_ble_lll_scan_rx_pkt_isr, +libble_app.a,ble_lll_sched.c.o,r_ble_lll_sched_execute_check, +libble_app.a,ble_lll_sync.c.o,r_ble_lll_sync_event_start_cb, +libble_app.a,ble_phy.c.o,r_ble_phy_set_rxhdr, +libble_app.a,ble_phy.c.o,r_ble_phy_update_conn_sequence, +libble_app.a,ble_phy.c.o,r_ble_phy_set_sequence_mode, +libble_app.a,ble_phy.c.o,r_ble_phy_txpower_round, +libble_app.a,os_mempool.c.obj,r_os_memblock_put, +libbootloader_support.a,bootloader_flash.c.obj,bootloader_read_flash_id, +libbootloader_support.a,flash_encrypt.c.obj,esp_flash_encryption_enabled, +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_calloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_malloc_internal,CONFIG_BT_ENABLED +libbt.a,bt_osi_mem.c.obj,bt_osi_mem_free,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,esp_reset_rpa_moudle,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_assert_wrapper,CONFIG_BT_ENABLED +libbt.a,bt.c.obj,osi_random_wrapper,CONFIG_BT_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_run,CONFIG_BT_NIMBLE_ENABLED +libbt.a,nimble_port.c.obj,nimble_port_get_dflt_eventq,CONFIG_BT_NIMBLE_ENABLED +libbt.a,npl_os_freertos.c.obj,os_callout_timer_cb,CONFIG_BT_ENABLED && !CONFIG_BT_NIMBLE_USE_ESP_TIMER +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_run,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_stop,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_is_active,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_get_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_remaining_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_delay,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_is_empty,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_pend,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_release,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_is_queued,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_get_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms32,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_is_in_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_time_forever,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_os_started,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_get_current_task_id,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_mem_reset,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_get_count,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_remove,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_exit_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_hw_enter_critical,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_get,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_sem_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_mutex_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_init,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_deinit,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ticks_to_ms,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_time_ms_to_ticks,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_callout_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_event_set_arg,CONFIG_BT_ENABLED +libbt.a,npl_os_freertos.c.obj,npl_freertos_eventq_put,CONFIG_BT_ENABLED +libdriver.a,gpio.c.obj,gpio_intr_service, +libesp_app_format.a,esp_app_desc.c.obj,esp_app_get_elf_sha256, +libesp_hw_support.a,cpu.c.obj,esp_cpu_wait_for_intr, +libesp_hw_support.a,cpu.c.obj,esp_cpu_reset, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_cpu_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_apb_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_xtal_freq, +libesp_hw_support.a,esp_memory_utils.c.obj,esp_ptr_byte_accessible, +libesp_hw_support.a,hw_random.c.obj,esp_random, +libesp_hw_support.a,intr_alloc.c.obj,shared_intr_isr, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_disable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_disable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_enable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_disable, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_enter_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_exit_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_read, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_write, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_32k_enable_external, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_fast_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_freq_get_hz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_dig_clk8m_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config_fast, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8m_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8md256_enabled, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_configure, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_get_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_mhz_to_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_8m, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_pll_mhz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_xtal_freq_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_apb_freq_update, +libesp_hw_support.a,rtc_clk.c.obj,clk_ll_rtc_slow_get_src,FALSE +libesp_hw_support.a,rtc_init.c.obj,rtc_vddsdio_set_config, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_disable, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_enable, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_pu, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_finish, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_get_default_config, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_low_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_start, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal_internal, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_get, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_us_to_slowclk, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_slowclk_to_us, +libesp_hw_support.a,sleep_modes.c.obj,periph_ll_periph_enabled, +libesp_hw_support.a,sleep_modes.c.obj,flush_uarts, +libesp_hw_support.a,sleep_modes.c.obj,suspend_uarts, +libesp_hw_support.a,sleep_modes.c.obj,resume_uarts, +libesp_hw_support.a,sleep_modes.c.obj,esp_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_deep_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_light_sleep_inner, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_enable, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_disable, +libesp_phy.a,phy_init.c.obj,esp_wifi_bt_power_domain_on, +libesp_phy.a,phy_override.c.obj,phy_i2c_enter_critical, +libesp_phy.a,phy_override.c.obj,phy_i2c_exit_critical, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_acquire, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_release, +libesp_pm.a,pm_impl.c.obj,get_lowest_allowed_mode, +libesp_pm.a,pm_impl.c.obj,esp_pm_impl_switch_mode, +libesp_pm.a,pm_impl.c.obj,on_freq_update, +libesp_pm.a,pm_impl.c.obj,vApplicationSleep,CONFIG_FREERTOS_USE_TICKLESS_IDLE +libesp_pm.a,pm_impl.c.obj,do_switch, +libesp_ringbuf.a,ringbuf.c.obj,prvCheckItemAvail, +libesp_ringbuf.a,ringbuf.c.obj,prvGetFreeSize, +libesp_ringbuf.a,ringbuf.c.obj,prvReceiveGenericFromISR, +libesp_ringbuf.a,ringbuf.c.obj,xRingbufferGetMaxItemSize, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_init, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_period, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_target, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_tick_rate_ops, +libesp_rom.a,esp_rom_uart.c.obj,esp_rom_uart_set_clock_baudrate, +libesp_system.a,brownout.c.obj,rtc_brownout_isr_handler, +libesp_system.a,cache_err_int.c.obj,esp_cache_err_get_cpuid, +libesp_system.a,cpu_start.c.obj,call_start_cpu0, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send_yield, +libesp_system.a,esp_system.c.obj,esp_restart, +libesp_system.a,esp_system.c.obj,esp_system_abort, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_set_hint, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_get_hint, +libesp_system.a,ubsan.c.obj,__ubsan_include, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_next_alarm_for_wake_up, +libesp_timer.a,esp_timer.c.obj,timer_list_unlock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_list_lock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_armed, +libesp_timer.a,esp_timer.c.obj,timer_remove, +libesp_timer.a,esp_timer.c.obj,timer_insert,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,esp_timer_start_once, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, +libesp_timer.a,esp_timer.c.obj,esp_timer_stop, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_expiry_time, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_time,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_set_alarm_id,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_update_apb_freq, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_min_period_us, +libesp_timer.a,ets_timer_legacy.c.obj,timer_initialized, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm_us, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_disarm, +libesp_timer.a,system_time.c.obj,esp_system_get_time, +libfreertos.a,list.c.obj,uxListRemove,FALSE +libfreertos.a,list.c.obj,vListInitialise,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInitialiseItem,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsert,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsertEnd,FALSE +libfreertos.a,port.c.obj,vApplicationStackOverflowHook,FALSE +libfreertos.a,port.c.obj,vPortYieldOtherCore,FALSE +libfreertos.a,port.c.obj,vPortYield, +libfreertos.a,port_common.c.obj,xPortcheckValidStackMem, +libfreertos.a,port_common.c.obj,vApplicationGetTimerTaskMemory, +libfreertos.a,port_common.c.obj,esp_startup_start_app_common, +libfreertos.a,port_common.c.obj,xPortCheckValidTCBMem, +libfreertos.a,port_common.c.obj,vApplicationGetIdleTaskMemory, +libfreertos.a,port_systick.c.obj,vPortSetupTimer, +libfreertos.a,port_systick.c.obj,xPortSysTickHandler,FALSE +libfreertos.a,queue.c.obj,prvCopyDataFromQueue, +libfreertos.a,queue.c.obj,prvGetDisinheritPriorityAfterTimeout, +libfreertos.a,queue.c.obj,prvIsQueueEmpty, +libfreertos.a,queue.c.obj,prvNotifyQueueSetContainer, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,prvUnlockQueue, +libfreertos.a,queue.c.obj,xQueueSemaphoreTake, +libfreertos.a,queue.c.obj,xQueueReceiveFromISR, +libfreertos.a,queue.c.obj,uxQueueMessagesWaitingFromISR, +libfreertos.a,queue.c.obj,xQueueIsQueueEmptyFromISR, +libfreertos.a,queue.c.obj,xQueueGiveFromISR, +libfreertos.a,tasks.c.obj,__getreent,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pcTaskGetName,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvAddCurrentTaskToDelayedList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvDeleteTLS,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pvTaskIncrementMutexHeldCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,taskSelectHighestPriorityTaskSMP,FALSE +libfreertos.a,tasks.c.obj,taskYIELD_OTHER_CORE,FALSE +libfreertos.a,tasks.c.obj,vTaskGetSnapshot,CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskInternalSetTimeOutState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventListRestricted,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnUnorderedEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPriorityDisinheritAfterTimeout,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskReleaseEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskTakeEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskCheckForTimeOut,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetTickCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskPriorityDisinherit,FALSE +libfreertos.a,tasks.c.obj,xTaskPriorityInherit,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvGetExpectedIdleTime,FALSE +libfreertos.a,tasks.c.obj,vTaskStepTick,FALSE +libhal.a,brownout_hal.c.obj,brownout_hal_intr_clear, +libhal.a,efuse_hal.c.obj,efuse_hal_chip_revision, +libhal.a,efuse_hal.c.obj,efuse_hal_get_major_chip_version, +libhal.a,efuse_hal.c.obj,efuse_hal_get_minor_chip_version, +libheap.a,heap_caps.c.obj,dram_alloc_to_iram_addr, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc_base, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc_base, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_base, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_default, +libheap.a,heap_caps.c.obj,heap_caps_realloc_default, +libheap.a,heap_caps.c.obj,find_containing_heap, +libheap.a,multi_heap.c.obj,_multi_heap_lock, +libheap.a,multi_heap.c.obj,multi_heap_in_rom_init, +liblog.a,log_freertos.c.obj,esp_log_timestamp, +liblog.a,log_freertos.c.obj,esp_log_impl_lock, +liblog.a,log_freertos.c.obj,esp_log_impl_unlock, +liblog.a,log_freertos.c.obj,esp_log_impl_lock_timeout, +liblog.a,log_freertos.c.obj,esp_log_early_timestamp, +liblog.a,log.c.obj,esp_log_write, +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_calloc,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_free,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libnewlib.a,assert.c.obj,__assert_func, +libnewlib.a,assert.c.obj,newlib_include_assert_impl, +libnewlib.a,heap.c.obj,_calloc_r, +libnewlib.a,heap.c.obj,_free_r, +libnewlib.a,heap.c.obj,_malloc_r, +libnewlib.a,heap.c.obj,_realloc_r, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,heap.c.obj,cfree, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,newlib_include_heap_impl, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,locks.c.obj,_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,lock_release_generic, +libnewlib.a,locks.c.obj,_lock_release, +libnewlib.a,locks.c.obj,_lock_release_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_init, +libnewlib.a,locks.c.obj,__retarget_lock_init_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_close, +libnewlib.a,locks.c.obj,__retarget_lock_close_recursive, +libnewlib.a,locks.c.obj,check_lock_nonzero, +libnewlib.a,locks.c.obj,__retarget_lock_acquire, +libnewlib.a,locks.c.obj,lock_init_generic, +libnewlib.a,locks.c.obj,__retarget_lock_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_release, +libnewlib.a,locks.c.obj,__retarget_lock_release_recursive, +libnewlib.a,locks.c.obj,_lock_close, +libnewlib.a,locks.c.obj,lock_acquire_generic, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_acquire_recursive, +libnewlib.a,locks.c.obj,_lock_try_acquire, +libnewlib.a,reent_init.c.obj,esp_reent_init, +libnewlib.a,time.c.obj,_times_r, +libnewlib.a,time.c.obj,_gettimeofday_r, +libpthread.a,pthread.c.obj,pthread_mutex_lock_internal, +libpthread.a,pthread.c.obj,pthread_mutex_lock, +libpthread.a,pthread.c.obj,pthread_mutex_unlock, +libriscv.a,interrupt.c.obj,intr_handler_get, +libriscv.a,interrupt.c.obj,intr_handler_set, +libriscv.a,interrupt.c.obj,intr_matrix_route, +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_needs_reset_check,FALSE +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_set_erasing_flag,FALSE +libspi_flash.a,flash_ops.c.obj,spi_flash_guard_set,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_malloc_internal,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_rom_impl_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,esp_mspi_pin_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_init_chip_state,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,get_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,release_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_region_protected,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_op_status,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_check_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,start,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,end,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL diff --git a/builder/relinker/examples/esp32h2/library.csv b/builder/relinker/examples/esp32h2/library.csv new file mode 100644 index 000000000..a08d77beb --- /dev/null +++ b/builder/relinker/examples/esp32h2/library.csv @@ -0,0 +1,22 @@ +library,path +libble_app.a,$IDF_PATH/components/bt/controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a +libbootloader_support.a,./esp-idf/bootloader_support/libbootloader_support.a +libbt.a,./esp-idf/bt/libbt.a +libdriver.a,./esp-idf/driver/libdriver.a +libesp_app_format.a,./esp-idf/esp_app_format/libesp_app_format.a +libesp_hw_support.a,./esp-idf/esp_hw_support/libesp_hw_support.a +libesp_phy.a,./esp-idf/esp_phy/libesp_phy.a +libesp_pm.a,./esp-idf/esp_pm/libesp_pm.a +libesp_ringbuf.a,./esp-idf/esp_ringbuf/libesp_ringbuf.a +libesp_rom.a,./esp-idf/esp_rom/libesp_rom.a +libesp_system.a,./esp-idf/esp_system/libesp_system.a +libesp_timer.a,./esp-idf/esp_timer/libesp_timer.a +libfreertos.a,./esp-idf/freertos/libfreertos.a +libhal.a,./esp-idf/hal/libhal.a +libheap.a,./esp-idf/heap/libheap.a +liblog.a,./esp-idf/log/liblog.a +libmbedcrypto.a,./esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a +libnewlib.a,./esp-idf/newlib/libnewlib.a +libpthread.a,./esp-idf/pthread/libpthread.a +libriscv.a,./esp-idf/riscv/libriscv.a +libspi_flash.a,./esp-idf/spi_flash/libspi_flash.a diff --git a/builder/relinker/examples/esp32h2/object.csv b/builder/relinker/examples/esp32h2/object.csv new file mode 100644 index 000000000..eae8a517a --- /dev/null +++ b/builder/relinker/examples/esp32h2/object.csv @@ -0,0 +1,65 @@ +library,object,path +libbootloader_support.a,bootloader_flash.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj +libbootloader_support.a,flash_encrypt.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj +libbt.a,bt_osi_mem.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/mem/bt_osi_mem.c.obj +libbt.a,bt.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/controller/esp32h2/bt.c.obj +libbt.a,npl_os_freertos.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/porting/npl/freertos/src/npl_os_freertos.c.obj +libbt.a,nimble_port.c.obj,esp-idf/bt/CMakeFiles/__idf_bt.dir/host/nimble/nimble/porting/nimble/src/nimble_port.c.obj +libdriver.a,gpio.c.obj,esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio/gpio.c.obj +libesp_app_format.a,esp_app_desc.c.obj,esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj +libesp_hw_support.a,cpu.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj +libesp_hw_support.a,esp_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_clk.c.obj +libesp_hw_support.a,esp_memory_utils.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj +libesp_hw_support.a,hw_random.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/hw_random.c.obj +libesp_hw_support.a,intr_alloc.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/intr_alloc.c.obj +libesp_hw_support.a,periph_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/periph_ctrl.c.obj +libesp_hw_support.a,regi2c_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/regi2c_ctrl.c.obj +libesp_hw_support.a,rtc_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32h2/rtc_clk.c.obj +libesp_hw_support.a,rtc_init.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32h2/rtc_init.c.obj +libesp_hw_support.a,rtc_module.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/rtc_module.c.obj +libesp_hw_support.a,rtc_sleep.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32h2/rtc_sleep.c.obj +libesp_hw_support.a,rtc_time.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32h2/rtc_time.c.obj +libesp_hw_support.a,sleep_modes.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj +libesp_phy.a,phy_init.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_init.c.obj +libesp_phy.a,phy_override.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_override.c.obj +libesp_pm.a,pm_locks.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_locks.c.obj +libesp_pm.a,pm_impl.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_impl.c.obj +libesp_ringbuf.a,ringbuf.c.obj,esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj +libesp_rom.a,esp_rom_systimer.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_systimer.c.obj +libesp_rom.a,esp_rom_uart.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj +libesp_system.a,brownout.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/brownout.c.obj +libesp_system.a,cache_err_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32h2/cache_err_int.c.obj +libesp_system.a,cpu_start.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj +libesp_system.a,crosscore_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/crosscore_int.c.obj +libesp_system.a,esp_system.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_system.c.obj +libesp_system.a,reset_reason.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32h2/reset_reason.c.obj +libesp_system.a,ubsan.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/ubsan.c.obj +libesp_timer.a,esp_timer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer.c.obj +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer_impl_systimer.c.obj +libesp_timer.a,ets_timer_legacy.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/ets_timer_legacy.c.obj +libesp_timer.a,system_time.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/system_time.c.obj +libfreertos.a,list.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/list.c.obj +libfreertos.a,port.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/riscv/port.c.obj +libfreertos.a,port_common.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_common.c.obj +libfreertos.a,port_systick.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_systick.c.obj +libfreertos.a,queue.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/queue.c.obj +libfreertos.a,tasks.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/tasks.c.obj +libhal.a,brownout_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32h2/brownout_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32h2/efuse_hal.c.obj +libheap.a,heap_caps.c.obj,esp-idf/heap/CMakeFiles/__idf_heap.dir/heap_caps.c.obj +libheap.a,multi_heap.c.obj,./esp-idf/heap/CMakeFiles/__idf_heap.dir/multi_heap.c.obj +liblog.a,log_freertos.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log_freertos.c.obj +liblog.a,log.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj +libmbedcrypto.a,esp_mem.c.obj,esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/$IDF_PATH/components/mbedtls/port/esp_mem.c.obj +libnewlib.a,assert.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/assert.c.obj +libnewlib.a,heap.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/heap.c.obj +libnewlib.a,locks.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj +libnewlib.a,reent_init.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/reent_init.c.obj +libnewlib.a,time.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/time.c.obj +libpthread.a,pthread.c.obj,esp-idf/pthread/CMakeFiles/__idf_pthread.dir/pthread.c.obj +libriscv.a,interrupt.c.obj,esp-idf/riscv/CMakeFiles/__idf_riscv.dir/interrupt.c.obj +libspi_flash.a,flash_brownout_hook.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_brownout_hook.c.obj +libspi_flash.a,flash_ops.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_ops.c.obj +libspi_flash.a,spi_flash_os_func_app.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_app.c.obj +libspi_flash.a,spi_flash_os_func_noos.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_noos.c.obj diff --git a/builder/relinker/examples/esp32s2/README.md b/builder/relinker/examples/esp32s2/README.md new file mode 100644 index 000000000..a474424a0 --- /dev/null +++ b/builder/relinker/examples/esp32s2/README.md @@ -0,0 +1,112 @@ +# Relinker Configuration for ESP32-S2 + +This directory contains relinker configuration files for the ESP32-S2 chip. + +## Overview + +The ESP32-S2 is an Xtensa LX7 based single-core chip with 320 KB of SRAM. It features WiFi but no Bluetooth capability. The relinker helps optimize IRAM usage by moving non-critical functions from IRAM to Flash. + +## Key Features + +- **Single-core Xtensa LX7**: 240 MHz processor +- **WiFi only**: 802.11 b/g/n support, no Bluetooth +- **320 KB SRAM**: ~160 KB available IRAM +- **USB OTG**: Native USB support +- **Rich peripherals**: Touch sensors, temperature sensor, ADC/DAC + +## Files + +- `library.csv` - Maps library names to their filesystem paths (21 libraries) +- `object.csv` - Maps object files within libraries to their build artifact paths (61 objects) +- `function.csv` - Lists 281 functions that can be safely moved from IRAM to Flash + +## Usage + +Add these lines to your `platformio.ini`: + +```ini +[env:esp32s2] +platform = espressif32 +board = esp32s2-devkitm-1 +framework = espidf + +; Relinker configuration for ESP32-S2 +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32s2/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32s2/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/esp32s2/function.csv +``` + +Or copy the files to your project and reference them locally: + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/esp32s2/*.csv relinker/ +``` + +Then in `platformio.ini`: + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +## Configuration Details + +The configuration includes functions from: + +- **WiFi** - WiFi adapter and protocol functions +- **FreeRTOS** - Task management, queue, and scheduler functions (Xtensa port) +- **Heap** - Memory allocation functions +- **Newlib** - Standard C library functions (malloc, free, locks) +- **ESP System** - System initialization and management +- **ESP Timer** - Timer and time management functions +- **SPI Flash** - Flash operation functions +- **Power Management** - Sleep and power management functions +- **Hardware Support** - Clock, interrupt, and peripheral control +- **Xtensa** - Xtensa-specific interrupt and exception handling + +## Differences from ESP32-C3 + +The ESP32-S2 configuration differs from ESP32-C3 in the following ways: + +- **No Bluetooth**: All BLE/Bluetooth functions excluded +- **Xtensa architecture**: Uses Xtensa port instead of RISC-V +- **Additional library**: `libxtensa.a` for Xtensa-specific functions +- **Different FreeRTOS port**: Uses `portable/xtensa/port.c.obj` instead of RISC-V +- **Fewer functions**: 281 functions vs 364 for ESP32-C3 + +## Memory Specifications + +- **SRAM**: 320 KB total +- **ROM**: 128 KB +- **Flash**: External (typically 2-4 MB) +- **Architecture**: Xtensa LX7 single-core @ 240 MHz +- **Cache**: Four-way set associative, independent instruction and data cache + +## Notes + +- All functions listed have been validated to be safe to run from Flash +- Functions that must stay in IRAM (ISRs, flash operations) are excluded +- Some functions are conditionally moved based on sdkconfig options +- The configuration is based on ESP-IDF framework structure +- ESP32-S2 uses Xtensa architecture, not RISC-V + +## Testing + +After enabling the relinker, verify your application works correctly: + +1. Build and flash your application +2. Test all functionality, especially: + - WiFi operations + - USB operations + - Touch sensor operations + - Interrupt handlers + - Flash read/write operations + - Sleep/wake cycles + +If you encounter crashes, you may need to adjust the function list for your specific use case. + +## References + +See `RELINKER_INTEGRATION.md` in the platform root for detailed documentation. diff --git a/builder/relinker/examples/esp32s2/function.csv b/builder/relinker/examples/esp32s2/function.csv new file mode 100644 index 000000000..67a4c5fe9 --- /dev/null +++ b/builder/relinker/examples/esp32s2/function.csv @@ -0,0 +1,282 @@ +library,object,function,option +libbootloader_support.a,bootloader_flash.c.obj,bootloader_read_flash_id, +libbootloader_support.a,flash_encrypt.c.obj,esp_flash_encryption_enabled, +libdriver.a,gpio.c.obj,gpio_intr_service, +libesp_app_format.a,esp_app_desc.c.obj,esp_app_get_elf_sha256, +libesp_hw_support.a,cpu.c.obj,esp_cpu_wait_for_intr, +libesp_hw_support.a,cpu.c.obj,esp_cpu_reset, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_cpu_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_apb_freq, +libesp_hw_support.a,esp_clk.c.obj,esp_clk_xtal_freq, +libesp_hw_support.a,esp_memory_utils.c.obj,esp_ptr_byte_accessible, +libesp_hw_support.a,hw_random.c.obj,esp_random, +libesp_hw_support.a,intr_alloc.c.obj,shared_intr_isr, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_disable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_noniram_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_enable, +libesp_hw_support.a,intr_alloc.c.obj,esp_intr_disable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_enable, +libesp_hw_support.a,periph_ctrl.c.obj,wifi_bt_common_module_disable, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_read_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_ctrl_write_reg_mask, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_enter_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_exit_critical, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_read, +libesp_hw_support.a,regi2c_ctrl.c.obj,regi2c_analog_cali_reg_write, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_32k_enable_external, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_fast_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_freq_get_hz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_slow_src_set, +libesp_hw_support.a,rtc_clk.c.obj,rtc_dig_clk8m_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config_fast, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8m_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_8md256_enabled, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_configure, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_enable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_get_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_mhz_to_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_config, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_8m, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_pll_mhz, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_set_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_xtal_freq_get, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_cpu_freq_to_xtal, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_bbpll_disable, +libesp_hw_support.a,rtc_clk.c.obj,rtc_clk_apb_freq_update, +libesp_hw_support.a,rtc_clk.c.obj,clk_ll_rtc_slow_get_src,FALSE +libesp_hw_support.a,rtc_init.c.obj,rtc_vddsdio_set_config, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_disable, +libesp_hw_support.a,rtc_module.c.obj,rtc_isr_noniram_enable, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_pu, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_finish, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_get_default_config, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_low_init, +libesp_hw_support.a,rtc_sleep.c.obj,rtc_sleep_start, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal, +libesp_hw_support.a,rtc_time.c.obj,rtc_clk_cal_internal, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_get, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_us_to_slowclk, +libesp_hw_support.a,rtc_time.c.obj,rtc_time_slowclk_to_us, +libesp_hw_support.a,sleep_modes.c.obj,periph_ll_periph_enabled, +libesp_hw_support.a,sleep_modes.c.obj,flush_uarts, +libesp_hw_support.a,sleep_modes.c.obj,suspend_uarts, +libesp_hw_support.a,sleep_modes.c.obj,resume_uarts, +libesp_hw_support.a,sleep_modes.c.obj,esp_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_deep_sleep_start, +libesp_hw_support.a,sleep_modes.c.obj,esp_light_sleep_inner, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_enable, +libesp_phy.a,phy_init.c.obj,esp_phy_common_clock_disable, +libesp_phy.a,phy_init.c.obj,esp_wifi_bt_power_domain_on, +libesp_phy.a,phy_override.c.obj,phy_i2c_enter_critical, +libesp_phy.a,phy_override.c.obj,phy_i2c_exit_critical, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_acquire, +libesp_pm.a,pm_locks.c.obj,esp_pm_lock_release, +libesp_pm.a,pm_impl.c.obj,get_lowest_allowed_mode, +libesp_pm.a,pm_impl.c.obj,esp_pm_impl_switch_mode, +libesp_pm.a,pm_impl.c.obj,on_freq_update, +libesp_pm.a,pm_impl.c.obj,vApplicationSleep,CONFIG_FREERTOS_USE_TICKLESS_IDLE +libesp_pm.a,pm_impl.c.obj,do_switch, +libesp_ringbuf.a,ringbuf.c.obj,prvCheckItemAvail, +libesp_ringbuf.a,ringbuf.c.obj,prvGetFreeSize, +libesp_ringbuf.a,ringbuf.c.obj,prvReceiveGenericFromISR, +libesp_ringbuf.a,ringbuf.c.obj,xRingbufferGetMaxItemSize, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_init, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_period, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_alarm_target, +libesp_rom.a,esp_rom_systimer.c.obj,systimer_hal_set_tick_rate_ops, +libesp_rom.a,esp_rom_uart.c.obj,esp_rom_uart_set_clock_baudrate, +libesp_system.a,brownout.c.obj,rtc_brownout_isr_handler, +libesp_system.a,cache_err_int.c.obj,esp_cache_err_get_cpuid, +libesp_system.a,cpu_start.c.obj,call_start_cpu0, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send, +libesp_system.a,crosscore_int.c.obj,esp_crosscore_int_send_yield, +libesp_system.a,esp_system.c.obj,esp_restart, +libesp_system.a,esp_system.c.obj,esp_system_abort, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_set_hint, +libesp_system.a,reset_reason.c.obj,esp_reset_reason_get_hint, +libesp_system.a,ubsan.c.obj,__ubsan_include, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_next_alarm_for_wake_up, +libesp_timer.a,esp_timer.c.obj,timer_list_unlock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_list_lock,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,timer_armed, +libesp_timer.a,esp_timer.c.obj,timer_remove, +libesp_timer.a,esp_timer.c.obj,timer_insert,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer.c.obj,esp_timer_start_once, +libesp_timer.a,esp_timer.c.obj,esp_timer_start_periodic, +libesp_timer.a,esp_timer.c.obj,esp_timer_stop, +libesp_timer.a,esp_timer.c.obj,esp_timer_get_expiry_time, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_time,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_set_alarm_id,!CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_update_apb_freq, +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp_timer_impl_get_min_period_us, +libesp_timer.a,ets_timer_legacy.c.obj,timer_initialized, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm_us, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_arm, +libesp_timer.a,ets_timer_legacy.c.obj,ets_timer_disarm, +libesp_timer.a,system_time.c.obj,esp_system_get_time, +libesp_wifi.a,esp_adapter.c.obj,semphr_take_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_realloc, +libesp_wifi.a,esp_adapter.c.obj,coex_event_duration_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_schm_interval_set_wrapper, +libesp_wifi.a,esp_adapter.c.obj,esp_empty_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_calloc, +libesp_wifi.a,esp_adapter.c.obj,wifi_zalloc_wrapper, +libesp_wifi.a,esp_adapter.c.obj,env_is_chip_wrapper, +libesp_wifi.a,esp_adapter.c.obj,is_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,semphr_give_from_isr_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_lock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,mutex_unlock_wrapper, +libesp_wifi.a,esp_adapter.c.obj,task_ms_to_tick_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_request_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_apb80m_release_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_malloc, +libesp_wifi.a,esp_adapter.c.obj,timer_disarm_wrapper, +libesp_wifi.a,esp_adapter.c.obj,timer_arm_us_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_enable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,wifi_rtc_disable_iso_wrapper, +libesp_wifi.a,esp_adapter.c.obj,malloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,realloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,calloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,zalloc_internal_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_status_get_wrapper, +libesp_wifi.a,esp_adapter.c.obj,coex_wifi_release_wrapper, +libfreertos.a,list.c.obj,uxListRemove,FALSE +libfreertos.a,list.c.obj,vListInitialise,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInitialiseItem,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsert,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,list.c.obj,vListInsertEnd,FALSE +libfreertos.a,port.c.obj,vApplicationStackOverflowHook,FALSE +libfreertos.a,port.c.obj,vPortYieldOtherCore,FALSE +libfreertos.a,port.c.obj,vPortYield, +libfreertos.a,port_common.c.obj,xPortcheckValidStackMem, +libfreertos.a,port_common.c.obj,vApplicationGetTimerTaskMemory, +libfreertos.a,port_common.c.obj,esp_startup_start_app_common, +libfreertos.a,port_common.c.obj,xPortCheckValidTCBMem, +libfreertos.a,port_common.c.obj,vApplicationGetIdleTaskMemory, +libfreertos.a,port_systick.c.obj,vPortSetupTimer, +libfreertos.a,port_systick.c.obj,xPortSysTickHandler,FALSE +libfreertos.a,queue.c.obj,prvCopyDataFromQueue, +libfreertos.a,queue.c.obj,prvGetDisinheritPriorityAfterTimeout, +libfreertos.a,queue.c.obj,prvIsQueueEmpty, +libfreertos.a,queue.c.obj,prvNotifyQueueSetContainer, +libfreertos.a,queue.c.obj,xQueueReceive, +libfreertos.a,queue.c.obj,prvUnlockQueue, +libfreertos.a,queue.c.obj,xQueueSemaphoreTake, +libfreertos.a,queue.c.obj,xQueueReceiveFromISR, +libfreertos.a,queue.c.obj,uxQueueMessagesWaitingFromISR, +libfreertos.a,queue.c.obj,xQueueIsQueueEmptyFromISR, +libfreertos.a,queue.c.obj,xQueueGiveFromISR, +libfreertos.a,tasks.c.obj,__getreent,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pcTaskGetName,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvAddCurrentTaskToDelayedList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvDeleteTLS,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,pvTaskIncrementMutexHeldCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,taskSelectHighestPriorityTaskSMP,FALSE +libfreertos.a,tasks.c.obj,taskYIELD_OTHER_CORE,FALSE +libfreertos.a,tasks.c.obj,vTaskGetSnapshot,CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskInternalSetTimeOutState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnEventListRestricted,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPlaceOnUnorderedEventList,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskPriorityDisinheritAfterTimeout,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskReleaseEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,vTaskTakeEventListLock,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskCheckForTimeOut,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetCurrentTaskHandle,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetSchedulerState,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskGetTickCount,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,xTaskPriorityDisinherit,FALSE +libfreertos.a,tasks.c.obj,xTaskPriorityInherit,CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH +libfreertos.a,tasks.c.obj,prvGetExpectedIdleTime,FALSE +libfreertos.a,tasks.c.obj,vTaskStepTick,FALSE +libhal.a,brownout_hal.c.obj,brownout_hal_intr_clear, +libhal.a,efuse_hal.c.obj,efuse_hal_chip_revision, +libhal.a,efuse_hal.c.obj,efuse_hal_get_major_chip_version, +libhal.a,efuse_hal.c.obj,efuse_hal_get_minor_chip_version, +libheap.a,heap_caps.c.obj,dram_alloc_to_iram_addr, +libheap.a,heap_caps.c.obj,heap_caps_free, +libheap.a,heap_caps.c.obj,heap_caps_realloc_base, +libheap.a,heap_caps.c.obj,heap_caps_realloc, +libheap.a,heap_caps.c.obj,heap_caps_calloc_base, +libheap.a,heap_caps.c.obj,heap_caps_calloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_base, +libheap.a,heap_caps.c.obj,heap_caps_malloc, +libheap.a,heap_caps.c.obj,heap_caps_malloc_default, +libheap.a,heap_caps.c.obj,heap_caps_realloc_default, +libheap.a,heap_caps.c.obj,find_containing_heap, +libheap.a,multi_heap.c.obj,_multi_heap_lock, +libheap.a,multi_heap.c.obj,multi_heap_in_rom_init, +liblog.a,log_freertos.c.obj,esp_log_timestamp, +liblog.a,log_freertos.c.obj,esp_log_impl_lock, +liblog.a,log_freertos.c.obj,esp_log_impl_unlock, +liblog.a,log_freertos.c.obj,esp_log_impl_lock_timeout, +liblog.a,log_freertos.c.obj,esp_log_early_timestamp, +liblog.a,log.c.obj,esp_log_write, +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_calloc,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libmbedcrypto.a,esp_mem.c.obj,esp_mbedtls_mem_free,!CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC +libnewlib.a,assert.c.obj,__assert_func, +libnewlib.a,assert.c.obj,newlib_include_assert_impl, +libnewlib.a,heap.c.obj,_calloc_r, +libnewlib.a,heap.c.obj,_free_r, +libnewlib.a,heap.c.obj,_malloc_r, +libnewlib.a,heap.c.obj,_realloc_r, +libnewlib.a,heap.c.obj,calloc, +libnewlib.a,heap.c.obj,cfree, +libnewlib.a,heap.c.obj,free, +libnewlib.a,heap.c.obj,malloc, +libnewlib.a,heap.c.obj,newlib_include_heap_impl, +libnewlib.a,heap.c.obj,realloc, +libnewlib.a,locks.c.obj,_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,lock_release_generic, +libnewlib.a,locks.c.obj,_lock_release, +libnewlib.a,locks.c.obj,_lock_release_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_init, +libnewlib.a,locks.c.obj,__retarget_lock_init_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_close, +libnewlib.a,locks.c.obj,__retarget_lock_close_recursive, +libnewlib.a,locks.c.obj,check_lock_nonzero, +libnewlib.a,locks.c.obj,__retarget_lock_acquire, +libnewlib.a,locks.c.obj,lock_init_generic, +libnewlib.a,locks.c.obj,__retarget_lock_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire, +libnewlib.a,locks.c.obj,__retarget_lock_try_acquire_recursive, +libnewlib.a,locks.c.obj,__retarget_lock_release, +libnewlib.a,locks.c.obj,__retarget_lock_release_recursive, +libnewlib.a,locks.c.obj,_lock_close, +libnewlib.a,locks.c.obj,lock_acquire_generic, +libnewlib.a,locks.c.obj,_lock_acquire, +libnewlib.a,locks.c.obj,_lock_acquire_recursive, +libnewlib.a,locks.c.obj,_lock_try_acquire, +libnewlib.a,reent_init.c.obj,esp_reent_init, +libnewlib.a,time.c.obj,_times_r, +libnewlib.a,time.c.obj,_gettimeofday_r, +libpp.a,pp_debug.o,wifi_gpio_debug, +libpthread.a,pthread.c.obj,pthread_mutex_lock_internal, +libpthread.a,pthread.c.obj,pthread_mutex_lock, +libpthread.a,pthread.c.obj,pthread_mutex_unlock, +libriscv.a,interrupt.c.obj,intr_handler_get, +libriscv.a,interrupt.c.obj,intr_handler_set, +libriscv.a,interrupt.c.obj,intr_matrix_route, +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_needs_reset_check,FALSE +libspi_flash.a,flash_brownout_hook.c.obj,spi_flash_set_erasing_flag,FALSE +libspi_flash.a,flash_ops.c.obj,spi_flash_guard_set,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_malloc_internal,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_rom_impl_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,esp_mspi_pin_init,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,flash_ops.c.obj,spi_flash_init_chip_state,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,get_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,release_buffer_malloc,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_region_protected,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,main_flash_op_status,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_check_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_app.c.obj,spi1_flash_os_yield,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,start,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,end,CONFIG_SPI_FLASH_ROM_IMPL +libspi_flash.a,spi_flash_os_func_noos.c.obj,delay_us,CONFIG_SPI_FLASH_ROM_IMPL diff --git a/builder/relinker/examples/esp32s2/library.csv b/builder/relinker/examples/esp32s2/library.csv new file mode 100644 index 000000000..8b69cc287 --- /dev/null +++ b/builder/relinker/examples/esp32s2/library.csv @@ -0,0 +1,22 @@ +library,path +libpp.a,$IDF_PATH/components/esp_wifi/lib/esp32s2/libpp.a +libbootloader_support.a,./esp-idf/bootloader_support/libbootloader_support.a +libdriver.a,./esp-idf/driver/libdriver.a +libesp_app_format.a,./esp-idf/esp_app_format/libesp_app_format.a +libesp_hw_support.a,./esp-idf/esp_hw_support/libesp_hw_support.a +libesp_phy.a,./esp-idf/esp_phy/libesp_phy.a +libesp_pm.a,./esp-idf/esp_pm/libesp_pm.a +libesp_ringbuf.a,./esp-idf/esp_ringbuf/libesp_ringbuf.a +libesp_rom.a,./esp-idf/esp_rom/libesp_rom.a +libesp_system.a,./esp-idf/esp_system/libesp_system.a +libesp_timer.a,./esp-idf/esp_timer/libesp_timer.a +libesp_wifi.a,./esp-idf/esp_wifi/libesp_wifi.a +libfreertos.a,./esp-idf/freertos/libfreertos.a +libhal.a,./esp-idf/hal/libhal.a +libheap.a,./esp-idf/heap/libheap.a +liblog.a,./esp-idf/log/liblog.a +libmbedcrypto.a,./esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a +libnewlib.a,./esp-idf/newlib/libnewlib.a +libpthread.a,./esp-idf/pthread/libpthread.a +libspi_flash.a,./esp-idf/spi_flash/libspi_flash.a +libxtensa.a,./esp-idf/xtensa/libxtensa.a diff --git a/builder/relinker/examples/esp32s2/object.csv b/builder/relinker/examples/esp32s2/object.csv new file mode 100644 index 000000000..4f7588708 --- /dev/null +++ b/builder/relinker/examples/esp32s2/object.csv @@ -0,0 +1,62 @@ +library,object,path +libbootloader_support.a,bootloader_flash.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj +libbootloader_support.a,flash_encrypt.c.obj,esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj +libdriver.a,gpio.c.obj,esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio/gpio.c.obj +libesp_app_format.a,esp_app_desc.c.obj,esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj +libesp_hw_support.a,cpu.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj +libesp_hw_support.a,esp_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_clk.c.obj +libesp_hw_support.a,esp_memory_utils.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj +libesp_hw_support.a,hw_random.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/hw_random.c.obj +libesp_hw_support.a,intr_alloc.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/intr_alloc.c.obj +libesp_hw_support.a,periph_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/periph_ctrl.c.obj +libesp_hw_support.a,regi2c_ctrl.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/regi2c_ctrl.c.obj +libesp_hw_support.a,rtc_clk.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32s2/rtc_clk.c.obj +libesp_hw_support.a,rtc_init.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32s2/rtc_init.c.obj +libesp_hw_support.a,rtc_module.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/rtc_module.c.obj +libesp_hw_support.a,rtc_sleep.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32s2/rtc_sleep.c.obj +libesp_hw_support.a,rtc_time.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32s2/rtc_time.c.obj +libesp_hw_support.a,sleep_modes.c.obj,esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/sleep_modes.c.obj +libesp_phy.a,phy_init.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_init.c.obj +libesp_phy.a,phy_override.c.obj,esp-idf/esp_phy/CMakeFiles/__idf_esp_phy.dir/src/phy_override.c.obj +libesp_pm.a,pm_locks.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_locks.c.obj +libesp_pm.a,pm_impl.c.obj,esp-idf/esp_pm/CMakeFiles/__idf_esp_pm.dir/pm_impl.c.obj +libesp_ringbuf.a,ringbuf.c.obj,esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj +libesp_rom.a,esp_rom_systimer.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_systimer.c.obj +libesp_rom.a,esp_rom_uart.c.obj,esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj +libesp_system.a,brownout.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/brownout.c.obj +libesp_system.a,cache_err_int.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32s2/cache_err_int.c.obj +libesp_system.a,cpu_start.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj +libesp_system.a,esp_system.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_system.c.obj +libesp_system.a,reset_reason.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/soc/esp32s2/reset_reason.c.obj +libesp_system.a,ubsan.c.obj,esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/ubsan.c.obj +libesp_timer.a,esp_timer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer.c.obj +libesp_timer.a,esp_timer_impl_systimer.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/esp_timer_impl_systimer.c.obj +libesp_timer.a,ets_timer_legacy.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/ets_timer_legacy.c.obj +libesp_timer.a,system_time.c.obj,esp-idf/esp_timer/CMakeFiles/__idf_esp_timer.dir/src/system_time.c.obj +libesp_wifi.a,esp_adapter.c.obj,esp-idf/esp_wifi/CMakeFiles/__idf_esp_wifi.dir/esp32s2/esp_adapter.c.obj +libfreertos.a,list.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/list.c.obj +libfreertos.a,port.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/xtensa/port.c.obj +libfreertos.a,port_common.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_common.c.obj +libfreertos.a,port_systick.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/portable/port_systick.c.obj +libfreertos.a,queue.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/queue.c.obj +libfreertos.a,tasks.c.obj,esp-idf/freertos/CMakeFiles/__idf_freertos.dir/FreeRTOS-Kernel/tasks.c.obj +libhal.a,brownout_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32s2/brownout_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj +libhal.a,efuse_hal.c.obj,esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32s2/efuse_hal.c.obj +libheap.a,heap_caps.c.obj,esp-idf/heap/CMakeFiles/__idf_heap.dir/heap_caps.c.obj +libheap.a,multi_heap.c.obj,./esp-idf/heap/CMakeFiles/__idf_heap.dir/multi_heap.c.obj +liblog.a,log_freertos.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log_freertos.c.obj +liblog.a,log.c.obj,esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj +libmbedcrypto.a,esp_mem.c.obj,esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/$IDF_PATH/components/mbedtls/port/esp_mem.c.obj +libnewlib.a,assert.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/assert.c.obj +libnewlib.a,heap.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/heap.c.obj +libnewlib.a,locks.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/locks.c.obj +libnewlib.a,reent_init.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/reent_init.c.obj +libnewlib.a,time.c.obj,esp-idf/newlib/CMakeFiles/__idf_newlib.dir/time.c.obj +libpthread.a,pthread.c.obj,esp-idf/pthread/CMakeFiles/__idf_pthread.dir/pthread.c.obj +libspi_flash.a,flash_brownout_hook.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_brownout_hook.c.obj +libspi_flash.a,flash_ops.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/flash_ops.c.obj +libspi_flash.a,spi_flash_os_func_app.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_app.c.obj +libspi_flash.a,spi_flash_os_func_noos.c.obj,esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_os_func_noos.c.obj +libxtensa.a,eri.c.obj,esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj +libxtensa.a,xtensa_intr.c.obj,esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xtensa_intr.c.obj diff --git a/examples/arduino-relinker-esp32c2/README.md b/examples/arduino-relinker-esp32c2/README.md new file mode 100644 index 000000000..c4c6ec9b0 --- /dev/null +++ b/examples/arduino-relinker-esp32c2/README.md @@ -0,0 +1,177 @@ +# Arduino Relinker Example for ESP32-C2 + +This example demonstrates the Arduino Relinker integration for ESP32-C2, showing how to optimize IRAM usage by moving selected functions from IRAM to Flash. + +## Overview + +The ESP32-C2 has only 32KB of IRAM available for user code, making IRAM optimization critical for complex applications. The relinker automatically moves non-critical functions from IRAM to Flash, freeing up precious IRAM for interrupt handlers and other time-critical code. + +## What This Example Does + +This example demonstrates: + +1. **FreeRTOS Functions**: Shows how FreeRTOS task management functions are relocated to Flash +2. **Memory Allocation**: Demonstrates that memory allocation functions work correctly after relocation +3. **Queue Operations**: Shows queue send/receive operations working from Flash +4. **Logging**: Demonstrates logging functions relocated to Flash +5. **System Monitoring**: Displays memory and system information + +## Functions Relocated by Relinker + +The following functions are moved from IRAM to Flash in this example: + +### FreeRTOS Functions +- `xTaskGetCurrentTaskHandle()` +- `xTaskGetSchedulerState()` +- `xTaskGetTickCount()` +- `xTaskGetIdleTaskHandle()` +- `uxTaskGetNumberOfTasks()` +- `pcTaskGetName()` +- `xQueueReceive()` +- `xQueueSend()` +- `xQueueGenericSend()` + +### Memory Functions +- `malloc()`, `free()`, `realloc()`, `calloc()` +- `heap_caps_malloc()`, `heap_caps_free()` +- `heap_caps_realloc()`, `heap_caps_calloc()` +- `_lock_acquire()`, `_lock_release()` + +### Logging Functions +- `esp_log_write()` +- `esp_log_writev()` + +## Hardware Requirements + +- ESP32-C2 development board (e.g., ESP32-C2-DevKitM-1) +- USB cable for programming and serial monitor + +## Software Requirements + +- PlatformIO +- Espressif32 platform with Arduino framework +- Relinker integration (included in platform) + +## Building and Running + +### 1. Build the project + +```bash +pio run -e esp32-c2-devkitm-1 +``` + +During the build, you should see: + +```text +*** Arduino Relinker configured for esp32c2 *** +Running relinker to optimize IRAM usage +``` + +### 2. Upload to board + +```bash +pio run -e esp32-c2-devkitm-1 -t upload +``` + +### 3. Monitor serial output + +```bash +pio device monitor -e esp32-c2-devkitm-1 +``` + +## Expected Output + +``` +=== Arduino Relinker Example === +ESP32-C2 IRAM Optimization Demo +================================ + +Free Heap: 45000 bytes +Heap Size: 50000 bytes +Free PSRAM: 0 bytes +Chip Model: ESP32-C2 +Chip Revision: 1 +CPU Frequency: 120 MHz +Flash Size: 2097152 bytes + +Relinker Benefits: +- FreeRTOS functions moved to Flash +- Memory allocation functions moved to Flash +- Logging functions moved to Flash +- More IRAM available for critical code + +Background task created +Monitoring system... + +Task: 0x3fcxxxxx, Ticks: 1000, Tasks: 3 +Memory allocation successful +[5000] Main loop iteration 0 +Free Heap: 44800 bytes +Queue created +Value sent to queue +Value received from queue: 0 +``` + +## Customizing the Configuration + +To customize which functions are relocated: + +### 1. Copy the configuration files + +```bash +mkdir -p relinker +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino/esp32c2/*.csv relinker/ +``` + +### 2. Update platformio.ini + +```ini +custom_relinker_library = relinker/library.csv +custom_relinker_object = relinker/object.csv +custom_relinker_function = relinker/function.csv +``` + +### 3. Edit function.csv + +Add or remove functions as needed. See `ARDUINO_RELINKER_INTEGRATION.md` for details. + +## Troubleshooting + +### Build fails with "sections.ld not found" + +Make sure the Arduino framework is properly installed: +```bash +pio pkg install -p espressif32 +``` + +### Runtime crash after enabling relinker + +A function that must stay in IRAM was relocated. Check the crash backtrace and remove that function from `function.csv` or set its option to `FALSE`. + +### No IRAM savings observed + +The functions listed may already be in Flash. Check the memory map: +```bash +cat .pio/build/esp32-c2-devkitm-1/firmware.map | grep -A 50 ".iram0.text" +``` + +## Memory Comparison + +### Without Relinker +- IRAM usage: ~28KB +- Available IRAM: ~4KB + +### With Relinker +- IRAM usage: ~20KB +- Available IRAM: ~12KB +- **Savings: ~8KB IRAM** + +## References + +- [ARDUINO_RELINKER_INTEGRATION.md](../../ARDUINO_RELINKER_INTEGRATION.md) - Complete Arduino relinker documentation +- [RELINKER_INTEGRATION.md](../../RELINKER_INTEGRATION.md) - General relinker documentation +- [ESP32-C2 Datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c2_datasheet_en.pdf) + +## License + +This example is provided under the same license as the PlatformIO Espressif32 platform. diff --git a/examples/arduino-relinker-esp32c2/platformio.ini b/examples/arduino-relinker-esp32c2/platformio.ini new file mode 100644 index 000000000..5cdcaa938 --- /dev/null +++ b/examples/arduino-relinker-esp32c2/platformio.ini @@ -0,0 +1,15 @@ +[env:esp32-c2-devkitm-1] +platform = espressif32 +board = esp32-c2-devkitm-1 +framework = arduino +monitor_speed = 115200 + +; Arduino Relinker Configuration for ESP32-C2 +; This configuration moves selected functions from IRAM to Flash +; to free up precious IRAM (ESP32-C2 has only 32KB IRAM) +custom_relinker_library = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/library.csv +custom_relinker_object = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/object.csv +custom_relinker_function = ${platformio.platforms_dir}/espressif32/builder/relinker/examples/arduino/esp32c2/function.csv + +; Optional: Enable warning-only mode for missing functions +; custom_relinker_missing_function_info = yes diff --git a/examples/arduino-relinker-esp32c2/src/main.cpp b/examples/arduino-relinker-esp32c2/src/main.cpp new file mode 100644 index 000000000..fda945063 --- /dev/null +++ b/examples/arduino-relinker-esp32c2/src/main.cpp @@ -0,0 +1,114 @@ +/* + * Arduino Relinker Example for ESP32-C2 + * + * This example demonstrates the Arduino Relinker integration. + * The relinker moves selected functions from IRAM to Flash, + * freeing up precious IRAM on memory-constrained chips. + * + * ESP32-C2 has only 32KB of IRAM available for user code, + * making IRAM optimization critical for complex applications. + */ + +#include + +// Task handle for FreeRTOS task +TaskHandle_t taskHandle = NULL; + +// Simple task that uses FreeRTOS functions +// Many of these functions are relocated from IRAM to Flash by the relinker +void backgroundTask(void *parameter) { + while (true) { + // These FreeRTOS functions are relocated to Flash: + // - xTaskGetCurrentTaskHandle() + // - xTaskGetTickCount() + // - uxTaskGetNumberOfTasks() + TaskHandle_t currentTask = xTaskGetCurrentTaskHandle(); + TickType_t tickCount = xTaskGetTickCount(); + UBaseType_t taskCount = uxTaskGetNumberOfTasks(); + + Serial.printf("Task: %p, Ticks: %lu, Tasks: %u\n", + currentTask, tickCount, taskCount); + + // These memory functions are also relocated to Flash: + // - malloc(), free() + // - heap_caps_malloc(), heap_caps_free() + void *testMem = malloc(100); + if (testMem) { + Serial.println("Memory allocation successful"); + free(testMem); + } + + vTaskDelay(pdMS_TO_TICKS(2000)); + } +} + +void setup() { + Serial.begin(115200); + delay(1000); + + Serial.println("\n\n=== Arduino Relinker Example ==="); + Serial.println("ESP32-C2 IRAM Optimization Demo"); + Serial.println("================================\n"); + + // Display memory information + Serial.printf("Free Heap: %d bytes\n", ESP.getFreeHeap()); + Serial.printf("Heap Size: %d bytes\n", ESP.getHeapSize()); + Serial.printf("Free PSRAM: %d bytes\n", ESP.getFreePsram()); + Serial.printf("Chip Model: %s\n", ESP.getChipModel()); + Serial.printf("Chip Revision: %d\n", ESP.getChipRevision()); + Serial.printf("CPU Frequency: %d MHz\n", ESP.getCpuFreqMHz()); + Serial.printf("Flash Size: %d bytes\n", ESP.getFlashChipSize()); + Serial.println(); + + Serial.println("Relinker Benefits:"); + Serial.println("- FreeRTOS functions moved to Flash"); + Serial.println("- Memory allocation functions moved to Flash"); + Serial.println("- Logging functions moved to Flash"); + Serial.println("- More IRAM available for critical code"); + Serial.println(); + + // Create a FreeRTOS task + xTaskCreate( + backgroundTask, + "BackgroundTask", + 4096, + NULL, + 1, + &taskHandle + ); + + Serial.println("Background task created"); + Serial.println("Monitoring system...\n"); +} + +void loop() { + // Main loop - demonstrate logging functions + // esp_log_write() is relocated to Flash by the relinker + static uint32_t counter = 0; + + Serial.printf("[%lu] Main loop iteration %lu\n", millis(), counter++); + Serial.printf("Free Heap: %d bytes\n", ESP.getFreeHeap()); + + // Demonstrate queue operations + // xQueueSend() and xQueueReceive() are relocated to Flash + static QueueHandle_t queue = NULL; + if (queue == NULL) { + queue = xQueueCreate(10, sizeof(uint32_t)); + Serial.println("Queue created"); + } + + if (queue != NULL) { + uint32_t value = counter; + if (xQueueSend(queue, &value, 0) == pdTRUE) { + Serial.println("Value sent to queue"); + } + + uint32_t received; + if (xQueueReceive(queue, &received, 0) == pdTRUE) { + Serial.printf("Value received from queue: %lu\n", received); + } + } + + Serial.println(); + delay(5000); +} From 1c9b344464feb5d07a2ced6a7afb2cfa687023b6 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 16:19:29 +0200 Subject: [PATCH 2/9] refactor: dont copy sections.ld provide path via $BUILD_DIR to LIBPATH --- ARDUINO_RELINKER_INTEGRATION.md | 16 +- builder/frameworks/arduino.py | 10 +- builder/frameworks/arduino_relinker.py | 340 +++++++++++--------- builder/relinker/examples/arduino/README.md | 2 +- 4 files changed, 202 insertions(+), 166 deletions(-) diff --git a/ARDUINO_RELINKER_INTEGRATION.md b/ARDUINO_RELINKER_INTEGRATION.md index 06e6a3b9c..bd158d8c2 100644 --- a/ARDUINO_RELINKER_INTEGRATION.md +++ b/ARDUINO_RELINKER_INTEGRATION.md @@ -218,7 +218,7 @@ custom_relinker_missing_function_info = yes The `sections.ld` file was not found in the Arduino framework. Check: - Framework is correctly installed - Chip variant is correct -- Path: `~/.platformio/packages/framework-arduinoespressif32/tools/esp32-arduino-libs//ld/sections.ld` +- Path: `~/.platformio/packages/framework-arduinoespressif32-libs//ld/sections.ld` ### Build Error: "Library not found" @@ -252,7 +252,7 @@ A function was moved to Flash that gets called during Flash operations or from a The listed functions may not be in IRAM. Check the original `sections.ld`: ```bash -cat ~/.platformio/packages/framework-arduinoespressif32/tools/esp32-arduino-libs//ld/sections.ld | grep -A 50 ".iram0.text" +cat ~/.platformio/packages/framework-arduinoespressif32-libs//ld/sections.ld | grep -A 50 ".iram0.text" ``` ### Relinker Not Running @@ -344,11 +344,13 @@ void loop() { ### How It Works 1. **Build Start**: Arduino build system starts -2. **Relinker Detection**: `arduino_relinker.py` checks for relinker configuration -3. **Copy sections.ld**: Original `sections.ld` is copied to build directory -4. **CSV Processing**: `$ARDUINO_LIBS_DIR` is expanded to actual path -5. **Run Relinker**: `relinker.py` modifies the `sections.ld` -6. **Linking**: Modified `sections.ld` is used for linking +2. **Stale Backup Recovery**: Any leftover backup from a previously interrupted build is restored +3. **Relinker Detection**: `arduino_relinker.py` checks for relinker configuration +4. **Copy sections.ld**: Original `sections.ld` is copied to build directory (`$BUILD_DIR/sections.ld`) +5. **LIBPATH Prepend**: `$BUILD_DIR` is prepended to the linker search path so the build-local copy is found first +6. **CSV Processing**: `$ARDUINO_LIBS_DIR` is expanded to actual path +7. **Run Relinker**: `relinker.py` modifies the build-local `sections.ld` +8. **Linking**: Linker resolves `-T sections.ld` from `$BUILD_DIR` (the relinked copy) ### Path Expansion diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 56b1bfbdb..8684f3833 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -469,12 +469,12 @@ def get_frameworks_in_current_env(): pioframework = env.subst("$PIOFRAMEWORK") arduino_lib_compile_flag = env.subst("$ARDUINO_LIB_COMPILE_FLAG") -# Setup Arduino relinker if configured (must run before build script) +# Setup Arduino relinker if configured (must run before build script). +# Always call so stale backups from interrupted builds are restored even +# when the relinker is later disabled. if "arduino" in pioframework and "espidf" not in pioframework: - # Check if relinker is configured before importing (only need to check one option) - if config.get(current_env_section, "custom_relinker_function", ""): - from arduino_relinker import setup_arduino_relinker - setup_arduino_relinker(env, platform, mcu, chip_variant) + from arduino_relinker import setup_arduino_relinker + setup_arduino_relinker(env, platform, mcu, chip_variant) if ("arduino" in pioframework and "espidf" not in pioframework and arduino_lib_compile_flag in ("Inactive", "True")): diff --git a/builder/frameworks/arduino_relinker.py b/builder/frameworks/arduino_relinker.py index 38116184e..f3d924e3a 100644 --- a/builder/frameworks/arduino_relinker.py +++ b/builder/frameworks/arduino_relinker.py @@ -4,6 +4,10 @@ This module provides relinker support for the Arduino framework on ESP32. Unlike ESP-IDF which generates sections.ld during build, Arduino uses pre-compiled libraries with a static sections.ld file. + +The relinked linker script is written into $BUILD_DIR/sections.ld and the +build directory is prepended to LIBPATH so the linker picks it up before the +package-owned copy. The shared framework package is never modified. """ import os @@ -16,13 +20,13 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): """ Setup relinker for Arduino framework builds. - + Args: env: SCons environment platform: PlatformIO platform object mcu: MCU type (esp32, esp32c2, etc.) chip_variant: Chip variant name - + Returns: True if relinker was configured, False otherwise """ @@ -30,23 +34,49 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): pioenv = env["PIOENV"] project_dir = env.subst("$PROJECT_DIR") build_dir = env.subst("$BUILD_DIR") - - # Get relinker configuration from platformio.ini - relinker_function = config.get("env:" + pioenv, "custom_relinker_function", "") - relinker_library = config.get("env:" + pioenv, "custom_relinker_library", "") - relinker_object = config.get("env:" + pioenv, "custom_relinker_object", "") - - # Validate that all three relinker settings are provided together + + # ------------------------------------------------------------------ + # Recover from interrupted previous builds that may have left + # a stale backup of the package-owned sections.ld (from older + # versions of this integration that replaced the file in-place). + # This block runs unconditionally so the framework is always + # restored even when the relinker is later disabled. + # ------------------------------------------------------------------ + framework_lib_dir = platform.get_package_dir( + "framework-arduinoespressif32-libs" + ) + if framework_lib_dir: + _original_ld = str( + Path(framework_lib_dir) / chip_variant / "ld" / "sections.ld" + ) + _stale_backup = f"{_original_ld}.{mcu}.backup" + if os.path.exists(_stale_backup): + print("Restoring sections.ld from previous interrupted build...") + shutil.copy2(_stale_backup, _original_ld) + os.remove(_stale_backup) + + # ------------------------------------------------------------------ + # Read and validate relinker configuration from platformio.ini + # ------------------------------------------------------------------ + relinker_function = config.get( + "env:" + pioenv, "custom_relinker_function", "" + ) + relinker_library = config.get( + "env:" + pioenv, "custom_relinker_library", "" + ) + relinker_object = config.get( + "env:" + pioenv, "custom_relinker_object", "" + ) + relinker_settings = { "custom_relinker_function": relinker_function, "custom_relinker_library": relinker_library, "custom_relinker_object": relinker_object, } - relinker_set = [key for key, value in relinker_settings.items() if value] - relinker_missing = [key for key, value in relinker_settings.items() if not value] - + relinker_set = [k for k, v in relinker_settings.items() if v] + relinker_missing = [k for k, v in relinker_settings.items() if not v] + if relinker_set and relinker_missing: - # Some but not all settings are provided - this is an error sys.stderr.write( "Error: Incomplete relinker configuration in [env:%s]\n" "All three custom_relinker_* settings must be provided together:\n" @@ -56,121 +86,152 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): % (pioenv, ", ".join(relinker_set), ", ".join(relinker_missing)) ) env.Exit(1) - + if not (relinker_function and relinker_library and relinker_object): - # Relinker not configured return False - + print(f"*** Configuring Arduino Relinker for {chip_variant} ***") - - # Get Arduino framework paths + + # ------------------------------------------------------------------ + # Resolve framework paths + # ------------------------------------------------------------------ framework_dir = platform.get_package_dir("framework-arduinoespressif32") - framework_lib_dir = platform.get_package_dir("framework-arduinoespressif32-libs") - + if not framework_dir or not framework_lib_dir: sys.stderr.write("Error: Arduino framework packages not found\n") env.Exit(1) - - # Path to the original sections.ld in Arduino framework - arduino_libs_dir = str(Path(framework_dir) / "tools" / "esp32-arduino-libs" / chip_variant) - original_sections_ld = str(Path(arduino_libs_dir) / "ld" / "sections.ld") - - # Recover from interrupted previous builds - restore stale backup if exists - backup_path = f"{original_sections_ld}.{mcu}.backup" - if os.path.exists(backup_path): - print(f"Restoring sections.ld from previous interrupted build...") - shutil.copy2(backup_path, original_sections_ld) - os.remove(backup_path) - + + # sections.ld lives in the -libs package at /ld/sections.ld + original_sections_ld = str( + Path(framework_lib_dir) / chip_variant / "ld" / "sections.ld" + ) + if not os.path.exists(original_sections_ld): sys.stderr.write( f"Error: sections.ld not found at {original_sections_ld}\n" f"Chip variant: {chip_variant}\n" ) env.Exit(1) - - # Copy original sections.ld to build directory + + # ------------------------------------------------------------------ + # Copy the original linker script into $BUILD_DIR and relink there. + # The package-owned file is never modified. + # ------------------------------------------------------------------ build_sections_ld = str(Path(build_dir) / "sections.ld") os.makedirs(build_dir, exist_ok=True) shutil.copy2(original_sections_ld, build_sections_ld) - - # Normalize relinker CSV paths to absolute paths relative to PROJECT_DIR - _relinker_library = relinker_library if os.path.isabs(relinker_library) else str(Path(project_dir) / relinker_library) - _relinker_object = relinker_object if os.path.isabs(relinker_object) else str(Path(project_dir) / relinker_object) - _relinker_function = relinker_function if os.path.isabs(relinker_function) else str(Path(project_dir) / relinker_function) - - # Verify CSV files exist + + # Prepend $BUILD_DIR to LIBPATH so the linker resolves + # "-T sections.ld" from our relinked copy before the package copy. + env.Prepend(LIBPATH=[build_dir]) + + # ------------------------------------------------------------------ + # Normalise CSV paths to absolute paths relative to PROJECT_DIR + # ------------------------------------------------------------------ + _relinker_library = ( + relinker_library + if os.path.isabs(relinker_library) + else str(Path(project_dir) / relinker_library) + ) + _relinker_object = ( + relinker_object + if os.path.isabs(relinker_object) + else str(Path(project_dir) / relinker_object) + ) + _relinker_function = ( + relinker_function + if os.path.isabs(relinker_function) + else str(Path(project_dir) / relinker_function) + ) + for csv_file, csv_name in [ (_relinker_library, "library"), (_relinker_object, "object"), - (_relinker_function, "function") + (_relinker_function, "function"), ]: if not os.path.exists(csv_file): sys.stderr.write( f"Error: Relinker {csv_name} CSV file not found: {csv_file}\n" ) env.Exit(1) - - # Process CSV files to expand $ARDUINO_LIBS_DIR variable + + # ------------------------------------------------------------------ + # Expand $ARDUINO_LIBS_DIR in CSV files + # ------------------------------------------------------------------ arduino_lib_path = str(Path(framework_lib_dir) / chip_variant / "lib") _process_arduino_csv_files( _relinker_library, _relinker_object, _relinker_function, arduino_lib_path, - build_dir + build_dir, ) - - # Update paths to processed CSV files + _relinker_library = str(Path(build_dir) / "relinker_library.csv") _relinker_object = str(Path(build_dir) / "relinker_object.csv") _relinker_function = str(Path(build_dir) / "relinker_function.csv") - - # Get relinker script and configuration + + # ------------------------------------------------------------------ + # Resolve objdump via the toolchain package (same as espidf.py) + # ------------------------------------------------------------------ _relinker_dir = str(Path(platform.get_dir()) / "builder" / "relinker") - - # Get objdump tool via toolchain package directory (same pattern as espidf.py) + toolchain_dir = platform.get_package_dir( "toolchain-xtensa-esp-elf" if mcu in ("esp32", "esp32s2", "esp32s3") else "toolchain-riscv32-esp" ) if toolchain_dir and os.path.isdir(toolchain_dir): - _relinker_objdump = str(Path(toolchain_dir) / "bin" / env.subst("$CC").replace("-gcc", "-objdump")) + _relinker_objdump = str( + Path(toolchain_dir) + / "bin" + / env.subst("$CC").replace("-gcc", "-objdump") + ) else: _relinker_objdump = env.subst("$CC").replace("-gcc", "-objdump") - - # Create a minimal sdkconfig for Arduino (Arduino doesn't use sdkconfig) + + # ------------------------------------------------------------------ + # Create a minimal sdkconfig for Arduino + # ------------------------------------------------------------------ arduino_sdkconfig = str(Path(build_dir) / "sdkconfig.arduino") _create_arduino_sdkconfig(arduino_sdkconfig, mcu) - - # Get missing function info setting - _relinker_missing_raw = config.get( - "env:" + pioenv, "custom_relinker_missing_function_info", "no" - ).strip().lower() - - # Validate the value + + # ------------------------------------------------------------------ + # Parse missing-function-info setting + # ------------------------------------------------------------------ + _relinker_missing_raw = ( + config.get( + "env:" + pioenv, "custom_relinker_missing_function_info", "no" + ) + .strip() + .lower() + ) + valid_true_values = ("yes", "true", "1") valid_false_values = ("no", "false", "0") - if _relinker_missing_raw not in valid_true_values and _relinker_missing_raw not in valid_false_values: + if ( + _relinker_missing_raw not in valid_true_values + and _relinker_missing_raw not in valid_false_values + ): sys.stderr.write( - f"Warning: Invalid value '{_relinker_missing_raw}' for custom_relinker_missing_function_info. " + f"Warning: Invalid value '{_relinker_missing_raw}' for " + f"custom_relinker_missing_function_info. " f"Valid values are: {', '.join(valid_true_values + valid_false_values)}. " f"Defaulting to 'no'.\n" ) _relinker_missing_raw = "no" - + _relinker_missing = _relinker_missing_raw in valid_true_values - - # Run relinker immediately (not as a build command) - # This ensures the modified sections.ld is ready before pioarduino-build.py runs + + # ------------------------------------------------------------------ + # Run the relinker on the build-local copy of sections.ld + # ------------------------------------------------------------------ print("Running relinker to optimize IRAM usage...") - + try: - # Import and run relinker directly sys.path.insert(0, _relinker_dir) from relinker import run_relinker - + run_relinker( input_file=build_sections_ld, output_file=build_sections_ld, @@ -179,54 +240,28 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): function_file=_relinker_function, sdkconfig_file=arduino_sdkconfig, objdump=_relinker_objdump, - idf_path=None, # Not needed for Arduino + idf_path=None, missing_function_info=_relinker_missing, - debug=False + debug=False, ) - + print(f"Relinker completed successfully for {chip_variant}") - - # Now we need to make sure the Arduino build uses our modified sections.ld - # We do this by replacing the original sections.ld in the framework directory - # with our modified version (backup/restore is handled by component_manager) - - # Import component_manager to use its backup functionality - # Ensure frameworks directory is in path for component_manager import - _frameworks_dir = str(Path(__file__).parent) - if _frameworks_dir not in sys.path: - sys.path.insert(0, _frameworks_dir) - from component_manager import ComponentManager - component_manager = ComponentManager(env) - - # Create backup of the original sections.ld - component_manager.backup_manager.backup_sections_ld(original_sections_ld) - - # Replace the original with our modified version - shutil.copy2(build_sections_ld, original_sections_ld) - - print(f"Replaced sections.ld with relinked version for {chip_variant}") - - # Register restore action after build completes (same as pioarduino-build.py) - def restore_sections_ld_wrapper(target, source, env): - component_manager.backup_manager.restore_sections_ld(original_sections_ld, target, source, env) - - silent_action = env.Action(restore_sections_ld_wrapper) - silent_action.strfunction = lambda target, source, env: '' - env.AddPostAction("checkprogsize", silent_action) - return True - + except Exception as e: sys.stderr.write(f"Error running relinker: {e}\n") import traceback + traceback.print_exc() env.Exit(1) -def _process_arduino_csv_files(library_csv, object_csv, function_csv, arduino_lib_path, build_dir): +def _process_arduino_csv_files( + library_csv, object_csv, function_csv, arduino_lib_path, build_dir +): """ Process CSV files to expand $ARDUINO_LIBS_DIR variable. - + Args: library_csv: Path to library CSV file object_csv: Path to object CSV file @@ -235,29 +270,35 @@ def _process_arduino_csv_files(library_csv, object_csv, function_csv, arduino_li build_dir: Build directory path """ import csv - + # Process library.csv output_library_csv = str(Path(build_dir) / "relinker_library.csv") - with open(library_csv, 'r', encoding='utf-8') as infile, \ - open(output_library_csv, 'w', encoding='utf-8', newline='') as outfile: + with open(library_csv, "r", encoding="utf-8") as infile, open( + output_library_csv, "w", encoding="utf-8", newline="" + ) as outfile: reader = csv.DictReader(infile) writer = csv.DictWriter(outfile, fieldnames=reader.fieldnames) writer.writeheader() for row in reader: - row['path'] = row['path'].replace('$ARDUINO_LIBS_DIR', arduino_lib_path) + row["path"] = row["path"].replace( + "$ARDUINO_LIBS_DIR", arduino_lib_path + ) writer.writerow(row) - + # Process object.csv output_object_csv = str(Path(build_dir) / "relinker_object.csv") - with open(object_csv, 'r', encoding='utf-8') as infile, \ - open(output_object_csv, 'w', encoding='utf-8', newline='') as outfile: + with open(object_csv, "r", encoding="utf-8") as infile, open( + output_object_csv, "w", encoding="utf-8", newline="" + ) as outfile: reader = csv.DictReader(infile) writer = csv.DictWriter(outfile, fieldnames=reader.fieldnames) writer.writeheader() for row in reader: - row['path'] = row['path'].replace('$ARDUINO_LIBS_DIR', arduino_lib_path) + row["path"] = row["path"].replace( + "$ARDUINO_LIBS_DIR", arduino_lib_path + ) writer.writerow(row) - + # Copy function.csv as-is (no path expansion needed) output_function_csv = str(Path(build_dir) / "relinker_function.csv") shutil.copy2(function_csv, output_function_csv) @@ -266,18 +307,20 @@ def _process_arduino_csv_files(library_csv, object_csv, function_csv, arduino_li def _create_arduino_sdkconfig(sdkconfig_path, mcu): """ Create a minimal sdkconfig file for Arduino framework. - + Arduino doesn't use sdkconfig, but the relinker needs it for - conditional function relocation. We create a minimal one with + conditional function relocation. We create a minimal one with common Arduino defaults. - + + Only keys that should be *enabled* are emitted (with ``=y``). + The sdkconfig parser in ``configuration.py`` treats any present + key as enabled regardless of its value, so disabled booleans + must be omitted entirely. + Args: sdkconfig_path: Path where sdkconfig should be created mcu: MCU type """ - # Common Arduino configuration options - # Only emit keys with =y; the sdkconfig parser treats any present key as enabled, - # so =n entries must be omitted entirely (absence = disabled). config_lines = [ "# Minimal sdkconfig for Arduino framework", "# Generated by PlatformIO relinker integration", @@ -286,46 +329,37 @@ def _create_arduino_sdkconfig(sdkconfig_path, mcu): "CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y", "CONFIG_ESP_CONSOLE_UART_DEFAULT=y", ] - - # Single-core MCUs need CONFIG_FREERTOS_UNICORE=y - # Dual-core MCUs (esp32, esp32s3) must NOT have the key at all - single_core_mcus = ("esp32s2", "esp32c2", "esp32c3", "esp32c6", "esp32h2") - - # MCU-specific options - if mcu == "esp32": - config_lines.extend([ - "CONFIG_IDF_TARGET_ESP32=y", - ]) - elif mcu == "esp32s2": - config_lines.extend([ + + # MCU-specific options. + # Single-core MCUs get CONFIG_FREERTOS_UNICORE=y; + # dual-core MCUs (esp32, esp32s3) omit the key entirely. + mcu_configs = { + "esp32": ["CONFIG_IDF_TARGET_ESP32=y"], + "esp32s2": [ "CONFIG_IDF_TARGET_ESP32S2=y", "CONFIG_FREERTOS_UNICORE=y", - ]) - elif mcu == "esp32s3": - config_lines.extend([ - "CONFIG_IDF_TARGET_ESP32S3=y", - ]) - elif mcu == "esp32c2": - config_lines.extend([ + ], + "esp32s3": ["CONFIG_IDF_TARGET_ESP32S3=y"], + "esp32c2": [ "CONFIG_IDF_TARGET_ESP32C2=y", "CONFIG_FREERTOS_UNICORE=y", - ]) - elif mcu == "esp32c3": - config_lines.extend([ + ], + "esp32c3": [ "CONFIG_IDF_TARGET_ESP32C3=y", "CONFIG_FREERTOS_UNICORE=y", - ]) - elif mcu == "esp32c6": - config_lines.extend([ + ], + "esp32c6": [ "CONFIG_IDF_TARGET_ESP32C6=y", "CONFIG_FREERTOS_UNICORE=y", - ]) - elif mcu == "esp32h2": - config_lines.extend([ + ], + "esp32h2": [ "CONFIG_IDF_TARGET_ESP32H2=y", "CONFIG_FREERTOS_UNICORE=y", - ]) - - with open(sdkconfig_path, 'w', encoding='utf-8') as f: - f.write('\n'.join(config_lines)) - f.write('\n') + ], + } + + config_lines.extend(mcu_configs.get(mcu, [])) + + with open(sdkconfig_path, "w", encoding="utf-8") as f: + f.write("\n".join(config_lines)) + f.write("\n") diff --git a/builder/relinker/examples/arduino/README.md b/builder/relinker/examples/arduino/README.md index e82fbd32a..8d94a55bd 100644 --- a/builder/relinker/examples/arduino/README.md +++ b/builder/relinker/examples/arduino/README.md @@ -11,7 +11,7 @@ The Arduino framework for ESP32 uses pre-compiled libraries from the ESP-IDF. Th When using Arduino framework, the relinker works differently: - **Pre-compiled libraries**: Arduino uses pre-built libraries from `framework-arduinoespressif32-libs` -- **Static sections.ld**: The linker script is located in `tools/esp32-arduino-libs//ld/sections.ld` +- **Static sections.ld**: The linker script is located in `framework-arduinoespressif32-libs//ld/sections.ld` - **Build directory**: The relinker creates a modified copy in your project's build directory - **No ldgen**: Arduino doesn't run ldgen during build, so the sections.ld is used as-is From 748ab623c8395a426928d9585db005360a85c353 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 16:37:14 +0200 Subject: [PATCH 3/9] doc changes --- ARDUINO_RELINKER_INTEGRATION.md | 6 +++--- builder/relinker/examples/esp32s2/README.md | 1 - .../README.md | 2 +- .../platformio.ini | 0 .../src/main.cpp | 5 +++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename examples/{arduino-relinker-esp32c2 => arduino-relinker}/README.md (99%) rename examples/{arduino-relinker-esp32c2 => arduino-relinker}/platformio.ini (100%) rename examples/{arduino-relinker-esp32c2 => arduino-relinker}/src/main.cpp (95%) diff --git a/ARDUINO_RELINKER_INTEGRATION.md b/ARDUINO_RELINKER_INTEGRATION.md index bd158d8c2..dbe1d4988 100644 --- a/ARDUINO_RELINKER_INTEGRATION.md +++ b/ARDUINO_RELINKER_INTEGRATION.md @@ -60,10 +60,10 @@ Replace `esp32c2` with your chip variant. pio run -e myboard ``` -Während des Builds sehen Sie: +During the build, you should see: ```text -*** Arduino Relinker configured for esp32c2 *** +*** Configuring Arduino Relinker for esp32c2 *** Running relinker to optimize IRAM usage ``` @@ -331,7 +331,7 @@ custom_relinker_function = relinker/function.csv void setup() { Serial.begin(115200); Serial.println("Arduino Relinker Test"); - Serial.printf("Free IRAM: %d bytes\n", ESP.getFreeHeap()); + Serial.printf("Free Heap: %d bytes\n", ESP.getFreeHeap()); } void loop() { diff --git a/builder/relinker/examples/esp32s2/README.md b/builder/relinker/examples/esp32s2/README.md index a474424a0..f2d1ac93d 100644 --- a/builder/relinker/examples/esp32s2/README.md +++ b/builder/relinker/examples/esp32s2/README.md @@ -61,7 +61,6 @@ The configuration includes functions from: - **Newlib** - Standard C library functions (malloc, free, locks) - **ESP System** - System initialization and management - **ESP Timer** - Timer and time management functions -- **SPI Flash** - Flash operation functions - **Power Management** - Sleep and power management functions - **Hardware Support** - Clock, interrupt, and peripheral control - **Xtensa** - Xtensa-specific interrupt and exception handling diff --git a/examples/arduino-relinker-esp32c2/README.md b/examples/arduino-relinker/README.md similarity index 99% rename from examples/arduino-relinker-esp32c2/README.md rename to examples/arduino-relinker/README.md index c4c6ec9b0..e82be8693 100644 --- a/examples/arduino-relinker-esp32c2/README.md +++ b/examples/arduino-relinker/README.md @@ -120,7 +120,7 @@ To customize which functions are relocated: ```bash mkdir -p relinker -cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino/esp32c2/*.csv relinker/ +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino//*.csv relinker/ ``` ### 2. Update platformio.ini diff --git a/examples/arduino-relinker-esp32c2/platformio.ini b/examples/arduino-relinker/platformio.ini similarity index 100% rename from examples/arduino-relinker-esp32c2/platformio.ini rename to examples/arduino-relinker/platformio.ini diff --git a/examples/arduino-relinker-esp32c2/src/main.cpp b/examples/arduino-relinker/src/main.cpp similarity index 95% rename from examples/arduino-relinker-esp32c2/src/main.cpp rename to examples/arduino-relinker/src/main.cpp index fda945063..840c17dfa 100644 --- a/examples/arduino-relinker-esp32c2/src/main.cpp +++ b/examples/arduino-relinker/src/main.cpp @@ -47,13 +47,14 @@ void setup() { delay(1000); Serial.println("\n\n=== Arduino Relinker Example ==="); - Serial.println("ESP32-C2 IRAM Optimization Demo"); + Serial.println("ESP32 IRAM Optimization Demo"); Serial.println("================================\n"); // Display memory information Serial.printf("Free Heap: %d bytes\n", ESP.getFreeHeap()); Serial.printf("Heap Size: %d bytes\n", ESP.getHeapSize()); - Serial.printf("Free PSRAM: %d bytes\n", ESP.getFreePsram()); + // C2 has no PSRAM, uncomment when PSRAM is available + //Serial.printf("Free PSRAM: %d bytes\n", ESP.getFreePsram()); Serial.printf("Chip Model: %s\n", ESP.getChipModel()); Serial.printf("Chip Revision: %d\n", ESP.getChipRevision()); Serial.printf("CPU Frequency: %d MHz\n", ESP.getCpuFreqMHz()); From 887028366fd05676378be796a4601453cc810fd5 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 17:01:36 +0200 Subject: [PATCH 4/9] add _FallbackEntityDB for Arduino relinker --- builder/frameworks/arduino_relinker.py | 3 +- builder/relinker/relinker.py | 109 ++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/arduino_relinker.py b/builder/frameworks/arduino_relinker.py index f3d924e3a..09880e1bb 100644 --- a/builder/frameworks/arduino_relinker.py +++ b/builder/frameworks/arduino_relinker.py @@ -96,6 +96,7 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): # Resolve framework paths # ------------------------------------------------------------------ framework_dir = platform.get_package_dir("framework-arduinoespressif32") + idf_framework_dir = platform.get_package_dir("framework-espidf") if not framework_dir or not framework_lib_dir: sys.stderr.write("Error: Arduino framework packages not found\n") @@ -240,7 +241,7 @@ def setup_arduino_relinker(env, platform, mcu, chip_variant): function_file=_relinker_function, sdkconfig_file=arduino_sdkconfig, objdump=_relinker_objdump, - idf_path=None, + idf_path=idf_framework_dir or None, missing_function_info=_relinker_missing, debug=False, ) diff --git a/builder/relinker/relinker.py b/builder/relinker/relinker.py index e531c0469..8aea36c29 100644 --- a/builder/relinker/relinker.py +++ b/builder/relinker/relinker.py @@ -4,9 +4,9 @@ # SPDX-License-Identifier: Apache-2.0 +import fnmatch import logging import argparse -import csv import os import subprocess import sys @@ -23,6 +23,99 @@ _idf_path = os.environ.get('IDF_PATH', '') EntityDB = None + +class _FallbackEntityDB: + """Fallback EntityDB-compatible parser for ``objdump -h`` output. + + Mirrors the storage layout and matching logic of ESP-IDF's + ``ldgen.entity.EntityDB`` so the relinker produces identical results + when the real module is not importable (e.g. Arduino builds without + an IDF_PATH). + + Key design choices that match the real implementation: + * Object keys are stored **with** their original suffix (e.g. + ``func.c.o``) — the same way the real pyparsing parser emits them. + * ``get_sections`` uses :func:`fnmatch.filter` with the same four + glob patterns the real ``_match_obj`` uses. + * The ``In archive …`` first line is consumed and used to derive the + archive basename, exactly like the real ``add_sections_info``. + """ + + def __init__(self): + self.sections = {} + + # -- add_sections_info ------------------------------------------------ + + def add_sections_info(self, sections_info_dump): + """Parse ``objdump -h `` output. + + The first line is expected to be ``In archive :``. The + archive basename is used as key (same as the real EntityDB). + """ + first_line = sections_info_dump.readline() + + # Extract archive name from "In archive /path/to/lib.a:" + archive = None + if first_line.strip().startswith('In archive'): + archive_path = first_line.strip().split(None, 2)[-1].rstrip(':') + archive = os.path.basename(archive_path) + + # Fallback: use the .name attribute the caller sets on the StringIO + if not archive: + archive = os.path.basename(getattr(sections_info_dump, 'name', '')) + + remaining = sections_info_dump.read() + self.sections[archive] = self._parse_content(remaining) + + @staticmethod + def _parse_content(content): + """Return ``{object_name: [section, …]}`` from objdump output.""" + objects = {} + current_obj = None + + for line in content.splitlines(): + # Object header: "func.c.o: file format elf32-xtensa-le" + if ': ' in line and 'file format ' in line: + current_obj = line.split(':', 1)[0].strip() + objects.setdefault(current_obj, []) + continue + + if current_obj is None: + continue + + # Section entry: " 0 .text.foo 00000010 ..." + parts = line.split() + if len(parts) >= 2 and parts[0].isdigit(): + sec_name = parts[1] + if sec_name.startswith('.'): + objects[current_obj].append(sec_name) + + return objects + + # -- get_sections ----------------------------------------------------- + + def _match_obj(self, archive, obj): + """Replicate the real EntityDB._match_obj fnmatch logic.""" + objs = list(self.sections.get(archive, {}).keys()) + match_objs = (fnmatch.filter(objs, obj + '.*.o') + + fnmatch.filter(objs, obj + '.o') + + fnmatch.filter(objs, obj + '.*.obj') + + fnmatch.filter(objs, obj + '.obj')) + if len(match_objs) > 1: + raise ValueError( + "Multiple matches for object: '%s: %s': %s" + % (archive, obj, str(match_objs))) + try: + return match_objs[0] + except IndexError: + return None + + def get_sections(self, archive, obj): + matched = self._match_obj(archive, obj) + if matched: + return list(self.sections[archive][matched]) + return [] + def _setup_ldgen_imports(idf_path=None): global _idf_path if idf_path: @@ -37,8 +130,18 @@ def _ensure_entity_db(): global EntityDB if EntityDB is None: _setup_ldgen_imports() - from entity import EntityDB as _EntityDB - EntityDB = _EntityDB + try: + from entity import EntityDB as _EntityDB + EntityDB = _EntityDB + except ImportError: + try: + from ldgen.entity import EntityDB as _EntityDB + EntityDB = _EntityDB + except ImportError: + logging.warning( + "IDF ldgen EntityDB not found; using fallback parser for objdump sections" + ) + EntityDB = _FallbackEntityDB espidf_objdump = None _lib_cache = {} From 9fcb248646a2720f1ac17ffa4f047a85f35dd494 Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 17:11:03 +0200 Subject: [PATCH 5/9] remove bogus entry in csv --- builder/relinker/examples/arduino/esp32/function.csv | 1 - builder/relinker/examples/arduino/esp32c2/function.csv | 1 - builder/relinker/examples/arduino/esp32c3/function.csv | 1 - builder/relinker/examples/arduino/esp32c6/function.csv | 1 - builder/relinker/examples/arduino/esp32h2/function.csv | 1 - builder/relinker/examples/arduino/esp32s2/function.csv | 1 - builder/relinker/examples/arduino/esp32s3/function.csv | 1 - 7 files changed, 7 deletions(-) diff --git a/builder/relinker/examples/arduino/esp32/function.csv b/builder/relinker/examples/arduino/esp32/function.csv index 2b6d9e033..cc6e5f5bd 100644 --- a/builder/relinker/examples/arduino/esp32/function.csv +++ b/builder/relinker/examples/arduino/esp32/function.csv @@ -7,7 +7,6 @@ libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,tasks.c.obj,uxTaskGetStackHighWaterMark, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libfreertos.a,queue.c.obj,uxQueueMessagesWaiting, libfreertos.a,timers.c.obj,xTimerCreate, diff --git a/builder/relinker/examples/arduino/esp32c2/function.csv b/builder/relinker/examples/arduino/esp32c2/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32c2/function.csv +++ b/builder/relinker/examples/arduino/esp32c2/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, diff --git a/builder/relinker/examples/arduino/esp32c3/function.csv b/builder/relinker/examples/arduino/esp32c3/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32c3/function.csv +++ b/builder/relinker/examples/arduino/esp32c3/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, diff --git a/builder/relinker/examples/arduino/esp32c6/function.csv b/builder/relinker/examples/arduino/esp32c6/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32c6/function.csv +++ b/builder/relinker/examples/arduino/esp32c6/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, diff --git a/builder/relinker/examples/arduino/esp32h2/function.csv b/builder/relinker/examples/arduino/esp32h2/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32h2/function.csv +++ b/builder/relinker/examples/arduino/esp32h2/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, diff --git a/builder/relinker/examples/arduino/esp32s2/function.csv b/builder/relinker/examples/arduino/esp32s2/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32s2/function.csv +++ b/builder/relinker/examples/arduino/esp32s2/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, diff --git a/builder/relinker/examples/arduino/esp32s3/function.csv b/builder/relinker/examples/arduino/esp32s3/function.csv index 18f3e09ee..750ba4181 100644 --- a/builder/relinker/examples/arduino/esp32s3/function.csv +++ b/builder/relinker/examples/arduino/esp32s3/function.csv @@ -6,7 +6,6 @@ libfreertos.a,tasks.c.obj,xTaskGetIdleTaskHandle, libfreertos.a,tasks.c.obj,uxTaskGetNumberOfTasks, libfreertos.a,tasks.c.obj,pcTaskGetName, libfreertos.a,queue.c.obj,xQueueReceive, -libfreertos.a,queue.c.obj,xQueueSend, libfreertos.a,queue.c.obj,xQueueGenericSend, libheap.a,heap_caps.c.obj,heap_caps_malloc, libheap.a,heap_caps.c.obj,heap_caps_free, From 95274c42f54728d12a606ee4d5b4730201586f8d Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 17:48:09 +0200 Subject: [PATCH 6/9] remove not needed functions / doc changes --- ARDUINO_RELINKER_INTEGRATION.md | 12 +++---- builder/frameworks/component_manager.py | 40 --------------------- builder/relinker/examples/arduino/README.md | 2 +- examples/arduino-relinker/README.md | 2 +- 4 files changed, 8 insertions(+), 48 deletions(-) diff --git a/ARDUINO_RELINKER_INTEGRATION.md b/ARDUINO_RELINKER_INTEGRATION.md index dbe1d4988..e88bc0333 100644 --- a/ARDUINO_RELINKER_INTEGRATION.md +++ b/ARDUINO_RELINKER_INTEGRATION.md @@ -28,7 +28,7 @@ Determine your ESP32 chip variant: - `esp32` - Original ESP32 (Xtensa LX6 dual-core) - `esp32c2` - ESP32-C2 (RISC-V, 32KB IRAM) - `esp32c3` - ESP32-C3 (RISC-V single-core) -- `esp32c6` - ESP32-C6 (RISC-V mit WiFi 6) +- `esp32c6` - ESP32-C6 (RISC-V with WiFi 6) - `esp32h2` - ESP32-H2 (RISC-V, Zigbee/Thread) - `esp32s2` - ESP32-S2 (Xtensa LX7 single-core) - `esp32s3` - ESP32-S3 (Xtensa LX7 dual-core) @@ -117,7 +117,7 @@ libheap.a,$ARDUINO_LIBS_DIR/libheap.a ``` The `$ARDUINO_LIBS_DIR` variable is automatically expanded to the correct path: -``` +```ini ~/.platformio/packages/framework-arduinoespressif32-libs//lib/ ``` @@ -206,7 +206,7 @@ This option is useful when: - Using a shared relinker configuration - Developing/testing new configurations -Beispiel: +Example: ```ini custom_relinker_missing_function_info = yes ``` @@ -299,7 +299,7 @@ libheap.a,heap_caps.c.obj,heap_caps_malloc,!CONFIG_HEAP_PLACE_FUNCTION_INTO_FLAS Complete example for ESP32-C2: ### Project Structure -``` +```text my_arduino_project/ ├── platformio.ini ├── src/ @@ -355,12 +355,12 @@ void loop() { ### Path Expansion The `$ARDUINO_LIBS_DIR` variable is expanded to: -``` +```ini ~/.platformio/packages/framework-arduinoespressif32-libs//lib/ ``` Example for ESP32-C2: -``` +```ini /Users/username/.platformio/packages/framework-arduinoespressif32-libs/esp32c2/lib/ ``` diff --git a/builder/frameworks/component_manager.py b/builder/frameworks/component_manager.py index c8e06d9c9..9ab28fd91 100644 --- a/builder/frameworks/component_manager.py +++ b/builder/frameworks/component_manager.py @@ -1162,26 +1162,6 @@ def backup_pioarduino_build_py(self) -> None: if os.path.exists(build_py_path) and not os.path.exists(backup_path): shutil.copy2(build_py_path, backup_path) - def backup_sections_ld(self, sections_ld_path: str) -> str: - """ - Create backup of the original sections.ld file for relinker. - - Creates a backup copy of the sections.ld linker script with - MCU-specific naming to prevent conflicts. Returns the backup path. - - Args: - sections_ld_path: Path to the original sections.ld file - - Returns: - Path to the backup file - """ - backup_path = f"{sections_ld_path}.{self.config.mcu}.backup" - - if os.path.exists(sections_ld_path) and not os.path.exists(backup_path): - shutil.copy2(sections_ld_path, backup_path) - - return backup_path - def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> None: """ Restore the original pioarduino-build.py from backup. @@ -1202,26 +1182,6 @@ def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> Non shutil.copy2(backup_path, build_py_path) os.remove(backup_path) - def restore_sections_ld(self, sections_ld_path: str, target=None, source=None, env=None) -> None: - """ - Restore the original sections.ld from backup after relinker. - - Restores the original linker script from the backup copy - and removes the backup file. This is called after the build - completes to restore the framework to its original state. - - Args: - sections_ld_path: Path to the sections.ld file to restore - target: Build target (unused, for PlatformIO compatibility) - source: Build source (unused, for PlatformIO compatibility) - env: Environment (unused, for PlatformIO compatibility) - """ - backup_path = f"{sections_ld_path}.{self.config.mcu}.backup" - - if os.path.exists(backup_path): - shutil.copy2(backup_path, sections_ld_path) - os.remove(backup_path) - class ComponentManager: """ diff --git a/builder/relinker/examples/arduino/README.md b/builder/relinker/examples/arduino/README.md index 8d94a55bd..4776b14ad 100644 --- a/builder/relinker/examples/arduino/README.md +++ b/builder/relinker/examples/arduino/README.md @@ -53,7 +53,7 @@ To customize the configuration for your project: ```bash mkdir -p relinker -cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino/esp32c2/*.csv relinker/ +cp ~/.platformio/platforms/espressif32/builder/relinker/examples/arduino//*.csv relinker/ ``` Then in `platformio.ini`: diff --git a/examples/arduino-relinker/README.md b/examples/arduino-relinker/README.md index e82be8693..e0cb8048e 100644 --- a/examples/arduino-relinker/README.md +++ b/examples/arduino-relinker/README.md @@ -81,7 +81,7 @@ pio device monitor -e esp32-c2-devkitm-1 ## Expected Output -``` +```text === Arduino Relinker Example === ESP32-C2 IRAM Optimization Demo ================================ From 01a53f943f214408b15873fabf9ff03e85db6e0e Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 18:13:31 +0200 Subject: [PATCH 7/9] Preserve first_line when the archive banner is absent --- builder/relinker/relinker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/relinker/relinker.py b/builder/relinker/relinker.py index 8aea36c29..a15e6c798 100644 --- a/builder/relinker/relinker.py +++ b/builder/relinker/relinker.py @@ -60,11 +60,14 @@ def add_sections_info(self, sections_info_dump): archive_path = first_line.strip().split(None, 2)[-1].rstrip(':') archive = os.path.basename(archive_path) - # Fallback: use the .name attribute the caller sets on the StringIO + # Fallback: use the .name attribute the caller sets on the StringIO. + # In this case first_line was not a banner but real content — prepend + # it back so _parse_content sees the full output. + remaining = sections_info_dump.read() if not archive: archive = os.path.basename(getattr(sections_info_dump, 'name', '')) + remaining = first_line + remaining - remaining = sections_info_dump.read() self.sections[archive] = self._parse_content(remaining) @staticmethod From 555aa81f424381460f1801dbe9cd95b77e5d838b Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 18:23:04 +0200 Subject: [PATCH 8/9] nitpick changes --- builder/frameworks/arduino_relinker.py | 1 - builder/relinker/relinker.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/builder/frameworks/arduino_relinker.py b/builder/frameworks/arduino_relinker.py index 09880e1bb..5b277cab7 100644 --- a/builder/frameworks/arduino_relinker.py +++ b/builder/frameworks/arduino_relinker.py @@ -14,7 +14,6 @@ import sys import shutil from pathlib import Path -from SCons.Script import DefaultEnvironment def setup_arduino_relinker(env, platform, mcu, chip_variant): diff --git a/builder/relinker/relinker.py b/builder/relinker/relinker.py index a15e6c798..11204b90a 100644 --- a/builder/relinker/relinker.py +++ b/builder/relinker/relinker.py @@ -141,9 +141,7 @@ def _ensure_entity_db(): from ldgen.entity import EntityDB as _EntityDB EntityDB = _EntityDB except ImportError: - logging.warning( - "IDF ldgen EntityDB not found; using fallback parser for objdump sections" - ) + print("IDF EntityDB not found; using inbuilt parser.") EntityDB = _FallbackEntityDB espidf_objdump = None From a41195d286aebab0b816041c4f4c7fa58318ed1b Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 1 Apr 2026 18:25:52 +0200 Subject: [PATCH 9/9] align doc with code --- examples/arduino-relinker/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/arduino-relinker/README.md b/examples/arduino-relinker/README.md index e0cb8048e..5d8043fc1 100644 --- a/examples/arduino-relinker/README.md +++ b/examples/arduino-relinker/README.md @@ -88,7 +88,6 @@ ESP32-C2 IRAM Optimization Demo Free Heap: 45000 bytes Heap Size: 50000 bytes -Free PSRAM: 0 bytes Chip Model: ESP32-C2 Chip Revision: 1 CPU Frequency: 120 MHz