esp-hal 1.2.0

Bare-metal HAL for Espressif devices
Documentation
crate: esp-hal

# When adding an option whose non-default value changes the compiled code, set it via `env` in the
# non-default `check-configs` entry in `Cargo.toml` of an appropriate crate (e.g.
# `ESP_HAL_CONFIG_<NAME> = "false"`) so CI can check if the crate builds with non-default configurations.

options:
  - name: place-spi-master-driver-in-ram
    description: Places the SPI master driver in RAM for better performance
    default:
      - value: false

  - name: place-switch-tables-in-ram
    description: "Places switch-tables, some lookup tables and constants related to
      interrupt handling into RAM - resulting in better performance but slightly more
      RAM consumption."
    default:
      - value: true
    stability: !Stable "1.0.0"

  - name: place-anon-in-ram
    description: "Places anonymous symbols into RAM - resulting in better performance
      at the cost of significant more RAM consumption. Best to be combined with
      `place-switch-tables-in-ram`."
    default:
      - value: false
    stability: !Stable "1.0.0"

  - name: place-rmt-driver-in-ram
    description: Places the RMT driver in RAM for better performance
    default:
      - value: false

  - name: spi-address-workaround
    description: "Enables a workaround for the issue where SPI in
      half-duplex mode incorrectly transmits the address on a single line if the
      data buffer is empty."
    default:
      - value: true
    active: "esp32"

  - name: stack-guard-offset
    description: The stack guard variable will be placed this many bytes from the stack's end. Needs to be a multiple of 4.
    default:
      - value: 60
    active: "true"
    stability: !Stable "1.0.0"

  - name: stack-guard-value
    description: The value to be written to the stack guard variable.
    default:
      - value: 3740121773
    display_hint: Hex

  - name: ensure-main-stack-minimum
    description: Prevent successful build if the main stack is smaller than the configured minimum number of bytes.
    default:
      - value: 8192
    constraints:
      - type:
          validator: non_negative_integer

  - name: init-stack-ptr-range-check
    description: Check that the stack pointer is in range during initialization.
    default:
      - value: true

  - name: stack-guard-monitoring
    description: Use a data watchpoint to check if the stack guard was overwritten.
    default:
      - value: true

  - name: write-vec-table-monitoring
    description: Use a data watchpoint to check that the vector table was not unintentionally overwritten.
    default:
      - value: false
    active: "esp32c2 || esp32c3 || esp32c6 || esp32h2"

  - name: stack-guard-monitoring-with-debugger-connected
    description: Enable the stack guard also with a debugger connected. Also applies to `write-vec-table-monitoring`.
    default:
      - value: true

  - name: impl-critical-section
    description: "Provide a `critical-section` implementation. Note that if disabled,
      you will need to provide a `critical-section` implementation which is
      using `restore-state-u32`."
    default:
      - value: true

  - name: instruction-cache-size
    description: Instruction cache size to be set on application startup.
    default:
      - value: '"8KB"'
        if: "esp32s2"
      - value: '"32KB"'
    constraints:
      - if: "esp32s2"
        type:
          validator: enumeration
          value:
            - "8KB"
            - "16KB"
      - type:
          validator: enumeration
          value:
            - "16KB"
            - "32KB"
    active: "esp32s2 || esp32s3"

  - name: instruction-cache-line-size
    description: Instruction cache line size to be set on application startup.
    default:
      - value: '"32B"'
    constraints:
      - type:
          validator: enumeration
          value:
            - "16B"
            - "32B"
    active: "esp32s2 || esp32s3"

  - name: icache-associated-ways
    description: Instruction cache associated ways to be set on application startup.
    default:
      - value: '"8"'
    constraints:
      - type:
          validator: enumeration
          value:
            - "4"
            - "8"
    active: "esp32s3"

  - name: data-cache-size
    description: Data cache size to be set on application startup.
    default:
      - value: '"8KB"'
        if: "esp32s2"
      - value: '"64KB"'
    constraints:
      - if: "esp32s2"
        type:
          validator: enumeration
          value:
            - "0KB"
            - "8KB"
            - "16KB"
      - type:
          validator: enumeration
          value:
            - "32KB"
            - "64KB"
    active: "esp32s2 || esp32s3"

  - name: data-cache-line-size
    description: Data cache line size to be set on application startup.
    default:
      - value: '"32B"'
    constraints:
      - if: "esp32s2"
        type:
          validator: enumeration
          value:
            - "16B"
            - "32B"
      - type:
          validator: enumeration
          value:
            - "16B"
            - "32B"
            - "64B"
    active: "esp32s2 || esp32s3"

  - name: dcache-associated-ways
    description: Data cache associated ways to be set on application startup.
    default:
      - value: '"8"'
    constraints:
      - type:
          validator: enumeration
          value:
            - "4"
            - "8"
    active: "esp32s3"

  - name: l2-cache-size
    description: "ESP32-P4 L2 cache size. Must match the 2nd-stage bootloader's
      `CACHE.L2_CACHE_CACHESIZE_CONF` setting (TRM L2MEM Config 0..3). Default
      `256KB` matches the IDF bootloader bundled by espflash."
    default:
      - value: '"256KB"'
    constraints:
      - type:
          validator: enumeration
          value:
            - "0KB"
            - "128KB"
            - "256KB"
            - "512KB"
    active: "esp32p4"

  - name: min-chip-revision
    description: "The minimum chip revision required for the application to run, in format: major * 100 + minor."
    default:
      - value: 300
        if: "esp32"
      - value: 300
        if: "esp32p4"
      - value: 0

  - name: use_rwdata_ld_hook
    description: Include 'rwdata_hook.x'
    default:
      - value: false

  - name: use_rwtext_ld_hook
    description: Include 'rwtext_hook.x'
    default:
      - value: false

  - name: clear-crypto-secrets
    description: "Clear secret material (keys, exponents, intermediate results) from
      the crypto accelerator registers after each operation. Disabling
      this leaves secret material in the peripheral until a subsequent operation
      overwrites it."
    default:
      - value: true

  - name: use-xtal32k
    description: "Enable the external 32 kHz crystal (XTAL32K). When enabled, LP/RTC slow clock
      defaults to the crystal, XTAL32K is powered at init, and the dedicated crystal
      GPIO pins are removed from `Peripherals`. Do not use those pads for GPIO, ADC, LP,
      or any other function (including via `steal` / `AnyPin`) while the crystal is active.
      When disabled (default), XTAL32K stays off so those pins can be used as hi-Z GPIO."
    default:
      - value: false
    active: "soc_has_clock_node_xtal32k_clk"

  - name: enable-pmp
    description: "Protects additional memory regions via Physical Memory Protection (PMP). (Only RISC-V other than ESP32-C2/C3)"
    default:
      # TODO - investigate why it's not working correctly
      - value: false
        if: "esp32s31"
      - value: true
    active: "riscv && !esp32c2 && !esp32c3"

checks:
  - "ESP_HAL_CONFIG_STACK_GUARD_OFFSET % 4 == 0"