Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d73fa5af4 |
@ -1,4 +0,0 @@
|
||||
[alias]
|
||||
xtask = "run --package xtask --"
|
||||
xfmt = "xtask fmt-packages"
|
||||
qa = "xtask run-example qa-test"
|
||||
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,31 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ["bug", "status:needs-attention"]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Bug description
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
## To Reproduce
|
||||
|
||||
<!-- Steps to reproduce the behavior. -->
|
||||
1. ...
|
||||
2. ...
|
||||
|
||||
<!-- Please share the minimal repro of the issue where the bug can be reproduced. -->
|
||||
|
||||
<!-- Make sure you are able to reproduce the bug in the `main` branch, too. -->
|
||||
|
||||
## Expected behavior
|
||||
|
||||
<!-- A clear and concise description of what you expected to happen. Attach screenshots if needed. -->
|
||||
|
||||
## Environment
|
||||
|
||||
- Target device: [e.g. ESP32-S3] <!-- Use `espflash board-info` to get the target device iformation. -->
|
||||
- Crate name and version: [e.g. esp-hal 0.20.0]
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,8 +0,0 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Ask questions in Matrix channel (Recommended)
|
||||
url: https://matrix.to/#/#esp-rs:matrix.org
|
||||
about: Ask any questions directly in our Matrix channel.
|
||||
- name: Ask questions in GitHub Discussions
|
||||
url: https://github.com/esp-rs/esp-hal/discussions/new
|
||||
about: Post your questions and engage in discussions via GitHub.
|
||||
24
.github/ISSUE_TEMPLATE/feature_request.md
vendored
24
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,24 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ["enhancement", "status:needs-attention"]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Motivations
|
||||
|
||||
<!-- If your feature request is related to a problem, please describe it. -->
|
||||
|
||||
## Solution
|
||||
|
||||
<!-- Describe the solution you'd like. -->
|
||||
|
||||
## Alternatives
|
||||
|
||||
<!-- Describe any alternative solutions or features you've considered. -->
|
||||
|
||||
## Additional context
|
||||
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
||||
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
30
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,22 +1,18 @@
|
||||
## Thank you for your contribution!
|
||||
## Thank you!
|
||||
|
||||
We appreciate the time and effort you've put into this pull request.
|
||||
To help us review it efficiently, please ensure you've gone through the following checklist:
|
||||
Thank you for your contribution.
|
||||
Please make sure that your submission includes the following:
|
||||
|
||||
### Submission Checklist 📝
|
||||
- [ ] I have updated existing examples or added new ones (if applicable).
|
||||
- [ ] I have used `cargo xtask fmt-packages` command to ensure that all changed code is formatted correctly.
|
||||
- [ ] My changes were added to the [`CHANGELOG.md`](https://github.com/esp-rs/esp-hal/blob/main/esp-hal/CHANGELOG.md) in the **_proper_** section.
|
||||
- [ ] I have added necessary changes to user code to the [Migration Guide](https://github.com/esp-rs/esp-hal/blob/main/esp-hal/MIGRATING-0.21.md).
|
||||
- [ ] My changes are in accordance to the [esp-rs API guidelines](https://github.com/esp-rs/esp-hal/blob/main/documentation/API-GUIDELINES.md)
|
||||
### Must
|
||||
|
||||
#### Extra:
|
||||
- [ ] I have read the [CONTRIBUTING.md guide](https://github.com/esp-rs/esp-hal/blob/main/documentation/CONTRIBUTING.md) and followed its instructions.
|
||||
- [ ] The code compiles without `errors` or `warnings`.
|
||||
- [ ] All examples work.
|
||||
- [ ] `cargo fmt` was run.
|
||||
- [ ] Your changes were added to the `CHANGELOG.md` in the proper section.
|
||||
- [ ] You updated existing examples or added examples (if applicable).
|
||||
- [ ] Added examples are checked in CI
|
||||
|
||||
### Pull Request Details 📖
|
||||
### Nice to have
|
||||
|
||||
#### Description
|
||||
Please provide a clear and concise description of your changes, including the motivation behind these changes. The context is crucial for the reviewers.
|
||||
|
||||
#### Testing
|
||||
Describe how you tested your changes.
|
||||
- [ ] You add a description of your work to this PR.
|
||||
- [ ] You added proper docs for your newly added features and code.
|
||||
|
||||
68
.github/actions/check-esp-hal/action.yml
vendored
68
.github/actions/check-esp-hal/action.yml
vendored
@ -1,68 +0,0 @@
|
||||
name: Build and Check
|
||||
description: Build and check the esp-hal and esp-lp-hal pacakges for a specified device
|
||||
inputs:
|
||||
device:
|
||||
description: "Device SOC"
|
||||
required: true
|
||||
target:
|
||||
description: "Target"
|
||||
required: true
|
||||
toolchain:
|
||||
description: "Toolchain channel"
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up cargo environment
|
||||
shell: bash
|
||||
run: |
|
||||
# Convert the target triple from kebab-case to SCREAMING_SNAKE_CASE:
|
||||
big_target=$(echo "${{ matrix.device.target }}" | tr [:lower:] [:upper:] | tr '-' '_')
|
||||
# Set the *target specific* RUSTFLAGS for the current device:
|
||||
echo "CARGO_TARGET_${big_target}_RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV
|
||||
# Linting toolchain (stable cant build documentation)
|
||||
if [ "${{ inputs.toolchain }}" == "nightly" ]; then
|
||||
echo "LINTING_TOOLCHAIN=+nightly" >> $GITHUB_ENV
|
||||
else
|
||||
echo "LINTING_TOOLCHAIN=+esp" >> $GITHUB_ENV
|
||||
fi
|
||||
# Clippy and docs checks
|
||||
- name: Clippy
|
||||
shell: bash
|
||||
run: cargo $LINTING_TOOLCHAIN xtask lint-packages --chips ${{ inputs.device }}
|
||||
- name: Check doc-tests
|
||||
shell: bash
|
||||
run: cargo $LINTING_TOOLCHAIN xtask run-doc-test esp-hal ${{ inputs.device }}
|
||||
- name: Check documentation
|
||||
shell: bash
|
||||
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-hal --chips ${{ inputs.device }}
|
||||
# Build all supported examples for the low-power core first (if present):
|
||||
- name: Build prerequisite examples (esp-lp-hal)
|
||||
shell: bash
|
||||
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device)
|
||||
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-lp-hal ${{ inputs.device }}
|
||||
- name: Check esp-lp-hal documentation
|
||||
shell: bash
|
||||
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device)
|
||||
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-lp-hal --chips ${{ inputs.device }}
|
||||
# Make sure we're able to build the HAL without the default features
|
||||
# enabled:
|
||||
- name: Build (no features)
|
||||
shell: bash
|
||||
run: |
|
||||
cargo xtask build-package \
|
||||
--no-default-features \
|
||||
--toolchain=${{ inputs.toolchain }} \
|
||||
--features=${{ inputs.device }} \
|
||||
--target=${{ inputs.target }} \
|
||||
esp-hal
|
||||
- name: Build (examples)
|
||||
env:
|
||||
CI: 1
|
||||
shell: bash
|
||||
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-hal ${{ inputs.device }} --debug
|
||||
- name: Build (qa-test)
|
||||
env:
|
||||
CI: 1
|
||||
shell: bash
|
||||
run: cargo +${{ inputs.toolchain }} xtask build-examples qa-test ${{ inputs.device }} --debug
|
||||
169
.github/workflows/changelog.yml
vendored
169
.github/workflows/changelog.yml
vendored
@ -1,14 +1,7 @@
|
||||
name: Changelog check
|
||||
name: Change log check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# We will not track changes for the following packages/directories.
|
||||
paths-ignore:
|
||||
- "/examples/"
|
||||
- "/extras/"
|
||||
- "/hil-tests/"
|
||||
- "/resources/"
|
||||
- "/xtask/"
|
||||
# Run on labeled/unlabeled in addition to defaults to detect
|
||||
# adding/removing skip-changelog labels.
|
||||
types: [opened, reopened, labeled, unlabeled, synchronize]
|
||||
@ -19,162 +12,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check which package is modified
|
||||
uses: dorny/paths-filter@v3
|
||||
id: changes
|
||||
- uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
filters: |
|
||||
esp-alloc:
|
||||
- 'esp-alloc/**'
|
||||
esp-backtrace:
|
||||
- 'esp-backtrace/**'
|
||||
esp-build:
|
||||
- 'esp-build/**'
|
||||
esp-config:
|
||||
- 'esp-config/**'
|
||||
esp-hal:
|
||||
- 'esp-hal/**'
|
||||
esp-hal-embassy:
|
||||
- 'esp-hal-embassy/**'
|
||||
esp-hal-procmacros:
|
||||
- 'esp-hal-procmacros/**'
|
||||
esp-ieee802154:
|
||||
- 'esp-ieee802154/**'
|
||||
esp-lp-hal:
|
||||
- 'esp-lp-hal/**'
|
||||
esp-metadata:
|
||||
- 'esp-metadata/**'
|
||||
esp-println:
|
||||
- 'esp-println/**'
|
||||
esp-riscv-rt:
|
||||
- 'esp-riscv-rt/**'
|
||||
esp-storage:
|
||||
- 'esp-storage/**'
|
||||
esp-wifi:
|
||||
- 'esp-wifi/**'
|
||||
xtensa-lx:
|
||||
- 'xtensa-lx/**'
|
||||
xtensa-lx-rt:
|
||||
- 'xtensa-lx-rt/**'
|
||||
|
||||
- name: Check that changelog updated (esp-alloc)
|
||||
if: steps.changes.outputs.esp-alloc == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-alloc/CHANGELOG.md
|
||||
changeLogPath: CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-alloc/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-backtrace)
|
||||
if: steps.changes.outputs.esp-backtrace == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-backtrace/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-backtrace/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-build)
|
||||
if: steps.changes.outputs.esp-build == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-build/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-build/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-config)
|
||||
if: steps.changes.outputs.esp-config == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-config/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-config/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-hal)
|
||||
if: steps.changes.outputs.esp-hal == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-hal/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-hal/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-hal-embassy)
|
||||
if: steps.changes.outputs.esp-hal-embassy == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-hal-embassy/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-hal-embassy/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-hal-procmacros)
|
||||
if: steps.changes.outputs.esp-hal-procmacros == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-hal-procmacros/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-hal-procmacros/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-ieee802154)
|
||||
if: steps.changes.outputs.esp-ieee802154 == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-ieee802154/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-ieee802154/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-lp-hal)
|
||||
if: steps.changes.outputs.esp-lp-hal == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-lp-hal/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-lp-hal/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-println)
|
||||
if: steps.changes.outputs.esp-println == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-println/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-println/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-riscv-rt)
|
||||
if: steps.changes.outputs.esp-riscv-rt == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-riscv-rt/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-riscv-rt/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-storage)
|
||||
if: steps.changes.outputs.esp-storage == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-storage/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-storage/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (esp-wifi)
|
||||
if: steps.changes.outputs.esp-wifi == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: esp-wifi/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-wifi/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (xtensa-lx)
|
||||
if: steps.changes.outputs.xtensa-lx == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: xtensa-lx/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the xtensa-lx/CHANGELOG.md file."
|
||||
|
||||
- name: Check that changelog updated (xtensa-lx-rt)
|
||||
if: steps.changes.outputs.xtensa-lx-rt == 'true'
|
||||
uses: dangoslen/changelog-enforcer@v3
|
||||
with:
|
||||
changeLogPath: xtensa-lx-rt/CHANGELOG.md
|
||||
skipLabels: "skip-changelog"
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the xtensa-lx-rt/CHANGELOG.md file."
|
||||
missingUpdateErrorMessage: "Please add a changelog entry in the CHANGELOG.md file."
|
||||
|
||||
801
.github/workflows/ci.yml
vendored
801
.github/workflows/ci.yml
vendored
@ -1,31 +1,23 @@
|
||||
# NOTE:
|
||||
#
|
||||
# When adding support for a new chip to `esp-hal`, there are a number of
|
||||
# updates which must be made to the CI workflow in order to reflect this; the
|
||||
# changes are:
|
||||
#
|
||||
# 1.) In the 'esp-hal' job, add the name of the chip to the `matrix.soc` array.
|
||||
# 1a.) If the device has a low-power core (which is supported in
|
||||
# `esp-lp-hal`), then update the `if` condition to build prerequisites.
|
||||
# 2.) In the 'msrv' job, add checks as needed for the new chip.
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**/CHANGELOG.md"
|
||||
- "**/README.md"
|
||||
push:
|
||||
branches-ignore:
|
||||
- "gh-readonly-queue/**"
|
||||
- "main"
|
||||
paths-ignore:
|
||||
- "**/CHANGELOG.md"
|
||||
- "**/README.md"
|
||||
merge_group:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MSRV: "1.83.0"
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
DEFMT_LOG: trace
|
||||
MSRV: "1.67.0"
|
||||
|
||||
# Cancel any currently running workflows from the same PR, branch, or
|
||||
# tag when a new workflow is triggered.
|
||||
@ -37,90 +29,579 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
# --------------------------------------------------------------------------
|
||||
# Build Packages
|
||||
# Check Packages
|
||||
|
||||
esp-hal:
|
||||
name: esp-hal (${{ matrix.device.soc }})
|
||||
esp-hal-smartled:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SSID: SSID
|
||||
PASSWORD: PASSWORD
|
||||
STATIC_IP: 1.1.1.1
|
||||
GATEWAY_IP: 1.1.1.1
|
||||
HOST_IP: 1.1.1.1
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
device: [
|
||||
# RISC-V devices:
|
||||
{ soc: "esp32c2", target: "riscv32imc-unknown-none-elf", toolchain: "stable" },
|
||||
{ soc: "esp32c3", target: "riscv32imc-unknown-none-elf", toolchain: "stable" },
|
||||
{ soc: "esp32c6", target: "riscv32imac-unknown-none-elf", toolchain: "stable" },
|
||||
{ soc: "esp32h2", target: "riscv32imac-unknown-none-elf", toolchain: "stable" },
|
||||
# Xtensa devices:
|
||||
{ soc: "esp32", target: "xtensa-esp32-none-elf", toolchain: "esp" },
|
||||
{ soc: "esp32s2", target: "xtensa-esp32s2-none-elf", toolchain: "esp" },
|
||||
{ soc: "esp32s3", target: "xtensa-esp32s3-none-elf", toolchain: "esp" },
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Install the Rust toolchain for Xtensa devices:
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
ldproxy: false
|
||||
version: 1.83.0.1
|
||||
# Install the Rust stable toolchain for RISC-V devices:
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
|
||||
toolchain: stable
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
ldproxy: false
|
||||
override: false
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build and Check
|
||||
uses: ./.github/actions/check-esp-hal
|
||||
with:
|
||||
device: ${{ matrix.device.soc }}
|
||||
target: ${{ matrix.device.target }}
|
||||
toolchain: ${{ matrix.device.toolchain }}
|
||||
# Build all RISC-V targets:
|
||||
- name: build (esp32c3)
|
||||
run: cd esp-hal-smartled/ && cargo +nightly build -Zbuild-std=core --target=riscv32imc-unknown-none-elf --features=esp32c3
|
||||
- name: build (esp32c6)
|
||||
run: cd esp-hal-smartled/ && cargo +nightly build -Zbuild-std=core --target=riscv32imac-unknown-none-elf --features=esp32c6
|
||||
- name: build (esp32h2)
|
||||
run: cd esp-hal-smartled/ && cargo +nightly build -Zbuild-std=core --target=riscv32imac-unknown-none-elf --features=esp32h2
|
||||
# Build all Xtensa targets:
|
||||
- name: build (esp32)
|
||||
run: cd esp-hal-smartled/ && cargo +esp build -Zbuild-std=core --target=xtensa-esp32-none-elf --features=esp32,xtal-40mhz
|
||||
- name: build (esp32s2)
|
||||
run: cd esp-hal-smartled/ && cargo +esp build -Zbuild-std=core --target=xtensa-esp32s2-none-elf --features=esp32s2
|
||||
- name: build (esp32s3)
|
||||
run: cd esp-hal-smartled/ && cargo +esp build -Zbuild-std=core --target=xtensa-esp32s3-none-elf --features=esp32s3
|
||||
# Ensure documentation can be built (requires a chip feature!)
|
||||
- name: rustdoc
|
||||
run: cd esp-hal-smartled/ && cargo doc -Zbuild-std=core --target=riscv32imc-unknown-none-elf --features=esp32c3
|
||||
|
||||
extras:
|
||||
esp-riscv-rt:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get update && sudo apt-get -y install musl-tools libudev-dev pkg-config
|
||||
# Build the extra crates
|
||||
- name: Build the bench-server
|
||||
run: cd extras/bench-server && cargo build
|
||||
- name: Build esp-wifishark
|
||||
run: cd extras/esp-wifishark && cargo build
|
||||
- name: Build ieee802154-sniffer
|
||||
run: cd extras/ieee802154-sniffer && cargo build
|
||||
- name: Build esp-riscv-rt (riscv32imc, no features)
|
||||
run: cd esp-riscv-rt/ && cargo build -Zbuild-std=core --target=riscv32imc-unknown-none-elf
|
||||
- name: Build esp-riscv-rt (riscv32imac, no features)
|
||||
run: cd esp-riscv-rt/ && cargo build -Zbuild-std=core --target=riscv32imac-unknown-none-elf
|
||||
- name: Build esp-riscv-rt (riscv32imc, all features)
|
||||
run: cd esp-riscv-rt/ && cargo build -Zbuild-std=core --target=riscv32imc-unknown-none-elf --features=ci
|
||||
- name: Build esp-riscv-rt (riscv32imac, all features)
|
||||
run: cd esp-riscv-rt/ && cargo build -Zbuild-std=core --target=riscv32imac-unknown-none-elf --features=ci
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp-riscv-rt/ && cargo doc
|
||||
|
||||
esp-ulp-riscv-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
- name: build esp-ulp-riscv-hal (esp32s2)
|
||||
run: cd esp-ulp-riscv-hal/ && cargo build --release --features=esp32s2 --examples
|
||||
- name: build esp-ulp-riscv-hal (esp32s3)
|
||||
run: cd esp-ulp-riscv-hal/ && cargo build --release --features=esp32s3 --examples
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp-ulp-riscv-hal/ && cargo doc --features=esp32s3
|
||||
|
||||
esp32-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
default: true
|
||||
buildtargets: esp32
|
||||
ldproxy: false
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
- name: build esp32-hal (no features)
|
||||
run: cd esp32-hal/ && cargo build --examples
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32-hal (common features)
|
||||
run: |
|
||||
cd esp32-hal/
|
||||
cargo build --examples --features=eh1,ufmt,log
|
||||
cargo build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32-hal (embassy)
|
||||
run: |
|
||||
cd esp32-hal/
|
||||
cargo check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo check --example=embassy_multicore --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo check --example=embassy_multicore_interrupt --features=embassy,embassy-time-timg0,embassy-executor-interrupt
|
||||
cargo check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32-hal (embassy, async)
|
||||
run: |
|
||||
cd esp32-hal/
|
||||
cargo check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread --release
|
||||
cargo check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
- name: check esp32-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32-hal/
|
||||
cargo check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,defmt
|
||||
cargo check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
|
||||
- name: check esp32-hal (psram)
|
||||
run: cd esp32-hal/ && cargo check --example=psram --features=psram-2m --release # This example requires release!
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32-hal (no default features)
|
||||
run: cd esp32-hal/ && cargo build --no-default-features --features=xtal-40mhz
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32-hal/ && cargo doc --features=eh1
|
||||
|
||||
esp32c2-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
# We also use this as an opportunity to verify that the examples link
|
||||
# for each supported image format.
|
||||
- name: build esp32c2-hal (no features)
|
||||
run: cd esp32c2-hal/ && cargo build --examples
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32c2-hal (common features)
|
||||
run: |
|
||||
cd esp32c2-hal/
|
||||
cargo +nightly build --examples --features=eh1,ufmt,log
|
||||
cargo +nightly build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32c2-hal (async, systick)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
- name: check esp32c2-hal (async, timg0)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
- name: check esp32c2-hal (async, gpio)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_wait --features=embassy,embassy-time-systick,embassy-executor-thread,async
|
||||
- name: check esp32c2-hal (async, multiprio)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_multiprio --features=embassy,embassy-time-systick,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32c2-hal (async, spi)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_spi --features=embassy,embassy-time-systick,embassy-executor-thread,async
|
||||
- name: check esp32c2-hal (async, serial)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_serial --features=embassy,embassy-time-systick,embassy-executor-thread,async
|
||||
- name: check esp32c2-hal (async, i2c)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=embassy_i2c --features=embassy,embassy-time-systick,embassy-executor-thread,async
|
||||
- name: check esp32c2-hal (interrupt-preemption)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=interrupt_preemption --features=interrupt-preemption
|
||||
- name: check esp32c2-hal (direct-vectoring)
|
||||
run: cd esp32c2-hal/ && cargo +nightly check --example=direct-vectoring --features=direct-vectoring
|
||||
- name: check esp32c2-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32c2-hal/
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32c2-hal (no default features)
|
||||
run: cd esp32c2-hal/ && cargo build --no-default-features --features=xtal-40mhz
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32c2-hal/ && cargo doc --features=eh1
|
||||
|
||||
esp32c3-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
- name: build esp32c3-hal (no features)
|
||||
run: cd esp32c3-hal/ && cargo +nightly build --examples
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32c3-hal (common features)
|
||||
run: |
|
||||
cd esp32c3-hal/
|
||||
cargo +nightly build --examples --features=eh1,ufmt,log
|
||||
cargo +nightly build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32c3-hal (embassy)
|
||||
run: |
|
||||
cd esp32c3-hal/
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32c3-hal (embassy, async)
|
||||
run: |
|
||||
cd esp32c3-hal/
|
||||
cargo +nightly check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread --release
|
||||
cargo +nightly check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_usb_serial_jtag --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
- name: check esp32c3-hal (interrupt-preemption)
|
||||
run: cd esp32c3-hal/ && cargo +nightly check --example=interrupt_preemption --features=interrupt-preemption
|
||||
- name: check esp32c3-hal (direct-vectoring)
|
||||
run: cd esp32c3-hal/ && cargo +nightly check --example=direct-vectoring --features=direct-vectoring
|
||||
- name: check esp32c3-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32c3-hal/
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32c3-hal (no default features)
|
||||
run: cd esp32c3-hal/ && cargo build --no-default-features
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32c3-hal/ && cargo doc --features=eh1
|
||||
|
||||
esp32c6-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imac-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# build the lp-hal examples first to make sure the examples which expect
|
||||
# the ELF files to be present will compile
|
||||
- name: build esp32c6-lp-hal prerequisites
|
||||
run: cd esp32c6-lp-hal/ && cargo +nightly build --release --examples
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
# We also use this as an opportunity to verify that the examples link
|
||||
# for each supported image format.
|
||||
- name: build esp32c6-hal (no features)
|
||||
run: cd esp32c6-hal/ && cargo +nightly build --examples
|
||||
- name: build esp32c6-hal (flip-link feature)
|
||||
run: cd esp32c6-hal/ && cargo +nightly build --examples --features=flip-link
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32c6-hal (common features)
|
||||
run: |
|
||||
cd esp32c6-hal/
|
||||
cargo +nightly build --examples --features=eh1,ufmt,log
|
||||
cargo +nightly build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32c6-hal (embassy)
|
||||
run: |
|
||||
cd esp32c6-hal/
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32c6-hal (embassy, async)
|
||||
run: |
|
||||
cd esp32c6-hal/
|
||||
cargo +nightly check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread --release
|
||||
cargo +nightly check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_usb_serial_jtag --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_parl_io_tx --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_parl_io_rx --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
- name: check esp32c6-hal (interrupt-preemption)
|
||||
run: cd esp32c6-hal/ && cargo +nightly check --example=interrupt_preemption --features=interrupt-preemption
|
||||
- name: check esp32c6-hal (direct-vectoring)
|
||||
run: cd esp32c6-hal/ && cargo +nightly check --example=direct-vectoring --features=direct-vectoring
|
||||
- name: check esp32c6-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32c6-hal/
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32c6-hal (no default features)
|
||||
run: cd esp32c6-hal/ && cargo build --no-default-features
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32c6-hal/ && cargo doc --features=eh1
|
||||
|
||||
esp32c6-lp-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imac-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
- name: build esp32c6-lp-hal (no features)
|
||||
run: cd esp32c6-lp-hal/ && cargo +nightly build --release --examples
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32c6-lp-hal/ && cargo doc
|
||||
|
||||
esp32h2-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imac-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
# We also use this as an opportunity to verify that the examples link
|
||||
# for each supported image format.
|
||||
- name: build esp32h2-hal (no features)
|
||||
run: cd esp32h2-hal/ && cargo +nightly build --examples
|
||||
- name: build esp32h2-hal (flip-link feature)
|
||||
run: cd esp32h2-hal/ && cargo +nightly build --examples --features=flip-link
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32h2-hal (common features)
|
||||
run: |
|
||||
cd esp32h2-hal/
|
||||
cargo +nightly build --examples --features=eh1,ufmt,log
|
||||
cargo +nightly build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32h2-hal (embassy)
|
||||
run: |
|
||||
cd esp32h2-hal/
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32h2-hal (embassy, async)
|
||||
run: |
|
||||
cd esp32h2-hal/
|
||||
cargo +nightly check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread --release
|
||||
cargo +nightly check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_usb_serial_jtag --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_parl_io_tx --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +nightly check --example=embassy_parl_io_rx --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
- name: check esp32h2-hal (interrupt-preemption)
|
||||
run: cd esp32h2-hal/ && cargo +nightly check --example=interrupt_preemption --features=interrupt-preemption
|
||||
- name: check esp32h2-hal (direct-vectoring)
|
||||
run: cd esp32h2-hal/ && cargo +nightly check --example=direct-vectoring --features=direct-vectoring
|
||||
- name: check esp32h2-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32h2-hal/
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
|
||||
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32h2-hal (no default features)
|
||||
run: cd esp32h2-hal/ && cargo build --no-default-features
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32h2-hal/ && cargo doc --features=eh1
|
||||
|
||||
esp32s2-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
default: true
|
||||
buildtargets: esp32s2
|
||||
ldproxy: false
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# build the esp-ulp-riscv-hal examples first to make sure the examples which expect
|
||||
# the ELF files to be present will compile
|
||||
- name: build esp-ulp-riscv-hal prerequisites
|
||||
run: cd esp-ulp-riscv-hal/ && cargo +nightly build --release --features=esp32s2 --examples
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
- name: check esp32s2-hal (no features)
|
||||
run: cd esp32s2-hal/ && cargo +esp build --examples
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32s2-hal (common features)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp build --examples --features=eh1,ufmt,log
|
||||
cargo +esp build --examples --features=eh1,ufmt,defmt
|
||||
# FIXME: `time-systick` feature disabled for now, see 'esp32s2-hal/Cargo.toml'.
|
||||
# - name: check esp32s2-hal (async, systick)
|
||||
# run: cd esp32s2-hal/ && cargo check --example=embassy_hello_world --features=embassy,embassy-time-systick,executor
|
||||
- name: check esp32s2-hal (embassy, timg0)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32s2-hal (embassy, systick)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multiprio --features=embassy,embassy-time-systick,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32s2-hal (embassy, timg0, async)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread --release
|
||||
cargo +esp check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
- name: check esp32s2-hal (embassy, systick, async)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp check --example=embassy_wait --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_spi --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_serial --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2c --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
- name: check esp32s2-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32s2-hal/
|
||||
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,defmt
|
||||
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
|
||||
- name: check esp32s2-hal (psram)
|
||||
run: cd esp32s2-hal/ && cargo +esp check --example=psram --features=psram-2m --release # This example requires release!
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32s2-hal (no default features)
|
||||
run: cd esp32s2-hal/ && cargo build --no-default-features
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32s2-hal/ && cargo +esp doc --features=eh1
|
||||
|
||||
esp32s3-hal:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
default: true
|
||||
buildtargets: esp32s3
|
||||
ldproxy: false
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# build the esp-ulp-riscv-hal examples first to make sure the examples which expect
|
||||
# the ELF files to be present will compile
|
||||
- name: build esp-ulp-riscv-hal prerequisites
|
||||
run: cd esp-ulp-riscv-hal/ && cargo +nightly build --release --features=esp32s3 --examples
|
||||
|
||||
# Perform a full build initially to verify that the examples not only
|
||||
# build, but also link successfully.
|
||||
# We also use this as an opportunity to verify that the examples link
|
||||
# for each supported image format.
|
||||
- name: build esp32s3-hal (no features)
|
||||
run: cd esp32s3-hal/ && cargo +esp build --examples
|
||||
# Subsequent steps can just check the examples instead, as we're already
|
||||
# confident that they link.
|
||||
- name: check esp32s3-hal (common features)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp build --examples --features=eh1,ufmt,log
|
||||
cargo +esp build --examples --features=eh1,ufmt,defmt
|
||||
- name: check esp32s3-hal (embassy, timg0)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --example=embassy_hello_world --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multicore --features=embassy,embassy-time-timg0,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multicore_interrupt --features=embassy,embassy-time-timg0,embassy-executor-interrupt
|
||||
cargo +esp check --example=embassy_multiprio --features=embassy,embassy-time-timg0,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32s3-hal (embassy, systick)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --example=embassy_hello_world --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multicore --features=embassy,embassy-time-systick,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_multicore_interrupt --features=embassy,embassy-time-systick,embassy-executor-interrupt
|
||||
cargo +esp check --example=embassy_multiprio --features=embassy,embassy-time-systick,embassy-executor-thread,embassy-executor-interrupt
|
||||
- name: check esp32s3-hal (embassy, timg0, async)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --example=embassy_wait --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_spi --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_serial --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2c --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2s_read --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2s_sound --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_rmt_rx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_rmt_tx --features=embassy,embassy-time-timg0,async,embassy-executor-thread
|
||||
- name: check esp32s3-hal (embassy, systick, async)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --example=embassy_wait --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_spi --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_serial --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_i2c --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
cargo +esp check --example=embassy_usb_serial_jtag --features=embassy,embassy-time-systick,async,embassy-executor-thread
|
||||
- name: check esp32s3-hal (octal psram and psram)
|
||||
run: | # This examples require release!
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --example=octal_psram --features=opsram-2m --release
|
||||
cargo +esp check --example=psram --features=psram-2m --release
|
||||
- name: check esp32s3-hal (embassy, log/defmt)
|
||||
run: |
|
||||
cd esp32s3-hal/
|
||||
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,defmt
|
||||
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
|
||||
# Make sure we can build without default features enabled, too!
|
||||
- name: check esp32s3-hal (no default features)
|
||||
run: cd esp32s3-hal/ && cargo build --no-default-features
|
||||
# Ensure documentation can be built
|
||||
- name: rustdoc
|
||||
run: cd esp32s3-hal/ && cargo doc --features=eh1
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# MSRV
|
||||
|
||||
msrv:
|
||||
msrv-riscv:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTC_BOOTSTRAP: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
ldproxy: false
|
||||
version: ${{ env.MSRV }}
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
|
||||
@ -128,42 +609,127 @@ jobs:
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Verify the MSRV for all RISC-V chips.
|
||||
- name: msrv RISCV (esp-hal)
|
||||
run: |
|
||||
cargo xtask build-package --features=esp32c2,ci --target=riscv32imc-unknown-none-elf esp-hal
|
||||
cargo xtask build-package --features=esp32c3,ci --target=riscv32imc-unknown-none-elf esp-hal
|
||||
cargo xtask build-package --features=esp32c6,ci --target=riscv32imac-unknown-none-elf esp-hal
|
||||
cargo xtask build-package --features=esp32h2,ci --target=riscv32imac-unknown-none-elf esp-hal
|
||||
# Build the esp32c6-lp-hal examples first. This is done to ensure the
|
||||
# examples which expect the ELF files to be present will compile:
|
||||
- name: build esp32c6-lp-hal prerequisites
|
||||
run: cd esp32c6-lp-hal && cargo build --release --examples
|
||||
|
||||
- name: msrv RISCV (esp-wifi)
|
||||
# Verify the MSRV for all RISC-V chips.
|
||||
- name: msrv (esp32c2-hal)
|
||||
run: |
|
||||
cargo xtask build-package --features=esp32c2,wifi,ble,esp-hal/unstable --target=riscv32imc-unknown-none-elf esp-wifi
|
||||
cargo xtask build-package --features=esp32c3,wifi,ble,esp-hal/unstable --target=riscv32imc-unknown-none-elf esp-wifi
|
||||
cargo xtask build-package --features=esp32c6,wifi,ble,esp-hal/unstable --target=riscv32imac-unknown-none-elf esp-wifi
|
||||
cargo xtask build-package --features=esp32h2,ble,esp-hal/unstable --target=riscv32imac-unknown-none-elf esp-wifi
|
||||
cd esp32c2-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
- name: msrv (esp32c3-hal)
|
||||
run: |
|
||||
cd esp32c3-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
- name: msrv (esp32c6-hal)
|
||||
run: |
|
||||
cd esp32c6-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
- name: msrv (esp32c6-lp-hal)
|
||||
run: |
|
||||
cd esp32c6-lp-hal/
|
||||
cargo build
|
||||
- name: msrv (esp32h2-hal)
|
||||
run: |
|
||||
cd esp32h2-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
|
||||
msrv-xtensa:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTC_BOOTSTRAP: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf
|
||||
toolchain: ${{ env.MSRV }}
|
||||
components: rust-src
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
ldproxy: false
|
||||
version: ${{ env.MSRV }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Build the `esp-ulp-riscv-hal` examples first. This is done to ensure
|
||||
# the examples which expect the ELF files to be present will compile:
|
||||
- name: build esp-ulp-riscv-hal prerequisites
|
||||
run: cd esp-ulp-riscv-hal && cargo build --release --features=esp32s3 --examples
|
||||
|
||||
# Verify the MSRV for all Xtensa chips:
|
||||
- name: msrv Xtensa (esp-hal)
|
||||
- name: msrv (esp32-hal)
|
||||
run: |
|
||||
cargo xtask build-package --toolchain=esp --features=esp32,ci --target=xtensa-esp32-none-elf esp-hal
|
||||
cargo xtask build-package --toolchain=esp --features=esp32s2,ci --target=xtensa-esp32s2-none-elf esp-hal
|
||||
cargo xtask build-package --toolchain=esp --features=esp32s3,ci --target=xtensa-esp32s3-none-elf esp-hal
|
||||
|
||||
- name: msrv Xtensa (esp-wifi)
|
||||
cd esp32-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
- name: msrv (esp32s2-hal)
|
||||
run: |
|
||||
cargo xtask build-package --toolchain=esp --features=esp32,wifi,ble,esp-hal/unstable --target=xtensa-esp32-none-elf esp-wifi
|
||||
cargo xtask build-package --toolchain=esp --features=esp32s2,wifi,esp-hal/unstable --target=xtensa-esp32s2-none-elf esp-wifi
|
||||
cargo xtask build-package --toolchain=esp --features=esp32s3,wifi,ble,esp-hal/unstable --target=xtensa-esp32s3-none-elf esp-wifi
|
||||
|
||||
- name: msrv (esp-lp-hal)
|
||||
cd esp32s2-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
- name: msrv (esp32s3-hal)
|
||||
run: |
|
||||
cargo xtask build-package --features=esp32c6 --target=riscv32imac-unknown-none-elf esp-lp-hal
|
||||
cargo xtask build-package --features=esp32s2 --target=riscv32imc-unknown-none-elf esp-lp-hal
|
||||
cargo xtask build-package --features=esp32s3 --target=riscv32imc-unknown-none-elf esp-lp-hal
|
||||
cd esp32s3-hal/
|
||||
cargo build --features=eh1,ufmt,log
|
||||
cargo build --features=defmt
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Format
|
||||
# Lint
|
||||
|
||||
clippy-riscv:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
targets: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
|
||||
components: clippy,rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Run 'cargo clippy' on all packages targeting RISC-V:
|
||||
- name: clippy (esp-riscv-rt)
|
||||
run: cd esp-riscv-rt && cargo clippy --target=riscv32imc-unknown-none-elf -- -D warnings
|
||||
- name: clippy (esp-ulp-riscv-hal, esp32s2)
|
||||
run: cd esp-ulp-riscv-hal && cargo clippy --features=esp32s2 -- -D warnings
|
||||
- name: clippy (esp-ulp-riscv-hal, esp32s3)
|
||||
run: cd esp-ulp-riscv-hal && cargo clippy --features=esp32s3 -- -D warnings
|
||||
- name: clippy (esp32c2-hal)
|
||||
run: cd esp32c2-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32c3-hal)
|
||||
run: cd esp32c3-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32c6-hal)
|
||||
run: cd esp32c6-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32c6-lp-hal)
|
||||
run: cd esp32c6-lp-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32h2-hal)
|
||||
run: cd esp32h2-hal && cargo clippy -- -D warnings
|
||||
|
||||
clippy-xtensa:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
ldproxy: false
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Run 'cargo clippy' on all packages targeting Xtensa:
|
||||
- name: clippy (esp32-hal)
|
||||
run: cd esp32-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32s2-hal)
|
||||
run: cd esp32s2-hal && cargo clippy -- -D warnings
|
||||
- name: clippy (esp32s3-hal)
|
||||
run: cd esp32s3-hal && cargo clippy -- -D warnings
|
||||
|
||||
rustfmt:
|
||||
runs-on: ubuntu-latest
|
||||
@ -179,20 +745,29 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Check the formatting of all packages:
|
||||
- run: cargo xtask fmt-packages --check
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# host tests
|
||||
|
||||
host-tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
# Check the formatting of all packages:
|
||||
- run: cd esp-config && cargo test --features build
|
||||
- name: rustfmt (esp-hal-common)
|
||||
run: cargo fmt --all --manifest-path=esp-hal-common/Cargo.toml -- --check
|
||||
- name: rustfmt (esp-hal-procmacros)
|
||||
run: cargo fmt --all --manifest-path=esp-hal-procmacros/Cargo.toml -- --check
|
||||
- name: rustfmt (esp-hal-smartled)
|
||||
run: cargo fmt --all --manifest-path=esp-hal-smartled/Cargo.toml -- --check
|
||||
- name: rustfmt (esp-riscv-rt)
|
||||
run: cargo fmt --all --manifest-path=esp-riscv-rt/Cargo.toml -- --check
|
||||
- name: rustfmt (esp-ulp-riscv-hal)
|
||||
run: cargo fmt --all --manifest-path=esp-ulp-riscv-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32c2-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32c2-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32c3-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32c3-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32c6-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32c6-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32c6-lp-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32c6-lp-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32h2-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32h2-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32s2-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32s2-hal/Cargo.toml -- --check
|
||||
- name: rustfmt (esp32s3-hal)
|
||||
run: cargo fmt --all --manifest-path=esp32s3-hal/Cargo.toml -- --check
|
||||
|
||||
53
.github/workflows/ci_nightly.yml
vendored
53
.github/workflows/ci_nightly.yml
vendored
@ -1,53 +0,0 @@
|
||||
name: CI - nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
DEFMT_LOG: trace
|
||||
|
||||
jobs:
|
||||
|
||||
esp-hal-nightly:
|
||||
name: esp-hal | nightly (${{ matrix.device.soc }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SSID: SSID
|
||||
PASSWORD: PASSWORD
|
||||
STATIC_IP: 1.1.1.1
|
||||
GATEWAY_IP: 1.1.1.1
|
||||
HOST_IP: 1.1.1.1
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
device: [
|
||||
# RISC-V devices:
|
||||
{ soc: "esp32c2", target: "riscv32imc-unknown-none-elf" },
|
||||
{ soc: "esp32c3", target: "riscv32imc-unknown-none-elf" },
|
||||
{ soc: "esp32c6", target: "riscv32imac-unknown-none-elf" },
|
||||
{ soc: "esp32h2", target: "riscv32imac-unknown-none-elf" },
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Install the Rust nightly toolchain for RISC-V devices:
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src, clippy, rustfmt
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build and Check
|
||||
uses: ./.github/actions/check-esp-hal
|
||||
with:
|
||||
device: ${{ matrix.device.soc }}
|
||||
target: ${{ matrix.device.target }}
|
||||
toolchain: nightly
|
||||
99
.github/workflows/documentation.yml
vendored
99
.github/workflows/documentation.yml
vendored
@ -1,99 +0,0 @@
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
esp-hal:
|
||||
description: "esp-hal tag"
|
||||
required: true
|
||||
esp-wifi:
|
||||
description: "esp-wifi tag"
|
||||
required: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
packages: '[
|
||||
{ "name": "esp-hal", "tag": "${{ github.event.inputs.esp-hal }}" },
|
||||
{ "name": "esp-wifi", "tag": "esp-wifi-${{ github.event.inputs.esp-wifi }}" }
|
||||
]'
|
||||
steps:
|
||||
- run: echo "Setup complete!"
|
||||
build:
|
||||
needs: setup
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
packages: ${{ fromJson(needs.setup.outputs.packages) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
default: true
|
||||
ldproxy: false
|
||||
version: 1.83.0.1
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: esp-rs/esp-hal
|
||||
ref: ${{ matrix.packages.tag }}
|
||||
|
||||
- name: Build documentation
|
||||
run: cargo xtask build-documentation --packages=${{ matrix.packages.name }}
|
||||
|
||||
# https://github.com/actions/deploy-pages/issues/303#issuecomment-1951207879
|
||||
- name: Remove problematic '.lock' files
|
||||
run: find docs -name ".lock" -exec rm -f {} \;
|
||||
|
||||
- name: Upload docs for ${{ matrix.packages.name }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.packages.name }}
|
||||
path: "docs/${{ matrix.packages.name }}"
|
||||
|
||||
assemble:
|
||||
needs: [setup, build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Prepare
|
||||
run: mkdir docs
|
||||
- name: Download all docs
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: "docs/"
|
||||
|
||||
- name: Create index.html
|
||||
run: "cargo xtask build-documentation-index --packages=$(echo '${{ needs.setup.outputs.packages }}' | jq -r '[.[].name] | join(\",\")')"
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: "docs/"
|
||||
|
||||
deploy:
|
||||
# Add a dependency to the assemble job:
|
||||
needs: assemble
|
||||
|
||||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment:
|
||||
permissions:
|
||||
pages: write # to deploy to Pages
|
||||
id-token: write # to verify the deployment originates from an appropriate source
|
||||
|
||||
# Deploy to the github-pages environment:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
# Specify runner + deployment step:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
186
.github/workflows/hil.yml
vendored
186
.github/workflows/hil.yml
vendored
@ -1,186 +0,0 @@
|
||||
name: HIL
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
merge_group:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
repository:
|
||||
description: "Owner and repository to test"
|
||||
required: true
|
||||
default: 'esp-rs/esp-hal'
|
||||
branch:
|
||||
description: "Branch, tag or SHA to checkout."
|
||||
required: true
|
||||
default: "main"
|
||||
|
||||
# Cancel any currently running workflows from the same PR, branch, or
|
||||
# tag when a new workflow is triggered.
|
||||
#
|
||||
# https://stackoverflow.com/a/66336834
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build-xtasks:
|
||||
name: Build xtasks | ${{ matrix.host.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
host:
|
||||
- arch: armv7
|
||||
rust-target: armv7-unknown-linux-gnueabihf
|
||||
- arch: aarch64
|
||||
rust-target: aarch64-unknown-linux-gnu
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
- uses: actions/checkout@v4
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
repository: ${{ github.event.inputs.repository }}
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
|
||||
- name: Install cross
|
||||
run: cargo install cross
|
||||
|
||||
- name: Build xtasks
|
||||
run: cross build --release --target ${{ matrix.host.rust-target }} -p xtask
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: xtask-${{ matrix.host.arch }}
|
||||
path: target/${{ matrix.host.rust-target }}/release/xtask
|
||||
|
||||
build-tests:
|
||||
name: Build HIL Tests | ${{ matrix.target.soc }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
# RISC-V devices:
|
||||
- soc: esp32c2
|
||||
rust-target: riscv32imc-unknown-none-elf
|
||||
- soc: esp32c3
|
||||
rust-target: riscv32imc-unknown-none-elf
|
||||
- soc: esp32c6
|
||||
rust-target: riscv32imac-unknown-none-elf
|
||||
- soc: esp32h2
|
||||
rust-target: riscv32imac-unknown-none-elf
|
||||
# # Xtensa devices:
|
||||
- soc: esp32
|
||||
rust-target: xtensa-esp32-none-elf
|
||||
- soc: esp32s2
|
||||
rust-target: xtensa-esp32s2-none-elf
|
||||
- soc: esp32s3
|
||||
rust-target: xtensa-esp32s3-none-elf
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
- uses: actions/checkout@v4
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
repository: ${{ github.event.inputs.repository }}
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
# Install the Rust toolchain for RISC-V devices:
|
||||
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.target.soc) }}
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: ${{ matrix.target.rust-target }}
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
# Install the Rust toolchain for Xtensa devices:
|
||||
- if: contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.target.soc)
|
||||
uses: esp-rs/xtensa-toolchain@v1.5
|
||||
with:
|
||||
buildtargets: ${{ matrix.target.soc }}
|
||||
default: true
|
||||
ldproxy: false
|
||||
version: 1.83.0.1
|
||||
|
||||
- name: Build tests
|
||||
run: cargo xtask build-tests ${{ matrix.target.soc }}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tests-${{ matrix.target.soc }}
|
||||
path: /home/runner/work/esp-hal/esp-hal/target/tests/${{ matrix.target.soc }}
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
|
||||
hil:
|
||||
name: Run HIL Tests | ${{ matrix.target.soc }}
|
||||
needs: [build-tests, build-xtasks]
|
||||
runs-on:
|
||||
labels: [self-hosted, "${{ matrix.target.runner }}"]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
# RISC-V devices:
|
||||
- soc: esp32c2
|
||||
runner: esp32c2-jtag
|
||||
host: aarch64
|
||||
- soc: esp32c3
|
||||
runner: esp32c3-usb
|
||||
host: armv7
|
||||
- soc: esp32c6
|
||||
runner: esp32c6-usb
|
||||
host: armv7
|
||||
- soc: esp32h2
|
||||
runner: esp32h2-usb
|
||||
host: armv7
|
||||
# Xtensa devices:
|
||||
- soc: esp32
|
||||
runner: esp32-jtag
|
||||
host: aarch64
|
||||
- soc: esp32s2
|
||||
runner: esp32s2-jtag
|
||||
host: armv7
|
||||
- soc: esp32s3
|
||||
runner: esp32s3-usb
|
||||
host: armv7
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: tests-${{ matrix.target.soc }}
|
||||
path: tests-${{ matrix.target.soc }}
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: xtask-${{ matrix.target.host }}
|
||||
|
||||
- name: Run Tests
|
||||
id: run-tests
|
||||
run: |
|
||||
[ -f ~/setup.sh ] && source ~/setup.sh
|
||||
|
||||
export PATH=$PATH:/home/espressif/.cargo/bin
|
||||
chmod +x xtask
|
||||
./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }}
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
rm -rf tests-${{ matrix.target.soc }}
|
||||
rm -f xtask
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@ -16,9 +16,3 @@ Cargo.lock
|
||||
# Wokwi related files
|
||||
diagram.json
|
||||
wokwi.toml
|
||||
|
||||
# We'll ignore VS Code settings (at least for now...)
|
||||
**/.vscode/settings.json
|
||||
|
||||
# Ignore generated documentation
|
||||
docs/
|
||||
|
||||
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["rust-lang.rust-analyzer", "tamasfe.even-better-toml"]
|
||||
}
|
||||
34
.vscode/settings.json
vendored
Normal file
34
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
|
||||
"rust-analyzer.cargo.buildScripts.enable": true,
|
||||
"rust-analyzer.check.allTargets": false,
|
||||
"rust-analyzer.imports.granularity.enforce": true,
|
||||
"rust-analyzer.imports.granularity.group": "crate",
|
||||
"rust-analyzer.procMacro.attributes.enable": true,
|
||||
"rust-analyzer.procMacro.enable": true,
|
||||
"rust-analyzer.showUnlinkedFileNotification": false,
|
||||
|
||||
// Uncomment ONE line for the chip you want to work on.
|
||||
// This makes rust-analyzer work on the HAL crate and all its dependencies.
|
||||
"rust-analyzer.linkedProjects": [
|
||||
"esp32-hal/Cargo.toml"
|
||||
// "esp32c2-hal/Cargo.toml",
|
||||
// "esp32c3-hal/Cargo.toml",
|
||||
// "esp32c6-hal/Cargo.toml",
|
||||
// "esp32c6-lp-hal/Cargo.toml",
|
||||
// "esp32h2-hal/Cargo.toml",
|
||||
// "esp32s2-hal/Cargo.toml",
|
||||
// "esp32s3-hal/Cargo.toml",
|
||||
],
|
||||
|
||||
"[toml]": {
|
||||
"editor.formatOnSave": false,
|
||||
},
|
||||
"[markdown]": {
|
||||
"editor.formatOnSave": false,
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.formatOnSave": false,
|
||||
}
|
||||
}
|
||||
402
CHANGELOG.md
Normal file
402
CHANGELOG.md
Normal file
@ -0,0 +1,402 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
Please note that only changes to the `esp-hal-common` package are tracked in this CHANGELOG.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.15.0] - 2024-01-19
|
||||
|
||||
### Added
|
||||
|
||||
- ESP32-C6: Properly initialize PMU (#974)
|
||||
- Implement overriding base mac address (#1044)
|
||||
- Add `rt-riscv` and `rt-xtensa` features to enable/disable runtime support (#1057)
|
||||
- ESP32-C6: Implement deep sleep (#918)
|
||||
- Add `embedded-io` feature to each chip-specific HAL (#1072)
|
||||
- Add `embassy-time-driver` to `esp-hal-common` due to updating `embassy-time` to `v0.3.0` (#1075)
|
||||
- ESP32-S3: Added support for 80Mhz PSRAM (#1069)
|
||||
|
||||
### Changed
|
||||
|
||||
- Set up interrupts for the DMA and async enabled peripherals only when `async` feature is provided (#1042)
|
||||
- Update to `1.0.0` releases of the `embedded-hal-*` packages (#1068)
|
||||
- Update `embassy-time` to `0.3.0` and embassy-executor to `0.5.0` release due to the release of the `embedded-hal-*` packages (#1075)
|
||||
- No longer depend on `embassy-time` (#1092)
|
||||
- Update to latest `smart-leds-trait` and `smart-leds` packages (#1094)
|
||||
|
||||
### Fixed
|
||||
|
||||
- ESP32: correct gpio 32/33 in errata36() (#1053)
|
||||
- ESP32: make gpio 4 usable as analog pin (#1078)
|
||||
- Fix double &mut for the `SetDutyCycle` impl on `PwmPin` (#1033)
|
||||
- ESP32/ESP32-S3: Fix stack-top calculation for app-core (#1081)
|
||||
- ESP32/ESP32-S2/ESP32-S3: Fix embassy-time-timg0 driver (#1091)
|
||||
- ESP32: ADC readings are no longer inverted (#1093)
|
||||
|
||||
### Removed
|
||||
|
||||
### Breaking
|
||||
|
||||
- Unify the low-power peripheral names (`RTC_CNTL` and `LP_CLKRST` to `LPWR`) (#1064)
|
||||
|
||||
## [0.14.1] - 2023-12-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix SHA for all targets (#1021)
|
||||
|
||||
## [0.14.0] - 2023-12-12
|
||||
|
||||
### Added
|
||||
|
||||
- ESP32-C6: LP core clock is configurable (#907)
|
||||
- Derive `Clone` and `Copy` for `EspTwaiFrame` (#914)
|
||||
- A way to configure inverted pins (#912)
|
||||
- Added API to check a GPIO-pin's interrupt status bit (#929)
|
||||
- A `embedded_io_async::Read` implementation for `UsbSerialJtag` (#889)
|
||||
- `RtcClock::get_xtal_freq`, `RtcClock::get_slow_freq` (#957)
|
||||
- Added Rx Timeout functionality to async Uart (#911)
|
||||
- RISC-V: Thread-mode and interrupt-mode executors, `#[main]` macro (#947)
|
||||
- A macro to make it easier to create DMA buffers and descriptors (#935)
|
||||
- I2C timeout is configurable (#1011)
|
||||
- ESP32-C6/ESP32-H2: `flip-link` feature gives zero-cost stack overflow protection (#1008)
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve DMA documentation & clean up module (#915)
|
||||
- Only allow a single version of `esp-hal-common` to be present in an application (#934)
|
||||
- ESP32-C3/C6 and ESP32-H2 can now use the `zero-rtc-bss` feature to enable `esp-hal-common/rv-zero-rtc-bss` (#867)
|
||||
- Reuse `ieee802154_clock_enable/disable()` functions for BLE and rename `ble_ieee802154_clock_enable()` (#953)
|
||||
- The `embedded-io` trait implementations are now gated behind the `embedded-io` feature (#964)
|
||||
- Simplifed RMT channels and channel creators (#958)
|
||||
- Reworked construction of I2S driver instances (#983)
|
||||
- ESP32-S2/S3: Don't require GPIO 18 to create a USB peripheral driver instance (#990)
|
||||
- Updated to latest release candidate (`1.0.0-rc.2`) for `embedded-hal{-async,-nb}` (#994)
|
||||
- Explicit panic when hitting the `DefaultHandler` (#1005)
|
||||
- Relevant interrupts are now auto enabled in `embassy::init` (#1014).
|
||||
|
||||
### Fixed
|
||||
|
||||
- ESP32-C2/C3 examples: fix build error (#899)
|
||||
- ESP32-S3: Fix GPIO interrupt handler crashing when using GPIO48. (#898)
|
||||
- Fixed short wait times in embassy causing hangs (#906)
|
||||
- Make sure to clear LP/RTC RAM before loading code (#916)
|
||||
- Async RMT channels can be used concurrently (#925)
|
||||
- Xtensa: Allow using `embassy-executor`'s thread-mode executor if neither `embassy-executor-thread`, nor `embassy-executor-interrupt` is enabled. (#937)
|
||||
- Uart Async: Improve interrupt handling and irq <--> future communication (#977)
|
||||
- RISC-V: Fix stack allocation (#988)
|
||||
- ESP32-C6: Fix used RAM (#997)
|
||||
- ESP32-H2: Fix used RAM (#1003)
|
||||
- Fix SPI slave DMA dma\_read and dma\_write (#1013)
|
||||
- ESP32-C6/H2: Fix disabling of interrupts (#1040)
|
||||
|
||||
### Removed
|
||||
|
||||
- Direct boot support has been removed (#903).
|
||||
- Removed the `mcu-boot` feature from `esp32c3-hal` (#938)
|
||||
- Removed SpiBusController and SpiBusDevice in favour of embedded-hal-bus and embassy-embedded-hal implementataions. (#978)
|
||||
|
||||
### Breaking
|
||||
|
||||
- `Spi::new`/`Spi::new_half_duplex` takes no gpio pin now, instead you need to call `with_pins` to setup those (#901).
|
||||
- ESP32-C2, ESP32-C3, ESP32-S2: atomic emulation trap has been removed. (#904) (#985)
|
||||
- When upgrading you must either remove [these lines](https://github.com/esp-rs/riscv-atomic-emulation-trap#usage) from your `.cargo/config.toml`.
|
||||
- Usage of `core::sync::atomic::*` in dependent crates should be replaced with [portable-atomic](https://github.com/taiki-e/portable-atomic).
|
||||
- RSA driver now takes `u32` words instead of `u8` bytes. The expected slice length is now 4 times shorter. (#981)
|
||||
|
||||
## [0.13.1] - 2023-11-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- ESP32-C3: Make sure BLE and WiFi are not powered down when esp-wifi needs them (#891)
|
||||
- ESP32-C6/H2: Fix setting UART baud rate (#893)
|
||||
|
||||
## [0.13.0] - 2023-10-31
|
||||
|
||||
### Added
|
||||
|
||||
- Implement SetFrequencyCycle and PwmPin from embedded_hal for PwmPin of MCPWM. (#880)
|
||||
- Added `embassy-time-systick` to ESP32-S2 (#827)
|
||||
- Implement enabling/disabling BLE clock on ESP32-C6 (#784)
|
||||
- Async support for RMT (#787)
|
||||
- Implement `defmt::Format` for more types (#786)
|
||||
- Add new_no_miso to Spi FullDuplexMode (#794)
|
||||
- Add UART support for splitting into TX and RX (#754)
|
||||
- Async support for I2S (#801)
|
||||
- Async support for PARL_IO (#807)
|
||||
- ETM driver, GPIO ETM (#819)
|
||||
- (G)DMA AES support (#821)
|
||||
- SYSTIMER ETM functionality (#828)
|
||||
- Adding async support for RSA peripheral(doesn't work properly for `esp32` chip - issue will be created)(#790)
|
||||
- Added sleep support for ESP32-C3 with timer and GPIO wakeups (#795)
|
||||
- Support for ULP-RISCV including Delay and GPIO (#840, #845)
|
||||
- Add bare-bones SPI slave support, DMA only (#580, #843)
|
||||
- Embassy `#[main]` convenience macro (#841)
|
||||
- Add a `defmt` feature to the `esp-hal-smartled` package (#846)
|
||||
- Support 16MB octal PS-RAM for ESP32-S3 (#858)
|
||||
- RISCV TRACE Encoder driver for ESP32-C6 / ESP32-H2 (#864)
|
||||
- `embedded_hal` 1 `InputPin` and `embedded_hal_async` `Wait` impls for open drain outputs (#905)
|
||||
|
||||
### Changed
|
||||
|
||||
- Bumped MSRV to 1.67 (#798)
|
||||
- Optimised multi-core critical section implementation (#797)
|
||||
- Changed linear- and curve-calibrated ADC to provide readings in mV (#836)
|
||||
|
||||
### Fixed
|
||||
|
||||
- S3: Allow powering down RC_FAST_CLK (#796)
|
||||
- UART/ESP32: fix calculating FIFO counter with `get_rx_fifo_count()` (#804)
|
||||
- Xtensa targets: Use ESP32Reset - not Reset (#823)
|
||||
- Examples should now work with the `defmt` feature (#810)
|
||||
- Fixed a race condition causing SpiDma to stop working unexpectedly (#869)
|
||||
- Fixed async uart serial, and updated the embassy_serial examples (#871).
|
||||
- Fix ESP32-S3 direct-boot (#873)
|
||||
- Fix ESP32-C6 ADC (#876)
|
||||
- Fix ADC Calibration not being used on ESP32-S2 and ESP32-S3 (#1000)
|
||||
|
||||
### Removed
|
||||
|
||||
- `Pin::is_pcore_interrupt_set` (#793)
|
||||
- `Pin::is_pcore_non_maskable_interrupt_set` (#793)
|
||||
- `Pin::is_acore_interrupt_set` (#793)
|
||||
- `Pin::is_acore_non_maskable_interrupt_set` (#793)
|
||||
- `Pin::enable_hold` (#793)
|
||||
- Removed the generic return type for ADC reads (#792)
|
||||
|
||||
### Breaking
|
||||
|
||||
- `Uart::new` now takes the `&Clocks` struct to ensure baudrate is correct for CPU/APB speed. (#808)
|
||||
- `Uart::new_with_config` takes an `Config` instead of `Option<Config>`. (#808)
|
||||
- `Alarm::set_period` takes a period (duration) instead of a frequency (#812)
|
||||
- `Alarm::interrupt_clear` is now `Alarm::clear_interrupt` to be consistent (#812)
|
||||
- The `PeripheralClockControl` struct is no longer public, drivers no longer take this as a parameter (#817)
|
||||
- Unify the system peripheral, `SYSTEM`, `DPORT` and `PCR` are now all exposed as `SYSTEM` (#832).
|
||||
- Unified the ESP32's and ESP32-C2's xtal frequency features (#831)
|
||||
- Replace any underscores in feature names with dashes (#833)
|
||||
- The `spi` and `spi_slave` modules have been refactored into the `spi`, `spi::master`, and `spi::slave` modules (#843)
|
||||
- The `WithDmaSpi2`/`WithDmaSpi3` structs are no longer generic around the inner peripheral type (#853)
|
||||
- The `SarAdcExt`/`SensExt` traits are now collectively named `AnalogExt` instead (#857)
|
||||
- Replace the `radio` module with peripheral singleton structs (#852)
|
||||
- The SPI traits are no longer re-exported in the main prelude, but from preludes in `spi::master`/`spi::slave` instead (#860)
|
||||
- The `embedded-hal-1` and `embedded-hal-async` traits are no longer re-exported in the prelude (#860)
|
||||
|
||||
## [0.12.0] - 2023-09-05
|
||||
|
||||
### Added
|
||||
|
||||
- Implement RTCIO pullup, pulldown and hold control for Xtensa MCUs (#684)
|
||||
- S3: Implement RTCIO wakeup source (#690)
|
||||
- Add PARL_IO driver for ESP32-C6 / ESP32-H2 (#733, #760)
|
||||
- Implement `ufmt_write::uWrite` trait for USB Serial JTAG (#751)
|
||||
- Add HMAC peripheral support (#755)
|
||||
- Add multicore-aware embassy executor for Xtensa MCUs (#723, #756).
|
||||
- Add interrupt-executor for Xtensa MCUs (#723, #756).
|
||||
- Add missing `Into<Gpio<Analog, GPIONUN>>` conversion (#764)
|
||||
- Updated `clock` module documentation (#774)
|
||||
- Add `log` feature to enable log output (#773)
|
||||
- Add `defmt` feature to enable log output (#773)
|
||||
- A new macro to load LP core code on ESP32-C6 (#779)
|
||||
- Add `ECC`` peripheral driver (#785)
|
||||
- Initial LLD support for Xtensa chips (#861).
|
||||
|
||||
### Changed
|
||||
|
||||
- Update the `embedded-hal-*` packages to `1.0.0-rc.1` and implement traits from `embedded-io` and `embedded-io-async` (#747)
|
||||
- Moved AlignmentHelper to its own module (#753)
|
||||
- Disable all watchdog timers by default at startup (#763)
|
||||
- `log` crate is now opt-in (#773)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `psram` availability lookup in `esp-hal-common` build script (#718)
|
||||
- Fix wrong `dram_seg` length in `esp32s2-hal` linker script (#732)
|
||||
- Fix setting alarm when a timer group is used as the alarm source. (#730)
|
||||
- Fix `Instant::now()` not counting in some cases when using TIMG0 as the timebase (#737)
|
||||
- Fix number of ADC attenuations for ESP32-C6 (#771)
|
||||
- Fix SHA registers access (#805)
|
||||
|
||||
### Breaking
|
||||
|
||||
- `CpuControl::start_app_core()` now takes an `FnOnce` closure (#739)
|
||||
|
||||
## [0.11.0] - 2023-08-10
|
||||
|
||||
### Added
|
||||
|
||||
- Add initial LP-IO support for ESP32-C6 (#639)
|
||||
- Implement sleep with some wakeup methods for `esp32` (#574)
|
||||
- Add a new RMT driver (#653, #667, #695)
|
||||
- Implemented calibrated ADC API for ESP32-S3 (#641)
|
||||
- Add MCPWM DeadTime configuration (#406)
|
||||
- Implement sleep with some wakeup methods for `esp32-s3` (#660, #689, #696)
|
||||
- Add feature enabling directly hooking the interrupt vector table (#621)
|
||||
- Add `ClockControl::max` helper for all chips (#701)
|
||||
- Added module-level documentation for all peripherals (#680)
|
||||
- Implement sleep with some wakeup methods for `esp32-s3` (#660)
|
||||
- Add `FlashSafeDma` wrapper for eh traits which ensure correct DMA transfer from source data in flash (ROM) (#678)
|
||||
|
||||
### Changed
|
||||
|
||||
- Update `embedded-hal-*` alpha packages to their latest versions (#640)
|
||||
- Implement the `Clone` and `Copy` traits for the `Rng` driver (#650)
|
||||
- Use all remaining memory as core-0's stack (#716)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Async Uart `read` when `set_at_cmd` is not used (#652)
|
||||
- USB device support is working again (#656)
|
||||
- Add missing interrupt status read for esp32s3, which fixes USB-SERIAL-JTAG interrupts (#664)
|
||||
- GPIO interrupt status bits are now properly cleared (#670)
|
||||
- Increase frequency resolution in `set_periodic` (#686)
|
||||
- Fixed ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3 radio clock gating (#679, #681)
|
||||
- Partially fix ESP32 radio clocks (#709)
|
||||
- Fixed "ESP32/ESP32-S2 RMT transmission with with data.len() > RMT_CHANNEL_RAM_SIZE results in TransmissionError" #707 (#710)
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove the `allow-opt-level-z` feature from `esp32c3-hal` (#654)
|
||||
- Remove the old `pulse_control` driver (#694)
|
||||
|
||||
### Breaking
|
||||
|
||||
- `DmaTransfer::wait` and `I2sReadDmaTransfer::wait_receive` now return `Result` (#665)
|
||||
- `gpio::Pin` is now object-safe (#687)
|
||||
|
||||
## [0.10.0] - 2023-06-04
|
||||
|
||||
### Added
|
||||
|
||||
- Add `WithDmaSpi3` to prelude for ESP32S3 (#623)
|
||||
- Add bare-bones PSRAM support for ESP32 (#506)
|
||||
- Add initial support for the ESP32-H2 (#513, #526, #527, #528, #530, #538, #544, #548, #551, #556, #560, #566, #549, #564, #569, #576, #577, #589, #591, #597)
|
||||
- Add bare-bones PSRAM support for ESP32-S3 (#517)
|
||||
- Add async support to the I2C driver (#519)
|
||||
- Implement Copy and Eq for EspTwaiError (#540)
|
||||
- Add LEDC hardware fade support (#475)
|
||||
- Added support for multicore async GPIO (#542)
|
||||
- Add a fn to poll DMA transfers (#559)
|
||||
- Add unified field-based efuse access (#567)
|
||||
- Move `esp-riscv-rt` into esp-hal (#578)
|
||||
- Add CRC functions from ESP ROM (#587)
|
||||
- Add a `debug` feature to enable the PACs' `impl-register-debug` feature (#596)
|
||||
- Add initial support for `I2S` in ESP32-H2 (#597)
|
||||
- Add octal PSRAM support for ESP32-S3 (#610)
|
||||
- Add MD5 functions from ESP ROM (#618)
|
||||
- Add embassy async `read` support for `uart` (#620)
|
||||
- Add bare-bones support to run code on ULP-RISCV / LP core (#631)
|
||||
- Add ADC calibration implementation for a riscv chips (#555)
|
||||
- Add `async` implementation for `USB Serial/JTAG`(#632)
|
||||
|
||||
### Changed
|
||||
|
||||
- Simplify the `Delay` driver, derive `Clone` and `Copy` (#568)
|
||||
- DMA types can no longer be constructed by the user (#625)
|
||||
- Move core interrupt handling from Flash to RAM for RISC-V chips (ESP32-H2, ESP32-C2, ESP32-C3, ESP32-C6) (#541)
|
||||
- Change LED pin to GPIO2 in ESP32 blinky example (#581)
|
||||
- Update ESP32-H2 and ESP32-C6 clocks and remove `i2c_clock` for all chips but ESP32 (#592)
|
||||
- Use both timers in `TIMG0` for embassy time driver when able (#609)
|
||||
- Re-work `RadioExt` implementations, add support for ESP32-H2 (#627)
|
||||
- Improve examples documentation (#533)
|
||||
- esp32h2-hal: added README (#585)
|
||||
- Update `esp-hal-procmacros` package dependencies and features (#628)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Corrected the expected DMA descriptor counts (#622, #625)
|
||||
- DMA is supported for SPI3 on ESP32-S3 (#507)
|
||||
- `change_bus_frequency` is now available on `SpiDma` (#529)
|
||||
- Fixed a bug where a GPIO interrupt could erroneously fire again causing the next `await` on that pin to instantly return `Poll::Ok` (#537)
|
||||
- Set `vecbase` on core 1 (ESP32, ESP32-S3) (#536)
|
||||
- ESP32-S3: Move PSRAM related function to RAM (#546)
|
||||
- ADC driver will now apply attenuation values to the correct ADC's channels. (#554)
|
||||
- Sometimes half-duplex non-DMA SPI reads were reading garbage in non-release mode (#552)
|
||||
- ESP32-C3: Fix GPIO5 ADC channel id (#562)
|
||||
- ESP32-H2: Fix direct-boot feature (#570)
|
||||
- Fix Async GPIO not disabling interupts on chips with multiple banks (#572)
|
||||
- ESP32-C6: Support FOSC CLK calibration for ECO1+ chip revisions (#593)
|
||||
- Fixed CI by pinning the log crate to 0.4.18 (#600)
|
||||
- ESP32-S3: Fix calculation of PSRAM start address (#601)
|
||||
- Fixed wrong variable access (FOSC CLK calibration for ESP32-C6 #593)
|
||||
- Fixed [trap location in ram](https://github.com/esp-rs/esp-hal/pull/605#issuecomment-1604039683) (#605)
|
||||
- Fix rom::crc docs (#611)
|
||||
- Fixed a possible overlap of `.data` and `.rwtext` (#616)
|
||||
- Avoid SDA/SCL being low while configuring pins for I2C (#619)
|
||||
|
||||
### Breaking
|
||||
|
||||
- Simplified user-facing SpiDma and I2s types (#626)
|
||||
- Significantly simplified user-facing GPIO pin types. (#553)
|
||||
- No longer re-export the `soc` module and the contents of the `interrupt` module at the package level (#607)
|
||||
|
||||
## [0.9.0] - 2023-05-02
|
||||
|
||||
### Added
|
||||
|
||||
- Add bare-bones PSRAM support for ESP32-S2 (#493)
|
||||
- Add `DEBUG_ASSIST` functionality (#484)
|
||||
- Add RSA peripheral support (#467)
|
||||
- Add PeripheralClockControl argument to `timg`, `wdt`, `sha`, `usb-serial-jtag` and `uart` constructors (#463)
|
||||
- Added API to raise and reset software interrupts (#426)
|
||||
- Implement `embedded_hal_nb::serial::*` traits for `UsbSerialJtag` (#498)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `get_wakeup_cause` comparison error (#472)
|
||||
- Use 192 as mclk_multiple for 24-bit I2S (#471)
|
||||
- Fix `CpuControl::start_app_core` signature (#466)
|
||||
- Move `rwtext` after other RAM data sections (#464)
|
||||
- ESP32-C3: Disable `usb_pad_enable` when setting GPIO18/19 to input/output (#461)
|
||||
- Fix 802.15.4 clock enabling (ESP32-C6) (#458)
|
||||
- ESP32-S3: Disable usb_pad_enable when setting GPIO19/20 to input/output (#645)
|
||||
|
||||
### Changed
|
||||
|
||||
- Update `embedded-hal-async` and `embassy-*` dependencies (#488)
|
||||
- Update to `embedded-hal@1.0.0-alpha.10` and `embedded-hal-nb@1.0.0-alpha.2` (#487)
|
||||
- Let users configure the LEDC output pin as open-drain (#474)
|
||||
- Use bitflags to decode wakeup cause (#473)
|
||||
- Minor linker script additions (#470)
|
||||
- Minor documentation improvements (#460)
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove unnecessary generic from `UsbSerialJtag` driver (#492)
|
||||
- Remove `#[doc(inline)]` from esp-hal-common re-exports (#490)
|
||||
|
||||
## [0.8.0] - 2023-03-27
|
||||
|
||||
## [0.7.1] - 2023-02-22
|
||||
|
||||
## [0.7.0] - 2023-02-21
|
||||
|
||||
## [0.5.0] - 2023-01-26
|
||||
|
||||
## [0.4.0] - 2022-12-12
|
||||
|
||||
## [0.3.0] - 2022-11-17
|
||||
|
||||
## [0.2.0] - 2022-09-13
|
||||
|
||||
## [0.1.0] - 2022-08-05
|
||||
|
||||
[0.15.0]: https://github.com/esp-rs/esp-hal/compare/v0.14.1...v0.15.0
|
||||
[0.14.1]: https://github.com/esp-rs/esp-hal/compare/v0.14.0...v0.14.1
|
||||
[0.14.0]: https://github.com/esp-rs/esp-hal/compare/v0.13.1...v0.14.0
|
||||
[0.13.1]: https://github.com/esp-rs/esp-hal/compare/v0.13.0...v0.13.1
|
||||
[0.13.0]: https://github.com/esp-rs/esp-hal/compare/v0.12.0...v0.13.0
|
||||
[0.12.0]: https://github.com/esp-rs/esp-hal/compare/v0.11.0...v0.12.0
|
||||
[0.11.0]: https://github.com/esp-rs/esp-hal/compare/v0.10.0...v0.11.0
|
||||
[0.10.0]: https://github.com/esp-rs/esp-hal/compare/v0.9.0...v0.10.0
|
||||
[0.9.0]: https://github.com/esp-rs/esp-hal/compare/v0.8.0...v0.9.0
|
||||
[0.8.0]: https://github.com/esp-rs/esp-hal/compare/v0.7.1...v0.8.0
|
||||
[0.7.1]: https://github.com/esp-rs/esp-hal/compare/v0.7.0...v0.7.1
|
||||
[0.7.0]: https://github.com/esp-rs/esp-hal/compare/v0.5.0...v0.7.0
|
||||
[0.5.0]: https://github.com/esp-rs/esp-hal/compare/v0.4.0...v0.5.0
|
||||
[0.4.0]: https://github.com/esp-rs/esp-hal/compare/v0.3.0...v0.4.0
|
||||
[0.3.0]: https://github.com/esp-rs/esp-hal/compare/v0.2.0...v0.3.0
|
||||
[0.2.0]: https://github.com/esp-rs/esp-hal/compare/v0.1.0...v0.2.0
|
||||
[0.1.0]: https://github.com/esp-rs/esp-hal/releases/tag/v0.1.0
|
||||
101
CONTRIBUTING.md
Normal file
101
CONTRIBUTING.md
Normal file
@ -0,0 +1,101 @@
|
||||
# Welcome to the `esp-hal` contributing guide
|
||||
|
||||
Thank you for investing your time in contributing to our project!
|
||||
|
||||
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
|
||||
|
||||
Use the table of contents icon (<img src="resources/table-of-contents.png" width="24" height="24" />) in the top right corner of this document to get to a specific section of this guide quickly.
|
||||
|
||||
## New Contributor Guide
|
||||
|
||||
To get an overview of the project, please read the [README]. Here are some resources to help you get started with open source contributions:
|
||||
|
||||
- [Finding ways to contribute to open source on GitHub]
|
||||
- [Set up Git]
|
||||
- [GitHub flow]
|
||||
- [Collaborating with pull requests]
|
||||
|
||||
[README]: README.md
|
||||
[Finding ways to contribute to open source on GitHub]: https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github
|
||||
[Set up Git]: https://docs.github.com/en/get-started/quickstart/set-up-git
|
||||
[GitHub flow]: https://docs.github.com/en/get-started/quickstart/github-flow
|
||||
[Collaborating with pull requests]: https://docs.github.com/en/github/collaborating-with-pull-requests
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Issues
|
||||
|
||||
#### Create a New Issue
|
||||
|
||||
If you spot a problem with the docs, [search if an issue already exists]. If a related issue doesn't exist, you can open a new issue using the [issue form].
|
||||
|
||||
[search if an issue already exists]: https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments
|
||||
[issue form]: https://github.com/esp-rs/esp-hal/issues/new/
|
||||
|
||||
#### Solve an Issue
|
||||
|
||||
Scan through our [existing issues] to find one that interests you. You can narrow down the search using labels as filters. If you find an issue to work on, you are welcome to open a PR with a fix.
|
||||
|
||||
It's recommended that you comment in the relevant issue, mentioning that you are actively working on it, however this is not a requirement.
|
||||
|
||||
If somebody is already assigned to an issue, this does not necessarily mean they are actively working on it; don't be afraid to comment in these issues asking if you can take over the work if you're interested.
|
||||
|
||||
[existing issues]: https://github.com/esp-rs/esp-hal/issues
|
||||
|
||||
### Make Changes
|
||||
|
||||
1. Fork the repository.
|
||||
- Using GitHub Desktop:
|
||||
- [Getting started with GitHub Desktop] will guide you through setting up Desktop.
|
||||
- Once Desktop is set up, you can use it to [fork the repo!]
|
||||
- Using the command line:
|
||||
- [Fork the repo] so that you can make your changes without affecting the original project until you're ready to merge them.
|
||||
2. Install or update to the latest version of Rust. See [rustup.rs] for more information.
|
||||
3. Create a working branch and start with your changes!
|
||||
|
||||
[Getting started with GitHub Desktop]: https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop
|
||||
[fork the repo!]: https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop
|
||||
[Fork the repo]: https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository
|
||||
[rustup.rs]: https://rustup.rs/
|
||||
|
||||
### Commit Your Update
|
||||
|
||||
Commit the changes once you are happy with them. Don't forget to self-review to speed up the review process.
|
||||
|
||||
We ask that you ensure all source code files has been properly formatted with `rustfmt`, and that you have linted your changes by running `cargo clippy`. These tools can be installed by running the following commands:
|
||||
|
||||
```shell
|
||||
rustup component add rustfmt
|
||||
rustup component add clippy
|
||||
```
|
||||
|
||||
We _strongly_ recommend that you use the supplied `pre-commit` Git hook, which will ensure that all source code has been formatted correctly prior to committing. See the [Git documentation] for more information on hooks.
|
||||
|
||||
The `pre-commit` hook can be installed by running the following command in a terminal, from the root of the repository:
|
||||
|
||||
```shell
|
||||
cp pre-commit .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
[Git documentation]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
|
||||
|
||||
### Pull Request
|
||||
|
||||
When you're finished with the changes, create a pull request, also known as a PR.
|
||||
|
||||
- Fill the pull request template so that we can review your PR. This template helps reviewers understand your changes as well as the purpose of your pull request.
|
||||
- Don't forget to [link PR to issue] if you are solving one.
|
||||
- Enable the checkbox to [allow maintainer edits] so the branch can be updated for a merge. Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information.
|
||||
- We may ask for changes to be made before a PR can be merged, either using [suggested changes] or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
|
||||
- As you update your PR and apply changes, mark each conversation as [resolved].
|
||||
- If you run into any merge issues, checkout this [git tutorial] to help you resolve merge conflicts and other issues.
|
||||
|
||||
[link PR to issue]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
|
||||
[allow maintainer edits]: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork
|
||||
[suggested changes]: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request
|
||||
[resolved]: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations
|
||||
[git tutorial]: https://github.com/skills/resolve-merge-conflicts
|
||||
|
||||
### Your PR is Merged!
|
||||
|
||||
Congratulations! The esp-rs team thanks you for your contributions!
|
||||
28
Cargo.toml
28
Cargo.toml
@ -1,28 +0,0 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["xtask"]
|
||||
exclude = [
|
||||
"esp-alloc",
|
||||
"esp-backtrace",
|
||||
"esp-build",
|
||||
"esp-config",
|
||||
"esp-hal",
|
||||
"esp-hal-embassy",
|
||||
"esp-hal-procmacros",
|
||||
"esp-ieee802154",
|
||||
"esp-lp-hal",
|
||||
"esp-metadata",
|
||||
"esp-println",
|
||||
"esp-riscv-rt",
|
||||
"esp-wifi",
|
||||
"esp-storage",
|
||||
"examples",
|
||||
"extras/bench-server",
|
||||
"extras/esp-wifishark",
|
||||
"extras/ieee802154-sniffer",
|
||||
"hil-test",
|
||||
"qa-test",
|
||||
"xtensa-lx",
|
||||
"xtensa-lx-rt",
|
||||
"xtensa-lx-rt/procmacros",
|
||||
]
|
||||
115
README.md
115
README.md
@ -1,29 +1,20 @@
|
||||
# esp-hal
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
Bare-metal (`no_std`) hardware abstraction layer for Espressif devices. Currently supports, to varying degrees, the following devices:
|
||||
**H**ardware **A**bstraction **L**ayer crates for the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, and **ESP32-S2/S3** from Espressif. Additionally provides support for programming the low-power RISC-V cores found on the **ESP32-C6** and **ESP32-S2/S3**.
|
||||
|
||||
- ESP32 Series: _ESP32_
|
||||
- ESP32-C Series: _ESP32-C2, ESP32-C3, ESP32-C6_
|
||||
- ESP32-H Series: _ESP32-H2_
|
||||
- ESP32-S Series: _ESP32-S2, ESP32-S3_
|
||||
|
||||
Additionally provides limited support for programming the low-power RISC-V cores found on the _ESP32-C6_, _ESP32-S2_, and _ESP32-S3_ via the [esp-lp-hal] package.
|
||||
|
||||
These packages are all `no_std`; if you are looking for `std` support, please use [esp-idf-svc] instead.
|
||||
These HALs are `no_std`; if you are looking for `std` support, please use [esp-idf-hal] instead.
|
||||
|
||||
If you have any questions, comments, or concerns, please [open an issue], [start a new discussion], or join us on [Matrix]. For additional information regarding any of the crates in this repository, please refer to the relevant crate's README.
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> This repository includes crates that are at various stages of maturity and stability. While many functionalities have already been implemented and are usable for most tasks, certain advanced or less common features may still be under development. Each crate may offer different levels of functionality and guarantees.
|
||||
> This project is still in the relatively early stages of development, and as such there should be no expectation of API stability. A significant number of peripherals currently have drivers implemented but have varying levels of functionality. For most basic tasks, this should be usable already, however some more advanced or uncommon features may not yet be implemented.
|
||||
|
||||
[esp-lp-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp-lp-hal
|
||||
[esp-idf-svc]: https://github.com/esp-rs/esp-idf-svc
|
||||
[esp-idf-hal]: https://github.com/esp-rs/esp-idf-hal
|
||||
[open an issue]: https://github.com/esp-rs/esp-hal/issues/new
|
||||
[start a new discussion]: https://github.com/esp-rs/esp-hal/discussions/new
|
||||
[matrix]: https://matrix.to/#/#esp-rs:matrix.org
|
||||
@ -32,10 +23,10 @@ If you have any questions, comments, or concerns, please [open an issue], [start
|
||||
|
||||
For information relating to the development of Rust applications on ESP devices, please first read [The Rust on ESP Book].
|
||||
|
||||
For information about the HAL and how to use it in your own projects, please refer to the [documentation].
|
||||
For information about the HAL and how to use it in your own projects, please refer to the documentation on [docs.rs] for the relevant chip.
|
||||
|
||||
[The Rust on ESP Book]: https://esp-rs.github.io/book/
|
||||
[documentation]: https://docs.esp-rs.org/esp-hal/
|
||||
[docs.rs]: https://docs.rs
|
||||
|
||||
## Resources
|
||||
|
||||
@ -45,16 +36,90 @@ For information about the HAL and how to use it in your own projects, please ref
|
||||
- [The Rust on ESP Book](https://esp-rs.github.io/book/)
|
||||
- [Embedded Rust (no_std) on Espressif](https://esp-rs.github.io/no_std-training/)
|
||||
|
||||
## Crates
|
||||
## HAL Crates
|
||||
|
||||
This repository is home to a number of different packages; for more information regarding a particular package, please refer to its `README.md` and/or documentation.
|
||||
### High-Power Cores
|
||||
|
||||
## Contributing
|
||||
| Crate | Documentation | Technical Reference Manual | Target | MSRV |
|
||||
| :-----------: | :------------------------------------------------: | :------------------------: | :----------------------------: | :---------: |
|
||||
| [esp32-hal] | [![esp32-hal-docs]](https://docs.rs/esp32-hal) | [ESP32] | `xtensa-esp32-none-elf` | ![esp] |
|
||||
| [esp32c2-hal] | [![esp32c2-hal-docs]](https://docs.rs/esp32c2-hal) | [ESP32-C2] | `riscv32imc-unknown-none-elf` | ![nightly] |
|
||||
| [esp32c3-hal] | [![esp32c3-hal-docs]](https://docs.rs/esp32c3-hal) | [ESP32-C3] | `riscv32imc-unknown-none-elf` | ![nightly] |
|
||||
| [esp32c6-hal] | [![esp32c6-hal-docs]](https://docs.rs/esp32c6-hal) | [ESP32-C6] | `riscv32imac-unknown-none-elf` | ![nightly] |
|
||||
| [esp32h2-hal] | [![esp32h2-hal-docs]](https://docs.rs/esp32h2-hal) | [ESP32-H2] | `riscv32imac-unknown-none-elf` | ![nightly] |
|
||||
| [esp32s2-hal] | [![esp32s2-hal-docs]](https://docs.rs/esp32s2-hal) | [ESP32-S2] | `xtensa-esp32s2-none-elf` | ![esp] |
|
||||
| [esp32s3-hal] | [![esp32s3-hal-docs]](https://docs.rs/esp32s3-hal) | [ESP32-S3] | `xtensa-esp32s3-none-elf` | ![esp] |
|
||||
|
||||
We have a number of living documents to aid contributing to the project, please give these a read before modifying code:
|
||||
[esp]: https://img.shields.io/badge/rustc-esp%201.74+-red.svg
|
||||
[nightly]: https://img.shields.io/badge/rustc-nightly%202023/11/30+-red.svg
|
||||
|
||||
- [API-GUIDELINES](https://github.com/esp-rs/esp-hal/blob/main/documentation/API-GUIDELINES.md)
|
||||
- [CONTRIBUTING-GUIDE](https://github.com/esp-rs/esp-hal/blob/main/documentation/CONTRIBUTING.md)
|
||||
[esp32-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32-hal
|
||||
[esp32c2-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32c2-hal
|
||||
[esp32c3-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32c3-hal
|
||||
[esp32c6-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32c6-hal
|
||||
[esp32h2-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32h2-hal
|
||||
[esp32s2-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32s2-hal
|
||||
[esp32s3-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32s3-hal
|
||||
[esp32-hal-docs]: https://img.shields.io/docsrs/esp32-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32c2-hal-docs]: https://img.shields.io/docsrs/esp32c2-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32c3-hal-docs]: https://img.shields.io/docsrs/esp32c3-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32c6-hal-docs]: https://img.shields.io/docsrs/esp32c6-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32h2-hal-docs]: https://img.shields.io/docsrs/esp32h2-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32s2-hal-docs]: https://img.shields.io/docsrs/esp32s2-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32s3-hal-docs]: https://img.shields.io/docsrs/esp32s3-hal?color=C96329&logo=rust&style=flat-square
|
||||
[esp32]: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
|
||||
[esp32-c2]: https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf
|
||||
[esp32-c3]: https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf
|
||||
[esp32-c6]: https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf
|
||||
[esp32-h2]: https://www.espressif.com/sites/default/files/documentation/esp32-h2_technical_reference_manual_en.pdf
|
||||
[esp32-s2]: https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf
|
||||
[esp32-s3]: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf
|
||||
|
||||
### Low-Power Cores
|
||||
|
||||
| Crate | Documentation | Target |
|
||||
| :-----------------: | :------------------------: | :----------------------------: |
|
||||
| [esp-ulp-riscv-hal] | N/A (_Not yet published_) | `riscv32imc-unknown-none-elf` |
|
||||
| [esp32c6-lp-hal] | N/A (_Not yet published_) | `riscv32imac-unknown-none-elf` |
|
||||
|
||||
[esp-ulp-riscv-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp-ulp-riscv-hal
|
||||
[esp32c6-lp-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32c6-lp-hal
|
||||
|
||||
## Ancillary Crates
|
||||
|
||||
There are a number of other crates within the [esp-rs organization] which can be used in conjunction with `esp-hal`:
|
||||
|
||||
| Crate | Description |
|
||||
| :--------------: | :----------------------------------------------------------------------------: |
|
||||
| [esp-alloc] | A simple `no_std` heap allocator |
|
||||
| [esp-backtrace] | Backtrace support for bare-metal applications |
|
||||
| [esp-ieee802154] | Low-level IEEE802.15.4 driver for the ESP32-C6 and ESP32-H2 |
|
||||
| [esp-openthread] | A bare-metal Thread implementation using `esp-ieee802154` |
|
||||
| [esp-println] | Provides `print!` and `println!` implementations |
|
||||
| [esp-storage] | Implementation of [embedded-storage] traits to access unencrypted flash memory |
|
||||
| [esp-wifi] | `no_std` Wi-Fi/BLE/ESP-NOW support |
|
||||
|
||||
[esp-rs organization]: https://github.com/esp-rs
|
||||
[esp-alloc]: https://github.com/esp-rs/esp-alloc
|
||||
[esp-backtrace]: https://github.com/esp-rs/esp-backtrace
|
||||
[esp-ieee802154]: https://github.com/esp-rs/esp-ieee802154
|
||||
[esp-openthread]: https://github.com/esp-rs/esp-openthread
|
||||
[esp-println]: https://github.com/esp-rs/esp-println
|
||||
[esp-storage]: https://github.com/esp-rs/esp-storage
|
||||
[embedded-storage]: https://github.com/rust-embedded-community/embedded-storage
|
||||
[esp-wifi]: https://github.com/esp-rs/esp-wifi
|
||||
|
||||
## Git Hooks
|
||||
|
||||
We provide a simple `pre-commit` hook to verify the formatting of each package prior to committing changes. We _strongly_ encourage use of this git hook.
|
||||
|
||||
The hook can be enabled by copying it in to the `.git/hooks/` directory:
|
||||
|
||||
```bash
|
||||
cp pre-commit .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
When using this hook, you can choose to ignore its failure on a per-commit basis by committing with the `--no-verify` flag; however, you will need to be sure that all packages are formatted when submitting a pull request.
|
||||
|
||||
## License
|
||||
|
||||
@ -65,7 +130,7 @@ Licensed under either of:
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution notice
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
|
||||
@ -1,144 +0,0 @@
|
||||
# `esp-rs` API Guidelines
|
||||
|
||||
## About
|
||||
|
||||
This is a living document - make sure to check the latest version of this document.
|
||||
|
||||
> [!NOTE]
|
||||
> Not all of the currently existing code follows this guideline, yet.
|
||||
|
||||
In general, the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines) apply to all projects in the ESP-RS GitHub organization where possible.
|
||||
- Especially for public API but if possible also for internal APIs.
|
||||
|
||||
## Amendments to the Rust API Guidelines
|
||||
|
||||
- `C-RW-VALUE` and `C-SERDE` do not apply.
|
||||
- `C-COMMON-TRAITS`:
|
||||
The set of traits to implement depend on the type and use case. In esp-hal, we can highlight a few such use cases and provide recommendations what should be implemented. If nothing here applies, use your best judgement.
|
||||
- Driver structures: `Debug`
|
||||
- Driver configuration: `Default`, `Debug`, `PartialEq/Eq`, `Clone/Copy`, `Hash`
|
||||
- `Clone/Copy` depends on the size and contents of the structure. They should generally be implemented, unless there is a good reason not to.
|
||||
- The `Default` configuration needs to make sense for a particular driver, and applying the default configuration must not fail.
|
||||
- Error types: `Debug`, `PartialEq/Eq`, `Clone/Copy`, `Hash`, `Error`, `Display`
|
||||
|
||||
## Construction and Destruction of Drivers
|
||||
|
||||
- Drivers must take peripherals via the `PeripheralRef` pattern - they don't consume peripherals directly.
|
||||
- If a driver requires pins, those pins should be configured using `fn with_signal_name(self, pin: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self` or `fn with_signal_name(self, pin: impl Peripheral<P = impl PeripheralOutput> + 'd) -> Self`
|
||||
- If a driver supports multiple peripheral instances (for example, I2C0 is one such instance):
|
||||
- The driver should not be generic over the peripheral instance.
|
||||
- The author must to use `crate::any_peripheral` to define the "any" peripheral instance type.
|
||||
- The driver must implement a `new` constructor that automatically converts the peripheral instance into the any type.
|
||||
- If a driver is configurable, configuration options should be implemented as a `Config` struct in the same module where the driver is located.
|
||||
- The driver's constructor should take the config struct by value, and it should return `Result<Self, ConfigError>`.
|
||||
- The `ConfigError` enum should be separate from other `Error` enums used by the driver.
|
||||
- The driver should implement `fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>`.
|
||||
- In case the driver's configuration is infallible (all possible combinations of options are supported by the hardware), the `ConfigError` should be implemented as an empty `enum`.
|
||||
- Configuration structs should derive `procmacros::BuilderLite` in order to automatically implement the Builder Lite pattern for them.
|
||||
- If a driver implements both blocking and async operations, or only implements blocking operations, but may support asynchronous ones in the future, the driver's type signature must include a `crate::Mode` type parameter.
|
||||
- By default, constructors must configure the driver for blocking mode. The driver must implement `into_async` (and a matching `into_blocking`) function that reconfigures the driver.
|
||||
- `into_async` must configure the driver and/or the associated DMA channels. This most often means enabling an interrupt handler.
|
||||
- `into_blocking` must undo the configuration done by `into_async`.
|
||||
- The asynchronous driver implementation must also expose the blocking methods (except for interrupt related functions).
|
||||
- Drivers must have a `Drop` implementation resetting the peripheral to idle state. There are some exceptions to this:
|
||||
- GPIO where common usage is to "set and drop" so they can't be changed
|
||||
- Where we don't want to disable the peripheral as it's used internally, for example SYSTIMER is used by `time::now()` API. See `KEEP_ENABLED` in src/system.rs
|
||||
- A driver doesn't need to do anything special for deinitialization and has a `PeripheralGuard` field which implements the disabling and resetting of the peripheral.
|
||||
- Consider using a builder-like pattern for driver construction.
|
||||
|
||||
## Interoperability
|
||||
|
||||
- Don't use `log::XXX!` macros directly - use the wrappers in `fmt.rs` (e.g. just `info!` instead of `log::info!` or importing `log::*`)!
|
||||
- Consider implementing common ecosystem traits, like the ones in `embedded-hal` or `embassy-embedded-hal`.
|
||||
- Where the guidelines suggest implementing `Debug`, `defmt::Format` should also be implemented.
|
||||
- The `defmt::Format` implementation needs to be gated behind the `defmt` feature.
|
||||
- see [this example](https://github.com/esp-rs/esp-hal/blob/df2b7bd8472cc1d18db0d9441156575570f59bb3/esp-hal/src/spi/mod.rs#L15)
|
||||
- e.g. `#[cfg_attr(feature = "defmt", derive(defmt::Format))]`
|
||||
- Implementations of common, but unstable traits (e.g. `embassy_embedded_hal::SetConfig`) need to be gated with the `unstable` feature.
|
||||
|
||||
## API Surface
|
||||
|
||||
- API documentation must be provided for every new driver and API.
|
||||
- Private details should not leak into the public API, and should be made private where technically possible.
|
||||
- Implementation details that _need_ to be public should be marked with `#[doc(hidden)]` and a comment as to why it needs to be public.
|
||||
- For the time being, this includes any `Instance` traits, and `State` or `Info` structs as well.
|
||||
- Functions which technically need to be public but shouldn't be callable by the user need to be sealed.
|
||||
- see [this example in Rust's core library](https://github.com/rust-lang/rust/blob/044a28a4091f2e1a5883f7fa990223f8b200a2cd/library/core/src/error.rs#L89-L100)
|
||||
- Any public traits, that **must not** be implemented downstream need to be `Sealed`.
|
||||
- Prefer compile-time checks over runtime checks where possible, prefer a fallible API over panics.
|
||||
- Follow naming conventions in order to be consistent across drivers - take inspiration from existing drivers.
|
||||
- Design APIs in a way that they are easy to use.
|
||||
- Driver API decisions should be assessed individually, don't _not_ just follow embedded-hal or other ecosystem trait crates. Expose the capabilities of the hardware. (Ecosystem traits are implemented on top of the inherent API)
|
||||
- Avoid type states and extraneous generics whenever possible
|
||||
- These often lead to usability problems, and tend to just complicate things needlessly - sometimes it can be a good tradeoff to make a type not ZST
|
||||
- Common cases of useless type info is storing pin information - this is usually not required after configuring the pins and will bloat the complexity of the type massively. When following the `PeripheralRef` pattern it's not needed in order to keep users from re-using the pin while in use
|
||||
- Avoiding `&mut self` when `&self` is safe to use. `&self` is generally easier to use as an API. Typical applications of this are where the methods just do writes to registers which don't have side effects.
|
||||
- Maintain order consistency in the API, such as in the case of pairs like RX/TX.
|
||||
- If your driver provides a way to listen for interrupts, the interrupts should be listed in a `derive(EnumSetType)` enum as opposed to one function per interrupt flag.
|
||||
- If a driver only implements a subset of a peripheral's capabilities, it should be placed in the `peripheral::subcategory` module.
|
||||
- For example, if a driver implements the slave-mode I2C driver, it should be placed into `i2c::slave`.
|
||||
- This helps us reducing the need of introducing breaking changes if we implement additional functionalities.
|
||||
- Avoid abbreviations and contractions in the API, where possible.
|
||||
- Saving a few characters may introduce ambiguity, e.g `SpiTransDone`, is it `Transmit` or `Transfer`?
|
||||
- Common abbreviations, that are well understood such as `Dma` are perfectly fine.
|
||||
|
||||
## Maintainability
|
||||
|
||||
- Avoid excessive use of macros unless there is no other option; modification of the PAC crates should be considered before resorting to macros.
|
||||
- Every line of code is a liability. Take some time to see if your implementation can be simplified before opening a PR.
|
||||
- If you are porting code from ESP-IDF (or anything else), please include a link WITH the commit hash in it, and please highlight the relevant line(s) of code
|
||||
- If necessary provide further context as comments (consider linking to code, PRs, TRM - make sure to use permanent links, e.g. include the hash when linking to a Git repository, include the revision, page number etc. when linking to TRMs)
|
||||
- Prefer line comments (//) to block comments (/* ... */)
|
||||
- Generally, follow common "good practices" and idiomatic Rust style
|
||||
- All `Future` objects (public or private) must be marked with ``#[must_use = "futures do nothing unless you `.await` or poll them"]``.
|
||||
- Prefer `cfg_if!` (or, if the branches just pick between separate values of the same variable, `cfg!()`) over multiple exclusive `#[cfg]` attributes. `cfg_if!`/`cfg!()` visually divide the options, often results in simpler conditions and simplifies adding new branches in the future.
|
||||
|
||||
## Driver implementation
|
||||
|
||||
- If a common `Instance` trait is used for multiple peripherals, those traits should not have any logic implemented in them.
|
||||
- The `Instance` traits should only be used to access information about a peripheral instance.
|
||||
- The internal implementation of the driver should be non-generic over the peripheral instance. This helps the compiler produce smaller code.
|
||||
- The author is encouraged to return a static shared reference to an `Info` and a `State` structure from the `Instance` trait.
|
||||
- The `Info` struct should describe the peripheral. Do not use any interior mutability.
|
||||
- The `State` struct should contain counters, wakers and other, mutable state. As this is accessed via a shared reference, interior mutability and atomic variables are preferred.
|
||||
|
||||
## Modules Documentation
|
||||
|
||||
Modules should have the following documentation format:
|
||||
```rust
|
||||
//! # Peripheral Name (Peripheral Acronym)
|
||||
//!
|
||||
//! ## Overview
|
||||
//! Small description of the peripheral, see ESP-IDF docs or TRM
|
||||
//!
|
||||
//! ## Configuration
|
||||
//! Explain how can the peripheral be configured, and which parameters can be configured
|
||||
//!
|
||||
//! ## Usage
|
||||
//! Explain if we implement any external traits
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! ### Name of the Example
|
||||
//! Small description of the example if needed
|
||||
//! ```rust, no_run
|
||||
//! ...
|
||||
//! ```
|
||||
//!
|
||||
//! ## Implementation State
|
||||
//! List unsupported features
|
||||
```
|
||||
- If any of the headers is empty, remove it
|
||||
- When possible, use ESP-IDF docs and TRM as references and include links if possible.
|
||||
- In case of referencing an ESP-IDF link make it chip-specific, for example:
|
||||
```
|
||||
#, "/api-reference/peripherals/etm.html)")]
|
||||
```
|
||||
- In case of referencing a TRM chapter, use the `crate::trm_markdown_link!()` macro. If you are referring to a particular chapter, you may use `crate::trm_markdown_link!("#chapter_anchor")`.
|
||||
- Documentation examples must be short
|
||||
- But must also provide value beyond what the rustdoc generated docs show
|
||||
- Showing a snippet of a slightly more complex interaction, for example inverting the signals for a driver
|
||||
- Showing construction if it is more complex, or requires some non-obvious precursor steps. Think about this for drivers that take a generic instance to construct, rustdoc doesn't do a good job of showing what concrete things can be passed into a constructor.
|
||||
- For more complex scenarios, create an example.
|
||||
- Use rustdoc syntax for linking to other documentation items instead of markdown links where possible
|
||||
- https://doc.rust-lang.org/rustdoc/write-documentation/linking-to-items-by-name.html
|
||||
@ -1,143 +0,0 @@
|
||||
|
||||
# Welcome to the `esp-hal` Contributing Guide
|
||||
|
||||
Thank you for considering contributing to our project! Your efforts help make `esp-hal` a better ecosystem for everyone.
|
||||
|
||||
This guide outlines the contribution workflow, from reporting issues and submitting pull requests, to the review process and eventual merger of contributions.
|
||||
|
||||
## Quick Navigation
|
||||
* [New Contributor Guide]
|
||||
* [Getting Started]
|
||||
* [Issues: Reporting and Resolving]
|
||||
* [Making Changes: Fork, Edit, and Pull Request]
|
||||
* [Testing Your Contributions]
|
||||
* [Commit Your Updates]
|
||||
* [Pull Request: From Submission to Merge]
|
||||
* [Your PR is merged!]
|
||||
|
||||
[New Contributor Guide]: #new-contributor-guide
|
||||
[Getting Started]: #getting-started
|
||||
[Issues: Reporting and Resolving]: #issues-reporting-and-resolving
|
||||
[Making Changes: Fork, Edit, and Pull Request]: #making-changes-fork-edit-and-pull-request
|
||||
[Testing Your Contributions]: #testing-your-contributions
|
||||
[Commit your updates]: #commit-your-updates
|
||||
[Pull Request: From Submission to Merge]: #pull-request-from-submission-to-merge
|
||||
[Your PR is merged!]: #your-pr-is-merged
|
||||
|
||||
## New Contributor Guide
|
||||
|
||||
Welcome aboard! If you're new to `esp-hal` or open-source contribution, here are some resources to get you started:
|
||||
|
||||
* [Understanding the Project]: A high-level overview of `esp-hal`.
|
||||
* Intro to Open Source Contribution: [GitHub's Guide]
|
||||
* [Setting Up Git]
|
||||
* Workflow Insights: [GitHub Flow]
|
||||
* Collaborating via [Pull Requests]
|
||||
|
||||
Before adding or changing code, review the [esp-rs API guidelines].
|
||||
|
||||
[Understanding the Project]: README.md
|
||||
[GitHub's Guide]: https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github
|
||||
[Setting Up Git]: https://docs.github.com/en/get-started/quickstart/set-up-git
|
||||
[GitHub Flow]: https://docs.github.com/en/get-started/quickstart/github-flow
|
||||
[Pull Requests]: https://docs.github.com/en/github/collaborating-with-pull-requests
|
||||
[esp-rs API guidelines]: ./documentation/API-GUIDELINES.md
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Issues: Reporting and Resolving
|
||||
|
||||
#### Reporting a New Issue
|
||||
|
||||
Encountered a problem or have an idea? First, [check existing issues] to avoid duplicates. If your concern is new, use our [issue form] to submit it.
|
||||
|
||||
[check existing issues]: https://github.com/esp-rs/esp-hal/issues
|
||||
[issue form]: https://github.com/esp-rs/esp-hal/issues/new/
|
||||
|
||||
#### Working on an Issue
|
||||
|
||||
Browse [existing issues] to find one that resonates with you. Use labels for easier filtering. If you decide to tackle an issue, it's courteous (but not mandatory) to let others know by commenting.
|
||||
|
||||
[existing issues]: https://github.com/esp-rs/esp-hal/issues
|
||||
|
||||
#### Making Changes: Fork, Edit, and Pull Request
|
||||
|
||||
1. **Fork**: Start by [forking the repository]. This keeps the main project safe while you make your changes.
|
||||
2. **Setup**: Ensure you have the latest Rust toolchain via [rustup.rs].
|
||||
3. **Branch**: Create a branch in your fork for your changes. Keep your changes focused and limited to a single issue or feature.
|
||||
|
||||
[forking the repository]: https://docs.github.com/en/github/getting-started-with-github/fork-a-repo
|
||||
[rustup.rs]: https://rustup.rs/
|
||||
|
||||
#### What You Should Do:
|
||||
|
||||
* **API changes**: If your contribution changes the API, please adapt the driver (including module level documentation) and examples accordingly and update the [HIL] (Hardware-in-the-Loop) tests.
|
||||
* **Run Related Examples**: After making changes, run any affected examples to ensure they build successfully and perform as expected.
|
||||
* **Manual Testing**: For hardware-related changes, manually test your changes on the actual devices when possible. If not, please note it in the corresponding issue, and someone from our team will assist with testing. This is crucial because hardware behavior can sometimes differ from what's simulated or expected.
|
||||
* **HIL Tests**: Ensure that any changes to the API or hardware interaction logic are reflected in the HIL tests located in the `hil-test` directory. This helps verify the real-world applicability of your changes.
|
||||
|
||||
By taking these extra steps to test your contributions, you help maintain the high quality and reliability of `esp-hal`, ensuring it remains a robust platform for everyone.
|
||||
|
||||
[HIL]: https://github.com/esp-rs/esp-hal/tree/main/hil-test
|
||||
|
||||
### Testing Your Contributions
|
||||
|
||||
Ensuring the quality and reliability of `esp-hal` is a shared responsibility, and testing plays a critical role in this process. Our GitHub CI automatically checks the buildability of all examples and drivers within the project. However, automated tests can't catch everything, especially when it comes to the nuanced behavior of hardware interactions. So make sure that the example affected by your change works as expected.
|
||||
|
||||
Further steps that can (or should) be taken in testing:
|
||||
|
||||
* Using [xtask], build examples for the specified chip.
|
||||
* Build the documentation and run the doctests if they have been modified using the `build-documentation` and `run-doc-test` commands in [xtask].
|
||||
* Run the [HIL] tests locally if changes have been made to them.
|
||||
|
||||
[xtask]: https://github.com/esp-rs/esp-hal/tree/main/xtask
|
||||
|
||||
### Commit Your Updates
|
||||
|
||||
Commit your changes once you're satisfied. Review your own work to streamline the review process later. Use `rustfmt` and `cargo clippy` to ensure your code adheres to Rust's conventions.
|
||||
|
||||
```shell
|
||||
rustup component add rustfmt
|
||||
rustup component add clippy
|
||||
```
|
||||
|
||||
We _strongly_ recommend that you format your code before committing to ensure consistency throughout the project.
|
||||
To format all packages in the workspace, run the following command in a terminal from the root of the repository:
|
||||
|
||||
```shell
|
||||
cargo xtask fmt-packages
|
||||
```
|
||||
|
||||
We also recommend using the `lint-packages` subcommand, which uses `cargo clippy` and will lint the entire driver in order to catch common mistakes in the code.
|
||||
|
||||
```shell
|
||||
cargo xtask lint-packages
|
||||
```
|
||||
|
||||
This will use `rustfmt` to ensure that all source code is formatted correctly prior to committing.
|
||||
|
||||
## Pull Request: From Submission to Merge
|
||||
|
||||
* Fill the pull request template so that we can review your PR. This template helps reviewers understand your changes as well as the purpose of your pull request.
|
||||
* [Link your PR] to any relevant issues it addresses.
|
||||
* [Allow edits from maintainers] so the branch can be updated for a merge. Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information.
|
||||
* Make sure you add an entry with your changes to the [Changelog]. Also make sure that it is in the appropriate section of the document.
|
||||
* Make sure you add your changes to the current [migration guide].
|
||||
* We may ask for changes to be made before a PR can be merged, either using [suggested changes] or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
|
||||
* As you update your PR and apply changes, mark each conversation as [resolved].
|
||||
* Resolve merge conflicts if they arise, using resources like [this git tutorial] for help.
|
||||
|
||||
[Link your PR]: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
|
||||
[Allow edits from maintainers]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-forkmember
|
||||
[Changelog]: esp-hal/CHANGELOG.md
|
||||
[migration guide]: esp-hal/MIGRATING-0.20.md
|
||||
[suggested changes]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request
|
||||
[resolved]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#resolving-conversations
|
||||
[this git tutorial]: https://github.com/skills/resolve-merge-conflicts
|
||||
|
||||
|
||||
## Your PR is Merged!
|
||||
|
||||
Congratulations! The `esp-rs` team thanks you for your contributions!
|
||||
|
||||
Contributing to open source extends beyond just code! Each contribution, regardless of size, plays a significant role. We appreciate your involvement in this collective endeavor.
|
||||
@ -1 +0,0 @@
|
||||
avoid-breaking-exported-api = false
|
||||
@ -1,36 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- `esp_alloc::HEAP.stats()` can now be used to get heap usage informations (#2137)
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Removed
|
||||
|
||||
## 0.5.0 - 2024-10-10
|
||||
|
||||
### Changed
|
||||
|
||||
- a global allocator is created in esp-alloc, now you need to add individual memory regions (up to 3) to the allocator (#2099)
|
||||
|
||||
## 0.4.0 - 2024-06-04
|
||||
|
||||
## 0.3.0 - 2023-04-25
|
||||
|
||||
## 0.2.1 - 2023-04-21
|
||||
|
||||
## 0.2.0 - 2023-02-22
|
||||
|
||||
## 0.1.0 - 2022-07-25
|
||||
|
||||
[Unreleased]: https://github.com/esp-rs/esp-hal/commits/main/esp-alloc?since=2024-10-10
|
||||
@ -1,37 +0,0 @@
|
||||
[package]
|
||||
name = "esp-alloc"
|
||||
version = "0.5.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.68"
|
||||
description = "A heap allocator for Espressif devices"
|
||||
keywords = ["allocator", "embedded", "embedded-hal", "esp32", "espressif", "memory"]
|
||||
categories = ["embedded", "memory-management", "no-std"]
|
||||
repository = "https://github.com/esp-rs/esp-hal"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "riscv32imc-unknown-none-elf"
|
||||
features = ["nightly"]
|
||||
|
||||
[dependencies]
|
||||
defmt = { version = "0.3.8", optional = true }
|
||||
cfg-if = "1.0.0"
|
||||
critical-section = "1.1.3"
|
||||
enumset = "1.1.5"
|
||||
linked_list_allocator = { version = "0.10.5", default-features = false, features = ["const_mut_refs"] }
|
||||
document-features = "0.2.10"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
nightly = []
|
||||
|
||||
## Implement `defmt::Format` on certain types.
|
||||
defmt = ["dep:defmt"]
|
||||
|
||||
## Enable this feature if you want to keep stats about the internal heap usage such as:
|
||||
## - Max memory usage since initialization of the heap
|
||||
## - Total allocated memory since initialization of the heap
|
||||
## - Total freed memory since initialization of the heap
|
||||
##
|
||||
## ⚠️ Note: Enabling this feature will require extra computation every time alloc/dealloc is called.
|
||||
internal-heap-stats = []
|
||||
@ -1,26 +0,0 @@
|
||||
# esp-alloc
|
||||
|
||||
[](https://crates.io/crates/esp-alloc)
|
||||
[](https://docs.rs/esp-alloc)
|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
A simple `no_std` heap allocator for RISC-V and Xtensa processors from Espressif. Supports all currently available ESP32 devices.
|
||||
|
||||
**NOTE:** using this as your global allocator requires using Rust 1.68 or greater, or the `nightly` release channel.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
any additional terms or conditions.
|
||||
@ -1,589 +0,0 @@
|
||||
//! A `no_std` heap allocator for RISC-V and Xtensa processors from
|
||||
//! Espressif. Supports all currently available ESP32 devices.
|
||||
//!
|
||||
//! **NOTE:** using this as your global allocator requires using Rust 1.68 or
|
||||
//! greater, or the `nightly` release channel.
|
||||
//!
|
||||
//! # Using this as your Global Allocator
|
||||
//!
|
||||
//! ```rust
|
||||
//! use esp_alloc as _;
|
||||
//!
|
||||
//! fn init_heap() {
|
||||
//! const HEAP_SIZE: usize = 32 * 1024;
|
||||
//! static mut HEAP: MaybeUninit<[u8; HEAP_SIZE]> = MaybeUninit::uninit();
|
||||
//!
|
||||
//! unsafe {
|
||||
//! esp_alloc::HEAP.add_region(esp_alloc::HeapRegion::new(
|
||||
//! HEAP.as_mut_ptr() as *mut u8,
|
||||
//! HEAP_SIZE,
|
||||
//! esp_alloc::MemoryCapability::Internal.into(),
|
||||
//! ));
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! # Using this with the nightly `allocator_api`-feature
|
||||
//! Sometimes you want to have more control over allocations.
|
||||
//!
|
||||
//! For that, it's convenient to use the nightly `allocator_api`-feature,
|
||||
//! which allows you to specify an allocator for single allocations.
|
||||
//!
|
||||
//! **NOTE:** To use this, you have to enable the crate's `nightly` feature
|
||||
//! flag.
|
||||
//!
|
||||
//! Create and initialize an allocator to use in single allocations:
|
||||
//! ```rust
|
||||
//! static PSRAM_ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();
|
||||
//!
|
||||
//! fn init_psram_heap() {
|
||||
//! unsafe {
|
||||
//! PSRAM_ALLOCATOR.add_region(esp_alloc::HeapRegion::new(
|
||||
//! psram::psram_vaddr_start() as *mut u8,
|
||||
//! psram::PSRAM_BYTES,
|
||||
//! esp_alloc::MemoryCapability::Internal.into(),
|
||||
//! ));
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! And then use it in an allocation:
|
||||
//! ```rust
|
||||
//! let large_buffer: Vec<u8, _> = Vec::with_capacity_in(1048576, &PSRAM_ALLOCATOR);
|
||||
//! ```
|
||||
//!
|
||||
//! You can also get stats about the heap usage at anytime with:
|
||||
//! ```rust
|
||||
//! let stats: HeapStats = esp_alloc::HEAP.stats();
|
||||
//! // HeapStats implements the Display and defmt::Format traits, so you can pretty-print the heap stats.
|
||||
//! println!("{}", stats);
|
||||
//! ```
|
||||
//!
|
||||
//! ```txt
|
||||
//! HEAP INFO
|
||||
//! Size: 131068
|
||||
//! Current usage: 46148
|
||||
//! Max usage: 46148
|
||||
//! Total freed: 0
|
||||
//! Total allocated: 46148
|
||||
//! Memory Layout:
|
||||
//! Internal | ████████████░░░░░░░░░░░░░░░░░░░░░░░ | Used: 35% (Used 46148 of 131068, free: 84920)
|
||||
//! Unused | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ |
|
||||
//! Unused | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ |
|
||||
//! ```
|
||||
//! ## Feature Flags
|
||||
#![doc = document_features::document_features!()]
|
||||
#![no_std]
|
||||
#![cfg_attr(feature = "nightly", feature(allocator_api))]
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
||||
|
||||
mod macros;
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
use core::alloc::{AllocError, Allocator};
|
||||
use core::{
|
||||
alloc::{GlobalAlloc, Layout},
|
||||
cell::RefCell,
|
||||
fmt::Display,
|
||||
ptr::{self, NonNull},
|
||||
};
|
||||
|
||||
use critical_section::Mutex;
|
||||
use enumset::{EnumSet, EnumSetType};
|
||||
use linked_list_allocator::Heap;
|
||||
|
||||
/// The global allocator instance
|
||||
#[global_allocator]
|
||||
pub static HEAP: EspHeap = EspHeap::empty();
|
||||
|
||||
const NON_REGION: Option<HeapRegion> = None;
|
||||
|
||||
const BAR_WIDTH: usize = 35;
|
||||
|
||||
fn write_bar(f: &mut core::fmt::Formatter<'_>, usage_percent: usize) -> core::fmt::Result {
|
||||
let used_blocks = BAR_WIDTH * usage_percent / 100;
|
||||
(0..used_blocks).try_for_each(|_| write!(f, "█"))?;
|
||||
(used_blocks..BAR_WIDTH).try_for_each(|_| write!(f, "░"))
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
fn write_bar_defmt(fmt: defmt::Formatter, usage_percent: usize) {
|
||||
let used_blocks = BAR_WIDTH * usage_percent / 100;
|
||||
(0..used_blocks).for_each(|_| defmt::write!(fmt, "█"));
|
||||
(used_blocks..BAR_WIDTH).for_each(|_| defmt::write!(fmt, "░"));
|
||||
}
|
||||
|
||||
#[derive(EnumSetType, Debug)]
|
||||
/// Describes the properties of a memory region
|
||||
pub enum MemoryCapability {
|
||||
/// Memory must be internal; specifically it should not disappear when
|
||||
/// flash/spiram cache is switched off
|
||||
Internal,
|
||||
/// Memory must be in SPI RAM
|
||||
External,
|
||||
}
|
||||
|
||||
/// Stats for a heap region
|
||||
#[derive(Debug)]
|
||||
pub struct RegionStats {
|
||||
/// Total usable size of the heap region in bytes.
|
||||
size: usize,
|
||||
|
||||
/// Currently used size of the heap region in bytes.
|
||||
used: usize,
|
||||
|
||||
/// Free size of the heap region in bytes.
|
||||
free: usize,
|
||||
|
||||
/// Capabilities of the memory region.
|
||||
capabilities: EnumSet<MemoryCapability>,
|
||||
}
|
||||
|
||||
impl Display for RegionStats {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let usage_percent = self.used * 100 / self.size;
|
||||
|
||||
// Display Memory type
|
||||
if self.capabilities.contains(MemoryCapability::Internal) {
|
||||
write!(f, "Internal")?;
|
||||
} else if self.capabilities.contains(MemoryCapability::External) {
|
||||
write!(f, "External")?;
|
||||
} else {
|
||||
write!(f, "Unknown")?;
|
||||
}
|
||||
|
||||
write!(f, " | ")?;
|
||||
|
||||
write_bar(f, usage_percent)?;
|
||||
|
||||
write!(
|
||||
f,
|
||||
" | Used: {}% (Used {} of {}, free: {})",
|
||||
usage_percent, self.used, self.size, self.free
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
impl defmt::Format for RegionStats {
|
||||
fn format(&self, fmt: defmt::Formatter) {
|
||||
let usage_percent = self.used * 100 / self.size;
|
||||
|
||||
if self.capabilities.contains(MemoryCapability::Internal) {
|
||||
defmt::write!(fmt, "Internal");
|
||||
} else if self.capabilities.contains(MemoryCapability::External) {
|
||||
defmt::write!(fmt, "External");
|
||||
} else {
|
||||
defmt::write!(fmt, "Unknown");
|
||||
}
|
||||
|
||||
defmt::write!(fmt, " | ");
|
||||
|
||||
write_bar_defmt(fmt, usage_percent);
|
||||
|
||||
defmt::write!(
|
||||
fmt,
|
||||
" | Used: {}% (Used {} of {}, free: {})",
|
||||
usage_percent,
|
||||
self.used,
|
||||
self.size,
|
||||
self.free
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A memory region to be used as heap memory
|
||||
pub struct HeapRegion {
|
||||
heap: Heap,
|
||||
capabilities: EnumSet<MemoryCapability>,
|
||||
}
|
||||
|
||||
impl HeapRegion {
|
||||
/// Create a new [HeapRegion] with the given capabilities
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// - The supplied memory region must be available for the entire program
|
||||
/// (`'static`).
|
||||
/// - The supplied memory region must be exclusively available to the heap
|
||||
/// only, no aliasing.
|
||||
/// - `size > 0`.
|
||||
pub unsafe fn new(
|
||||
heap_bottom: *mut u8,
|
||||
size: usize,
|
||||
capabilities: EnumSet<MemoryCapability>,
|
||||
) -> Self {
|
||||
let mut heap = Heap::empty();
|
||||
heap.init(heap_bottom, size);
|
||||
|
||||
Self { heap, capabilities }
|
||||
}
|
||||
|
||||
/// Return stats for the current memory region
|
||||
pub fn stats(&self) -> RegionStats {
|
||||
RegionStats {
|
||||
size: self.heap.size(),
|
||||
used: self.heap.used(),
|
||||
free: self.heap.free(),
|
||||
capabilities: self.capabilities,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stats for a heap allocator
|
||||
///
|
||||
/// Enable the "internal-heap-stats" feature if you want collect additional heap
|
||||
/// informations at the cost of extra cpu time during every alloc/dealloc.
|
||||
#[derive(Debug)]
|
||||
pub struct HeapStats {
|
||||
/// Granular stats for all the configured memory regions.
|
||||
region_stats: [Option<RegionStats>; 3],
|
||||
|
||||
/// Total size of all combined heap regions in bytes.
|
||||
size: usize,
|
||||
|
||||
/// Current usage of the heap across all configured regions in bytes.
|
||||
current_usage: usize,
|
||||
|
||||
/// Estimation of the max used heap in bytes.
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
max_usage: usize,
|
||||
|
||||
/// Estimation of the total allocated bytes since initialization.
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
total_allocated: usize,
|
||||
|
||||
/// Estimation of the total freed bytes since initialization.
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
total_freed: usize,
|
||||
}
|
||||
|
||||
impl Display for HeapStats {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
writeln!(f, "HEAP INFO")?;
|
||||
writeln!(f, "Size: {}", self.size)?;
|
||||
writeln!(f, "Current usage: {}", self.current_usage)?;
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
{
|
||||
writeln!(f, "Max usage: {}", self.max_usage)?;
|
||||
writeln!(f, "Total freed: {}", self.total_freed)?;
|
||||
writeln!(f, "Total allocated: {}", self.total_allocated)?;
|
||||
}
|
||||
writeln!(f, "Memory Layout: ")?;
|
||||
for region in self.region_stats.iter() {
|
||||
if let Some(region) = region.as_ref() {
|
||||
region.fmt(f)?;
|
||||
writeln!(f)?;
|
||||
} else {
|
||||
// Display unused memory regions
|
||||
write!(f, "Unused | ")?;
|
||||
write_bar(f, 0)?;
|
||||
writeln!(f, " |")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
impl defmt::Format for HeapStats {
|
||||
fn format(&self, fmt: defmt::Formatter) {
|
||||
defmt::write!(fmt, "HEAP INFO\n");
|
||||
defmt::write!(fmt, "Size: {}\n", self.size);
|
||||
defmt::write!(fmt, "Current usage: {}\n", self.current_usage);
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
{
|
||||
defmt::write!(fmt, "Max usage: {}\n", self.max_usage);
|
||||
defmt::write!(fmt, "Total freed: {}\n", self.total_freed);
|
||||
defmt::write!(fmt, "Total allocated: {}\n", self.total_allocated);
|
||||
}
|
||||
defmt::write!(fmt, "Memory Layout:\n");
|
||||
for region in self.region_stats.iter() {
|
||||
if let Some(region) = region.as_ref() {
|
||||
defmt::write!(fmt, "{}\n", region);
|
||||
} else {
|
||||
defmt::write!(fmt, "Unused | ");
|
||||
write_bar_defmt(fmt, 0);
|
||||
defmt::write!(fmt, " |\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Internal stats to keep track across multiple regions.
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
struct InternalHeapStats {
|
||||
max_usage: usize,
|
||||
total_allocated: usize,
|
||||
total_freed: usize,
|
||||
}
|
||||
|
||||
/// A memory allocator
|
||||
///
|
||||
/// In addition to what Rust's memory allocator can do it allows to allocate
|
||||
/// memory in regions satisfying specific needs.
|
||||
pub struct EspHeap {
|
||||
heap: Mutex<RefCell<[Option<HeapRegion>; 3]>>,
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
internal_heap_stats: Mutex<RefCell<InternalHeapStats>>,
|
||||
}
|
||||
|
||||
impl EspHeap {
|
||||
/// Crate a new UNINITIALIZED heap allocator
|
||||
pub const fn empty() -> Self {
|
||||
EspHeap {
|
||||
heap: Mutex::new(RefCell::new([NON_REGION; 3])),
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
internal_heap_stats: Mutex::new(RefCell::new(InternalHeapStats {
|
||||
max_usage: 0,
|
||||
total_allocated: 0,
|
||||
total_freed: 0,
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a memory region to the heap
|
||||
///
|
||||
/// `heap_bottom` is a pointer to the location of the bottom of the heap.
|
||||
///
|
||||
/// `size` is the size of the heap in bytes.
|
||||
///
|
||||
/// You can add up to three regions per allocator.
|
||||
///
|
||||
/// Note that:
|
||||
///
|
||||
/// - Memory is allocated from the first suitable memory region first
|
||||
///
|
||||
/// - The heap grows "upwards", towards larger addresses. Thus `end_addr`
|
||||
/// must be larger than `start_addr`
|
||||
///
|
||||
/// - The size of the heap is `(end_addr as usize) - (start_addr as usize)`.
|
||||
/// The allocator won't use the byte at `end_addr`.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// - The supplied memory region must be available for the entire program (a
|
||||
/// `'static` lifetime).
|
||||
/// - The supplied memory region must be exclusively available to the heap
|
||||
/// only, no aliasing.
|
||||
/// - `size > 0`.
|
||||
pub unsafe fn add_region(&self, region: HeapRegion) {
|
||||
critical_section::with(|cs| {
|
||||
let mut regions = self.heap.borrow_ref_mut(cs);
|
||||
let free = regions
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|v| v.1.is_none())
|
||||
.map(|v| v.0);
|
||||
|
||||
if let Some(free) = free {
|
||||
regions[free] = Some(region);
|
||||
} else {
|
||||
panic!(
|
||||
"Exceeded the maximum of {} heap memory regions",
|
||||
regions.len()
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns an estimate of the amount of bytes in use in all memory regions.
|
||||
pub fn used(&self) -> usize {
|
||||
critical_section::with(|cs| {
|
||||
let regions = self.heap.borrow_ref(cs);
|
||||
let mut used = 0;
|
||||
for region in regions.iter() {
|
||||
if let Some(region) = region.as_ref() {
|
||||
used += region.heap.used();
|
||||
}
|
||||
}
|
||||
used
|
||||
})
|
||||
}
|
||||
|
||||
/// Return usage stats for the [Heap].
|
||||
///
|
||||
/// Note:
|
||||
/// [HeapStats] directly implements [Display], so this function can be
|
||||
/// called from within `println!()` to pretty-print the usage of the
|
||||
/// heap.
|
||||
pub fn stats(&self) -> HeapStats {
|
||||
const EMPTY_REGION_STAT: Option<RegionStats> = None;
|
||||
let mut region_stats: [Option<RegionStats>; 3] = [EMPTY_REGION_STAT; 3];
|
||||
|
||||
critical_section::with(|cs| {
|
||||
let mut used = 0;
|
||||
let mut free = 0;
|
||||
let regions = self.heap.borrow_ref(cs);
|
||||
for (id, region) in regions.iter().enumerate() {
|
||||
if let Some(region) = region.as_ref() {
|
||||
let stats = region.stats();
|
||||
free += stats.free;
|
||||
used += stats.used;
|
||||
region_stats[id] = Some(region.stats());
|
||||
}
|
||||
}
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "internal-heap-stats")] {
|
||||
let internal_heap_stats = self.internal_heap_stats.borrow_ref(cs);
|
||||
HeapStats {
|
||||
region_stats,
|
||||
size: free + used,
|
||||
current_usage: used,
|
||||
max_usage: internal_heap_stats.max_usage,
|
||||
total_allocated: internal_heap_stats.total_allocated,
|
||||
total_freed: internal_heap_stats.total_freed,
|
||||
}
|
||||
} else {
|
||||
HeapStats {
|
||||
region_stats,
|
||||
size: free + used,
|
||||
current_usage: used,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns an estimate of the amount of bytes available.
|
||||
pub fn free(&self) -> usize {
|
||||
self.free_caps(EnumSet::empty())
|
||||
}
|
||||
|
||||
/// The free heap satisfying the given requirements
|
||||
pub fn free_caps(&self, capabilities: EnumSet<MemoryCapability>) -> usize {
|
||||
critical_section::with(|cs| {
|
||||
let regions = self.heap.borrow_ref(cs);
|
||||
let mut free = 0;
|
||||
for region in regions.iter().filter(|region| {
|
||||
if region.is_some() {
|
||||
region
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.capabilities
|
||||
.is_superset(capabilities)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}) {
|
||||
if let Some(region) = region.as_ref() {
|
||||
free += region.heap.free();
|
||||
}
|
||||
}
|
||||
free
|
||||
})
|
||||
}
|
||||
|
||||
/// Allocate memory in a region satisfying the given requirements.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure that `layout` has non-zero size.
|
||||
///
|
||||
/// The allocated block of memory may or may not be initialized.
|
||||
pub unsafe fn alloc_caps(
|
||||
&self,
|
||||
capabilities: EnumSet<MemoryCapability>,
|
||||
layout: Layout,
|
||||
) -> *mut u8 {
|
||||
critical_section::with(|cs| {
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
let before = self.used();
|
||||
let mut regions = self.heap.borrow_ref_mut(cs);
|
||||
let mut iter = (*regions).iter_mut().filter(|region| {
|
||||
if region.is_some() {
|
||||
region
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.capabilities
|
||||
.is_superset(capabilities)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
|
||||
let res = loop {
|
||||
if let Some(Some(region)) = iter.next() {
|
||||
let res = region.heap.allocate_first_fit(layout);
|
||||
if let Ok(res) = res {
|
||||
break Some(res);
|
||||
}
|
||||
} else {
|
||||
break None;
|
||||
}
|
||||
};
|
||||
|
||||
res.map_or(ptr::null_mut(), |allocation| {
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
{
|
||||
let mut internal_heap_stats = self.internal_heap_stats.borrow_ref_mut(cs);
|
||||
drop(regions);
|
||||
// We need to call used because [linked_list_allocator::Heap] does internal size
|
||||
// alignment so we cannot use the size provided by the layout.
|
||||
let used = self.used();
|
||||
|
||||
internal_heap_stats.total_allocated += used - before;
|
||||
internal_heap_stats.max_usage =
|
||||
core::cmp::max(internal_heap_stats.max_usage, used);
|
||||
}
|
||||
|
||||
allocation.as_ptr()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl GlobalAlloc for EspHeap {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
self.alloc_caps(EnumSet::empty(), layout)
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||
if ptr.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
critical_section::with(|cs| {
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
let before = self.used();
|
||||
let mut regions = self.heap.borrow_ref_mut(cs);
|
||||
let mut iter = (*regions).iter_mut();
|
||||
|
||||
while let Some(Some(region)) = iter.next() {
|
||||
if region.heap.bottom() <= ptr && region.heap.top() >= ptr {
|
||||
region.heap.deallocate(NonNull::new_unchecked(ptr), layout);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "internal-heap-stats")]
|
||||
{
|
||||
let mut internal_heap_stats = self.internal_heap_stats.borrow_ref_mut(cs);
|
||||
drop(regions);
|
||||
// We need to call `used()` because [linked_list_allocator::Heap] does internal
|
||||
// size alignment so we cannot use the size provided by the
|
||||
// layout.
|
||||
internal_heap_stats.total_freed += before - self.used();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
unsafe impl Allocator for EspHeap {
|
||||
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
|
||||
let raw_ptr = unsafe { self.alloc(layout) };
|
||||
|
||||
if raw_ptr.is_null() {
|
||||
return Err(AllocError);
|
||||
}
|
||||
|
||||
let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
|
||||
Ok(NonNull::slice_from_raw_parts(ptr, layout.size()))
|
||||
}
|
||||
|
||||
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
|
||||
self.dealloc(ptr.as_ptr(), layout);
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
//! Macros provided for convenience
|
||||
|
||||
/// Initialize a global heap allocator providing a heap of the given size in
|
||||
/// bytes
|
||||
#[macro_export]
|
||||
macro_rules! heap_allocator {
|
||||
($size:expr) => {{
|
||||
static mut HEAP: core::mem::MaybeUninit<[u8; $size]> = core::mem::MaybeUninit::uninit();
|
||||
|
||||
unsafe {
|
||||
$crate::HEAP.add_region($crate::HeapRegion::new(
|
||||
HEAP.as_mut_ptr() as *mut u8,
|
||||
$size,
|
||||
$crate::MemoryCapability::Internal.into(),
|
||||
));
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
/// Initialize a global heap allocator backed by PSRAM
|
||||
///
|
||||
/// You need a SoC which supports PSRAM
|
||||
/// and activate the feature to enable it. You need to pass the PSRAM peripheral
|
||||
/// and the psram module path.
|
||||
///
|
||||
/// # Usage
|
||||
/// ```rust, no_run
|
||||
/// esp_alloc::psram_allocator!(peripherals.PSRAM, hal::psram);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! psram_allocator {
|
||||
($peripheral:expr, $psram_module:path) => {{
|
||||
use $psram_module as _psram;
|
||||
let (start, size) = _psram::psram_raw_parts(&$peripheral);
|
||||
unsafe {
|
||||
$crate::HEAP.add_region($crate::HeapRegion::new(
|
||||
start,
|
||||
size,
|
||||
$crate::MemoryCapability::External.into(),
|
||||
));
|
||||
}
|
||||
}};
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Removed
|
||||
|
||||
## 0.14.2 - 2024-10-10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix build when not using `panic-handler` (#2257)
|
||||
|
||||
## 0.14.1 - 2024-09-06
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
- Print a more helpful message in case of a `Cp0Disabled` exception (#2061)
|
||||
|
||||
### Fixed
|
||||
|
||||
### Removed
|
||||
|
||||
## 0.14.0 - 2024-08-29
|
||||
|
||||
### Added
|
||||
|
||||
- Add custom-pre-backtrace feature (#1822)
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve panic message printing (#1823)
|
||||
|
||||
## 0.13.0 - 2024-07-16
|
||||
|
||||
No changes - published to avoid conflicts with `esp-println`
|
||||
|
||||
## 0.12.2 - 2024-07-15
|
||||
|
||||
### Changed
|
||||
|
||||
- Remove build script check for `nightly-2024-06-12` (#1788)
|
||||
|
||||
## 0.12.1 - 2024-06-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix compilation for nightly after 2024-06-12. (#1681)
|
||||
- Only prints float registers on targets which have them. (#1690)
|
||||
|
||||
[Unreleased]: https://github.com/esp-rs/esp-hal/commits/main/esp-backtrace?since=2024-10-10
|
||||
@ -1,55 +0,0 @@
|
||||
[package]
|
||||
name = "esp-backtrace"
|
||||
version = "0.14.2"
|
||||
edition = "2021"
|
||||
rust-version = "1.76.0"
|
||||
description = "Bare-metal backtrace support for Espressif devices"
|
||||
keywords = ["backtrace", "embedded", "esp32", "espressif"]
|
||||
categories = ["embedded", "hardware-support", "no-std"]
|
||||
repository = "https://github.com/esp-rs/esp-hal"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "riscv32imc-unknown-none-elf"
|
||||
features = ["esp32c3", "panic-handler", "exception-handler", "println", "esp-println/uart"]
|
||||
|
||||
[dependencies]
|
||||
defmt = { version = "0.3.8", optional = true }
|
||||
esp-println = { version = "0.12.0", optional = true, default-features = false, path = "../esp-println" }
|
||||
semihosting = { version = "0.1.15", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
esp-build = { version = "0.1.0", path = "../esp-build" }
|
||||
|
||||
[features]
|
||||
default = ["colors"]
|
||||
|
||||
# You must enable exactly one of the below features to support the correct chip:
|
||||
esp32 = ["esp-println?/esp32", "semihosting?/openocd-semihosting", "print-float-registers"]
|
||||
esp32c2 = ["esp-println?/esp32c2"]
|
||||
esp32c3 = ["esp-println?/esp32c3"]
|
||||
esp32c6 = ["esp-println?/esp32c6"]
|
||||
esp32h2 = ["esp-println?/esp32h2"]
|
||||
esp32p4 = ["esp-println?/esp32p4"]
|
||||
esp32s2 = ["esp-println?/esp32s2", "semihosting?/openocd-semihosting"]
|
||||
esp32s3 = ["esp-println?/esp32s3", "semihosting?/openocd-semihosting", "print-float-registers"]
|
||||
|
||||
# Use esp-println
|
||||
println = ["dep:esp-println"]
|
||||
|
||||
# Use defmt
|
||||
defmt = ["dep:defmt"]
|
||||
|
||||
print-float-registers = [] # TODO support esp32p4
|
||||
|
||||
# You may optionally enable one or more of the below features to provide
|
||||
# additional functionality:
|
||||
colors = []
|
||||
custom-halt = []
|
||||
custom-pre-backtrace = []
|
||||
exception-handler = []
|
||||
halt-cores = []
|
||||
panic-handler = []
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = "allow"
|
||||
@ -1,60 +0,0 @@
|
||||
# esp-backtrace - backtrace for ESP32 bare-metal
|
||||
|
||||
[](https://crates.io/crates/esp-backtrace)
|
||||
[](https://docs.rs/esp-backtrace)
|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
Supports the ESP32, ESP32-C2/C3/C6, ESP32-H2, ESP32-P4, and ESP32-S2/S3. Optional exception and panic handlers are included, both of which can be enabled via their respective features.
|
||||
|
||||
Please note that when targeting a RISC-V device, you **need** to force frame pointers (i.e. `"-C", "force-frame-pointers",` in your `.cargo/config.toml`); this is **not** required for Xtensa.
|
||||
|
||||
You can get an array of backtrace addresses (currently limited to 10) via `arch::backtrace()` if
|
||||
you want to create a backtrace yourself (i.e. not using the panic or exception handler).
|
||||
|
||||
When using the panic and/or exception handler make sure to include `use esp_backtrace as _;`.
|
||||
|
||||
## Features
|
||||
|
||||
| Feature | Description |
|
||||
|----------------------|--------------------------------------------------------------------------------------------------------------------|
|
||||
| esp32 | Target ESP32 |
|
||||
| esp32c2 | Target ESP32-C2 |
|
||||
| esp32c3 | Target ESP32-C3 |
|
||||
| esp32c6 | Target ESP32-C6 |
|
||||
| esp32h2 | Target ESP32-H2 |
|
||||
| esp32p4 | Target ESP32-P4 |
|
||||
| esp32s2 | Target ESP32-S2 |
|
||||
| esp32s3 | Target ESP32-S3 |
|
||||
| panic-handler | Include a panic handler, will add `esp-println` as a dependency |
|
||||
| exception-handler | Include an exception handler, will add `esp-println` as a dependency |
|
||||
| println | Use `esp-println` to print messages |
|
||||
| defmt | Use `defmt` logging to print messages\* (check [example](https://github.com/playfulFence/backtrace-defmt-example)) |
|
||||
| colors | Print messages in red\* |
|
||||
| halt-cores | Halt both CPUs on ESP32 / ESP32-S3 instead of doing a `loop {}` in case of a panic or exception |
|
||||
| semihosting | Call `semihosting::process::abort()` on panic. |
|
||||
| custom-halt | Invoke the extern function `custom_halt()` instead of doing a `loop {}` in case of a panic or exception |
|
||||
| custom-pre-backtrace | Invoke the extern function `custom_pre_backtrace()` before handling a panic or exception |
|
||||
|
||||
\* _only used for panic and exception handlers_
|
||||
|
||||
### `defmt` Feature
|
||||
|
||||
Please note that `defmt` does _not_ provide MSRV guarantees with releases, and as such we are not able to make any MSRV guarantees when this feature is enabled. For more information refer to the MSRV section of `defmt`'s README:
|
||||
https://github.com/knurling-rs/defmt?tab=readme-ov-file#msrv
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
any additional terms or conditions.
|
||||
@ -1,15 +0,0 @@
|
||||
use esp_build::assert_unique_used_features;
|
||||
|
||||
fn main() {
|
||||
// Ensure that only a single chip is specified:
|
||||
assert_unique_used_features!(
|
||||
"esp32", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4", "esp32s2", "esp32s3"
|
||||
);
|
||||
|
||||
// Ensure that exactly a backend is selected:
|
||||
assert_unique_used_features!("defmt", "println");
|
||||
|
||||
if cfg!(feature = "custom-halt") && cfg!(feature = "halt-cores") {
|
||||
panic!("Only one of `custom-halt` and `halt-cores` can be enabled");
|
||||
}
|
||||
}
|
||||
@ -1,341 +0,0 @@
|
||||
#![allow(rustdoc::bare_urls, unused_macros)]
|
||||
#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
||||
#![no_std]
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt as _;
|
||||
#[cfg(feature = "println")]
|
||||
use esp_println as _;
|
||||
|
||||
const MAX_BACKTRACE_ADDRESSES: usize = 10;
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
const RESET: &str = "\u{001B}[0m";
|
||||
#[cfg(feature = "colors")]
|
||||
const RED: &str = "\u{001B}[31m";
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
macro_rules! println {
|
||||
("") => {
|
||||
// Do nothing if the string is just a space
|
||||
};
|
||||
($($arg:tt)*) => {
|
||||
defmt::error!($($arg)*);
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "println", not(feature = "defmt")))]
|
||||
macro_rules! println {
|
||||
($($arg:tt)*) => {
|
||||
esp_println::println!($($arg)*);
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(unused, unused_variables)]
|
||||
fn set_color_code(code: &str) {
|
||||
#[cfg(feature = "println")]
|
||||
{
|
||||
println!("{}", code);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(target_arch = "riscv32", path = "riscv.rs")]
|
||||
#[cfg_attr(target_arch = "xtensa", path = "xtensa.rs")]
|
||||
pub mod arch;
|
||||
|
||||
#[cfg(feature = "panic-handler")]
|
||||
#[panic_handler]
|
||||
fn panic_handler(info: &core::panic::PanicInfo) -> ! {
|
||||
pre_backtrace();
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RED);
|
||||
|
||||
println!("");
|
||||
println!("====================== PANIC ======================");
|
||||
|
||||
#[cfg(not(feature = "defmt"))]
|
||||
println!("{}", info);
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
println!("{}", defmt::Display2Format(info));
|
||||
|
||||
println!("");
|
||||
println!("Backtrace:");
|
||||
println!("");
|
||||
|
||||
let backtrace = crate::arch::backtrace();
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
if backtrace.iter().filter(|e| e.is_some()).count() == 0 {
|
||||
println!("No backtrace available - make sure to force frame-pointers. (see https://crates.io/crates/esp-backtrace)");
|
||||
}
|
||||
for addr in backtrace.into_iter().flatten() {
|
||||
#[cfg(all(feature = "colors", feature = "println"))]
|
||||
println!("{}0x{:x}", RED, addr - crate::arch::RA_OFFSET);
|
||||
|
||||
#[cfg(not(all(feature = "colors", feature = "println")))]
|
||||
println!("0x{:x}", addr - crate::arch::RA_OFFSET);
|
||||
}
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RESET);
|
||||
|
||||
#[cfg(feature = "semihosting")]
|
||||
semihosting::process::abort();
|
||||
|
||||
#[cfg(not(feature = "semihosting"))]
|
||||
halt();
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "exception-handler", target_arch = "xtensa"))]
|
||||
#[no_mangle]
|
||||
#[link_section = ".rwtext"]
|
||||
unsafe fn __user_exception(cause: arch::ExceptionCause, context: arch::Context) {
|
||||
pre_backtrace();
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RED);
|
||||
|
||||
// Unfortunately, a different formatter string is used
|
||||
#[cfg(not(feature = "defmt"))]
|
||||
esp_println::println!("\n\nException occurred '{}'", cause);
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
defmt::error!("\n\nException occurred '{}'", cause);
|
||||
|
||||
println!("{:?}", context);
|
||||
|
||||
let backtrace = crate::arch::backtrace_internal(context.A1, 0);
|
||||
for e in backtrace {
|
||||
if let Some(addr) = e {
|
||||
println!("0x{:x}", addr);
|
||||
}
|
||||
}
|
||||
println!("");
|
||||
println!("");
|
||||
println!("");
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RESET);
|
||||
|
||||
#[cfg(feature = "semihosting")]
|
||||
semihosting::process::abort();
|
||||
|
||||
#[cfg(not(feature = "semihosting"))]
|
||||
halt();
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "exception-handler", target_arch = "riscv32"))]
|
||||
#[export_name = "ExceptionHandler"]
|
||||
fn exception_handler(context: &arch::TrapFrame) -> ! {
|
||||
pre_backtrace();
|
||||
|
||||
let mepc = context.pc;
|
||||
let code = context.mcause & 0xff;
|
||||
let mtval = context.mtval;
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RED);
|
||||
|
||||
if code == 14 {
|
||||
println!("");
|
||||
println!(
|
||||
"Stack overflow detected at 0x{:x} called by 0x{:x}",
|
||||
mepc, context.ra
|
||||
);
|
||||
println!("");
|
||||
} else {
|
||||
let code = match code {
|
||||
0 => "Instruction address misaligned",
|
||||
1 => "Instruction access fault",
|
||||
2 => "Illegal instruction",
|
||||
3 => "Breakpoint",
|
||||
4 => "Load address misaligned",
|
||||
5 => "Load access fault",
|
||||
6 => "Store/AMO address misaligned",
|
||||
7 => "Store/AMO access fault",
|
||||
8 => "Environment call from U-mode",
|
||||
9 => "Environment call from S-mode",
|
||||
10 => "Reserved",
|
||||
11 => "Environment call from M-mode",
|
||||
12 => "Instruction page fault",
|
||||
13 => "Load page fault",
|
||||
14 => "Reserved",
|
||||
15 => "Store/AMO page fault",
|
||||
_ => "UNKNOWN",
|
||||
};
|
||||
|
||||
println!(
|
||||
"Exception '{}' mepc=0x{:08x}, mtval=0x{:08x}",
|
||||
code, mepc, mtval
|
||||
);
|
||||
#[cfg(not(feature = "defmt"))]
|
||||
println!("{:x?}", context);
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
println!("{:?}", context);
|
||||
|
||||
let backtrace = crate::arch::backtrace_internal(context.s0 as u32, 0);
|
||||
if backtrace.iter().filter(|e| e.is_some()).count() == 0 {
|
||||
println!("No backtrace available - make sure to force frame-pointers. (see https://crates.io/crates/esp-backtrace)");
|
||||
}
|
||||
for addr in backtrace.into_iter().flatten() {
|
||||
#[cfg(all(feature = "colors", feature = "println"))]
|
||||
println!("{}0x{:x}", RED, addr - crate::arch::RA_OFFSET);
|
||||
|
||||
#[cfg(not(all(feature = "colors", feature = "println")))]
|
||||
println!("0x{:x}", addr - crate::arch::RA_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
println!("");
|
||||
println!("");
|
||||
println!("");
|
||||
|
||||
#[cfg(feature = "colors")]
|
||||
set_color_code(RESET);
|
||||
|
||||
#[cfg(feature = "semihosting")]
|
||||
semihosting::process::abort();
|
||||
|
||||
#[cfg(not(feature = "semihosting"))]
|
||||
halt();
|
||||
}
|
||||
|
||||
// Ensure that the address is in DRAM and that it is 16-byte aligned.
|
||||
//
|
||||
// Based loosely on the `esp_stack_ptr_in_dram` function from
|
||||
// `components/esp_hw_support/include/esp_memory_utils.h` in ESP-IDF.
|
||||
//
|
||||
// Address ranges can be found in `components/soc/$CHIP/include/soc/soc.h` as
|
||||
// `SOC_DRAM_LOW` and `SOC_DRAM_HIGH`.
|
||||
fn is_valid_ram_address(address: u32) -> bool {
|
||||
if (address & 0xF) != 0 {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32")]
|
||||
if !(0x3FFA_E000..=0x4000_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32c2")]
|
||||
if !(0x3FCA_0000..=0x3FCE_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32c3")]
|
||||
if !(0x3FC8_0000..=0x3FCE_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32c6")]
|
||||
if !(0x4080_0000..=0x4088_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32h2")]
|
||||
if !(0x4080_0000..=0x4085_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32p4")]
|
||||
if !(0x4FF0_0000..=0x4FFC_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32s2")]
|
||||
if !(0x3FFB_0000..=0x4000_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32s3")]
|
||||
if !(0x3FC8_8000..=0x3FD0_0000).contains(&address) {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
not(any(feature = "esp32", feature = "esp32p4", feature = "esp32s3")),
|
||||
not(feature = "halt-cores")
|
||||
),
|
||||
not(feature = "custom-halt")
|
||||
))]
|
||||
#[allow(unused)]
|
||||
fn halt() -> ! {
|
||||
loop {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "custom-halt")]
|
||||
fn halt() -> ! {
|
||||
extern "Rust" {
|
||||
fn custom_halt() -> !;
|
||||
}
|
||||
unsafe { custom_halt() }
|
||||
}
|
||||
|
||||
// TODO: Enable `halt` function for `esp32p4` feature once implemented
|
||||
#[cfg(all(any(feature = "esp32", feature = "esp32s3"), feature = "halt-cores"))]
|
||||
#[allow(unused)]
|
||||
fn halt() -> ! {
|
||||
#[cfg(feature = "esp32")]
|
||||
mod registers {
|
||||
pub(crate) const OPTIONS0: u32 = 0x3ff48000;
|
||||
pub(crate) const SW_CPU_STALL: u32 = 0x3ff480ac;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32p4")]
|
||||
mod registers {
|
||||
pub(crate) const SW_CPU_STALL: u32 = 0x50115200;
|
||||
}
|
||||
|
||||
#[cfg(feature = "esp32s3")]
|
||||
mod registers {
|
||||
pub(crate) const OPTIONS0: u32 = 0x60008000;
|
||||
pub(crate) const SW_CPU_STALL: u32 = 0x600080bc;
|
||||
}
|
||||
|
||||
let sw_cpu_stall = registers::SW_CPU_STALL as *mut u32;
|
||||
|
||||
#[cfg(feature = "esp32p4")]
|
||||
unsafe {}
|
||||
|
||||
#[cfg(not(feature = "esp32p4"))]
|
||||
unsafe {
|
||||
// We need to write the value "0x86" to stall a particular core. The write
|
||||
// location is split into two separate bit fields named "c0" and "c1", and the
|
||||
// two fields are located in different registers. Each core has its own pair of
|
||||
// "c0" and "c1" bit fields.
|
||||
|
||||
let options0 = registers::OPTIONS0 as *mut u32;
|
||||
|
||||
options0.write_volatile(options0.read_volatile() & !(0b1111) | 0b1010);
|
||||
|
||||
sw_cpu_stall.write_volatile(
|
||||
sw_cpu_stall.read_volatile() & !(0b111111 << 20) & !(0b111111 << 26)
|
||||
| (0x21 << 20)
|
||||
| (0x21 << 26),
|
||||
);
|
||||
}
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "custom-pre-backtrace"))]
|
||||
#[allow(unused)]
|
||||
fn pre_backtrace() {}
|
||||
|
||||
#[cfg(feature = "custom-pre-backtrace")]
|
||||
fn pre_backtrace() {
|
||||
extern "Rust" {
|
||||
fn custom_pre_backtrace();
|
||||
}
|
||||
unsafe { custom_pre_backtrace() }
|
||||
}
|
||||
@ -1,219 +0,0 @@
|
||||
use core::arch::asm;
|
||||
|
||||
use crate::MAX_BACKTRACE_ADDRESSES;
|
||||
|
||||
// subtract 4 from the return address
|
||||
// the return address is the address following the JALR
|
||||
// we get better results (especially if the caller was the last instruction in
|
||||
// the calling function) if we report the address of the JALR itself
|
||||
// even if it was a C.JALR we should get good results using RA - 4
|
||||
#[allow(unused)]
|
||||
pub(super) const RA_OFFSET: usize = 4;
|
||||
|
||||
/// Registers saved in trap handler
|
||||
#[doc(hidden)]
|
||||
#[derive(Default, Clone, Copy)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[repr(C)]
|
||||
#[cfg(feature = "exception-handler")]
|
||||
pub(crate) struct TrapFrame {
|
||||
/// Return address, stores the address to return to after a function call or
|
||||
/// interrupt.
|
||||
pub ra: usize,
|
||||
/// Temporary register t0, used for intermediate values.
|
||||
pub t0: usize,
|
||||
/// Temporary register t1, used for intermediate values.
|
||||
pub t1: usize,
|
||||
/// Temporary register t2, used for intermediate values.
|
||||
pub t2: usize,
|
||||
/// Temporary register t3, used for intermediate values.
|
||||
pub t3: usize,
|
||||
/// Temporary register t4, used for intermediate values.
|
||||
pub t4: usize,
|
||||
/// Temporary register t5, used for intermediate values.
|
||||
pub t5: usize,
|
||||
/// Temporary register t6, used for intermediate values.
|
||||
pub t6: usize,
|
||||
/// Argument register a0, typically used to pass the first argument to a
|
||||
/// function.
|
||||
pub a0: usize,
|
||||
/// Argument register a1, typically used to pass the second argument to a
|
||||
/// function.
|
||||
pub a1: usize,
|
||||
/// Argument register a2, typically used to pass the third argument to a
|
||||
/// function.
|
||||
pub a2: usize,
|
||||
/// Argument register a3, typically used to pass the fourth argument to a
|
||||
/// function.
|
||||
pub a3: usize,
|
||||
/// Argument register a4, typically used to pass the fifth argument to a
|
||||
/// function.
|
||||
pub a4: usize,
|
||||
/// Argument register a5, typically used to pass the sixth argument to a
|
||||
/// function.
|
||||
pub a5: usize,
|
||||
/// Argument register a6, typically used to pass the seventh argument to a
|
||||
/// function.
|
||||
pub a6: usize,
|
||||
/// Argument register a7, typically used to pass the eighth argument to a
|
||||
/// function.
|
||||
pub a7: usize,
|
||||
/// Saved register s0, used to hold values across function calls.
|
||||
pub s0: usize,
|
||||
/// Saved register s1, used to hold values across function calls.
|
||||
pub s1: usize,
|
||||
/// Saved register s2, used to hold values across function calls.
|
||||
pub s2: usize,
|
||||
/// Saved register s3, used to hold values across function calls.
|
||||
pub s3: usize,
|
||||
/// Saved register s4, used to hold values across function calls.
|
||||
pub s4: usize,
|
||||
/// Saved register s5, used to hold values across function calls.
|
||||
pub s5: usize,
|
||||
/// Saved register s6, used to hold values across function calls.
|
||||
pub s6: usize,
|
||||
/// Saved register s7, used to hold values across function calls.
|
||||
pub s7: usize,
|
||||
/// Saved register s8, used to hold values across function calls.
|
||||
pub s8: usize,
|
||||
/// Saved register s9, used to hold values across function calls.
|
||||
pub s9: usize,
|
||||
/// Saved register s10, used to hold values across function calls.
|
||||
pub s10: usize,
|
||||
/// Saved register s11, used to hold values across function calls.
|
||||
pub s11: usize,
|
||||
/// Global pointer register, holds the address of the global data area.
|
||||
pub gp: usize,
|
||||
/// Thread pointer register, holds the address of the thread-local storage
|
||||
/// area.
|
||||
pub tp: usize,
|
||||
/// Stack pointer register, holds the address of the top of the stack.
|
||||
pub sp: usize,
|
||||
/// Program counter, stores the address of the next instruction to be
|
||||
/// executed.
|
||||
pub pc: usize,
|
||||
/// Machine status register, holds the current status of the processor,
|
||||
/// including interrupt enable bits and privilege mode.
|
||||
pub mstatus: usize,
|
||||
/// Machine cause register, contains the reason for the trap (e.g.,
|
||||
/// exception or interrupt number).
|
||||
pub mcause: usize,
|
||||
/// Machine trap value register, contains additional information about the
|
||||
/// trap (e.g., faulting address).
|
||||
pub mtval: usize,
|
||||
}
|
||||
|
||||
#[cfg(feature = "exception-handler")]
|
||||
impl core::fmt::Debug for TrapFrame {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
|
||||
write!(
|
||||
fmt,
|
||||
"TrapFrame
|
||||
PC=0x{:08x} RA/x1=0x{:08x} SP/x2=0x{:08x} GP/x3=0x{:08x} TP/x4=0x{:08x}
|
||||
T0/x5=0x{:08x} T1/x6=0x{:08x} T2/x7=0x{:08x} S0/FP/x8=0x{:08x} S1/x9=0x{:08x}
|
||||
A0/x10=0x{:08x} A1/x11=0x{:08x} A2/x12=0x{:08x} A3/x13=0x{:08x} A4/x14=0x{:08x}
|
||||
A5/x15=0x{:08x} A6/x16=0x{:08x} A7/x17=0x{:08x} S2/x18=0x{:08x} S3/x19=0x{:08x}
|
||||
S4/x20=0x{:08x} S5/x21=0x{:08x} S6/x22=0x{:08x} S7/x23=0x{:08x} S8/x24=0x{:08x}
|
||||
S9/x25=0x{:08x} S10/x26=0x{:08x} S11/x27=0x{:08x} T3/x28=0x{:08x} T4/x29=0x{:08x}
|
||||
T5/x30=0x{:08x} T6/x31=0x{:08x}
|
||||
|
||||
MSTATUS=0x{:08x}
|
||||
MCAUSE=0x{:08x}
|
||||
MTVAL=0x{:08x}
|
||||
",
|
||||
self.pc,
|
||||
self.ra,
|
||||
self.gp,
|
||||
self.sp,
|
||||
self.tp,
|
||||
self.t0,
|
||||
self.t1,
|
||||
self.t2,
|
||||
self.s0,
|
||||
self.s1,
|
||||
self.a0,
|
||||
self.a1,
|
||||
self.a2,
|
||||
self.a3,
|
||||
self.a4,
|
||||
self.a5,
|
||||
self.a6,
|
||||
self.a7,
|
||||
self.s2,
|
||||
self.s3,
|
||||
self.s4,
|
||||
self.s5,
|
||||
self.s6,
|
||||
self.s7,
|
||||
self.s8,
|
||||
self.s9,
|
||||
self.s10,
|
||||
self.s11,
|
||||
self.t3,
|
||||
self.t4,
|
||||
self.t5,
|
||||
self.t6,
|
||||
self.mstatus,
|
||||
self.mcause,
|
||||
self.mtval,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an array of backtrace addresses.
|
||||
///
|
||||
/// This needs `force-frame-pointers` enabled.
|
||||
pub fn backtrace() -> [Option<usize>; MAX_BACKTRACE_ADDRESSES] {
|
||||
let fp = unsafe {
|
||||
let mut _tmp: u32;
|
||||
asm!("mv {0}, x8", out(reg) _tmp);
|
||||
_tmp
|
||||
};
|
||||
|
||||
backtrace_internal(fp, 2)
|
||||
}
|
||||
|
||||
pub(crate) fn backtrace_internal(
|
||||
fp: u32,
|
||||
suppress: i32,
|
||||
) -> [Option<usize>; MAX_BACKTRACE_ADDRESSES] {
|
||||
let mut result = [None; 10];
|
||||
let mut index = 0;
|
||||
|
||||
let mut fp = fp;
|
||||
let mut suppress = suppress;
|
||||
let mut old_address = 0;
|
||||
loop {
|
||||
unsafe {
|
||||
let address = (fp as *const u32).offset(-1).read_volatile(); // RA/PC
|
||||
fp = (fp as *const u32).offset(-2).read_volatile(); // next FP
|
||||
|
||||
if old_address == address {
|
||||
break;
|
||||
}
|
||||
|
||||
old_address = address;
|
||||
|
||||
if address == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
if !crate::is_valid_ram_address(fp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if suppress == 0 {
|
||||
result[index] = Some(address as usize);
|
||||
index += 1;
|
||||
|
||||
if index >= MAX_BACKTRACE_ADDRESSES {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
suppress -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
@ -1,424 +0,0 @@
|
||||
use core::{arch::asm, fmt::Display};
|
||||
|
||||
use crate::MAX_BACKTRACE_ADDRESSES;
|
||||
|
||||
// subtract 3 from the return address
|
||||
// the return address is the address following the callxN
|
||||
// we get better results (especially if the caller was the last function in the
|
||||
// calling function) if we report the address of callxN itself
|
||||
#[allow(unused)]
|
||||
pub(super) const RA_OFFSET: usize = 3;
|
||||
|
||||
/// Exception Cause
|
||||
#[doc(hidden)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[repr(C)]
|
||||
pub enum ExceptionCause {
|
||||
/// Illegal Instruction
|
||||
IllegalInstruction = 0,
|
||||
/// System Call (Syscall Instruction)
|
||||
Syscall = 1,
|
||||
/// Instruction Fetch Error
|
||||
InstrFetchError = 2,
|
||||
/// Load Store Error
|
||||
LoadStoreError = 3,
|
||||
/// Level 1 Interrupt
|
||||
LevelOneInterrupt = 4,
|
||||
/// Stack Extension Assist (movsp Instruction) For Alloca
|
||||
Alloca = 5,
|
||||
/// Integer Divide By Zero
|
||||
DivideByZero = 6,
|
||||
/// Use Of Failed Speculative Access (Not Implemented)
|
||||
NextPCValueIllegal = 7,
|
||||
/// Privileged Instruction
|
||||
PrivilegedInstruction = 8,
|
||||
/// Unaligned Load Or Store
|
||||
UnalignedLoadOrStore = 9,
|
||||
/// Reserved
|
||||
ExternalRegisterPrivilegeError = 10,
|
||||
/// Reserved
|
||||
ExclusiveError = 11,
|
||||
/// Pif Data Error On Instruction Fetch (Rb-200x And Later)
|
||||
InstrDataError = 12,
|
||||
/// Pif Data Error On Load Or Store (Rb-200x And Later)
|
||||
LoadStoreDataError = 13,
|
||||
/// Pif Address Error On Instruction Fetch (Rb-200x And Later)
|
||||
InstrAddrError = 14,
|
||||
/// Pif Address Error On Load Or Store (Rb-200x And Later)
|
||||
LoadStoreAddrError = 15,
|
||||
/// Itlb Miss (No Itlb Entry Matches, Hw Refill Also Missed)
|
||||
ItlbMiss = 16,
|
||||
/// Itlb Multihit (Multiple Itlb Entries Match)
|
||||
ItlbMultiHit = 17,
|
||||
/// Ring Privilege Violation On Instruction Fetch
|
||||
InstrRing = 18,
|
||||
/// Size Restriction On Ifetch (Not Implemented)
|
||||
Reserved19 = 19,
|
||||
/// Cache Attribute Does Not Allow Instruction Fetch
|
||||
InstrProhibited = 20,
|
||||
/// Reserved
|
||||
Reserved21 = 21,
|
||||
/// Reserved
|
||||
Reserved22 = 22,
|
||||
/// Reserved
|
||||
Reserved23 = 23,
|
||||
/// Dtlb Miss (No Dtlb Entry Matches, Hw Refill Also Missed)
|
||||
DtlbMiss = 24,
|
||||
/// Dtlb Multihit (Multiple Dtlb Entries Match)
|
||||
DtlbMultiHit = 25,
|
||||
/// Ring Privilege Violation On Load Or Store
|
||||
LoadStoreRing = 26,
|
||||
/// Size Restriction On Load/Store (Not Implemented)
|
||||
Reserved27 = 27,
|
||||
/// Cache Attribute Does Not Allow Load
|
||||
LoadProhibited = 28,
|
||||
/// Cache Attribute Does Not Allow Store
|
||||
StoreProhibited = 29,
|
||||
/// Reserved
|
||||
Reserved30 = 30,
|
||||
/// Reserved
|
||||
Reserved31 = 31,
|
||||
/// Access To Coprocessor 0 When Disabled
|
||||
Cp0Disabled = 32,
|
||||
/// Access To Coprocessor 1 When Disabled
|
||||
Cp1Disabled = 33,
|
||||
/// Access To Coprocessor 2 When Disabled
|
||||
Cp2Disabled = 34,
|
||||
/// Access To Coprocessor 3 When Disabled
|
||||
Cp3Disabled = 35,
|
||||
/// Access To Coprocessor 4 When Disabled
|
||||
Cp4Disabled = 36,
|
||||
/// Access To Coprocessor 5 When Disabled
|
||||
Cp5Disabled = 37,
|
||||
/// Access To Coprocessor 6 When Disabled
|
||||
Cp6Disabled = 38,
|
||||
/// Access To Coprocessor 7 When Disabled
|
||||
Cp7Disabled = 39,
|
||||
/// None
|
||||
None = 255,
|
||||
}
|
||||
|
||||
impl Display for ExceptionCause {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
if *self == Self::Cp0Disabled {
|
||||
write!(f, "Cp0Disabled (Access to the floating point coprocessor is not allowed. You may want to enable the `float-save-restore` feature of the `xtensa-lx-rt` crate.)")
|
||||
} else {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[repr(C)]
|
||||
pub struct Context {
|
||||
/// Program counter, stores the address of the next instruction to be
|
||||
/// executed.
|
||||
pub PC: u32,
|
||||
/// Processor status, holds various status flags for the CPU.
|
||||
pub PS: u32,
|
||||
/// General-purpose register A0 used for data storage and manipulation.
|
||||
pub A0: u32,
|
||||
/// General-purpose register A1 used for data storage and manipulation.
|
||||
pub A1: u32,
|
||||
/// General-purpose register A2 used for data storage and manipulation.
|
||||
pub A2: u32,
|
||||
/// General-purpose register A3 used for data storage and manipulation.
|
||||
pub A3: u32,
|
||||
/// General-purpose register A4 used for data storage and manipulation.
|
||||
pub A4: u32,
|
||||
/// General-purpose register A5 used for data storage and manipulation.
|
||||
pub A5: u32,
|
||||
/// General-purpose register A6 used for data storage and manipulation.
|
||||
pub A6: u32,
|
||||
/// General-purpose register A7 used for data storage and manipulation.
|
||||
pub A7: u32,
|
||||
/// General-purpose register A8 used for data storage and manipulation.
|
||||
pub A8: u32,
|
||||
/// General-purpose register A9 used for data storage and manipulation.
|
||||
pub A9: u32,
|
||||
/// General-purpose register A10 used for data storage and manipulation.
|
||||
pub A10: u32,
|
||||
/// General-purpose register A11 used for data storage and manipulation.
|
||||
pub A11: u32,
|
||||
/// General-purpose register A12 used for data storage and manipulation.
|
||||
pub A12: u32,
|
||||
/// General-purpose register A13 used for data storage and manipulation.
|
||||
pub A13: u32,
|
||||
/// General-purpose register A14 used for data storage and manipulation.
|
||||
pub A14: u32,
|
||||
/// General-purpose register A15 used for data storage and manipulation.
|
||||
pub A15: u32,
|
||||
/// Shift amount register, used for shift and rotate instructions.
|
||||
pub SAR: u32,
|
||||
/// Exception cause, indicates the reason for the last exception.
|
||||
pub EXCCAUSE: u32,
|
||||
/// Exception address, holds the address related to the exception.
|
||||
pub EXCVADDR: u32,
|
||||
/// Loop start address, used in loop instructions.
|
||||
pub LBEG: u32,
|
||||
/// Loop end address, used in loop instructions.
|
||||
pub LEND: u32,
|
||||
/// Loop counter, used to count iterations in loop instructions.
|
||||
pub LCOUNT: u32,
|
||||
/// Thread pointer, used for thread-local storage.
|
||||
pub THREADPTR: u32,
|
||||
/// Compare register, used for certain compare instructions.
|
||||
pub SCOMPARE1: u32,
|
||||
/// Break register, used for breakpoint-related operations.
|
||||
pub BR: u32,
|
||||
/// Accumulator low register, used for extended arithmetic operations.
|
||||
pub ACCLO: u32,
|
||||
/// Accumulator high register, used for extended arithmetic operations.
|
||||
pub ACCHI: u32,
|
||||
/// Additional register M0 used for special operations.
|
||||
pub M0: u32,
|
||||
/// Additional register M1 used for special operations.
|
||||
pub M1: u32,
|
||||
/// Additional register M2 used for special operations.
|
||||
pub M2: u32,
|
||||
/// Additional register M3 used for special operations.
|
||||
pub M3: u32,
|
||||
/// 64-bit floating-point register (low part), available if the
|
||||
/// `print-float-registers` feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F64R_LO: u32,
|
||||
/// 64-bit floating-point register (high part), available if the
|
||||
/// `print-float-registers` feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F64R_HI: u32,
|
||||
/// Floating-point status register, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F64S: u32,
|
||||
/// Floating-point control register, available if the
|
||||
/// `print-float-registers` feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub FCR: u32,
|
||||
/// Floating-point status register, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub FSR: u32,
|
||||
/// Floating-point register F0, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F0: u32,
|
||||
/// Floating-point register F1, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F1: u32,
|
||||
/// Floating-point register F2, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F2: u32,
|
||||
/// Floating-point register F3, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F3: u32,
|
||||
/// Floating-point register F4, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F4: u32,
|
||||
/// Floating-point register F5, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F5: u32,
|
||||
/// Floating-point register F6, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F6: u32,
|
||||
/// Floating-point register F7, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F7: u32,
|
||||
/// Floating-point register F8, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F8: u32,
|
||||
/// Floating-point register F9, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F9: u32,
|
||||
/// Floating-point register F10, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F10: u32,
|
||||
/// Floating-point register F11, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F11: u32,
|
||||
/// Floating-point register F12, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F12: u32,
|
||||
/// Floating-point register F13, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F13: u32,
|
||||
/// Floating-point register F14, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F14: u32,
|
||||
/// Floating-point register F15, available if the `print-float-registers`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
pub F15: u32,
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Context {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
|
||||
write!(
|
||||
fmt,
|
||||
"Context
|
||||
PC=0x{:08x} PS=0x{:08x}
|
||||
A0=0x{:08x} A1=0x{:08x} A2=0x{:08x} A3=0x{:08x} A4=0x{:08x}
|
||||
A5=0x{:08x} A6=0x{:08x} A7=0x{:08x} A8=0x{:08x} A9=0x{:08x}
|
||||
A10=0x{:08x} A11=0x{:08x} A12=0x{:08x} A13=0x{:08x} A14=0x{:08x}
|
||||
A15=0x{:08x}
|
||||
SAR={:08x}
|
||||
EXCCAUSE=0x{:08x} EXCVADDR=0x{:08x}
|
||||
LBEG=0x{:08x} LEND=0x{:08x} LCOUNT=0x{:08x}
|
||||
THREADPTR=0x{:08x}
|
||||
SCOMPARE1=0x{:08x}
|
||||
BR=0x{:08x}
|
||||
ACCLO=0x{:08x} ACCHI=0x{:08x}
|
||||
M0=0x{:08x} M1=0x{:08x} M2=0x{:08x} M3=0x{:08x}
|
||||
",
|
||||
self.PC,
|
||||
self.PS,
|
||||
self.A0,
|
||||
self.A1,
|
||||
self.A2,
|
||||
self.A3,
|
||||
self.A4,
|
||||
self.A5,
|
||||
self.A6,
|
||||
self.A7,
|
||||
self.A8,
|
||||
self.A9,
|
||||
self.A10,
|
||||
self.A11,
|
||||
self.A12,
|
||||
self.A13,
|
||||
self.A14,
|
||||
self.A15,
|
||||
self.SAR,
|
||||
self.EXCCAUSE,
|
||||
self.EXCVADDR,
|
||||
self.LBEG,
|
||||
self.LEND,
|
||||
self.LCOUNT,
|
||||
self.THREADPTR,
|
||||
self.SCOMPARE1,
|
||||
self.BR,
|
||||
self.ACCLO,
|
||||
self.ACCHI,
|
||||
self.M0,
|
||||
self.M1,
|
||||
self.M2,
|
||||
self.M3,
|
||||
)?;
|
||||
#[cfg(feature = "print-float-registers")]
|
||||
write!(
|
||||
fmt,
|
||||
"F64R_LO=0x{:08x} F64R_HI=0x{:08x} F64S=0x{:08x}
|
||||
FCR=0x{:08x} FSR=0x{:08x}
|
||||
F0=0x{:08x} F1=0x{:08x} F2=0x{:08x} F3=0x{:08x} F4=0x{:08x}
|
||||
F5=0x{:08x} F6=0x{:08x} F7=0x{:08x} F8=0x{:08x} F9=0x{:08x}
|
||||
F10=0x{:08x} F11=0x{:08x} F12=0x{:08x} F13=0x{:08x} F14=0x{:08x}
|
||||
F15=0x{:08x}",
|
||||
self.F64R_LO,
|
||||
self.F64R_HI,
|
||||
self.F64S,
|
||||
self.FCR,
|
||||
self.FSR,
|
||||
self.F0,
|
||||
self.F1,
|
||||
self.F2,
|
||||
self.F3,
|
||||
self.F4,
|
||||
self.F5,
|
||||
self.F6,
|
||||
self.F7,
|
||||
self.F8,
|
||||
self.F9,
|
||||
self.F10,
|
||||
self.F11,
|
||||
self.F12,
|
||||
self.F13,
|
||||
self.F14,
|
||||
self.F15,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an array of backtrace addresses.
|
||||
pub fn backtrace() -> [Option<usize>; MAX_BACKTRACE_ADDRESSES] {
|
||||
let sp = unsafe {
|
||||
let mut _tmp: u32;
|
||||
asm!("mov {0}, a1", out(reg) _tmp);
|
||||
_tmp
|
||||
};
|
||||
|
||||
backtrace_internal(sp, 1)
|
||||
}
|
||||
|
||||
pub(crate) fn sanitize_address(address: u32) -> u32 {
|
||||
(address & 0x3fff_ffff) | 0x4000_0000
|
||||
}
|
||||
|
||||
pub(crate) fn backtrace_internal(
|
||||
sp: u32,
|
||||
suppress: i32,
|
||||
) -> [Option<usize>; MAX_BACKTRACE_ADDRESSES] {
|
||||
let mut result = [None; 10];
|
||||
let mut index = 0;
|
||||
|
||||
let mut fp = sp;
|
||||
let mut suppress = suppress;
|
||||
let mut old_address = 0;
|
||||
|
||||
loop {
|
||||
unsafe {
|
||||
let address = sanitize_address((fp as *const u32).offset(-4).read_volatile()); // RA/PC
|
||||
fp = (fp as *const u32).offset(-3).read_volatile(); // next FP
|
||||
|
||||
if old_address == address {
|
||||
break;
|
||||
}
|
||||
|
||||
old_address = address;
|
||||
|
||||
// the address is 0 but we sanitized the address - then 0 becomes 0x40000000
|
||||
if address == 0x40000000 {
|
||||
break;
|
||||
}
|
||||
|
||||
if !crate::is_valid_ram_address(fp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if fp == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
if suppress == 0 {
|
||||
result[index] = Some(address as usize);
|
||||
index += 1;
|
||||
|
||||
if index >= MAX_BACKTRACE_ADDRESSES {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
suppress -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
[package]
|
||||
name = "esp-build"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.60.0"
|
||||
description = "Build utilities for esp-hal"
|
||||
repository = "https://github.com/esp-rs/esp-hal"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
quote = "1.0.37"
|
||||
syn = { version = "2.0.79", features = ["fold", "full"] }
|
||||
termcolor = "1.4.1"
|
||||
@ -1,33 +0,0 @@
|
||||
# esp-build
|
||||
|
||||
[](https://crates.io/crates/esp-build)
|
||||
[](https://docs.rs/esp-build)
|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
Build utilities for use with `esp-hal` and other related packages, intended for use in [build scripts]. This package is still quite minimal, but provides:
|
||||
|
||||
[build scripts]: https://doc.rust-lang.org/cargo/reference/build-scripts.html
|
||||
|
||||
## [Documentation](https://docs.rs/crate/esp-build)
|
||||
|
||||
## Minimum Supported Rust Version (MSRV)
|
||||
|
||||
This crate is guaranteed to compile on stable Rust 1.60 and up. It _might_
|
||||
compile with older versions but that may change in any new patch release.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
any additional terms or conditions.
|
||||
@ -1,229 +0,0 @@
|
||||
//! Build utilities for esp-hal.
|
||||
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
||||
|
||||
use std::io::Write as _;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::ToTokens;
|
||||
use syn::{parse_macro_input, punctuated::Punctuated, LitStr, Token};
|
||||
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||
|
||||
/// Print a build error and terminate the process.
|
||||
///
|
||||
/// It should be noted that the error will be printed BEFORE the main function
|
||||
/// is called, and as such this should NOT be thought analogous to `println!` or
|
||||
/// similar utilities.
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// esp_build::error! {"
|
||||
/// ERROR: something really bad has happened!
|
||||
/// "}
|
||||
/// // Process exits with exit code 1
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn error(input: TokenStream) -> TokenStream {
|
||||
do_alert(Color::Red, input);
|
||||
panic!("Build failed");
|
||||
}
|
||||
|
||||
/// Print a build warning.
|
||||
///
|
||||
/// It should be noted that the warning will be printed BEFORE the main function
|
||||
/// is called, and as such this should NOT be thought analogous to `println!` or
|
||||
/// similar utilities.
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// esp_build::warning! {"
|
||||
/// WARNING: something unpleasant has happened!
|
||||
/// "};
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn warning(input: TokenStream) -> TokenStream {
|
||||
do_alert(Color::Yellow, input)
|
||||
}
|
||||
|
||||
/// Given some features, assert that **at most** one of the features is enabled.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```rust
|
||||
/// assert_unique_features!("foo", "bar", "baz");
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn assert_unique_features(input: TokenStream) -> TokenStream {
|
||||
let features = parse_macro_input!(input with Punctuated<LitStr, Token![,]>::parse_terminated)
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let unique = impl_unique_features(&features, "exactly zero or one");
|
||||
|
||||
quote::quote! {
|
||||
#unique
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Given some features, assert that **at least** one of the features is
|
||||
/// enabled.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```rust
|
||||
/// assert_used_features!("foo", "bar", "baz");
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn assert_used_features(input: TokenStream) -> TokenStream {
|
||||
let features = parse_macro_input!(input with Punctuated<LitStr, Token![,]>::parse_terminated)
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let used = impl_used_features(&features, "at least one");
|
||||
|
||||
quote::quote! {
|
||||
#used
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Given some features, assert that **exactly** one of the features is enabled.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```rust
|
||||
/// assert_unique_used_features!("foo", "bar", "baz");
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
pub fn assert_unique_used_features(input: TokenStream) -> TokenStream {
|
||||
let features = parse_macro_input!(input with Punctuated<LitStr, Token![,]>::parse_terminated)
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let unique = impl_unique_features(&features, "exactly one");
|
||||
let used = impl_used_features(&features, "exactly one");
|
||||
|
||||
quote::quote! {
|
||||
#unique
|
||||
#used
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Helper Functions
|
||||
|
||||
fn impl_unique_features(features: &[LitStr], expectation: &str) -> impl ToTokens {
|
||||
let pairs = unique_pairs(features);
|
||||
let unique_cfgs = pairs
|
||||
.iter()
|
||||
.map(|(a, b)| quote::quote! { all(feature = #a, feature = #b) });
|
||||
|
||||
let message = format!(
|
||||
r#"
|
||||
ERROR: expected {expectation} enabled feature from feature group:
|
||||
{:?}
|
||||
"#,
|
||||
features.iter().map(|lit| lit.value()).collect::<Vec<_>>(),
|
||||
);
|
||||
|
||||
quote::quote! {
|
||||
#[cfg(any(#(#unique_cfgs),*))]
|
||||
::esp_build::error! { #message }
|
||||
}
|
||||
}
|
||||
|
||||
fn impl_used_features(features: &[LitStr], expectation: &str) -> impl ToTokens {
|
||||
let message = format!(
|
||||
r#"
|
||||
ERROR: expected {expectation} enabled feature from feature group:
|
||||
{:?}
|
||||
"#,
|
||||
features.iter().map(|lit| lit.value()).collect::<Vec<_>>()
|
||||
);
|
||||
|
||||
quote::quote! {
|
||||
#[cfg(not(any(#(feature = #features),*)))]
|
||||
::esp_build::error! { #message }
|
||||
}
|
||||
}
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dtolnay/build-alert/blob/49d060e/src/lib.rs#L54-L93
|
||||
fn do_alert(color: Color, input: TokenStream) -> TokenStream {
|
||||
let message = parse_macro_input!(input as LitStr).value();
|
||||
|
||||
let stderr = &mut StandardStream::stderr(ColorChoice::Auto);
|
||||
let color_spec = ColorSpec::new().set_fg(Some(color)).clone();
|
||||
|
||||
let mut has_nonspace = false;
|
||||
|
||||
for mut line in message.lines() {
|
||||
if !has_nonspace {
|
||||
let (maybe_heading, rest) = split_heading(line);
|
||||
|
||||
if let Some(heading) = maybe_heading {
|
||||
stderr.set_color(color_spec.clone().set_bold(true)).ok();
|
||||
write!(stderr, "\n{}", heading).ok();
|
||||
has_nonspace = true;
|
||||
}
|
||||
|
||||
line = rest;
|
||||
}
|
||||
|
||||
if line.is_empty() {
|
||||
writeln!(stderr).ok();
|
||||
} else {
|
||||
stderr.set_color(&color_spec).ok();
|
||||
writeln!(stderr, "{}", line).ok();
|
||||
|
||||
has_nonspace = has_nonspace || line.contains(|ch: char| ch != ' ');
|
||||
}
|
||||
}
|
||||
|
||||
stderr.reset().ok();
|
||||
writeln!(stderr).ok();
|
||||
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/dtolnay/build-alert/blob/49d060e/src/lib.rs#L95-L114
|
||||
fn split_heading(s: &str) -> (Option<&str>, &str) {
|
||||
let mut end = 0;
|
||||
while end < s.len() && s[end..].starts_with(|ch: char| ch.is_ascii_uppercase()) {
|
||||
end += 1;
|
||||
}
|
||||
|
||||
if end >= 3 && (end == s.len() || s[end..].starts_with(':')) {
|
||||
let (heading, rest) = s.split_at(end);
|
||||
(Some(heading), rest)
|
||||
} else {
|
||||
(None, s)
|
||||
}
|
||||
}
|
||||
|
||||
fn unique_pairs(features: &[LitStr]) -> Vec<(&LitStr, &LitStr)> {
|
||||
let mut pairs = Vec::new();
|
||||
|
||||
let mut i = 0;
|
||||
let mut j = 0;
|
||||
|
||||
while i < features.len() {
|
||||
let a = &features[i];
|
||||
let b = &features[j];
|
||||
|
||||
if a.value() != b.value() {
|
||||
pairs.push((a, b));
|
||||
}
|
||||
|
||||
j += 1;
|
||||
|
||||
if j >= features.len() {
|
||||
i += 1;
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
|
||||
pairs
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Fixed
|
||||
|
||||
- Users no longer have to manually import `esp_config_int_parse`. (#2630)
|
||||
|
||||
### Changed
|
||||
|
||||
- Crate prefixes and configuration keys are now separated by `_CONFIG_` (#2848)
|
||||
|
||||
### Removed
|
||||
|
||||
## 0.2.0 - 2024-11-20
|
||||
|
||||
### Added
|
||||
|
||||
- Add configuration validation (#2475)
|
||||
|
||||
## 0.1.0 - 2024-10-10
|
||||
|
||||
- Initial release
|
||||
|
||||
[Unreleased]: https://github.com/esp-rs/esp-hal/commits/main/esp-config?since=2024-11-20
|
||||
@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "esp-config"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.79.0"
|
||||
description = "Configure projects using esp-hal and related packages"
|
||||
repository = "https://github.com/esp-rs/esp-hal"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
document-features = "0.2.10"
|
||||
|
||||
[dev-dependencies]
|
||||
temp-env = "0.3.6"
|
||||
|
||||
[features]
|
||||
## Enable the generation and parsing of a config
|
||||
build = []
|
||||
@ -1,65 +0,0 @@
|
||||
# esp-config
|
||||
|
||||
[](https://crates.io/crates/esp-config)
|
||||
[](https://docs.rs/esp-config)
|
||||

|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
## [Documentation](https://docs.rs/crate/esp-config)
|
||||
|
||||
## Usage
|
||||
|
||||
`esp-config` takes a prefix (usually the crate name) and a set of configuration keys and default values to produce a configuration system that supports:
|
||||
|
||||
- Emitting rustc cfg's for boolean keys
|
||||
- Emitting environment variables for numbers
|
||||
- Along with decimal parsing, it supports Hex, Octal and Binary with the respective `0x`, `0o` and `0b` prefixes.
|
||||
- Emitting environment variables string values
|
||||
|
||||
### Viewing the configuration
|
||||
|
||||
The possible configuration values are output as a markdown table in the crates `OUT_DIR` with the format `{prefix}_config_table.md`, this can then be included into the crates top level documentation. Here is an example of the output:
|
||||
|
||||
|
||||
| Name | Description | Default value |
|
||||
|------|-------------|---------------|
|
||||
|**ESP_HAL_PLACE_SPI_DRIVER_IN_RAM**|Places the SPI driver in RAM for better performance|false|
|
||||
|
||||
### Setting configuration options
|
||||
|
||||
For any available configuration option, the environment variable or cfg is _always_ set based on the default value specified in the table. Users can override this by setting environment variables locally in their shell _or_ the preferred option is to utilize cargo's [`env` section](https://doc.rust-lang.org/cargo/reference/config.html#env).
|
||||
|
||||
It's important to note that due to a [bug in cargo](https://github.com/rust-lang/cargo/issues/10358), any modifications to the environment, local or otherwise will only get picked up on a full clean build of the project.
|
||||
|
||||
To see the final selected configuration another table is output to the `OUT_DIR` with the format `{prefix}_selected_config.md`.
|
||||
|
||||
### Capturing configuration values in the downstream crate
|
||||
|
||||
For all supported data types, there are helper macros that emit `const` code for parsing the configuration values.
|
||||
|
||||
- Numbers - `esp_config_int!(integer_type, "ENV")`
|
||||
- Strings - `esp_config_str!("ENV")`
|
||||
- Bool - `esp_config_bool!("ENV")`
|
||||
|
||||
In addition to environment variables, for boolean types rust `cfg`'s are emitted in snake case _without_ the prefix.
|
||||
|
||||
## Minimum Supported Rust Version (MSRV)
|
||||
|
||||
This crate is guaranteed to compile on stable Rust 1.79 and up. It _might_
|
||||
compile with older versions but that may change in any new patch release.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
any additional terms or conditions.
|
||||
@ -1,699 +0,0 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
env,
|
||||
fmt::{self, Write as _},
|
||||
fs,
|
||||
ops::Range,
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
const DOC_TABLE_HEADER: &str = r#"
|
||||
| Name | Description | Default value |
|
||||
|------|-------------|---------------|
|
||||
"#;
|
||||
|
||||
const SELECTED_TABLE_HEADER: &str = r#"
|
||||
| Name | Selected value |
|
||||
|------|----------------|
|
||||
"#;
|
||||
|
||||
/// Configuration errors.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Error {
|
||||
/// Parse errors.
|
||||
Parse(String),
|
||||
/// Validation errors.
|
||||
Validation(String),
|
||||
}
|
||||
|
||||
impl Error {
|
||||
/// Convenience function for creating parse errors.
|
||||
pub fn parse<S>(message: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::Parse(message.into())
|
||||
}
|
||||
|
||||
/// Convenience function for creating validation errors.
|
||||
pub fn validation<S>(message: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::Validation(message.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::Parse(message) => write!(f, "{message}"),
|
||||
Error::Validation(message) => write!(f, "{message}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Supported configuration value types.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Value {
|
||||
/// Booleans.
|
||||
Bool(bool),
|
||||
/// Integers.
|
||||
Integer(i128),
|
||||
/// Strings.
|
||||
String(String),
|
||||
}
|
||||
|
||||
// TODO: Do we want to handle negative values for non-decimal values?
|
||||
impl Value {
|
||||
fn parse_in_place(&mut self, s: &str) -> Result<(), Error> {
|
||||
*self = match self {
|
||||
Value::Bool(_) => match s {
|
||||
"true" => Value::Bool(true),
|
||||
"false" => Value::Bool(false),
|
||||
_ => {
|
||||
return Err(Error::parse(format!(
|
||||
"Expected 'true' or 'false', found: '{s}'"
|
||||
)))
|
||||
}
|
||||
},
|
||||
Value::Integer(_) => {
|
||||
let inner = match s.as_bytes() {
|
||||
[b'0', b'x', ..] => i128::from_str_radix(&s[2..], 16),
|
||||
[b'0', b'o', ..] => i128::from_str_radix(&s[2..], 8),
|
||||
[b'0', b'b', ..] => i128::from_str_radix(&s[2..], 2),
|
||||
_ => i128::from_str_radix(&s, 10),
|
||||
}
|
||||
.map_err(|_| Error::parse(format!("Expected valid intger value, found: '{s}'")))?;
|
||||
|
||||
Value::Integer(inner)
|
||||
}
|
||||
Value::String(_) => Value::String(s.into()),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Convert the value to a [bool].
|
||||
pub fn as_bool(&self) -> bool {
|
||||
match self {
|
||||
Value::Bool(value) => *value,
|
||||
_ => panic!("attempted to convert non-bool value to a bool"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert the value to an [i128].
|
||||
pub fn as_integer(&self) -> i128 {
|
||||
match self {
|
||||
Value::Integer(value) => *value,
|
||||
_ => panic!("attempted to convert non-integer value to an integer"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert the value to a [String].
|
||||
pub fn as_string(&self) -> String {
|
||||
match self {
|
||||
Value::String(value) => value.to_owned(),
|
||||
_ => panic!("attempted to convert non-string value to a string"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Is the value a bool?
|
||||
pub fn is_bool(&self) -> bool {
|
||||
matches!(self, Value::Bool(_))
|
||||
}
|
||||
|
||||
/// Is the value an integer?
|
||||
pub fn is_integer(&self) -> bool {
|
||||
matches!(self, Value::Integer(_))
|
||||
}
|
||||
|
||||
/// Is the value a string?
|
||||
pub fn is_string(&self) -> bool {
|
||||
matches!(self, Value::String(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Value {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Value::Bool(b) => write!(f, "{b}"),
|
||||
Value::Integer(i) => write!(f, "{i}"),
|
||||
Value::String(s) => write!(f, "{s}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration value validation functions.
|
||||
pub enum Validator {
|
||||
/// Only allow negative integers, i.e. any values less than 0.
|
||||
NegativeInteger,
|
||||
/// Only allow non-negative integers, i.e. any values greater than or equal
|
||||
/// to 0.
|
||||
NonNegativeInteger,
|
||||
/// Only allow positive integers, i.e. any values greater than to 0.
|
||||
PositiveInteger,
|
||||
/// Ensure that an integer value falls within the specified range.
|
||||
IntegerInRange(Range<i128>),
|
||||
/// A custom validation function to run against any supported value type.
|
||||
Custom(Box<dyn Fn(&Value) -> Result<(), Error>>),
|
||||
}
|
||||
|
||||
impl Validator {
|
||||
fn validate(&self, value: &Value) -> Result<(), Error> {
|
||||
match self {
|
||||
Validator::NegativeInteger => negative_integer(value)?,
|
||||
Validator::NonNegativeInteger => non_negative_integer(value)?,
|
||||
Validator::PositiveInteger => positive_integer(value)?,
|
||||
Validator::IntegerInRange(range) => integer_in_range(range, value)?,
|
||||
Validator::Custom(validator_fn) => validator_fn(value)?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn negative_integer(value: &Value) -> Result<(), Error> {
|
||||
if !value.is_integer() {
|
||||
return Err(Error::validation(
|
||||
"Validator::NegativeInteger can only be used with integer values",
|
||||
));
|
||||
} else if value.as_integer() >= 0 {
|
||||
return Err(Error::validation(format!(
|
||||
"Expected negative integer, found '{}'",
|
||||
value.as_integer()
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn non_negative_integer(value: &Value) -> Result<(), Error> {
|
||||
if !value.is_integer() {
|
||||
return Err(Error::validation(
|
||||
"Validator::NonNegativeInteger can only be used with integer values",
|
||||
));
|
||||
} else if value.as_integer() < 0 {
|
||||
return Err(Error::validation(format!(
|
||||
"Expected non-negative integer, found '{}'",
|
||||
value.as_integer()
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn positive_integer(value: &Value) -> Result<(), Error> {
|
||||
if !value.is_integer() {
|
||||
return Err(Error::validation(
|
||||
"Validator::PositiveInteger can only be used with integer values",
|
||||
));
|
||||
} else if value.as_integer() <= 0 {
|
||||
return Err(Error::validation(format!(
|
||||
"Expected positive integer, found '{}'",
|
||||
value.as_integer()
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn integer_in_range(range: &Range<i128>, value: &Value) -> Result<(), Error> {
|
||||
if !value.is_integer() || !range.contains(&value.as_integer()) {
|
||||
Err(Error::validation(format!(
|
||||
"Value '{}' does not fall within range '{:?}'",
|
||||
value, range
|
||||
)))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate and parse config from a prefix, and an array tuples containing the
|
||||
/// name, description, default value, and an optional validator.
|
||||
///
|
||||
/// This function will parse any `SCREAMING_SNAKE_CASE` environment variables
|
||||
/// that match the given prefix. It will then attempt to parse the [`Value`] and
|
||||
/// run any validators which have been specified.
|
||||
///
|
||||
/// Once the config has been parsed, this function will emit `snake_case` cfg's
|
||||
/// _without_ the prefix which can be used in the dependant crate. After that,
|
||||
/// it will create a markdown table in the `OUT_DIR` under the name
|
||||
/// `{prefix}_config_table.md` where prefix has also been converted to
|
||||
/// `snake_case`. This can be included in crate documentation to outline the
|
||||
/// available configuration options for the crate.
|
||||
///
|
||||
/// Passing a value of true for the `emit_md_tables` argument will create and
|
||||
/// write markdown files of the available configuration and selected
|
||||
/// configuration which can be included in documentation.
|
||||
///
|
||||
/// Unknown keys with the supplied prefix will cause this function to panic.
|
||||
pub fn generate_config(
|
||||
crate_name: &str,
|
||||
config: &[(&str, &str, Value, Option<Validator>)],
|
||||
emit_md_tables: bool,
|
||||
) -> HashMap<String, Value> {
|
||||
// Only rebuild if `build.rs` changed. Otherwise, Cargo will rebuild if any
|
||||
// other file changed.
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
#[cfg(not(test))]
|
||||
env_change_work_around();
|
||||
|
||||
let mut doc_table = String::from(DOC_TABLE_HEADER);
|
||||
let mut selected_config = String::from(SELECTED_TABLE_HEADER);
|
||||
|
||||
// Ensure that the prefix is `SCREAMING_SNAKE_CASE`:
|
||||
let prefix = format!("{}_CONFIG_", screaming_snake_case(crate_name));
|
||||
|
||||
// Build a lookup table for any provided validators; we must prefix the
|
||||
// name of the config and transform it to SCREAMING_SNAKE_CASE so that
|
||||
// it matches the keys in the hash table produced by `create_config`.
|
||||
let config_validators = config
|
||||
.iter()
|
||||
.flat_map(|(name, _description, _default, validator)| {
|
||||
if let Some(validator) = validator {
|
||||
let name = format!("{prefix}{}", screaming_snake_case(name));
|
||||
Some((name, validator))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
let mut configs = create_config(&prefix, config, &mut doc_table);
|
||||
capture_from_env(&prefix, &mut configs);
|
||||
|
||||
for (name, value) in configs.iter() {
|
||||
if let Some(validator) = config_validators.get(name) {
|
||||
validator.validate(value).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
emit_configuration(&prefix, &configs, &mut selected_config);
|
||||
|
||||
if emit_md_tables {
|
||||
let file_name = snake_case(crate_name);
|
||||
write_config_tables(&file_name, doc_table, selected_config);
|
||||
}
|
||||
|
||||
configs
|
||||
}
|
||||
|
||||
// A work-around for https://github.com/rust-lang/cargo/issues/10358
|
||||
// This can be removed when https://github.com/rust-lang/cargo/pull/14058 is merged.
|
||||
// Unlikely to work on projects in workspaces
|
||||
#[cfg(not(test))]
|
||||
fn env_change_work_around() {
|
||||
let mut out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
|
||||
// We clean out_dir by removing all trailing directories, until it ends with
|
||||
// target
|
||||
while !out_dir.ends_with("target") {
|
||||
if !out_dir.pop() {
|
||||
return; // We ran out of directories...
|
||||
}
|
||||
}
|
||||
out_dir.pop();
|
||||
|
||||
let dotcargo = out_dir.join(".cargo/");
|
||||
if dotcargo.exists() {
|
||||
if dotcargo.join("config.toml").exists() {
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
dotcargo.join("config.toml").display()
|
||||
);
|
||||
}
|
||||
if dotcargo.join("config").exists() {
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
dotcargo.join("config").display()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn create_config(
|
||||
prefix: &str,
|
||||
config: &[(&str, &str, Value, Option<Validator>)],
|
||||
doc_table: &mut String,
|
||||
) -> HashMap<String, Value> {
|
||||
let mut configs = HashMap::new();
|
||||
|
||||
for (name, description, default, _validator) in config {
|
||||
let name = format!("{prefix}{}", screaming_snake_case(name));
|
||||
configs.insert(name.clone(), default.clone());
|
||||
|
||||
// Write documentation table line:
|
||||
let default = default.to_string();
|
||||
writeln!(doc_table, "|**{name}**|{description}|{default}|").unwrap();
|
||||
|
||||
// Rebuild if config environment variable changed:
|
||||
println!("cargo:rerun-if-env-changed={name}");
|
||||
}
|
||||
|
||||
configs
|
||||
}
|
||||
|
||||
fn capture_from_env(prefix: &str, configs: &mut HashMap<String, Value>) {
|
||||
let mut unknown = Vec::new();
|
||||
let mut failed = Vec::new();
|
||||
|
||||
// Try and capture input from the environment:
|
||||
for (var, value) in env::vars() {
|
||||
if var.starts_with(prefix) {
|
||||
let Some(cfg) = configs.get_mut(&var) else {
|
||||
unknown.push(var);
|
||||
continue;
|
||||
};
|
||||
|
||||
if let Err(e) = cfg.parse_in_place(&value) {
|
||||
failed.push(format!("{var}: {e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !failed.is_empty() {
|
||||
panic!("Invalid configuration options detected: {:?}", failed);
|
||||
}
|
||||
|
||||
if !unknown.is_empty() {
|
||||
panic!("Unknown configuration options detected: {:?}", unknown);
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_configuration(
|
||||
prefix: &str,
|
||||
configs: &HashMap<String, Value>,
|
||||
selected_config: &mut String,
|
||||
) {
|
||||
for (name, value) in configs.iter() {
|
||||
let cfg_name = snake_case(name.trim_start_matches(prefix));
|
||||
println!("cargo:rustc-check-cfg=cfg({cfg_name})");
|
||||
|
||||
if let Value::Bool(true) = value {
|
||||
println!("cargo:rustc-cfg={cfg_name}");
|
||||
}
|
||||
|
||||
let value = value.to_string();
|
||||
|
||||
// Values that haven't been seen will be output here with the default value:
|
||||
println!("cargo:rustc-env={}={}", name, value);
|
||||
writeln!(selected_config, "|**{name}**|{value}|").unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn write_config_tables(prefix: &str, doc_table: String, selected_config: String) {
|
||||
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
|
||||
let out_file = out_dir
|
||||
.join(format!("{prefix}_config_table.md"))
|
||||
.display()
|
||||
.to_string();
|
||||
fs::write(out_file, doc_table).unwrap();
|
||||
|
||||
let out_file = out_dir
|
||||
.join(format!("{prefix}_selected_config.md"))
|
||||
.display()
|
||||
.to_string();
|
||||
fs::write(out_file, selected_config).unwrap();
|
||||
}
|
||||
|
||||
fn snake_case(name: &str) -> String {
|
||||
let mut name = name.replace("-", "_");
|
||||
name.make_ascii_lowercase();
|
||||
|
||||
name
|
||||
}
|
||||
|
||||
fn screaming_snake_case(name: &str) -> String {
|
||||
let mut name = name.replace("-", "_");
|
||||
name.make_ascii_uppercase();
|
||||
|
||||
name
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn value_number_formats() {
|
||||
const INPUTS: &[&str] = &["0xAA", "0o252", "0b0000000010101010", "170"];
|
||||
let mut v = Value::Integer(0);
|
||||
|
||||
for input in INPUTS {
|
||||
v.parse_in_place(input).unwrap();
|
||||
// no matter the input format, the output format should be decimal
|
||||
assert_eq!(format!("{v}"), "170");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn value_bool_inputs() {
|
||||
let mut v = Value::Bool(false);
|
||||
|
||||
v.parse_in_place("true").unwrap();
|
||||
assert_eq!(format!("{v}"), "true");
|
||||
|
||||
v.parse_in_place("false").unwrap();
|
||||
assert_eq!(format!("{v}"), "false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_override() {
|
||||
temp_env::with_vars(
|
||||
[
|
||||
("ESP_TEST_CONFIG_NUMBER", Some("0xaa")),
|
||||
("ESP_TEST_CONFIG_NUMBER_SIGNED", Some("-999")),
|
||||
("ESP_TEST_CONFIG_STRING", Some("Hello world!")),
|
||||
("ESP_TEST_CONFIG_BOOL", Some("true")),
|
||||
],
|
||||
|| {
|
||||
let configs = generate_config(
|
||||
"esp-test",
|
||||
&[
|
||||
("number", "NA", Value::Integer(999), None),
|
||||
("number_signed", "NA", Value::Integer(-777), None),
|
||||
("string", "NA", Value::String("Demo".to_owned()), None),
|
||||
("bool", "NA", Value::Bool(false), None),
|
||||
("number_default", "NA", Value::Integer(999), None),
|
||||
(
|
||||
"string_default",
|
||||
"NA",
|
||||
Value::String("Demo".to_owned()),
|
||||
None,
|
||||
),
|
||||
("bool_default", "NA", Value::Bool(false), None),
|
||||
],
|
||||
false,
|
||||
);
|
||||
|
||||
// some values have changed
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_NUMBER").unwrap() {
|
||||
Value::Integer(num) => *num,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
0xaa
|
||||
);
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_NUMBER_SIGNED").unwrap() {
|
||||
Value::Integer(num) => *num,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
-999
|
||||
);
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_STRING").unwrap() {
|
||||
Value::String(val) => val,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
"Hello world!"
|
||||
);
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_BOOL").unwrap() {
|
||||
Value::Bool(val) => *val,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
// the rest are the defaults
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_NUMBER_DEFAULT").unwrap() {
|
||||
Value::Integer(num) => *num,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
999
|
||||
);
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_STRING_DEFAULT").unwrap() {
|
||||
Value::String(val) => val,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
"Demo"
|
||||
);
|
||||
assert_eq!(
|
||||
match configs.get("ESP_TEST_CONFIG_BOOL_DEFAULT").unwrap() {
|
||||
Value::Bool(val) => *val,
|
||||
_ => unreachable!(),
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builtin_validation_passes() {
|
||||
temp_env::with_vars(
|
||||
[
|
||||
("ESP_TEST_CONFIG_POSITIVE_NUMBER", Some("7")),
|
||||
("ESP_TEST_CONFIG_NEGATIVE_NUMBER", Some("-1")),
|
||||
("ESP_TEST_CONFIG_NON_NEGATIVE_NUMBER", Some("0")),
|
||||
("ESP_TEST_CONFIG_RANGE", Some("9")),
|
||||
],
|
||||
|| {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[
|
||||
(
|
||||
"positive_number",
|
||||
"NA",
|
||||
Value::Integer(-1),
|
||||
Some(Validator::PositiveInteger),
|
||||
),
|
||||
(
|
||||
"negative_number",
|
||||
"NA",
|
||||
Value::Integer(1),
|
||||
Some(Validator::NegativeInteger),
|
||||
),
|
||||
(
|
||||
"non_negative_number",
|
||||
"NA",
|
||||
Value::Integer(-1),
|
||||
Some(Validator::NonNegativeInteger),
|
||||
),
|
||||
(
|
||||
"range",
|
||||
"NA",
|
||||
Value::Integer(0),
|
||||
Some(Validator::IntegerInRange(5..10)),
|
||||
),
|
||||
],
|
||||
false,
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn custom_validation_passes() {
|
||||
temp_env::with_vars([("ESP_TEST_CONFIG_NUMBER", Some("13"))], || {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[(
|
||||
"number",
|
||||
"NA",
|
||||
Value::Integer(-1),
|
||||
Some(Validator::Custom(Box::new(|value| {
|
||||
let range = 10..20;
|
||||
if !value.is_integer() || !range.contains(&value.as_integer()) {
|
||||
Err(Error::validation("value does not fall within range"))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}))),
|
||||
)],
|
||||
false,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn builtin_validation_bails() {
|
||||
temp_env::with_vars([("ESP_TEST_CONFIG_POSITIVE_NUMBER", Some("-99"))], || {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[(
|
||||
"positive_number",
|
||||
"NA",
|
||||
Value::Integer(-1),
|
||||
Some(Validator::PositiveInteger),
|
||||
)],
|
||||
false,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn custom_validation_bails() {
|
||||
temp_env::with_vars([("ESP_TEST_CONFIG_NUMBER", Some("37"))], || {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[(
|
||||
"number",
|
||||
"NA",
|
||||
Value::Integer(-1),
|
||||
Some(Validator::Custom(Box::new(|value| {
|
||||
let range = 10..20;
|
||||
if !value.is_integer() || !range.contains(&value.as_integer()) {
|
||||
Err(Error::validation("value does not fall within range"))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}))),
|
||||
)],
|
||||
false,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn env_unknown_bails() {
|
||||
temp_env::with_vars(
|
||||
[
|
||||
("ESP_TEST_CONFIG_NUMBER", Some("0xaa")),
|
||||
("ESP_TEST_CONFIG_RANDOM_VARIABLE", Some("")),
|
||||
],
|
||||
|| {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[("number", "NA", Value::Integer(999), None)],
|
||||
false,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn env_invalid_values_bails() {
|
||||
temp_env::with_vars([("ESP_TEST_CONFIG_NUMBER", Some("Hello world"))], || {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[("number", "NA", Value::Integer(999), None)],
|
||||
false,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_unknown_prefix_is_ignored() {
|
||||
temp_env::with_vars(
|
||||
[("ESP_TEST_OTHER_CONFIG_NUMBER", Some("Hello world"))],
|
||||
|| {
|
||||
generate_config(
|
||||
"esp-test",
|
||||
&[("number", "NA", Value::Integer(999), None)],
|
||||
false,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,110 +0,0 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
//! ## Feature Flags
|
||||
#![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)]
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
||||
#![cfg_attr(not(feature = "build"), no_std)]
|
||||
#![deny(missing_docs, rust_2018_idioms)]
|
||||
|
||||
#[cfg(feature = "build")]
|
||||
mod generate;
|
||||
#[cfg(feature = "build")]
|
||||
pub use generate::{generate_config, Error, Validator, Value};
|
||||
|
||||
/// Parse the value of an environment variable as a [bool] at compile time.
|
||||
#[macro_export]
|
||||
macro_rules! esp_config_bool {
|
||||
( $var:expr ) => {
|
||||
match env!($var).as_bytes() {
|
||||
b"true" => true,
|
||||
b"false" => false,
|
||||
_ => ::core::panic!("boolean value must be either 'true' or 'false'"),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: From 1.82 on, we can use `<$ty>::from_str_radix(env!($var), 10)`
|
||||
/// Parse the value of an environment variable as an integer at compile time.
|
||||
#[macro_export]
|
||||
macro_rules! esp_config_int {
|
||||
( $ty:ty, $var:expr ) => {
|
||||
const {
|
||||
const BYTES: &[u8] = env!($var).as_bytes();
|
||||
$crate::esp_config_int_parse!($ty, BYTES)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Get the string value of an environment variable at compile time.
|
||||
#[macro_export]
|
||||
macro_rules! esp_config_str {
|
||||
( $var:expr ) => {
|
||||
env!($var)
|
||||
};
|
||||
}
|
||||
|
||||
/// Parse a string like "777" into an integer, which _can_ be used in a `const`
|
||||
/// context
|
||||
#[doc(hidden)] // To avoid confusion with `esp_config_int`, hide this in the docs
|
||||
#[macro_export]
|
||||
macro_rules! esp_config_int_parse {
|
||||
( $ty:ty, $bytes:expr ) => {{
|
||||
let mut bytes = $bytes;
|
||||
let mut val: $ty = 0;
|
||||
let mut sign_seen = false;
|
||||
let mut is_negative = false;
|
||||
|
||||
while let [byte, rest @ ..] = bytes {
|
||||
match *byte {
|
||||
b'0'..=b'9' => {
|
||||
val = val * 10 + (*byte - b'0') as $ty;
|
||||
}
|
||||
b'-' | b'+' if !sign_seen => {
|
||||
is_negative = *byte == b'-';
|
||||
sign_seen = true;
|
||||
}
|
||||
_ => ::core::panic!("invalid character encountered while parsing integer"),
|
||||
}
|
||||
|
||||
bytes = rest;
|
||||
}
|
||||
|
||||
if is_negative {
|
||||
let original = val;
|
||||
// Subtract the value twice to get a negative:
|
||||
val -= original;
|
||||
val -= original;
|
||||
}
|
||||
|
||||
val
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
// We can only test success in the const context
|
||||
const _: () = {
|
||||
core::assert!(esp_config_int_parse!(i64, "-77777".as_bytes()) == -77777);
|
||||
core::assert!(esp_config_int_parse!(isize, "-7777".as_bytes()) == -7777);
|
||||
core::assert!(esp_config_int_parse!(i32, "-999".as_bytes()) == -999);
|
||||
core::assert!(esp_config_int_parse!(i16, "-99".as_bytes()) == -99);
|
||||
core::assert!(esp_config_int_parse!(i8, "-9".as_bytes()) == -9);
|
||||
|
||||
core::assert!(esp_config_int_parse!(u64, "77777".as_bytes()) == 77777);
|
||||
core::assert!(esp_config_int_parse!(usize, "7777".as_bytes()) == 7777);
|
||||
core::assert!(esp_config_int_parse!(u32, "999".as_bytes()) == 999);
|
||||
core::assert!(esp_config_int_parse!(u16, "99".as_bytes()) == 99);
|
||||
core::assert!(esp_config_int_parse!(u8, "9".as_bytes()) == 9);
|
||||
};
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_expect_positive() {
|
||||
esp_config_int_parse!(u8, "-5".as_bytes());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_invalid_digit() {
|
||||
esp_config_int_parse!(u32, "a".as_bytes());
|
||||
}
|
||||
}
|
||||
183
esp-hal-common/Cargo.toml
Normal file
183
esp-hal-common/Cargo.toml
Normal file
@ -0,0 +1,183 @@
|
||||
[package]
|
||||
name = "esp-hal-common"
|
||||
version = "0.15.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.67.0"
|
||||
description = "HAL implementations for peripherals common among Espressif devices; should not be used directly"
|
||||
repository = "https://github.com/esp-rs/esp-hal"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
# Prevent multiple copies of this crate in the same binary.
|
||||
# Needed because different copies might get different features, causing
|
||||
# confusing build errors due to expected features not getting enabled
|
||||
# on the unintentional copy.
|
||||
# This is especially common when mixing crates from crates.io and git.
|
||||
links = "esp-hal-common"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "2.4.2"
|
||||
bitfield = "0.14.0"
|
||||
cfg-if = "1.0.0"
|
||||
critical-section = "1.1.2"
|
||||
defmt = { version = "=0.3.5", optional = true }
|
||||
embedded-can = { version = "0.4.1", optional = true }
|
||||
embedded-dma = "0.2.0"
|
||||
embedded-hal = { version = "0.2.7", features = ["unproven"] }
|
||||
embedded-hal-1 = { version = "1.0.0", optional = true, package = "embedded-hal" }
|
||||
embedded-hal-nb = { version = "1.0.0", optional = true }
|
||||
embedded-io = { version = "0.6.1", optional = true }
|
||||
enumset = "1.1.3"
|
||||
esp-synopsys-usb-otg = { version = "0.4.0", optional = true, features = ["fs", "esp32sx"] }
|
||||
fugit = "0.3.7"
|
||||
heapless = "0.8.0"
|
||||
log = { version = "0.4.20", optional = true }
|
||||
nb = "1.1.0"
|
||||
paste = "1.0.14"
|
||||
portable-atomic = { version = "1.6.0", default-features = false }
|
||||
procmacros = { version = "0.8.0", features = ["enum-dispatch", "ram"], package = "esp-hal-procmacros", path = "../esp-hal-procmacros" }
|
||||
strum = { version = "0.25.0", default-features = false, features = ["derive"] }
|
||||
void = { version = "1.0.2", default-features = false }
|
||||
usb-device = { version = "0.3.1", optional = true }
|
||||
|
||||
# async
|
||||
embedded-hal-async = { version = "1.0.0", optional = true }
|
||||
embedded-io-async = { version = "0.6.1", optional = true }
|
||||
embassy-executor = { version = "0.5.0", optional = true }
|
||||
embassy-futures = { version = "0.1.1", optional = true }
|
||||
embassy-sync = { version = "0.5.0", optional = true }
|
||||
embassy-time-driver = { version = "0.1.0", optional = true }
|
||||
|
||||
# RISC-V
|
||||
riscv = { version = "0.11.0", optional = true }
|
||||
esp-riscv-rt = { version = "0.6.1", optional = true, path = "../esp-riscv-rt" }
|
||||
|
||||
# Xtensa
|
||||
xtensa-lx = { version = "0.8.0", optional = true }
|
||||
xtensa-lx-rt = { version = "0.16.0", optional = true }
|
||||
|
||||
# Part of `ufmt` containing only `uWrite` trait
|
||||
ufmt-write = { version = "0.1.0", optional = true }
|
||||
|
||||
# IMPORTANT:
|
||||
# Each supported device MUST have its PAC included below along with a
|
||||
# corresponding feature.
|
||||
esp32 = { version = "0.28.0", features = ["critical-section"], optional = true }
|
||||
esp32c2 = { version = "0.17.0", features = ["critical-section"], optional = true }
|
||||
esp32c3 = { version = "0.20.0", features = ["critical-section"], optional = true }
|
||||
esp32c6 = { version = "0.11.0", features = ["critical-section"], optional = true }
|
||||
esp32h2 = { version = "0.7.0", features = ["critical-section"], optional = true }
|
||||
esp32s2 = { version = "0.19.0", features = ["critical-section"], optional = true }
|
||||
esp32s3 = { version = "0.23.0", features = ["critical-section"], optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
basic-toml = "0.1.8"
|
||||
serde = { version = "1.0.195", features = ["derive"] }
|
||||
|
||||
[features]
|
||||
esp32 = ["dep:esp32", "xtensa", "procmacros/esp32", "xtensa-lx/esp32", "xtensa-lx-rt?/esp32"]
|
||||
esp32c2 = ["dep:esp32c2", "riscv", "procmacros/esp32c2", "portable-atomic/unsafe-assume-single-core"]
|
||||
esp32c3 = ["dep:esp32c3", "riscv", "procmacros/esp32c3", "portable-atomic/unsafe-assume-single-core"]
|
||||
esp32c6 = ["dep:esp32c6", "riscv", "procmacros/esp32c6"]
|
||||
esp32h2 = ["dep:esp32h2", "riscv", "procmacros/esp32h2"]
|
||||
esp32s2 = ["dep:esp32s2", "xtensa", "procmacros/esp32s2", "xtensa-lx/esp32s2", "xtensa-lx-rt?/esp32s2", "usb-otg", "portable-atomic/critical-section"]
|
||||
esp32s3 = ["dep:esp32s3", "xtensa", "procmacros/esp32s3", "xtensa-lx/esp32s3", "xtensa-lx-rt?/esp32s3", "usb-otg"]
|
||||
|
||||
# Crystal frequency selection (ESP32 and ESP32-C2 only!)
|
||||
xtal-26mhz = []
|
||||
xtal-40mhz = []
|
||||
|
||||
# Runetime support
|
||||
rt-riscv = ["esp-riscv-rt/zero-bss", "esp32c2?/rt", "esp32c3?/rt", "esp32c6?/rt", "esp32h2?/rt"]
|
||||
rt-xtensa = ["dep:xtensa-lx-rt", "esp32?/rt", "esp32s2?/rt", "esp32s3?/rt"]
|
||||
|
||||
# Only certain chips support flip-link (ESP32-C6 and ESPS32-H2)
|
||||
flip-link = ["esp-riscv-rt/fix-sp"]
|
||||
|
||||
# PSRAM support
|
||||
psram-2m = []
|
||||
psram-4m = []
|
||||
psram-8m = []
|
||||
|
||||
# Octal RAM support
|
||||
opsram-2m = []
|
||||
opsram-4m = []
|
||||
opsram-8m = []
|
||||
opsram-16m = []
|
||||
|
||||
# PSRAM 80Mhz frequency support
|
||||
psram-80mhz = []
|
||||
|
||||
# USB OTG support (ESP32-S2 and ESP32-S3 only! Enabled by default)
|
||||
usb-otg = ["esp-synopsys-usb-otg", "usb-device"]
|
||||
|
||||
# Interrupt-related feature:
|
||||
# - Use direct interrupt vectoring (RISC-V only!)
|
||||
# - Use interrupt preemption (RISC-V only!)
|
||||
# - Use vectored interrupts (calling the handlers defined in the PAC)
|
||||
direct-vectoring = ["esp-riscv-rt/direct-vectoring"]
|
||||
interrupt-preemption = ["esp-riscv-rt/interrupt-preemption"]
|
||||
vectored = ["procmacros/interrupt"]
|
||||
|
||||
# Enable logging
|
||||
log = ["dep:log"]
|
||||
|
||||
# Trait implementation features:
|
||||
# - Implement the `embedded-hal@1.0.0-rc.x` traits (and friends)
|
||||
# - Implement the `embedded-io` traits where able
|
||||
# - Implement the `ufmt_write::Write` trait where able
|
||||
eh1 = ["embedded-hal-1", "embedded-hal-nb", "embedded-can"]
|
||||
embedded-io = ["dep:embedded-io"]
|
||||
ufmt = ["ufmt-write"]
|
||||
|
||||
# Support for asynchronous operation, implementing traits from
|
||||
# `embedded-hal-async` and `embedded-io-async`
|
||||
async = [
|
||||
"embedded-hal-async",
|
||||
"eh1",
|
||||
"embassy-sync",
|
||||
"embassy-futures",
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
]
|
||||
|
||||
# Embassy support
|
||||
embassy = ["embassy-time-driver", "procmacros/embassy"]
|
||||
|
||||
embassy-executor-interrupt = ["embassy", "embassy-executor"]
|
||||
embassy-executor-thread = ["embassy", "embassy-executor"]
|
||||
|
||||
embassy-integrated-timers = ["embassy-executor?/integrated-timers"]
|
||||
|
||||
embassy-time-systick = []
|
||||
embassy-time-timg0 = []
|
||||
|
||||
# Architecture-specific features (intended for internal use)
|
||||
riscv = ["dep:riscv", "critical-section/restore-state-u8"]
|
||||
xtensa = ["critical-section/restore-state-u32"]
|
||||
|
||||
# Initialize / clear data sections and RTC memory
|
||||
rv-init-data = ["esp-riscv-rt/init-data", "esp-riscv-rt/init-rw-text"]
|
||||
rv-zero-rtc-bss = ["esp-riscv-rt/zero-rtc-fast-bss"]
|
||||
rv-init-rtc-data = ["esp-riscv-rt/init-rtc-fast-data", "esp-riscv-rt/init-rtc-fast-text"]
|
||||
|
||||
# Enable the `impl-register-debug` feature for the selected PAC
|
||||
debug = [
|
||||
"esp32?/impl-register-debug",
|
||||
"esp32c2?/impl-register-debug",
|
||||
"esp32c3?/impl-register-debug",
|
||||
"esp32c6?/impl-register-debug",
|
||||
"esp32h2?/impl-register-debug",
|
||||
"esp32s2?/impl-register-debug",
|
||||
"esp32s3?/impl-register-debug",
|
||||
]
|
||||
|
||||
# Enable support for `defmt`, for `esp-hal-common` and also for all our dependencies
|
||||
defmt = [
|
||||
"dep:defmt",
|
||||
"embassy-executor?/defmt",
|
||||
"embassy-futures?/defmt",
|
||||
"embassy-sync?/defmt",
|
||||
"embedded-hal-1?/defmt-03",
|
||||
"embedded-io/defmt-03",
|
||||
"embedded-io-async?/defmt-03",
|
||||
]
|
||||
37
esp-hal-common/README.md
Normal file
37
esp-hal-common/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
# esp-hal-common
|
||||
|
||||
[](https://crates.io/crates/esp-hal-common)
|
||||
[](https://docs.rs/esp-hal-common)
|
||||

|
||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||
|
||||
`no_std` HAL implementations for the peripherals which are common among Espressif devices. Implements a number of the traits defined by [embedded-hal](https://github.com/rust-embedded/embedded-hal).
|
||||
|
||||
This crate should not be used directly; you should use one of the device-specific HAL crates instead:
|
||||
|
||||
- [esp32-hal](../esp32-hal/README.md)
|
||||
- [esp32c2-hal](../esp32c2-hal/README.md)
|
||||
- [esp32c3-hal](../esp32c3-hal/README.md)
|
||||
- [esp32c6-hal](../esp32c6-hal/README.md)
|
||||
- [esp32h2-hal](../esp32h2-hal/README.md)
|
||||
- [esp32s2-hal](../esp32s2-hal/README.md)
|
||||
- [esp32s3-hal](../esp32s3-hal/README.md)
|
||||
|
||||
## [Documentation]
|
||||
|
||||
[documentation]: https://docs.rs/esp-hal-common/
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
||||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
||||
any additional terms or conditions.
|
||||
415
esp-hal-common/build.rs
Normal file
415
esp-hal-common/build.rs
Normal file
@ -0,0 +1,415 @@
|
||||
use std::{
|
||||
env,
|
||||
error::Error,
|
||||
fs::{self, File},
|
||||
io::{BufRead, BufReader, Write},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
// Macros taken from:
|
||||
// https://github.com/TheDan64/inkwell/blob/36c3b10/src/lib.rs#L81-L110
|
||||
|
||||
// Given some features, assert that AT MOST one of the features is enabled.
|
||||
macro_rules! assert_unique_features {
|
||||
() => {};
|
||||
|
||||
( $first:tt $(,$rest:tt)* ) => {
|
||||
$(
|
||||
#[cfg(all(feature = $first, feature = $rest))]
|
||||
compile_error!(concat!("Features \"", $first, "\" and \"", $rest, "\" cannot be used together"));
|
||||
)*
|
||||
assert_unique_features!($($rest),*);
|
||||
};
|
||||
}
|
||||
|
||||
// Given some features, assert that AT LEAST one of the features is enabled.
|
||||
macro_rules! assert_used_features {
|
||||
( $all:tt ) => {
|
||||
#[cfg(not(feature = $all))]
|
||||
compile_error!(concat!("The feature flag must be provided: ", $all));
|
||||
};
|
||||
|
||||
( $($all:tt),+ ) => {
|
||||
#[cfg(not(any($(feature = $all),*)))]
|
||||
compile_error!(concat!("One of the feature flags must be provided: ", $($all, ", "),*));
|
||||
};
|
||||
}
|
||||
|
||||
// Given some features, assert that EXACTLY one of the features is enabled.
|
||||
macro_rules! assert_unique_used_features {
|
||||
( $($all:tt),* ) => {
|
||||
assert_unique_features!($($all),*);
|
||||
assert_used_features!($($all),*);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
enum Arch {
|
||||
#[serde(rename = "riscv")]
|
||||
RiscV,
|
||||
#[serde(rename = "xtensa")]
|
||||
Xtensa,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Arch {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
Arch::RiscV => "riscv",
|
||||
Arch::Xtensa => "xtensa",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
enum CoreCount {
|
||||
#[serde(rename = "single_core")]
|
||||
Single,
|
||||
#[serde(rename = "multi_core")]
|
||||
Multi,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CoreCount {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
CoreCount::Single => "single_core",
|
||||
CoreCount::Multi => "multi_core",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Device {
|
||||
pub arch: Arch,
|
||||
pub cores: CoreCount,
|
||||
pub peripherals: Vec<String>,
|
||||
pub symbols: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Config {
|
||||
pub device: Device,
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
// NOTE: update when adding new device support!
|
||||
// Ensure that exactly one chip has been specified:
|
||||
assert_unique_used_features!(
|
||||
"esp32", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32s2", "esp32s3"
|
||||
);
|
||||
|
||||
// Handle the features for the ESP32's and ESP32-C2's different crystal
|
||||
// frequencies:
|
||||
#[cfg(any(feature = "esp32", feature = "esp32c2"))]
|
||||
{
|
||||
assert_unique_used_features!("xtal-26mhz", "xtal-40mhz");
|
||||
}
|
||||
|
||||
// If the `embassy` feature is enabled, ensure that a time driver implementation
|
||||
// is available:
|
||||
#[cfg(feature = "embassy")]
|
||||
{
|
||||
#[cfg(feature = "esp32")]
|
||||
assert_unique_used_features!("embassy-time-timg0");
|
||||
|
||||
#[cfg(not(feature = "esp32"))]
|
||||
assert_unique_used_features!("embassy-time-systick", "embassy-time-timg0");
|
||||
}
|
||||
|
||||
#[cfg(feature = "flip-link")]
|
||||
{
|
||||
#[cfg(not(any(feature = "esp32c6", feature = "esp32h2")))]
|
||||
panic!("flip-link is only available on ESP32-C6/ESP32-H2");
|
||||
}
|
||||
|
||||
// NOTE: update when adding new device support!
|
||||
// Determine the name of the configured device:
|
||||
let device_name = if cfg!(feature = "esp32") {
|
||||
"esp32"
|
||||
} else if cfg!(feature = "esp32c2") {
|
||||
"esp32c2"
|
||||
} else if cfg!(feature = "esp32c3") {
|
||||
"esp32c3"
|
||||
} else if cfg!(feature = "esp32c6") {
|
||||
"esp32c6"
|
||||
} else if cfg!(feature = "esp32h2") {
|
||||
"esp32h2"
|
||||
} else if cfg!(feature = "esp32s2") {
|
||||
"esp32s2"
|
||||
} else if cfg!(feature = "esp32s3") {
|
||||
"esp32s3"
|
||||
} else {
|
||||
unreachable!() // We've confirmed exactly one known device was selected
|
||||
};
|
||||
|
||||
if detect_atomic_extension("a") || detect_atomic_extension("s32c1i") {
|
||||
panic!(
|
||||
"Atomic emulation flags detected in `.cargo/config.toml`, this is no longer supported!"
|
||||
);
|
||||
}
|
||||
|
||||
// Load the configuration file for the configured device:
|
||||
let chip_toml_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("devices")
|
||||
.join(device_name)
|
||||
.join("device.toml")
|
||||
.canonicalize()?;
|
||||
|
||||
let config = fs::read_to_string(chip_toml_path)?;
|
||||
let config: Config = basic_toml::from_str(&config)?;
|
||||
let device = &config.device;
|
||||
|
||||
// Check PSRAM features are only given if the target supports PSRAM:
|
||||
if !&device.symbols.contains(&String::from("psram"))
|
||||
&& (cfg!(feature = "psram-2m") || cfg!(feature = "psram-4m") || cfg!(feature = "psram-8m"))
|
||||
{
|
||||
panic!("The target does not support PSRAM");
|
||||
}
|
||||
|
||||
// Define all necessary configuration symbols for the configured device:
|
||||
println!("cargo:rustc-cfg={}", device_name);
|
||||
println!("cargo:rustc-cfg={}", device.arch);
|
||||
println!("cargo:rustc-cfg={}", device.cores);
|
||||
|
||||
for peripheral in &device.peripherals {
|
||||
println!("cargo:rustc-cfg={peripheral}");
|
||||
}
|
||||
|
||||
for symbol in &device.symbols {
|
||||
println!("cargo:rustc-cfg={symbol}");
|
||||
}
|
||||
|
||||
let mut config_symbols = Vec::new();
|
||||
let arch = device.arch.to_string();
|
||||
let cores = device.cores.to_string();
|
||||
config_symbols.push(device_name);
|
||||
config_symbols.push(&arch);
|
||||
config_symbols.push(&cores);
|
||||
|
||||
for peripheral in &device.peripherals {
|
||||
config_symbols.push(peripheral);
|
||||
}
|
||||
|
||||
for symbol in &device.symbols {
|
||||
config_symbols.push(symbol);
|
||||
}
|
||||
|
||||
#[cfg(feature = "flip-link")]
|
||||
config_symbols.push("flip-link");
|
||||
|
||||
// Place all linker scripts in `OUT_DIR`, and instruct Cargo how to find these
|
||||
// files:
|
||||
let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
println!("cargo:rustc-link-search={}", out.display());
|
||||
|
||||
if cfg!(feature = "esp32") || cfg!(feature = "esp32s2") || cfg!(feature = "esp32s3") {
|
||||
fs::copy("ld/xtensa/hal-defaults.x", out.join("hal-defaults.x"))?;
|
||||
|
||||
let (irtc, drtc) = if cfg!(feature = "esp32s3") {
|
||||
("rtc_fast_seg", "rtc_fast_seg")
|
||||
} else {
|
||||
("rtc_fast_iram_seg", "rtc_fast_dram_seg")
|
||||
};
|
||||
|
||||
let alias = format!(
|
||||
r#"
|
||||
REGION_ALIAS("ROTEXT", irom_seg);
|
||||
REGION_ALIAS("RWTEXT", iram_seg);
|
||||
REGION_ALIAS("RODATA", drom_seg);
|
||||
REGION_ALIAS("RWDATA", dram_seg);
|
||||
REGION_ALIAS("RTC_FAST_RWTEXT", {});
|
||||
REGION_ALIAS("RTC_FAST_RWDATA", {});
|
||||
"#,
|
||||
irtc, drtc
|
||||
);
|
||||
|
||||
fs::write(out.join("alias.x"), alias)?;
|
||||
} else {
|
||||
preprocess_file(
|
||||
&config_symbols,
|
||||
"ld/riscv/hal-defaults.x",
|
||||
out.join("hal-defaults.x"),
|
||||
)?;
|
||||
preprocess_file(&config_symbols, "ld/riscv/asserts.x", out.join("asserts.x"))?;
|
||||
preprocess_file(&config_symbols, "ld/riscv/debug.x", out.join("debug.x"))?;
|
||||
}
|
||||
|
||||
copy_dir_all(&config_symbols, "ld/sections", &out)?;
|
||||
copy_dir_all(&config_symbols, format!("ld/{device_name}"), &out)?;
|
||||
|
||||
// Generate the eFuse table from the selected device's CSV file:
|
||||
gen_efuse_table(device_name, out)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn copy_dir_all(
|
||||
config_symbols: &Vec<&str>,
|
||||
src: impl AsRef<Path>,
|
||||
dst: impl AsRef<Path>,
|
||||
) -> std::io::Result<()> {
|
||||
fs::create_dir_all(&dst)?;
|
||||
for entry in fs::read_dir(src)? {
|
||||
let entry = entry?;
|
||||
let ty = entry.file_type()?;
|
||||
if ty.is_dir() {
|
||||
copy_dir_all(
|
||||
config_symbols,
|
||||
entry.path(),
|
||||
dst.as_ref().join(entry.file_name()),
|
||||
)?;
|
||||
} else {
|
||||
preprocess_file(
|
||||
config_symbols,
|
||||
entry.path(),
|
||||
dst.as_ref().join(entry.file_name()),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// A naive pre-processor for linker scripts
|
||||
fn preprocess_file(
|
||||
config: &Vec<&str>,
|
||||
src: impl AsRef<Path>,
|
||||
dst: impl AsRef<Path>,
|
||||
) -> std::io::Result<()> {
|
||||
let file = File::open(src)?;
|
||||
let mut out_file = File::create(dst)?;
|
||||
|
||||
let mut take = Vec::new();
|
||||
take.push(true);
|
||||
|
||||
for line in std::io::BufReader::new(file).lines() {
|
||||
let line = line?;
|
||||
let trimmed = line.trim();
|
||||
|
||||
if trimmed.starts_with("#IF ") {
|
||||
let condition = &trimmed[4..];
|
||||
let should_take = take.iter().all(|v| *v == true);
|
||||
let should_take = should_take && config.contains(&condition);
|
||||
take.push(should_take);
|
||||
continue;
|
||||
} else if trimmed == "#ELSE" {
|
||||
let taken = take.pop().unwrap();
|
||||
let should_take = take.iter().all(|v| *v == true);
|
||||
let should_take = should_take && !taken;
|
||||
take.push(should_take);
|
||||
continue;
|
||||
} else if trimmed == "#ENDIF" {
|
||||
take.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
if *take.last().unwrap() {
|
||||
out_file.write(line.as_bytes())?;
|
||||
out_file.write(b"\n")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn gen_efuse_table(device_name: &str, out_dir: impl AsRef<Path>) -> Result<(), Box<dyn Error>> {
|
||||
let src_path = PathBuf::from(format!("devices/{device_name}/efuse.csv"));
|
||||
let out_path = out_dir.as_ref().join("efuse_fields.rs");
|
||||
|
||||
println!("cargo:rerun-if-changed={}", src_path.display());
|
||||
|
||||
let mut writer = File::create(out_path)?;
|
||||
let mut reader = BufReader::new(File::open(src_path)?);
|
||||
let mut line = String::with_capacity(128);
|
||||
|
||||
while reader.read_line(&mut line)? > 0 {
|
||||
if line.ends_with("\n") {
|
||||
line.pop();
|
||||
if line.ends_with("\r") {
|
||||
line.pop();
|
||||
}
|
||||
}
|
||||
// drop comment and trim
|
||||
line.truncate(
|
||||
if let Some((pfx, _cmt)) = line.split_once("#") {
|
||||
pfx
|
||||
} else {
|
||||
&line
|
||||
}
|
||||
.trim()
|
||||
.len(),
|
||||
);
|
||||
// skip empty
|
||||
if line.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut fields = line.split(",");
|
||||
match (
|
||||
fields.next().map(|s| s.trim().replace(".", "_")),
|
||||
fields
|
||||
.next()
|
||||
.map(|s| s.trim().replace(|c: char| !c.is_ascii_digit(), "")),
|
||||
fields
|
||||
.next()
|
||||
.map(|s| s.trim())
|
||||
.and_then(|s| s.parse::<u32>().ok()),
|
||||
fields
|
||||
.next()
|
||||
.map(|s| s.trim())
|
||||
.and_then(|s| s.parse::<u32>().ok()),
|
||||
fields.next().map(|s| s.trim()),
|
||||
) {
|
||||
(Some(name), Some(block), Some(bit_off), Some(bit_len), Some(desc)) => {
|
||||
let desc = desc.replace('[', "`[").replace(']', "]`");
|
||||
writeln!(writer, "/// {desc}")?;
|
||||
writeln!(
|
||||
writer,
|
||||
"pub const {name}: EfuseField = EfuseField::new(EfuseBlock::Block{block}, {bit_off}, {bit_len});"
|
||||
)?;
|
||||
}
|
||||
other => eprintln!("Invalid data: {other:?}"),
|
||||
}
|
||||
|
||||
line.clear();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn detect_atomic_extension(ext: &str) -> bool {
|
||||
let rustflags = env::var_os("CARGO_ENCODED_RUSTFLAGS")
|
||||
.unwrap()
|
||||
.into_string()
|
||||
.unwrap();
|
||||
|
||||
// Users can pass -Ctarget-feature to the compiler multiple times, so we have to
|
||||
// handle that
|
||||
let target_flags = rustflags
|
||||
.split(0x1f as char)
|
||||
.filter(|s| s.starts_with("target-feature="))
|
||||
.map(|s| s.strip_prefix("target-feature="))
|
||||
.flatten();
|
||||
for tf in target_flags {
|
||||
let tf = tf
|
||||
.split(",")
|
||||
.map(|s| s.trim())
|
||||
.filter(|s| s.starts_with('+'))
|
||||
.map(|s| s.strip_prefix('+'))
|
||||
.flatten();
|
||||
for tf in tf {
|
||||
if tf == ext {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32"
|
||||
arch = "xtensa"
|
||||
cores = "multi_core"
|
||||
|
||||
@ -59,10 +58,6 @@ symbols = [
|
||||
"bt",
|
||||
"wifi",
|
||||
"psram",
|
||||
"timg_timer1",
|
||||
"touch",
|
||||
"large_intr_status",
|
||||
"gpio_bank_1",
|
||||
|
||||
# ROM capabilities
|
||||
"rom_crc_le",
|
||||
118
esp-hal-common/devices/esp32/efuse.csv
Normal file
118
esp-hal-common/devices/esp32/efuse.csv
Normal file
@ -0,0 +1,118 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 369d2d860d34e777c0f7d545a7dfc3c4
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 16, [] Efuse write disable mask
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [WR_DIS.EFUSE_RD_DISABLE] wr_dis of RD_DIS
|
||||
WR_DIS.WR_DIS, EFUSE_BLK0, 1, 1, [] wr_dis of WR_DIS
|
||||
WR_DIS.FLASH_CRYPT_CNT, EFUSE_BLK0, 2, 1, [] wr_dis of FLASH_CRYPT_CNT
|
||||
WR_DIS.UART_DOWNLOAD_DIS, EFUSE_BLK0, 2, 1, [] wr_dis of UART_DOWNLOAD_DIS
|
||||
WR_DIS.MAC, EFUSE_BLK0, 3, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.MAC_CRC, EFUSE_BLK0, 3, 1, [WR_DIS.MAC_FACTORY_CRC] wr_dis of MAC_CRC
|
||||
WR_DIS.DISABLE_APP_CPU, EFUSE_BLK0, 3, 1, [WR_DIS.CHIP_VER_DIS_APP_CPU] wr_dis of DISABLE_APP_CPU
|
||||
WR_DIS.DISABLE_BT, EFUSE_BLK0, 3, 1, [WR_DIS.CHIP_VER_DIS_BT] wr_dis of DISABLE_BT
|
||||
WR_DIS.DIS_CACHE, EFUSE_BLK0, 3, 1, [WR_DIS.CHIP_VER_DIS_CACHE] wr_dis of DIS_CACHE
|
||||
WR_DIS.VOL_LEVEL_HP_INV, EFUSE_BLK0, 3, 1, [] wr_dis of VOL_LEVEL_HP_INV
|
||||
WR_DIS.CLK8M_FREQ, EFUSE_BLK0, 4, 1, [WR_DIS.CK8M_FREQ] wr_dis of CLK8M_FREQ
|
||||
WR_DIS.ADC_VREF, EFUSE_BLK0, 4, 1, [] wr_dis of ADC_VREF
|
||||
WR_DIS.XPD_SDIO_REG, EFUSE_BLK0, 5, 1, [] wr_dis of XPD_SDIO_REG
|
||||
WR_DIS.XPD_SDIO_TIEH, EFUSE_BLK0, 5, 1, [WR_DIS.SDIO_TIEH] wr_dis of XPD_SDIO_TIEH
|
||||
WR_DIS.XPD_SDIO_FORCE, EFUSE_BLK0, 5, 1, [WR_DIS.SDIO_FORCE] wr_dis of XPD_SDIO_FORCE
|
||||
WR_DIS.SPI_PAD_CONFIG_CLK, EFUSE_BLK0, 6, 1, [] wr_dis of SPI_PAD_CONFIG_CLK
|
||||
WR_DIS.SPI_PAD_CONFIG_Q, EFUSE_BLK0, 6, 1, [] wr_dis of SPI_PAD_CONFIG_Q
|
||||
WR_DIS.SPI_PAD_CONFIG_D, EFUSE_BLK0, 6, 1, [] wr_dis of SPI_PAD_CONFIG_D
|
||||
WR_DIS.SPI_PAD_CONFIG_CS0, EFUSE_BLK0, 6, 1, [] wr_dis of SPI_PAD_CONFIG_CS0
|
||||
WR_DIS.BLOCK1, EFUSE_BLK0, 7, 1, [WR_DIS.ENCRYPT_FLASH_KEY WR_DIS.BLK1] wr_dis of BLOCK1
|
||||
WR_DIS.BLOCK2, EFUSE_BLK0, 8, 1, [WR_DIS.SECURE_BOOT_KEY WR_DIS.BLK2] wr_dis of BLOCK2
|
||||
WR_DIS.BLOCK3, EFUSE_BLK0, 9, 1, [WR_DIS.BLK3] wr_dis of BLOCK3
|
||||
WR_DIS.CUSTOM_MAC_CRC, EFUSE_BLK0, 9, 1, [WR_DIS.MAC_CUSTOM_CRC] wr_dis of CUSTOM_MAC_CRC
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 9, 1, [WR_DIS.MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.ADC1_TP_LOW, EFUSE_BLK0, 9, 1, [] wr_dis of ADC1_TP_LOW
|
||||
WR_DIS.ADC1_TP_HIGH, EFUSE_BLK0, 9, 1, [] wr_dis of ADC1_TP_HIGH
|
||||
WR_DIS.ADC2_TP_LOW, EFUSE_BLK0, 9, 1, [] wr_dis of ADC2_TP_LOW
|
||||
WR_DIS.ADC2_TP_HIGH, EFUSE_BLK0, 9, 1, [] wr_dis of ADC2_TP_HIGH
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 9, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.MAC_VERSION, EFUSE_BLK0, 9, 1, [WR_DIS.MAC_CUSTOM_VER] wr_dis of MAC_VERSION
|
||||
WR_DIS.BLK3_PART_RESERVE, EFUSE_BLK0, 10, 1, [] wr_dis of BLK3_PART_RESERVE
|
||||
WR_DIS.FLASH_CRYPT_CONFIG, EFUSE_BLK0, 10, 1, [WR_DIS.ENCRYPT_CONFIG] wr_dis of FLASH_CRYPT_CONFIG
|
||||
WR_DIS.CODING_SCHEME, EFUSE_BLK0, 10, 1, [] wr_dis of CODING_SCHEME
|
||||
WR_DIS.KEY_STATUS, EFUSE_BLK0, 10, 1, [] wr_dis of KEY_STATUS
|
||||
WR_DIS.ABS_DONE_0, EFUSE_BLK0, 12, 1, [] wr_dis of ABS_DONE_0
|
||||
WR_DIS.ABS_DONE_1, EFUSE_BLK0, 13, 1, [] wr_dis of ABS_DONE_1
|
||||
WR_DIS.JTAG_DISABLE, EFUSE_BLK0, 14, 1, [WR_DIS.DISABLE_JTAG] wr_dis of JTAG_DISABLE
|
||||
WR_DIS.CONSOLE_DEBUG_DISABLE, EFUSE_BLK0, 15, 1, [] wr_dis of CONSOLE_DEBUG_DISABLE
|
||||
WR_DIS.DISABLE_DL_ENCRYPT, EFUSE_BLK0, 15, 1, [] wr_dis of DISABLE_DL_ENCRYPT
|
||||
WR_DIS.DISABLE_DL_DECRYPT, EFUSE_BLK0, 15, 1, [] wr_dis of DISABLE_DL_DECRYPT
|
||||
WR_DIS.DISABLE_DL_CACHE, EFUSE_BLK0, 15, 1, [] wr_dis of DISABLE_DL_CACHE
|
||||
RD_DIS, EFUSE_BLK0, 16, 4, [] Disable reading from BlOCK1-3
|
||||
RD_DIS.BLOCK1, EFUSE_BLK0, 16, 1, [RD_DIS.ENCRYPT_FLASH_KEY RD_DIS.BLK1] rd_dis of BLOCK1
|
||||
RD_DIS.BLOCK2, EFUSE_BLK0, 17, 1, [RD_DIS.SECURE_BOOT_KEY RD_DIS.BLK2] rd_dis of BLOCK2
|
||||
RD_DIS.BLOCK3, EFUSE_BLK0, 18, 1, [RD_DIS.BLK3] rd_dis of BLOCK3
|
||||
RD_DIS.CUSTOM_MAC_CRC, EFUSE_BLK0, 18, 1, [RD_DIS.MAC_CUSTOM_CRC] rd_dis of CUSTOM_MAC_CRC
|
||||
RD_DIS.CUSTOM_MAC, EFUSE_BLK0, 18, 1, [RD_DIS.MAC_CUSTOM] rd_dis of CUSTOM_MAC
|
||||
RD_DIS.ADC1_TP_LOW, EFUSE_BLK0, 18, 1, [] rd_dis of ADC1_TP_LOW
|
||||
RD_DIS.ADC1_TP_HIGH, EFUSE_BLK0, 18, 1, [] rd_dis of ADC1_TP_HIGH
|
||||
RD_DIS.ADC2_TP_LOW, EFUSE_BLK0, 18, 1, [] rd_dis of ADC2_TP_LOW
|
||||
RD_DIS.ADC2_TP_HIGH, EFUSE_BLK0, 18, 1, [] rd_dis of ADC2_TP_HIGH
|
||||
RD_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] rd_dis of SECURE_VERSION
|
||||
RD_DIS.MAC_VERSION, EFUSE_BLK0, 18, 1, [RD_DIS.MAC_CUSTOM_VER] rd_dis of MAC_VERSION
|
||||
RD_DIS.BLK3_PART_RESERVE, EFUSE_BLK0, 19, 1, [] rd_dis of BLK3_PART_RESERVE
|
||||
RD_DIS.FLASH_CRYPT_CONFIG, EFUSE_BLK0, 19, 1, [RD_DIS.ENCRYPT_CONFIG] rd_dis of FLASH_CRYPT_CONFIG
|
||||
RD_DIS.CODING_SCHEME, EFUSE_BLK0, 19, 1, [] rd_dis of CODING_SCHEME
|
||||
RD_DIS.KEY_STATUS, EFUSE_BLK0, 19, 1, [] rd_dis of KEY_STATUS
|
||||
FLASH_CRYPT_CNT, EFUSE_BLK0, 20, 7, [] Flash encryption is enabled if this field has an odd number of bits set
|
||||
UART_DOWNLOAD_DIS, EFUSE_BLK0, 27, 1, [] Disable UART download mode. Valid for ESP32 V3 and newer; only
|
||||
MAC_FACTORY, EFUSE_BLK0, 32, 48, [MAC_FACTORY] MAC address
|
||||
MAC_CRC, EFUSE_BLK0, 80, 8, [MAC_FACTORY_CRC] CRC8 for MAC address
|
||||
DISABLE_APP_CPU, EFUSE_BLK0, 96, 1, [CHIP_VER_DIS_APP_CPU] Disables APP CPU
|
||||
DISABLE_BT, EFUSE_BLK0, 97, 1, [CHIP_VER_DIS_BT] Disables Bluetooth
|
||||
CHIP_PACKAGE_4BIT, EFUSE_BLK0, 98, 1, [CHIP_VER_PKG_4BIT] Chip package identifier #4bit
|
||||
DIS_CACHE, EFUSE_BLK0, 99, 1, [CHIP_VER_DIS_CACHE] Disables cache
|
||||
SPI_PAD_CONFIG_HD, EFUSE_BLK0, 100, 5, [] read for SPI_pad_config_hd
|
||||
CHIP_PACKAGE, EFUSE_BLK0, 105, 3, [CHIP_VER_PKG] Chip package identifier
|
||||
CHIP_CPU_FREQ_LOW, EFUSE_BLK0, 108, 1, [] If set alongside EFUSE_RD_CHIP_CPU_FREQ_RATED; the ESP32's max CPU frequency is rated for 160MHz. 240MHz otherwise
|
||||
CHIP_CPU_FREQ_RATED, EFUSE_BLK0, 109, 1, [] If set; the ESP32's maximum CPU frequency has been rated
|
||||
BLK3_PART_RESERVE, EFUSE_BLK0, 110, 1, [] BLOCK3 partially served for ADC calibration data
|
||||
CHIP_VER_REV1, EFUSE_BLK0, 111, 1, [] bit is set to 1 for rev1 silicon
|
||||
CLK8M_FREQ, EFUSE_BLK0, 128, 8, [CK8M_FREQ] 8MHz clock freq override
|
||||
ADC_VREF, EFUSE_BLK0, 136, 5, [] True ADC reference voltage
|
||||
XPD_SDIO_REG, EFUSE_BLK0, 142, 1, [] read for XPD_SDIO_REG
|
||||
XPD_SDIO_TIEH, EFUSE_BLK0, 143, 1, [SDIO_TIEH] If XPD_SDIO_FORCE & XPD_SDIO_REG {1: "3.3V"; 0: "1.8V"}
|
||||
XPD_SDIO_FORCE, EFUSE_BLK0, 144, 1, [SDIO_FORCE] Ignore MTDI pin (GPIO12) for VDD_SDIO on reset
|
||||
SPI_PAD_CONFIG_CLK, EFUSE_BLK0, 160, 5, [] Override SD_CLK pad (GPIO6/SPICLK)
|
||||
SPI_PAD_CONFIG_Q, EFUSE_BLK0, 165, 5, [] Override SD_DATA_0 pad (GPIO7/SPIQ)
|
||||
SPI_PAD_CONFIG_D, EFUSE_BLK0, 170, 5, [] Override SD_DATA_1 pad (GPIO8/SPID)
|
||||
SPI_PAD_CONFIG_CS0, EFUSE_BLK0, 175, 5, [] Override SD_CMD pad (GPIO11/SPICS0)
|
||||
CHIP_VER_REV2, EFUSE_BLK0, 180, 1, []
|
||||
VOL_LEVEL_HP_INV, EFUSE_BLK0, 182, 2, [] This field stores the voltage level for CPU to run at 240 MHz; or for flash/PSRAM to run at 80 MHz.0x0: level 7; 0x1: level 6; 0x2: level 5; 0x3: level 4. (RO)
|
||||
WAFER_VERSION_MINOR, EFUSE_BLK0, 184, 2, []
|
||||
FLASH_CRYPT_CONFIG, EFUSE_BLK0, 188, 4, [ENCRYPT_CONFIG] Flash encryption config (key tweak bits)
|
||||
CODING_SCHEME, EFUSE_BLK0, 192, 2, [] Efuse variable block length scheme {0: "NONE (BLK1-3 len=256 bits)"; 1: "3/4 (BLK1-3 len=192 bits)"; 2: "REPEAT (BLK1-3 len=128 bits) not supported"; 3: "NONE (BLK1-3 len=256 bits)"}
|
||||
CONSOLE_DEBUG_DISABLE, EFUSE_BLK0, 194, 1, [] Disable ROM BASIC interpreter fallback
|
||||
DISABLE_SDIO_HOST, EFUSE_BLK0, 195, 1, []
|
||||
ABS_DONE_0, EFUSE_BLK0, 196, 1, [] Secure boot V1 is enabled for bootloader image
|
||||
ABS_DONE_1, EFUSE_BLK0, 197, 1, [] Secure boot V2 is enabled for bootloader image
|
||||
JTAG_DISABLE, EFUSE_BLK0, 198, 1, [DISABLE_JTAG] Disable JTAG
|
||||
DISABLE_DL_ENCRYPT, EFUSE_BLK0, 199, 1, [] Disable flash encryption in UART bootloader
|
||||
DISABLE_DL_DECRYPT, EFUSE_BLK0, 200, 1, [] Disable flash decryption in UART bootloader
|
||||
DISABLE_DL_CACHE, EFUSE_BLK0, 201, 1, [] Disable flash cache in UART bootloader
|
||||
KEY_STATUS, EFUSE_BLK0, 202, 1, [] Usage of efuse block 3 (reserved)
|
||||
BLOCK1, EFUSE_BLK1, 0, MAX_BLK_LEN, [ENCRYPT_FLASH_KEY] Flash encryption key
|
||||
BLOCK2, EFUSE_BLK2, 0, MAX_BLK_LEN, [SECURE_BOOT_KEY] Security boot key
|
||||
CUSTOM_MAC_CRC, EFUSE_BLK3, 0, 8, [MAC_CUSTOM_CRC] CRC8 for custom MAC address
|
||||
MAC_CUSTOM, EFUSE_BLK3, 8, 48, [MAC_CUSTOM] Custom MAC address
|
||||
ADC1_TP_LOW, EFUSE_BLK3, 96, 7, [] ADC1 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
|
||||
ADC1_TP_HIGH, EFUSE_BLK3, 103, 9, [] ADC1 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
|
||||
ADC2_TP_LOW, EFUSE_BLK3, 112, 7, [] ADC2 Two Point calibration low point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
|
||||
ADC2_TP_HIGH, EFUSE_BLK3, 119, 9, [] ADC2 Two Point calibration high point. Only valid if EFUSE_RD_BLK3_PART_RESERVE
|
||||
SECURE_VERSION, EFUSE_BLK3, 128, 32, [] Secure version for anti-rollback
|
||||
MAC_VERSION, EFUSE_BLK3, 184, 8, [MAC_CUSTOM_VER] Version of the MAC field {1: "Custom MAC in BLOCK3"}
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32c2"
|
||||
arch = "riscv"
|
||||
cores = "single_core"
|
||||
|
||||
107
esp-hal-common/devices/esp32c2/efuse.csv
Normal file
107
esp-hal-common/devices/esp32c2/efuse.csv
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 897499b0349a608b895d467abbcf006b
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 8, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 1, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.DIS_PAD_JTAG, EFUSE_BLK0, 1, 1, [] wr_dis of DIS_PAD_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 1, 1, [] wr_dis of DIS_DOWNLOAD_ICACHE
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 2, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.XTS_KEY_LENGTH_256, EFUSE_BLK0, 2, 1, [] wr_dis of XTS_KEY_LENGTH_256
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 2, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 3, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 3, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 3, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_DIRECT_BOOT, EFUSE_BLK0, 3, 1, [] wr_dis of DIS_DIRECT_BOOT
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 3, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 3, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 4, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.CUSTOM_MAC_USED, EFUSE_BLK0, 4, 1, [WR_DIS.ENABLE_CUSTOM_MAC] wr_dis of CUSTOM_MAC_USED
|
||||
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 4, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 4, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 5, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.MAC, EFUSE_BLK0, 6, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.WAFER_VERSION_MINOR, EFUSE_BLK0, 6, 1, [] wr_dis of WAFER_VERSION_MINOR
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 6, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 6, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 6, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 6, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.OCODE, EFUSE_BLK0, 6, 1, [] wr_dis of OCODE
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 6, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0, EFUSE_BLK0, 6, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN3, EFUSE_BLK0, 6, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN0, EFUSE_BLK0, 6, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN3, EFUSE_BLK0, 6, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
WR_DIS.DIG_DBIAS_HVT, EFUSE_BLK0, 6, 1, [] wr_dis of DIG_DBIAS_HVT
|
||||
WR_DIS.DIG_LDO_SLP_DBIAS2, EFUSE_BLK0, 6, 1, [] wr_dis of DIG_LDO_SLP_DBIAS2
|
||||
WR_DIS.DIG_LDO_SLP_DBIAS26, EFUSE_BLK0, 6, 1, [] wr_dis of DIG_LDO_SLP_DBIAS26
|
||||
WR_DIS.DIG_LDO_ACT_DBIAS26, EFUSE_BLK0, 6, 1, [] wr_dis of DIG_LDO_ACT_DBIAS26
|
||||
WR_DIS.DIG_LDO_ACT_STEPD10, EFUSE_BLK0, 6, 1, [] wr_dis of DIG_LDO_ACT_STEPD10
|
||||
WR_DIS.RTC_LDO_SLP_DBIAS13, EFUSE_BLK0, 6, 1, [] wr_dis of RTC_LDO_SLP_DBIAS13
|
||||
WR_DIS.RTC_LDO_SLP_DBIAS29, EFUSE_BLK0, 6, 1, [] wr_dis of RTC_LDO_SLP_DBIAS29
|
||||
WR_DIS.RTC_LDO_SLP_DBIAS31, EFUSE_BLK0, 6, 1, [] wr_dis of RTC_LDO_SLP_DBIAS31
|
||||
WR_DIS.RTC_LDO_ACT_DBIAS31, EFUSE_BLK0, 6, 1, [] wr_dis of RTC_LDO_ACT_DBIAS31
|
||||
WR_DIS.RTC_LDO_ACT_DBIAS13, EFUSE_BLK0, 6, 1, [] wr_dis of RTC_LDO_ACT_DBIAS13
|
||||
WR_DIS.ADC_CALIBRATION_3, EFUSE_BLK0, 6, 1, [] wr_dis of ADC_CALIBRATION_3
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 7, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
RD_DIS, EFUSE_BLK0, 32, 2, [] Disable reading from BlOCK3
|
||||
RD_DIS.KEY0, EFUSE_BLK0, 32, 2, [] Read protection for EFUSE_BLK3. KEY0
|
||||
RD_DIS.KEY0.LOW, EFUSE_BLK0, 32, 1, [] Read protection for EFUSE_BLK3. KEY0 lower 128-bit key
|
||||
RD_DIS.KEY0.HI, EFUSE_BLK0, 33, 1, [] Read protection for EFUSE_BLK3. KEY0 higher 128-bit key
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 34, 2, [] RTC watchdog timeout threshold; in unit of slow clock cycle {0: "40000"; 1: "80000"; 2: "160000"; 3: "320000"}
|
||||
DIS_PAD_JTAG, EFUSE_BLK0, 36, 1, [] Set this bit to disable pad jtag
|
||||
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 37, 1, [] The bit be set to disable icache in download mode
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 38, 1, [] The bit be set to disable manual encryption
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 39, 3, [] Enables flash encryption when 1 or 3 bits are set and disables otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
XTS_KEY_LENGTH_256, EFUSE_BLK0, 42, 1, [] Flash encryption key length {0: "128 bits key"; 1: "256 bits key"}
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 43, 2, [] Set the default UARTboot message output mode {0: "Enable"; 1: "Enable when GPIO8 is low at reset"; 2: "Enable when GPIO8 is high at reset"; 3: "Disable"}
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 45, 1, [] Set this bit to force ROM code to send a resume command during SPI boot
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 46, 1, [] Set this bit to disable download mode (boot_mode[3:0] = 0; 1; 2; 4; 5; 6; 7)
|
||||
DIS_DIRECT_BOOT, EFUSE_BLK0, 47, 1, [] This bit set means disable direct_boot mode
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 48, 1, [] Set this bit to enable secure UART download mode
|
||||
FLASH_TPUW, EFUSE_BLK0, 49, 4, [] Configures flash waiting time after power-up; in unit of ms. If the value is less than 15; the waiting time is the configurable value. Otherwise; the waiting time is twice the configurable value
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 53, 1, [] The bit be set to enable secure boot
|
||||
SECURE_VERSION, EFUSE_BLK0, 54, 4, [] Secure version for anti-rollback
|
||||
CUSTOM_MAC_USED, EFUSE_BLK0, 58, 1, [ENABLE_CUSTOM_MAC] True if MAC_CUSTOM is burned
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 59, 1, [] Disables check of wafer version major
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 60, 1, [] Disables check of blk version major
|
||||
USER_DATA, EFUSE_BLK1, 0, 88, [] User data block
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK1, 0, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC address
|
||||
MAC_FACTORY, EFUSE_BLK2, 0, 48, [MAC_FACTORY] MAC address
|
||||
WAFER_VERSION_MINOR, EFUSE_BLK2, 48, 4, [] WAFER_VERSION_MINOR
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK2, 52, 2, [] WAFER_VERSION_MAJOR
|
||||
PKG_VERSION, EFUSE_BLK2, 54, 3, [] EFUSE_PKG_VERSION
|
||||
BLK_VERSION_MINOR, EFUSE_BLK2, 57, 3, [] Minor version of BLOCK2 {0: "No calib"; 1: "With calib"}
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK2, 60, 2, [] Major version of BLOCK2
|
||||
OCODE, EFUSE_BLK2, 62, 7, [] OCode
|
||||
TEMP_CALIB, EFUSE_BLK2, 69, 9, [] Temperature calibration data
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 78, 8, [] ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 86, 5, [] ADC1 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 91, 8, [] ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 99, 6, [] ADC1 calibration voltage at atten3
|
||||
DIG_DBIAS_HVT, EFUSE_BLK2, 105, 5, [] BLOCK2 digital dbias when hvt
|
||||
DIG_LDO_SLP_DBIAS2, EFUSE_BLK2, 110, 7, [] BLOCK2 DIG_LDO_DBG0_DBIAS2
|
||||
DIG_LDO_SLP_DBIAS26, EFUSE_BLK2, 117, 8, [] BLOCK2 DIG_LDO_DBG0_DBIAS26
|
||||
DIG_LDO_ACT_DBIAS26, EFUSE_BLK2, 125, 6, [] BLOCK2 DIG_LDO_ACT_DBIAS26
|
||||
DIG_LDO_ACT_STEPD10, EFUSE_BLK2, 131, 4, [] BLOCK2 DIG_LDO_ACT_STEPD10
|
||||
RTC_LDO_SLP_DBIAS13, EFUSE_BLK2, 135, 7, [] BLOCK2 DIG_LDO_SLP_DBIAS13
|
||||
RTC_LDO_SLP_DBIAS29, EFUSE_BLK2, 142, 9, [] BLOCK2 DIG_LDO_SLP_DBIAS29
|
||||
RTC_LDO_SLP_DBIAS31, EFUSE_BLK2, 151, 6, [] BLOCK2 DIG_LDO_SLP_DBIAS31
|
||||
RTC_LDO_ACT_DBIAS31, EFUSE_BLK2, 157, 6, [] BLOCK2 DIG_LDO_ACT_DBIAS31
|
||||
RTC_LDO_ACT_DBIAS13, EFUSE_BLK2, 163, 8, [] BLOCK2 DIG_LDO_ACT_DBIAS13
|
||||
ADC_CALIBRATION_3, EFUSE_BLK2, 192, 11, [] Store the bit [86:96] of ADC calibration data
|
||||
KEY0, EFUSE_BLK3, 0, 256, [BLOCK_KEY0] BLOCK_BLOCK_KEY0 - 256-bits. 256-bit key of Flash Encryption
|
||||
KEY0.FE_256BIT, EFUSE_BLK3, 0, 256, [] 256bit FE key
|
||||
KEY0.FE_128BIT, EFUSE_BLK3, 0, 128, [] 128bit FE key
|
||||
KEY0.SB_128BIT, EFUSE_BLK3, 128, 128, [] 128bit SB key
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32c3"
|
||||
arch = "riscv"
|
||||
cores = "single_core"
|
||||
|
||||
@ -52,7 +51,6 @@ symbols = [
|
||||
"phy",
|
||||
"bt",
|
||||
"wifi",
|
||||
"tsens",
|
||||
|
||||
# ROM capabilities
|
||||
"rom_crc_le",
|
||||
187
esp-hal-common/devices/esp32c3/efuse.csv
Normal file
187
esp-hal-common/devices/esp32c3/efuse.csv
Normal file
@ -0,0 +1,187 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: a85f874ae2b6538ca48b7c3db4a79531
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.DIS_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_ICACHE
|
||||
WR_DIS.DIS_USB_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_ICACHE
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_USB_DEVICE] wr_dis of DIS_USB_SERIAL_JTAG
|
||||
WR_DIS.DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_FORCE_DOWNLOAD
|
||||
WR_DIS.DIS_TWAI, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
|
||||
WR_DIS.JTAG_SEL_ENABLE, EFUSE_BLK0, 2, 1, [] wr_dis of JTAG_SEL_ENABLE
|
||||
WR_DIS.DIS_PAD_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_PAD_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 3, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 5, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE0
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 6, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE1
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 7, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE2
|
||||
WR_DIS.KEY_PURPOSE_0, EFUSE_BLK0, 8, 1, [WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
|
||||
WR_DIS.KEY_PURPOSE_1, EFUSE_BLK0, 9, 1, [WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
|
||||
WR_DIS.KEY_PURPOSE_2, EFUSE_BLK0, 10, 1, [WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
|
||||
WR_DIS.KEY_PURPOSE_3, EFUSE_BLK0, 11, 1, [WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
|
||||
WR_DIS.KEY_PURPOSE_4, EFUSE_BLK0, 12, 1, [WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
|
||||
WR_DIS.KEY_PURPOSE_5, EFUSE_BLK0, 13, 1, [WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 16, 1, [] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_DIRECT_BOOT, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_LEGACY_SPI_BOOT] wr_dis of DIS_DIRECT_BOOT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 18, 1, [WR_DIS.UART_PRINT_CHANNEL] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_USB_DOWNLOAD_MODE] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 18, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 18, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.ERR_RST_ENABLE, EFUSE_BLK0, 19, 1, [] wr_dis of ERR_RST_ENABLE
|
||||
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
|
||||
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
|
||||
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.SPI_PAD_CONFIG_CLK, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CLK
|
||||
WR_DIS.SPI_PAD_CONFIG_Q, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_Q
|
||||
WR_DIS.SPI_PAD_CONFIG_D, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D
|
||||
WR_DIS.SPI_PAD_CONFIG_CS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CS
|
||||
WR_DIS.SPI_PAD_CONFIG_HD, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_HD
|
||||
WR_DIS.SPI_PAD_CONFIG_WP, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_WP
|
||||
WR_DIS.SPI_PAD_CONFIG_DQS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_DQS
|
||||
WR_DIS.SPI_PAD_CONFIG_D4, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D4
|
||||
WR_DIS.SPI_PAD_CONFIG_D5, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D5
|
||||
WR_DIS.SPI_PAD_CONFIG_D6, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D6
|
||||
WR_DIS.SPI_PAD_CONFIG_D7, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D7
|
||||
WR_DIS.WAFER_VERSION_MINOR_LO, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_LO
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.K_RTC_LDO, EFUSE_BLK0, 20, 1, [] wr_dis of K_RTC_LDO
|
||||
WR_DIS.K_DIG_LDO, EFUSE_BLK0, 20, 1, [] wr_dis of K_DIG_LDO
|
||||
WR_DIS.V_RTC_DBIAS20, EFUSE_BLK0, 20, 1, [] wr_dis of V_RTC_DBIAS20
|
||||
WR_DIS.V_DIG_DBIAS20, EFUSE_BLK0, 20, 1, [] wr_dis of V_DIG_DBIAS20
|
||||
WR_DIS.DIG_DBIAS_HVT, EFUSE_BLK0, 20, 1, [] wr_dis of DIG_DBIAS_HVT
|
||||
WR_DIS.THRES_HVT, EFUSE_BLK0, 20, 1, [] wr_dis of THRES_HVT
|
||||
WR_DIS.WAFER_VERSION_MINOR_HI, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_HI
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 21, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.OCODE, EFUSE_BLK0, 21, 1, [] wr_dis of OCODE
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN1
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN2
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
WR_DIS.BLOCK_KEY1, EFUSE_BLK0, 24, 1, [WR_DIS.KEY1] wr_dis of BLOCK_KEY1
|
||||
WR_DIS.BLOCK_KEY2, EFUSE_BLK0, 25, 1, [WR_DIS.KEY2] wr_dis of BLOCK_KEY2
|
||||
WR_DIS.BLOCK_KEY3, EFUSE_BLK0, 26, 1, [WR_DIS.KEY3] wr_dis of BLOCK_KEY3
|
||||
WR_DIS.BLOCK_KEY4, EFUSE_BLK0, 27, 1, [WR_DIS.KEY4] wr_dis of BLOCK_KEY4
|
||||
WR_DIS.BLOCK_KEY5, EFUSE_BLK0, 28, 1, [WR_DIS.KEY5] wr_dis of BLOCK_KEY5
|
||||
WR_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 29, 1, [WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
|
||||
WR_DIS.USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, [] wr_dis of USB_EXCHG_PINS
|
||||
WR_DIS.VDD_SPI_AS_GPIO, EFUSE_BLK0, 30, 1, [] wr_dis of VDD_SPI_AS_GPIO
|
||||
WR_DIS.SOFT_DIS_JTAG, EFUSE_BLK0, 31, 1, [] wr_dis of SOFT_DIS_JTAG
|
||||
RD_DIS, EFUSE_BLK0, 32, 7, [] Disable reading from BlOCK4-10
|
||||
RD_DIS.BLOCK_KEY0, EFUSE_BLK0, 32, 1, [RD_DIS.KEY0] rd_dis of BLOCK_KEY0
|
||||
RD_DIS.BLOCK_KEY1, EFUSE_BLK0, 33, 1, [RD_DIS.KEY1] rd_dis of BLOCK_KEY1
|
||||
RD_DIS.BLOCK_KEY2, EFUSE_BLK0, 34, 1, [RD_DIS.KEY2] rd_dis of BLOCK_KEY2
|
||||
RD_DIS.BLOCK_KEY3, EFUSE_BLK0, 35, 1, [RD_DIS.KEY3] rd_dis of BLOCK_KEY3
|
||||
RD_DIS.BLOCK_KEY4, EFUSE_BLK0, 36, 1, [RD_DIS.KEY4] rd_dis of BLOCK_KEY4
|
||||
RD_DIS.BLOCK_KEY5, EFUSE_BLK0, 37, 1, [RD_DIS.KEY5] rd_dis of BLOCK_KEY5
|
||||
RD_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 38, 1, [RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
|
||||
DIS_ICACHE, EFUSE_BLK0, 40, 1, [] Set this bit to disable Icache
|
||||
DIS_USB_JTAG, EFUSE_BLK0, 41, 1, [] Set this bit to disable function of usb switch to jtag in module of usb device
|
||||
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, [] Set this bit to disable Icache in download mode (boot_mode[3:0] is 0; 1; 2; 3; 6; 7)
|
||||
DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 43, 1, [DIS_USB_DEVICE] USB-Serial-JTAG {0: "Enable"; 1: "Disable"}
|
||||
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, [] Set this bit to disable the function that forces chip into download mode
|
||||
DIS_TWAI, EFUSE_BLK0, 46, 1, [DIS_CAN] Set this bit to disable CAN function
|
||||
JTAG_SEL_ENABLE, EFUSE_BLK0, 47, 1, [] Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0
|
||||
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, [] Set these bits to disable JTAG in the soft way (odd number 1 means disable ). JTAG can be enabled in HMAC module
|
||||
DIS_PAD_JTAG, EFUSE_BLK0, 51, 1, [] Set this bit to disable JTAG in the hard way. JTAG is disabled permanently
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 52, 1, [] Set this bit to disable flash encryption when in download boot modes
|
||||
USB_EXCHG_PINS, EFUSE_BLK0, 57, 1, [] Set this bit to exchange USB D+ and D- pins
|
||||
VDD_SPI_AS_GPIO, EFUSE_BLK0, 58, 1, [] Set this bit to vdd spi pin function as gpio
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, [] RTC watchdog timeout threshold; in unit of slow clock cycle {0: "40000"; 1: "80000"; 2: "160000"; 3: "320000"}
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, [] Enables flash encryption when 1 or 3 bits are set and disables otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, [] Revoke 1st secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, [] Revoke 2nd secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, [] Revoke 3rd secure boot key
|
||||
KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, [KEY0_PURPOSE] Purpose of Key0
|
||||
KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, [KEY1_PURPOSE] Purpose of Key1
|
||||
KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, [KEY2_PURPOSE] Purpose of Key2
|
||||
KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, [KEY3_PURPOSE] Purpose of Key3
|
||||
KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, [KEY4_PURPOSE] Purpose of Key4
|
||||
KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, [KEY5_PURPOSE] Purpose of Key5
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, [] Set this bit to enable secure boot
|
||||
SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, [] Set this bit to enable revoking aggressive secure boot
|
||||
FLASH_TPUW, EFUSE_BLK0, 124, 4, [] Configures flash waiting time after power-up; in unit of ms. If the value is less than 15; the waiting time is the configurable value; Otherwise; the waiting time is twice the configurable value
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, [] Set this bit to disable download mode (boot_mode[3:0] = 0; 1; 2; 3; 6; 7)
|
||||
DIS_DIRECT_BOOT, EFUSE_BLK0, 129, 1, [DIS_LEGACY_SPI_BOOT] Disable direct boot mode
|
||||
DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 130, 1, [UART_PRINT_CHANNEL] USB printing {0: "Enable"; 1: "Disable"}
|
||||
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, [DIS_USB_DOWNLOAD_MODE] Disable UART download mode through USB-Serial-JTAG
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, [] Set this bit to enable secure UART download mode
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, [] Set the default UARTboot message output mode {0: "Enable"; 1: "Enable when GPIO8 is low at reset"; 2: "Enable when GPIO8 is high at reset"; 3: "Disable"}
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 141, 1, [] Set this bit to force ROM code to send a resume command during SPI boot
|
||||
SECURE_VERSION, EFUSE_BLK0, 142, 16, [] Secure version (used by ESP-IDF anti-rollback feature)
|
||||
ERR_RST_ENABLE, EFUSE_BLK0, 159, 1, [] Use BLOCK0 to check error record registers {0: "without check"; 1: "with check"}
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 160, 1, [] Disables check of wafer version major
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 161, 1, [] Disables check of blk version major
|
||||
MAC_FACTORY, EFUSE_BLK1, 0, 48, [MAC_FACTORY] MAC address
|
||||
SPI_PAD_CONFIG_CLK, EFUSE_BLK1, 48, 6, [] SPI PAD CLK
|
||||
SPI_PAD_CONFIG_Q, EFUSE_BLK1, 54, 6, [] SPI PAD Q(D1)
|
||||
SPI_PAD_CONFIG_D, EFUSE_BLK1, 60, 6, [] SPI PAD D(D0)
|
||||
SPI_PAD_CONFIG_CS, EFUSE_BLK1, 66, 6, [] SPI PAD CS
|
||||
SPI_PAD_CONFIG_HD, EFUSE_BLK1, 72, 6, [] SPI PAD HD(D3)
|
||||
SPI_PAD_CONFIG_WP, EFUSE_BLK1, 78, 6, [] SPI PAD WP(D2)
|
||||
SPI_PAD_CONFIG_DQS, EFUSE_BLK1, 84, 6, [] SPI PAD DQS
|
||||
SPI_PAD_CONFIG_D4, EFUSE_BLK1, 90, 6, [] SPI PAD D4
|
||||
SPI_PAD_CONFIG_D5, EFUSE_BLK1, 96, 6, [] SPI PAD D5
|
||||
SPI_PAD_CONFIG_D6, EFUSE_BLK1, 102, 6, [] SPI PAD D6
|
||||
SPI_PAD_CONFIG_D7, EFUSE_BLK1, 108, 6, [] SPI PAD D7
|
||||
WAFER_VERSION_MINOR_LO, EFUSE_BLK1, 114, 3, [] WAFER_VERSION_MINOR least significant bits
|
||||
PKG_VERSION, EFUSE_BLK1, 117, 3, [] Package version
|
||||
BLK_VERSION_MINOR, EFUSE_BLK1, 120, 3, [] BLK_VERSION_MINOR
|
||||
K_RTC_LDO, EFUSE_BLK1, 135, 7, [] BLOCK1 K_RTC_LDO
|
||||
K_DIG_LDO, EFUSE_BLK1, 142, 7, [] BLOCK1 K_DIG_LDO
|
||||
V_RTC_DBIAS20, EFUSE_BLK1, 149, 8, [] BLOCK1 voltage of rtc dbias20
|
||||
V_DIG_DBIAS20, EFUSE_BLK1, 157, 8, [] BLOCK1 voltage of digital dbias20
|
||||
DIG_DBIAS_HVT, EFUSE_BLK1, 165, 5, [] BLOCK1 digital dbias when hvt
|
||||
THRES_HVT, EFUSE_BLK1, 170, 10, [] BLOCK1 pvt threshold when hvt
|
||||
WAFER_VERSION_MINOR_HI, EFUSE_BLK1, 183, 1, [] WAFER_VERSION_MINOR most significant bit
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK1, 184, 2, [] WAFER_VERSION_MAJOR
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK2, 128, 2, [] BLK_VERSION_MAJOR of BLOCK2 {0: "No calibration"; 1: "With calibration"}
|
||||
TEMP_CALIB, EFUSE_BLK2, 131, 9, [] Temperature calibration data
|
||||
OCODE, EFUSE_BLK2, 140, 8, [] ADC OCode
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 148, 10, [] ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN1, EFUSE_BLK2, 158, 10, [] ADC1 init code at atten1
|
||||
ADC1_INIT_CODE_ATTEN2, EFUSE_BLK2, 168, 10, [] ADC1 init code at atten2
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 178, 10, [] ADC1 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 188, 10, [] ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN1, EFUSE_BLK2, 198, 10, [] ADC1 calibration voltage at atten1
|
||||
ADC1_CAL_VOL_ATTEN2, EFUSE_BLK2, 208, 10, [] ADC1 calibration voltage at atten2
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 218, 10, [] ADC1 calibration voltage at atten3
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC address
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
KEY1, EFUSE_BLK5, 0, 256, [BLOCK_KEY1] Key1 or user data
|
||||
KEY2, EFUSE_BLK6, 0, 256, [BLOCK_KEY2] Key2 or user data
|
||||
KEY3, EFUSE_BLK7, 0, 256, [BLOCK_KEY3] Key3 or user data
|
||||
KEY4, EFUSE_BLK8, 0, 256, [BLOCK_KEY4] Key4 or user data
|
||||
KEY5, EFUSE_BLK9, 0, 256, [BLOCK_KEY5] Key5 or user data
|
||||
SYS_DATA_PART2, EFUSE_BLK10, 0, 256, [BLOCK_SYS_DATA2] System data part 2 (reserved)
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32c6"
|
||||
arch = "riscv"
|
||||
cores = "single_core"
|
||||
|
||||
@ -60,7 +59,7 @@ peripherals = [
|
||||
"tee",
|
||||
"timg0",
|
||||
"timg1",
|
||||
"trace0",
|
||||
"trace",
|
||||
"twai0",
|
||||
"twai1",
|
||||
"uart0",
|
||||
@ -80,10 +79,8 @@ symbols = [
|
||||
"phy",
|
||||
"bt",
|
||||
"wifi",
|
||||
"wifi6",
|
||||
"ieee802154",
|
||||
"lp_core",
|
||||
"tsens",
|
||||
|
||||
# ROM capabilities
|
||||
"rom_crc_le",
|
||||
181
esp-hal-common/devices/esp32c6/efuse.csv
Normal file
181
esp-hal-common/devices/esp32c6/efuse.csv
Normal file
@ -0,0 +1,181 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 709e8ea096e8a03a10006d40d5451a49
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.CRYPT_DPA_ENABLE, EFUSE_BLK0, 1, 1, [] wr_dis of CRYPT_DPA_ENABLE
|
||||
WR_DIS.SWAP_UART_SDIO_EN, EFUSE_BLK0, 2, 1, [] wr_dis of SWAP_UART_SDIO_EN
|
||||
WR_DIS.DIS_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_ICACHE
|
||||
WR_DIS.DIS_USB_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_ICACHE
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB_SERIAL_JTAG
|
||||
WR_DIS.DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_FORCE_DOWNLOAD
|
||||
WR_DIS.DIS_TWAI, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
|
||||
WR_DIS.JTAG_SEL_ENABLE, EFUSE_BLK0, 2, 1, [] wr_dis of JTAG_SEL_ENABLE
|
||||
WR_DIS.DIS_PAD_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_PAD_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 3, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 5, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE0
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 6, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE1
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 7, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE2
|
||||
WR_DIS.KEY_PURPOSE_0, EFUSE_BLK0, 8, 1, [WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
|
||||
WR_DIS.KEY_PURPOSE_1, EFUSE_BLK0, 9, 1, [WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
|
||||
WR_DIS.KEY_PURPOSE_2, EFUSE_BLK0, 10, 1, [WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
|
||||
WR_DIS.KEY_PURPOSE_3, EFUSE_BLK0, 11, 1, [WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
|
||||
WR_DIS.KEY_PURPOSE_4, EFUSE_BLK0, 12, 1, [WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
|
||||
WR_DIS.KEY_PURPOSE_5, EFUSE_BLK0, 13, 1, [WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
|
||||
WR_DIS.SEC_DPA_LEVEL, EFUSE_BLK0, 14, 1, [WR_DIS.DPA_SEC_LEVEL] wr_dis of SEC_DPA_LEVEL
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 16, 1, [] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
|
||||
WR_DIS.SPI_DOWNLOAD_MSPI_DIS, EFUSE_BLK0, 17, 1, [] wr_dis of SPI_DOWNLOAD_MSPI_DIS
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_DIRECT_BOOT, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DIRECT_BOOT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_USB_PRINT] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 18, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 18, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.SECURE_BOOT_DISABLE_FAST_WAKE, EFUSE_BLK0, 19, 1, [] wr_dis of SECURE_BOOT_DISABLE_FAST_WAKE
|
||||
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
|
||||
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
|
||||
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.MAC_EXT, EFUSE_BLK0, 20, 1, [] wr_dis of MAC_EXT
|
||||
WR_DIS.WAFER_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.FLASH_CAP, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_CAP
|
||||
WR_DIS.FLASH_TEMP, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_TEMP
|
||||
WR_DIS.FLASH_VENDOR, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_VENDOR
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.OCODE, EFUSE_BLK0, 21, 1, [] wr_dis of OCODE
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN1
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN2
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH3
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH4, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH4
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH5, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH5
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH6, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH6
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
WR_DIS.BLOCK_KEY1, EFUSE_BLK0, 24, 1, [WR_DIS.KEY1] wr_dis of BLOCK_KEY1
|
||||
WR_DIS.BLOCK_KEY2, EFUSE_BLK0, 25, 1, [WR_DIS.KEY2] wr_dis of BLOCK_KEY2
|
||||
WR_DIS.BLOCK_KEY3, EFUSE_BLK0, 26, 1, [WR_DIS.KEY3] wr_dis of BLOCK_KEY3
|
||||
WR_DIS.BLOCK_KEY4, EFUSE_BLK0, 27, 1, [WR_DIS.KEY4] wr_dis of BLOCK_KEY4
|
||||
WR_DIS.BLOCK_KEY5, EFUSE_BLK0, 28, 1, [WR_DIS.KEY5] wr_dis of BLOCK_KEY5
|
||||
WR_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 29, 1, [WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
|
||||
WR_DIS.USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, [] wr_dis of USB_EXCHG_PINS
|
||||
WR_DIS.VDD_SPI_AS_GPIO, EFUSE_BLK0, 30, 1, [] wr_dis of VDD_SPI_AS_GPIO
|
||||
WR_DIS.SOFT_DIS_JTAG, EFUSE_BLK0, 31, 1, [] wr_dis of SOFT_DIS_JTAG
|
||||
RD_DIS, EFUSE_BLK0, 32, 7, [] Disable reading from BlOCK4-10
|
||||
RD_DIS.BLOCK_KEY0, EFUSE_BLK0, 32, 1, [RD_DIS.KEY0] rd_dis of BLOCK_KEY0
|
||||
RD_DIS.BLOCK_KEY1, EFUSE_BLK0, 33, 1, [RD_DIS.KEY1] rd_dis of BLOCK_KEY1
|
||||
RD_DIS.BLOCK_KEY2, EFUSE_BLK0, 34, 1, [RD_DIS.KEY2] rd_dis of BLOCK_KEY2
|
||||
RD_DIS.BLOCK_KEY3, EFUSE_BLK0, 35, 1, [RD_DIS.KEY3] rd_dis of BLOCK_KEY3
|
||||
RD_DIS.BLOCK_KEY4, EFUSE_BLK0, 36, 1, [RD_DIS.KEY4] rd_dis of BLOCK_KEY4
|
||||
RD_DIS.BLOCK_KEY5, EFUSE_BLK0, 37, 1, [RD_DIS.KEY5] rd_dis of BLOCK_KEY5
|
||||
RD_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 38, 1, [RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
|
||||
SWAP_UART_SDIO_EN, EFUSE_BLK0, 39, 1, [] Represents whether pad of uart and sdio is swapped or not. 1: swapped. 0: not swapped
|
||||
DIS_ICACHE, EFUSE_BLK0, 40, 1, [] Represents whether icache is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_USB_JTAG, EFUSE_BLK0, 41, 1, [] Represents whether the function of usb switch to jtag is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, [] Represents whether icache is disabled or enabled in Download mode. 1: disabled. 0: enabled
|
||||
DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 43, 1, [] Represents whether USB-Serial-JTAG is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, [] Represents whether the function that forces chip into download mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
SPI_DOWNLOAD_MSPI_DIS, EFUSE_BLK0, 45, 1, [] Represents whether SPI0 controller during boot_mode_download is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_TWAI, EFUSE_BLK0, 46, 1, [DIS_CAN] Represents whether TWAI function is disabled or enabled. 1: disabled. 0: enabled
|
||||
JTAG_SEL_ENABLE, EFUSE_BLK0, 47, 1, [] Represents whether the selection between usb_to_jtag and pad_to_jtag through strapping gpio15 when both EFUSE_DIS_PAD_JTAG and EFUSE_DIS_USB_JTAG are equal to 0 is enabled or disabled. 1: enabled. 0: disabled
|
||||
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, [] Represents whether JTAG is disabled in soft way. Odd number: disabled. Even number: enabled
|
||||
DIS_PAD_JTAG, EFUSE_BLK0, 51, 1, [] Represents whether JTAG is disabled in the hard way(permanently). 1: disabled. 0: enabled
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 52, 1, [] Represents whether flash encrypt function is disabled or enabled(except in SPI boot mode). 1: disabled. 0: enabled
|
||||
USB_EXCHG_PINS, EFUSE_BLK0, 57, 1, [] Represents whether the D+ and D- pins is exchanged. 1: exchanged. 0: not exchanged
|
||||
VDD_SPI_AS_GPIO, EFUSE_BLK0, 58, 1, [] Represents whether vdd spi pin is functioned as gpio. 1: functioned. 0: not functioned
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, [] Represents whether RTC watchdog timeout threshold is selected at startup. 1: selected. 0: not selected
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, [] Enables flash encryption when 1 or 3 bits are set and disables otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, [] Revoke 1st secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, [] Revoke 2nd secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, [] Revoke 3rd secure boot key
|
||||
KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, [KEY0_PURPOSE] Represents the purpose of Key0
|
||||
KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, [KEY1_PURPOSE] Represents the purpose of Key1
|
||||
KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, [KEY2_PURPOSE] Represents the purpose of Key2
|
||||
KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, [KEY3_PURPOSE] Represents the purpose of Key3
|
||||
KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, [KEY4_PURPOSE] Represents the purpose of Key4
|
||||
KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, [KEY5_PURPOSE] Represents the purpose of Key5
|
||||
SEC_DPA_LEVEL, EFUSE_BLK0, 112, 2, [DPA_SEC_LEVEL] Represents the spa secure level by configuring the clock random divide mode
|
||||
CRYPT_DPA_ENABLE, EFUSE_BLK0, 114, 1, [] Represents whether anti-dpa attack is enabled. 1:enabled. 0: disabled
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, [] Represents whether secure boot is enabled or disabled. 1: enabled. 0: disabled
|
||||
SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, [] Represents whether revoking aggressive secure boot is enabled or disabled. 1: enabled. 0: disabled
|
||||
FLASH_TPUW, EFUSE_BLK0, 124, 4, [] Represents the flash waiting time after power-up; in unit of ms. When the value less than 15; the waiting time is the programmed value. Otherwise; the waiting time is 2 times the programmed value
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, [] Represents whether Download mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_DIRECT_BOOT, EFUSE_BLK0, 129, 1, [] Represents whether direct boot mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 130, 1, [DIS_USB_PRINT] Represents whether print from USB-Serial-JTAG is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, [] Represents whether the USB-Serial-JTAG download function is disabled or enabled. 1: disabled. 0: enabled
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, [] Represents whether security download is enabled or disabled. 1: enabled. 0: disabled
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, [] Set the default UARTboot message output mode {0: "Enable"; 1: "Enable when GPIO8 is low at reset"; 2: "Enable when GPIO8 is high at reset"; 3: "Disable"}
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 141, 1, [] Represents whether ROM code is forced to send a resume command during SPI boot. 1: forced. 0:not forced
|
||||
SECURE_VERSION, EFUSE_BLK0, 142, 16, [] Represents the version used by ESP-IDF anti-rollback feature
|
||||
SECURE_BOOT_DISABLE_FAST_WAKE, EFUSE_BLK0, 158, 1, [] Represents whether FAST VERIFY ON WAKE is disabled or enabled when Secure Boot is enabled. 1: disabled. 0: enabled
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 160, 1, [] Disables check of wafer version major
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 161, 1, [] Disables check of blk version major
|
||||
MAC_FACTORY, EFUSE_BLK1, 0, 48, [MAC_FACTORY] MAC address
|
||||
MAC_EXT, EFUSE_BLK1, 48, 16, [] Stores the extended bits of MAC address
|
||||
WAFER_VERSION_MINOR, EFUSE_BLK1, 114, 4, []
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK1, 118, 2, []
|
||||
PKG_VERSION, EFUSE_BLK1, 120, 3, [] Package version
|
||||
BLK_VERSION_MINOR, EFUSE_BLK1, 123, 3, [] BLK_VERSION_MINOR of BLOCK2
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK1, 126, 2, [] BLK_VERSION_MAJOR of BLOCK2
|
||||
FLASH_CAP, EFUSE_BLK1, 128, 3, []
|
||||
FLASH_TEMP, EFUSE_BLK1, 131, 2, []
|
||||
FLASH_VENDOR, EFUSE_BLK1, 133, 3, []
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
TEMP_CALIB, EFUSE_BLK2, 128, 9, [] Temperature calibration data
|
||||
OCODE, EFUSE_BLK2, 137, 8, [] ADC OCode
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 145, 10, [] ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN1, EFUSE_BLK2, 155, 10, [] ADC1 init code at atten1
|
||||
ADC1_INIT_CODE_ATTEN2, EFUSE_BLK2, 165, 10, [] ADC1 init code at atten2
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 175, 10, [] ADC1 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 185, 10, [] ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN1, EFUSE_BLK2, 195, 10, [] ADC1 calibration voltage at atten1
|
||||
ADC1_CAL_VOL_ATTEN2, EFUSE_BLK2, 205, 10, [] ADC1 calibration voltage at atten2
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 215, 10, [] ADC1 calibration voltage at atten3
|
||||
ADC1_INIT_CODE_ATTEN0_CH0, EFUSE_BLK2, 225, 4, [] ADC1 init code at atten0 ch0
|
||||
ADC1_INIT_CODE_ATTEN0_CH1, EFUSE_BLK2, 229, 4, [] ADC1 init code at atten0 ch1
|
||||
ADC1_INIT_CODE_ATTEN0_CH2, EFUSE_BLK2, 233, 4, [] ADC1 init code at atten0 ch2
|
||||
ADC1_INIT_CODE_ATTEN0_CH3, EFUSE_BLK2, 237, 4, [] ADC1 init code at atten0 ch3
|
||||
ADC1_INIT_CODE_ATTEN0_CH4, EFUSE_BLK2, 241, 4, [] ADC1 init code at atten0 ch4
|
||||
ADC1_INIT_CODE_ATTEN0_CH5, EFUSE_BLK2, 245, 4, [] ADC1 init code at atten0 ch5
|
||||
ADC1_INIT_CODE_ATTEN0_CH6, EFUSE_BLK2, 249, 4, [] ADC1 init code at atten0 ch6
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
KEY1, EFUSE_BLK5, 0, 256, [BLOCK_KEY1] Key1 or user data
|
||||
KEY2, EFUSE_BLK6, 0, 256, [BLOCK_KEY2] Key2 or user data
|
||||
KEY3, EFUSE_BLK7, 0, 256, [BLOCK_KEY3] Key3 or user data
|
||||
KEY4, EFUSE_BLK8, 0, 256, [BLOCK_KEY4] Key4 or user data
|
||||
KEY5, EFUSE_BLK9, 0, 256, [BLOCK_KEY5] Key5 or user data
|
||||
SYS_DATA_PART2, EFUSE_BLK10, 0, 256, [BLOCK_SYS_DATA2] System data part 2 (reserved)
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32h2"
|
||||
arch = "riscv"
|
||||
cores = "single_core"
|
||||
|
||||
@ -53,8 +52,8 @@ peripherals = [
|
||||
"tee",
|
||||
"timg0",
|
||||
"timg1",
|
||||
"trace0",
|
||||
"twai0",
|
||||
"trace",
|
||||
# "twai0",
|
||||
"uart0",
|
||||
"uart1",
|
||||
"uhci0",
|
||||
155
esp-hal-common/devices/esp32h2/efuse.csv
Normal file
155
esp-hal-common/devices/esp32h2/efuse.csv
Normal file
@ -0,0 +1,155 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 4df10f83de85f2d830b7c466aabb28e7
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.DIS_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_ICACHE
|
||||
WR_DIS.DIS_USB_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB_JTAG
|
||||
WR_DIS.POWERGLITCH_EN, EFUSE_BLK0, 2, 1, [] wr_dis of POWERGLITCH_EN
|
||||
WR_DIS.DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_FORCE_DOWNLOAD
|
||||
WR_DIS.SPI_DOWNLOAD_MSPI_DIS, EFUSE_BLK0, 2, 1, [] wr_dis of SPI_DOWNLOAD_MSPI_DIS
|
||||
WR_DIS.DIS_TWAI, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
|
||||
WR_DIS.JTAG_SEL_ENABLE, EFUSE_BLK0, 2, 1, [] wr_dis of JTAG_SEL_ENABLE
|
||||
WR_DIS.DIS_PAD_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_PAD_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 3, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 5, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE0
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 6, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE1
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 7, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE2
|
||||
WR_DIS.KEY_PURPOSE_0, EFUSE_BLK0, 8, 1, [WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
|
||||
WR_DIS.KEY_PURPOSE_1, EFUSE_BLK0, 9, 1, [WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
|
||||
WR_DIS.KEY_PURPOSE_2, EFUSE_BLK0, 10, 1, [WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
|
||||
WR_DIS.KEY_PURPOSE_3, EFUSE_BLK0, 11, 1, [WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
|
||||
WR_DIS.KEY_PURPOSE_4, EFUSE_BLK0, 12, 1, [WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
|
||||
WR_DIS.KEY_PURPOSE_5, EFUSE_BLK0, 13, 1, [WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
|
||||
WR_DIS.SEC_DPA_LEVEL, EFUSE_BLK0, 14, 1, [] wr_dis of SEC_DPA_LEVEL
|
||||
WR_DIS.CRYPT_DPA_ENABLE, EFUSE_BLK0, 14, 1, [] wr_dis of CRYPT_DPA_ENABLE
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 16, 1, [] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
|
||||
WR_DIS.ECDSA_FORCE_USE_HARDWARE_K, EFUSE_BLK0, 17, 1, [] wr_dis of ECDSA_FORCE_USE_HARDWARE_K
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_DIRECT_BOOT, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DIRECT_BOOT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_USB_PRINT] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 18, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 18, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.SECURE_BOOT_DISABLE_FAST_WAKE, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_BOOT_DISABLE_FAST_WAKE
|
||||
WR_DIS.HYS_EN_PAD0, EFUSE_BLK0, 19, 1, [] wr_dis of HYS_EN_PAD0
|
||||
WR_DIS.HYS_EN_PAD1, EFUSE_BLK0, 19, 1, [] wr_dis of HYS_EN_PAD1
|
||||
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
|
||||
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.MAC_EXT, EFUSE_BLK0, 20, 1, [] wr_dis of MAC_EXT
|
||||
WR_DIS.RXIQ_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of RXIQ_VERSION
|
||||
WR_DIS.RXIQ_0, EFUSE_BLK0, 20, 1, [] wr_dis of RXIQ_0
|
||||
WR_DIS.RXIQ_1, EFUSE_BLK0, 20, 1, [] wr_dis of RXIQ_1
|
||||
WR_DIS.WAFER_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
|
||||
WR_DIS.FLASH_CAP, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_CAP
|
||||
WR_DIS.FLASH_TEMP, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_TEMP
|
||||
WR_DIS.FLASH_VENDOR, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_VENDOR
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 21, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 21, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 21, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
WR_DIS.BLOCK_KEY1, EFUSE_BLK0, 24, 1, [WR_DIS.KEY1] wr_dis of BLOCK_KEY1
|
||||
WR_DIS.BLOCK_KEY2, EFUSE_BLK0, 25, 1, [WR_DIS.KEY2] wr_dis of BLOCK_KEY2
|
||||
WR_DIS.BLOCK_KEY3, EFUSE_BLK0, 26, 1, [WR_DIS.KEY3] wr_dis of BLOCK_KEY3
|
||||
WR_DIS.BLOCK_KEY4, EFUSE_BLK0, 27, 1, [WR_DIS.KEY4] wr_dis of BLOCK_KEY4
|
||||
WR_DIS.BLOCK_KEY5, EFUSE_BLK0, 28, 1, [WR_DIS.KEY5] wr_dis of BLOCK_KEY5
|
||||
WR_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 29, 1, [WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
|
||||
WR_DIS.USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, [] wr_dis of USB_EXCHG_PINS
|
||||
WR_DIS.VDD_SPI_AS_GPIO, EFUSE_BLK0, 30, 1, [] wr_dis of VDD_SPI_AS_GPIO
|
||||
WR_DIS.SOFT_DIS_JTAG, EFUSE_BLK0, 31, 1, [] wr_dis of SOFT_DIS_JTAG
|
||||
RD_DIS, EFUSE_BLK0, 32, 7, [] Disable reading from BlOCK4-10
|
||||
RD_DIS.BLOCK_KEY0, EFUSE_BLK0, 32, 1, [RD_DIS.KEY0] rd_dis of BLOCK_KEY0
|
||||
RD_DIS.BLOCK_KEY1, EFUSE_BLK0, 33, 1, [RD_DIS.KEY1] rd_dis of BLOCK_KEY1
|
||||
RD_DIS.BLOCK_KEY2, EFUSE_BLK0, 34, 1, [RD_DIS.KEY2] rd_dis of BLOCK_KEY2
|
||||
RD_DIS.BLOCK_KEY3, EFUSE_BLK0, 35, 1, [RD_DIS.KEY3] rd_dis of BLOCK_KEY3
|
||||
RD_DIS.BLOCK_KEY4, EFUSE_BLK0, 36, 1, [RD_DIS.KEY4] rd_dis of BLOCK_KEY4
|
||||
RD_DIS.BLOCK_KEY5, EFUSE_BLK0, 37, 1, [RD_DIS.KEY5] rd_dis of BLOCK_KEY5
|
||||
RD_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 38, 1, [RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
|
||||
DIS_ICACHE, EFUSE_BLK0, 40, 1, [] Represents whether icache is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_USB_JTAG, EFUSE_BLK0, 41, 1, [] Represents whether the function of usb switch to jtag is disabled or enabled. 1: disabled. 0: enabled
|
||||
POWERGLITCH_EN, EFUSE_BLK0, 42, 1, [] Represents whether power glitch function is enabled. 1: enabled. 0: disabled
|
||||
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, [] Represents whether the function that forces chip into download mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
SPI_DOWNLOAD_MSPI_DIS, EFUSE_BLK0, 45, 1, [] Represents whether SPI0 controller during boot_mode_download is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_TWAI, EFUSE_BLK0, 46, 1, [DIS_CAN] Represents whether TWAI function is disabled or enabled. 1: disabled. 0: enabled
|
||||
JTAG_SEL_ENABLE, EFUSE_BLK0, 47, 1, [] Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio25 when both EFUSE_DIS_PAD_JTAG and EFUSE_DIS_USB_JTAG are equal to 0
|
||||
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, [] Represents whether JTAG is disabled in soft way. Odd number: disabled. Even number: enabled
|
||||
DIS_PAD_JTAG, EFUSE_BLK0, 51, 1, [] Represents whether JTAG is disabled in the hard way(permanently). 1: disabled. 0: enabled
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 52, 1, [] Represents whether flash encrypt function is disabled or enabled(except in SPI boot mode). 1: disabled. 0: enabled
|
||||
USB_EXCHG_PINS, EFUSE_BLK0, 57, 1, [] Represents whether the D+ and D- pins is exchanged. 1: exchanged. 0: not exchanged
|
||||
VDD_SPI_AS_GPIO, EFUSE_BLK0, 58, 1, [] Represents whether vdd spi pin is functioned as gpio. 1: functioned. 0: not functioned
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, [] Represents whether RTC watchdog timeout threshold is selected at startup. 1: selected. 0: not selected
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, [] Enables flash encryption when 1 or 3 bits are set and disables otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, [] Revoke 1st secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, [] Revoke 2nd secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, [] Revoke 3rd secure boot key
|
||||
KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, [KEY0_PURPOSE] Represents the purpose of Key0
|
||||
KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, [KEY1_PURPOSE] Represents the purpose of Key1
|
||||
KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, [KEY2_PURPOSE] Represents the purpose of Key2
|
||||
KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, [KEY3_PURPOSE] Represents the purpose of Key3
|
||||
KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, [KEY4_PURPOSE] Represents the purpose of Key4
|
||||
KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, [KEY5_PURPOSE] Represents the purpose of Key5
|
||||
SEC_DPA_LEVEL, EFUSE_BLK0, 112, 2, [] Represents the spa secure level by configuring the clock random divide mode
|
||||
ECDSA_FORCE_USE_HARDWARE_K, EFUSE_BLK0, 114, 1, [] Represents whether hardware random number k is forced used in ESDCA. 1: force used. 0: not force used
|
||||
CRYPT_DPA_ENABLE, EFUSE_BLK0, 115, 1, [] Represents whether anti-dpa attack is enabled. 1:enabled. 0: disabled
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, [] Represents whether secure boot is enabled or disabled. 1: enabled. 0: disabled
|
||||
SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, [] Represents whether revoking aggressive secure boot is enabled or disabled. 1: enabled. 0: disabled
|
||||
FLASH_TPUW, EFUSE_BLK0, 124, 4, [] Represents the flash waiting time after power-up; in unit of ms. When the value less than 15; the waiting time is the programmed value. Otherwise; the waiting time is 2 times the programmed value
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, [] Represents whether Download mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_DIRECT_BOOT, EFUSE_BLK0, 129, 1, [] Represents whether direct boot mode is disabled or enabled. 1: disabled. 0: enabled
|
||||
DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 130, 1, [DIS_USB_PRINT] Set this bit to disable USB-Serial-JTAG print during rom boot
|
||||
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, [] Represents whether the USB-Serial-JTAG download function is disabled or enabled. 1: disabled. 0: enabled
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, [] Represents whether security download is enabled or disabled. 1: enabled. 0: disabled
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, [] Set the default UARTboot message output mode {0: "Enable"; 1: "Enable when GPIO8 is low at reset"; 2: "Enable when GPIO8 is high at reset"; 3: "Disable"}
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 136, 1, [] Represents whether ROM code is forced to send a resume command during SPI boot. 1: forced. 0:not forced
|
||||
SECURE_VERSION, EFUSE_BLK0, 137, 16, [] Represents the version used by ESP-IDF anti-rollback feature
|
||||
SECURE_BOOT_DISABLE_FAST_WAKE, EFUSE_BLK0, 153, 1, [] Represents whether FAST VERIFY ON WAKE is disabled or enabled when Secure Boot is enabled. 1: disabled. 0: enabled
|
||||
HYS_EN_PAD0, EFUSE_BLK0, 154, 6, [] Set bits to enable hysteresis function of PAD0~5
|
||||
HYS_EN_PAD1, EFUSE_BLK0, 160, 22, [] Set bits to enable hysteresis function of PAD6~27
|
||||
MAC_FACTORY, EFUSE_BLK1, 0, 48, [MAC_FACTORY] MAC address
|
||||
MAC_EXT, EFUSE_BLK1, 48, 16, [] Stores the extended bits of MAC address
|
||||
RXIQ_VERSION, EFUSE_BLK1, 64, 3, [] RF Calibration data. RXIQ version
|
||||
RXIQ_0, EFUSE_BLK1, 67, 7, [] RF Calibration data. RXIQ data 0
|
||||
RXIQ_1, EFUSE_BLK1, 74, 7, [] RF Calibration data. RXIQ data 1
|
||||
WAFER_VERSION_MINOR, EFUSE_BLK1, 114, 3, []
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK1, 117, 2, []
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK1, 119, 1, [] Disables check of wafer version major
|
||||
FLASH_CAP, EFUSE_BLK1, 120, 3, []
|
||||
FLASH_TEMP, EFUSE_BLK1, 123, 2, []
|
||||
FLASH_VENDOR, EFUSE_BLK1, 125, 3, []
|
||||
PKG_VERSION, EFUSE_BLK1, 128, 3, [] Package version
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
BLK_VERSION_MINOR, EFUSE_BLK2, 130, 3, [] BLK_VERSION_MINOR of BLOCK2. 1: RF Calibration data in BLOCK1
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK2, 133, 2, [] BLK_VERSION_MAJOR of BLOCK2
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK2, 135, 1, [] Disables check of blk version major
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
KEY1, EFUSE_BLK5, 0, 256, [BLOCK_KEY1] Key1 or user data
|
||||
KEY2, EFUSE_BLK6, 0, 256, [BLOCK_KEY2] Key2 or user data
|
||||
KEY3, EFUSE_BLK7, 0, 256, [BLOCK_KEY3] Key3 or user data
|
||||
KEY4, EFUSE_BLK8, 0, 256, [BLOCK_KEY4] Key4 or user data
|
||||
KEY5, EFUSE_BLK9, 0, 256, [BLOCK_KEY5] Key5 or user data
|
||||
SYS_DATA_PART2, EFUSE_BLK10, 0, 256, [BLOCK_SYS_DATA2] System data part 2 (reserved)
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32s2"
|
||||
arch = "xtensa"
|
||||
cores = "single_core"
|
||||
|
||||
@ -34,6 +33,7 @@ peripherals = [
|
||||
"spi1",
|
||||
"spi2",
|
||||
"spi3",
|
||||
"spi4",
|
||||
"system",
|
||||
"systimer",
|
||||
"timg0",
|
||||
@ -56,10 +56,6 @@ symbols = [
|
||||
"wifi",
|
||||
"psram",
|
||||
"ulp_riscv_core",
|
||||
"timg_timer1",
|
||||
"large_intr_status",
|
||||
"gpio_bank_1",
|
||||
"spi_octal",
|
||||
|
||||
# ROM capabilities
|
||||
"rom_crc_le",
|
||||
@ -73,7 +69,4 @@ symbols = [
|
||||
"uart_support_wakeup_int",
|
||||
"ulp_supported",
|
||||
"riscv_coproc_supported",
|
||||
|
||||
# Other capabilities
|
||||
"psram_dma",
|
||||
]
|
||||
207
esp-hal-common/devices/esp32s2/efuse.csv
Normal file
207
esp-hal-common/devices/esp32s2/efuse.csv
Normal file
@ -0,0 +1,207 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 888a61f6f500d9c7ee0aa32016b0bee7
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.DIS_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_ICACHE
|
||||
WR_DIS.DIS_DCACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DCACHE
|
||||
WR_DIS.DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_ICACHE
|
||||
WR_DIS.DIS_DOWNLOAD_DCACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_DCACHE
|
||||
WR_DIS.DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_FORCE_DOWNLOAD
|
||||
WR_DIS.DIS_USB, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB
|
||||
WR_DIS.DIS_TWAI, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
|
||||
WR_DIS.DIS_BOOT_REMAP, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_BOOT_REMAP
|
||||
WR_DIS.SOFT_DIS_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of SOFT_DIS_JTAG
|
||||
WR_DIS.HARD_DIS_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of HARD_DIS_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.VDD_SPI_XPD, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_XPD
|
||||
WR_DIS.VDD_SPI_TIEH, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_TIEH
|
||||
WR_DIS.VDD_SPI_FORCE, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_FORCE
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 3, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 5, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE0
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 6, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE1
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 7, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE2
|
||||
WR_DIS.KEY_PURPOSE_0, EFUSE_BLK0, 8, 1, [WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
|
||||
WR_DIS.KEY_PURPOSE_1, EFUSE_BLK0, 9, 1, [WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
|
||||
WR_DIS.KEY_PURPOSE_2, EFUSE_BLK0, 10, 1, [WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
|
||||
WR_DIS.KEY_PURPOSE_3, EFUSE_BLK0, 11, 1, [WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
|
||||
WR_DIS.KEY_PURPOSE_4, EFUSE_BLK0, 12, 1, [WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
|
||||
WR_DIS.KEY_PURPOSE_5, EFUSE_BLK0, 13, 1, [WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 16, 1, [] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_LEGACY_SPI_BOOT, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_LEGACY_SPI_BOOT
|
||||
WR_DIS.UART_PRINT_CHANNEL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CHANNEL
|
||||
WR_DIS.DIS_USB_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_USB_DOWNLOAD_MODE
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 18, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.PIN_POWER_SELECTION, EFUSE_BLK0, 18, 1, [] wr_dis of PIN_POWER_SELECTION
|
||||
WR_DIS.FLASH_TYPE, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TYPE
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 18, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
|
||||
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.SPI_PAD_CONFIG_CLK, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CLK
|
||||
WR_DIS.SPI_PAD_CONFIG_Q, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_Q
|
||||
WR_DIS.SPI_PAD_CONFIG_D, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D
|
||||
WR_DIS.SPI_PAD_CONFIG_CS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CS
|
||||
WR_DIS.SPI_PAD_CONFIG_HD, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_HD
|
||||
WR_DIS.SPI_PAD_CONFIG_WP, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_WP
|
||||
WR_DIS.SPI_PAD_CONFIG_DQS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_DQS
|
||||
WR_DIS.SPI_PAD_CONFIG_D4, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D4
|
||||
WR_DIS.SPI_PAD_CONFIG_D5, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D5
|
||||
WR_DIS.SPI_PAD_CONFIG_D6, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D6
|
||||
WR_DIS.SPI_PAD_CONFIG_D7, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D7
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.WAFER_VERSION_MINOR_HI, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_HI
|
||||
WR_DIS.FLASH_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_VERSION
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.PSRAM_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PSRAM_VERSION
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.WAFER_VERSION_MINOR_LO, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_LO
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.ADC_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of ADC_CALIB
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 21, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.RTCCALIB_V1IDX_A10H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A10H
|
||||
WR_DIS.RTCCALIB_V1IDX_A11H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A11H
|
||||
WR_DIS.RTCCALIB_V1IDX_A12H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A12H
|
||||
WR_DIS.RTCCALIB_V1IDX_A13H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A13H
|
||||
WR_DIS.RTCCALIB_V1IDX_A20H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A20H
|
||||
WR_DIS.RTCCALIB_V1IDX_A21H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A21H
|
||||
WR_DIS.RTCCALIB_V1IDX_A22H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A22H
|
||||
WR_DIS.RTCCALIB_V1IDX_A23H, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A23H
|
||||
WR_DIS.RTCCALIB_V1IDX_A10L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A10L
|
||||
WR_DIS.RTCCALIB_V1IDX_A11L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A11L
|
||||
WR_DIS.RTCCALIB_V1IDX_A12L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A12L
|
||||
WR_DIS.RTCCALIB_V1IDX_A13L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A13L
|
||||
WR_DIS.RTCCALIB_V1IDX_A20L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A20L
|
||||
WR_DIS.RTCCALIB_V1IDX_A21L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A21L
|
||||
WR_DIS.RTCCALIB_V1IDX_A22L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A22L
|
||||
WR_DIS.RTCCALIB_V1IDX_A23L, EFUSE_BLK0, 21, 1, [] wr_dis of RTCCALIB_V1IDX_A23L
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
WR_DIS.BLOCK_KEY1, EFUSE_BLK0, 24, 1, [WR_DIS.KEY1] wr_dis of BLOCK_KEY1
|
||||
WR_DIS.BLOCK_KEY2, EFUSE_BLK0, 25, 1, [WR_DIS.KEY2] wr_dis of BLOCK_KEY2
|
||||
WR_DIS.BLOCK_KEY3, EFUSE_BLK0, 26, 1, [WR_DIS.KEY3] wr_dis of BLOCK_KEY3
|
||||
WR_DIS.BLOCK_KEY4, EFUSE_BLK0, 27, 1, [WR_DIS.KEY4] wr_dis of BLOCK_KEY4
|
||||
WR_DIS.BLOCK_KEY5, EFUSE_BLK0, 28, 1, [WR_DIS.KEY5] wr_dis of BLOCK_KEY5
|
||||
WR_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 29, 1, [WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
|
||||
WR_DIS.USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, [] wr_dis of USB_EXCHG_PINS
|
||||
WR_DIS.USB_EXT_PHY_ENABLE, EFUSE_BLK0, 30, 1, [WR_DIS.EXT_PHY_ENABLE] wr_dis of USB_EXT_PHY_ENABLE
|
||||
WR_DIS.USB_FORCE_NOPERSIST, EFUSE_BLK0, 30, 1, [] wr_dis of USB_FORCE_NOPERSIST
|
||||
WR_DIS.BLOCK0_VERSION, EFUSE_BLK0, 30, 1, [] wr_dis of BLOCK0_VERSION
|
||||
RD_DIS, EFUSE_BLK0, 32, 7, [] Disable reading from BlOCK4-10
|
||||
RD_DIS.BLOCK_KEY0, EFUSE_BLK0, 32, 1, [RD_DIS.KEY0] rd_dis of BLOCK_KEY0
|
||||
RD_DIS.BLOCK_KEY1, EFUSE_BLK0, 33, 1, [RD_DIS.KEY1] rd_dis of BLOCK_KEY1
|
||||
RD_DIS.BLOCK_KEY2, EFUSE_BLK0, 34, 1, [RD_DIS.KEY2] rd_dis of BLOCK_KEY2
|
||||
RD_DIS.BLOCK_KEY3, EFUSE_BLK0, 35, 1, [RD_DIS.KEY3] rd_dis of BLOCK_KEY3
|
||||
RD_DIS.BLOCK_KEY4, EFUSE_BLK0, 36, 1, [RD_DIS.KEY4] rd_dis of BLOCK_KEY4
|
||||
RD_DIS.BLOCK_KEY5, EFUSE_BLK0, 37, 1, [RD_DIS.KEY5] rd_dis of BLOCK_KEY5
|
||||
RD_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 38, 1, [RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
|
||||
DIS_ICACHE, EFUSE_BLK0, 40, 1, [] Set this bit to disable Icache
|
||||
DIS_DCACHE, EFUSE_BLK0, 41, 1, [] Set this bit to disable Dcache
|
||||
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, [] Disables Icache when SoC is in Download mode
|
||||
DIS_DOWNLOAD_DCACHE, EFUSE_BLK0, 43, 1, [] Disables Dcache when SoC is in Download mode
|
||||
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, [] Set this bit to disable the function that forces chip into download mode
|
||||
DIS_USB, EFUSE_BLK0, 45, 1, [] Set this bit to disable USB OTG function
|
||||
DIS_TWAI, EFUSE_BLK0, 46, 1, [DIS_CAN] Set this bit to disable the TWAI Controller function
|
||||
DIS_BOOT_REMAP, EFUSE_BLK0, 47, 1, [] Disables capability to Remap RAM to ROM address space
|
||||
SOFT_DIS_JTAG, EFUSE_BLK0, 49, 1, [] Software disables JTAG. When software disabled; JTAG can be activated temporarily by HMAC peripheral
|
||||
HARD_DIS_JTAG, EFUSE_BLK0, 50, 1, [] Hardware disables JTAG permanently
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 51, 1, [] Disables flash encryption when in download boot modes
|
||||
USB_EXCHG_PINS, EFUSE_BLK0, 56, 1, [] Set this bit to exchange USB D+ and D- pins
|
||||
USB_EXT_PHY_ENABLE, EFUSE_BLK0, 57, 1, [EXT_PHY_ENABLE] Set this bit to enable external USB PHY
|
||||
USB_FORCE_NOPERSIST, EFUSE_BLK0, 58, 1, [] If set; forces USB BVALID to 1
|
||||
BLOCK0_VERSION, EFUSE_BLK0, 59, 2, [] BLOCK0 efuse version
|
||||
VDD_SPI_XPD, EFUSE_BLK0, 68, 1, [] If VDD_SPI_FORCE is 1; this value determines if the VDD_SPI regulator is powered on
|
||||
VDD_SPI_TIEH, EFUSE_BLK0, 69, 1, [] If VDD_SPI_FORCE is 1; determines VDD_SPI voltage {0: "VDD_SPI connects to 1.8 V LDO"; 1: "VDD_SPI connects to VDD3P3_RTC_IO"}
|
||||
VDD_SPI_FORCE, EFUSE_BLK0, 70, 1, [] Set this bit to use XPD_VDD_PSI_REG and VDD_SPI_TIEH to configure VDD_SPI LDO
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, [] RTC watchdog timeout threshold; in unit of slow clock cycle {0: "40000"; 1: "80000"; 2: "160000"; 3: "320000"}
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, [] Enables flash encryption when 1 or 3 bits are set and disabled otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, [] Revoke 1st secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, [] Revoke 2nd secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, [] Revoke 3rd secure boot key
|
||||
KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, [KEY0_PURPOSE] Purpose of KEY0
|
||||
KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, [KEY1_PURPOSE] Purpose of KEY1
|
||||
KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, [KEY2_PURPOSE] Purpose of KEY2
|
||||
KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, [KEY3_PURPOSE] Purpose of KEY3
|
||||
KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, [KEY4_PURPOSE] Purpose of KEY4
|
||||
KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, [KEY5_PURPOSE] Purpose of KEY5
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, [] Set this bit to enable secure boot
|
||||
SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, [] Set this bit to enable aggressive secure boot key revocation mode
|
||||
FLASH_TPUW, EFUSE_BLK0, 124, 4, [] Configures flash startup delay after SoC power-up; in unit of (ms/2). When the value is 15; delay is 7.5 ms
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, [] Set this bit to disable all download boot modes
|
||||
DIS_LEGACY_SPI_BOOT, EFUSE_BLK0, 129, 1, [] Set this bit to disable Legacy SPI boot mode
|
||||
UART_PRINT_CHANNEL, EFUSE_BLK0, 130, 1, [] Selects the default UART for printing boot messages {0: "UART0"; 1: "UART1"}
|
||||
DIS_USB_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, [] Set this bit to disable use of USB OTG in UART download boot mode
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, [] Set this bit to enable secure UART download mode (read/write flash only)
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, [] Set the default UART boot message output mode {0: "Enable"; 1: "Enable when GPIO46 is low at reset"; 2: "Enable when GPIO46 is high at reset"; 3: "Disable"}
|
||||
PIN_POWER_SELECTION, EFUSE_BLK0, 136, 1, [] Set default power supply for GPIO33-GPIO37; set when SPI flash is initialized {0: "VDD3P3_CPU"; 1: "VDD_SPI"}
|
||||
FLASH_TYPE, EFUSE_BLK0, 137, 1, [] SPI flash type {0: "4 data lines"; 1: "8 data lines"}
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 138, 1, [] If set; forces ROM code to send an SPI flash resume command during SPI boot
|
||||
SECURE_VERSION, EFUSE_BLK0, 139, 16, [] Secure version (used by ESP-IDF anti-rollback feature)
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 160, 1, [] Disables check of wafer version major
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 161, 1, [] Disables check of blk version major
|
||||
MAC_FACTORY, EFUSE_BLK1, 0, 48, [MAC_FACTORY] MAC address
|
||||
SPI_PAD_CONFIG_CLK, EFUSE_BLK1, 48, 6, [] SPI_PAD_configure CLK
|
||||
SPI_PAD_CONFIG_Q, EFUSE_BLK1, 54, 6, [] SPI_PAD_configure Q(D1)
|
||||
SPI_PAD_CONFIG_D, EFUSE_BLK1, 60, 6, [] SPI_PAD_configure D(D0)
|
||||
SPI_PAD_CONFIG_CS, EFUSE_BLK1, 66, 6, [] SPI_PAD_configure CS
|
||||
SPI_PAD_CONFIG_HD, EFUSE_BLK1, 72, 6, [] SPI_PAD_configure HD(D3)
|
||||
SPI_PAD_CONFIG_WP, EFUSE_BLK1, 78, 6, [] SPI_PAD_configure WP(D2)
|
||||
SPI_PAD_CONFIG_DQS, EFUSE_BLK1, 84, 6, [] SPI_PAD_configure DQS
|
||||
SPI_PAD_CONFIG_D4, EFUSE_BLK1, 90, 6, [] SPI_PAD_configure D4
|
||||
SPI_PAD_CONFIG_D5, EFUSE_BLK1, 96, 6, [] SPI_PAD_configure D5
|
||||
SPI_PAD_CONFIG_D6, EFUSE_BLK1, 102, 6, [] SPI_PAD_configure D6
|
||||
SPI_PAD_CONFIG_D7, EFUSE_BLK1, 108, 6, [] SPI_PAD_configure D7
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK1, 114, 2, [] WAFER_VERSION_MAJOR
|
||||
WAFER_VERSION_MINOR_HI, EFUSE_BLK1, 116, 1, [] WAFER_VERSION_MINOR most significant bit
|
||||
FLASH_VERSION, EFUSE_BLK1, 117, 4, [] Flash version
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK1, 121, 2, [] BLK_VERSION_MAJOR
|
||||
PSRAM_VERSION, EFUSE_BLK1, 124, 4, [] PSRAM version
|
||||
PKG_VERSION, EFUSE_BLK1, 128, 4, [] Package version
|
||||
WAFER_VERSION_MINOR_LO, EFUSE_BLK1, 132, 3, [] WAFER_VERSION_MINOR least significant bits
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
ADC_CALIB, EFUSE_BLK2, 128, 4, [] 4 bit of ADC calibration
|
||||
BLK_VERSION_MINOR, EFUSE_BLK2, 132, 3, [] BLK_VERSION_MINOR of BLOCK2 {0: "No calib"; 1: "ADC calib V1"; 2: "ADC calib V2"}
|
||||
TEMP_CALIB, EFUSE_BLK2, 135, 9, [] Temperature calibration data
|
||||
RTCCALIB_V1IDX_A10H, EFUSE_BLK2, 144, 8, []
|
||||
RTCCALIB_V1IDX_A11H, EFUSE_BLK2, 152, 8, []
|
||||
RTCCALIB_V1IDX_A12H, EFUSE_BLK2, 160, 8, []
|
||||
RTCCALIB_V1IDX_A13H, EFUSE_BLK2, 168, 8, []
|
||||
RTCCALIB_V1IDX_A20H, EFUSE_BLK2, 176, 8, []
|
||||
RTCCALIB_V1IDX_A21H, EFUSE_BLK2, 184, 8, []
|
||||
RTCCALIB_V1IDX_A22H, EFUSE_BLK2, 192, 8, []
|
||||
RTCCALIB_V1IDX_A23H, EFUSE_BLK2, 200, 8, []
|
||||
RTCCALIB_V1IDX_A10L, EFUSE_BLK2, 208, 6, []
|
||||
RTCCALIB_V1IDX_A11L, EFUSE_BLK2, 214, 6, []
|
||||
RTCCALIB_V1IDX_A12L, EFUSE_BLK2, 220, 6, []
|
||||
RTCCALIB_V1IDX_A13L, EFUSE_BLK2, 226, 6, []
|
||||
RTCCALIB_V1IDX_A20L, EFUSE_BLK2, 232, 6, []
|
||||
RTCCALIB_V1IDX_A21L, EFUSE_BLK2, 238, 6, []
|
||||
RTCCALIB_V1IDX_A22L, EFUSE_BLK2, 244, 6, []
|
||||
RTCCALIB_V1IDX_A23L, EFUSE_BLK2, 250, 6, []
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
KEY1, EFUSE_BLK5, 0, 256, [BLOCK_KEY1] Key1 or user data
|
||||
KEY2, EFUSE_BLK6, 0, 256, [BLOCK_KEY2] Key2 or user data
|
||||
KEY3, EFUSE_BLK7, 0, 256, [BLOCK_KEY3] Key3 or user data
|
||||
KEY4, EFUSE_BLK8, 0, 256, [BLOCK_KEY4] Key4 or user data
|
||||
KEY5, EFUSE_BLK9, 0, 256, [BLOCK_KEY5] Key5 or user data
|
||||
SYS_DATA_PART2, EFUSE_BLK10, 0, 256, [BLOCK_SYS_DATA2] System data part 2 (reserved)
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -1,5 +1,4 @@
|
||||
[device]
|
||||
name = "esp32s3"
|
||||
arch = "xtensa"
|
||||
cores = "multi_core"
|
||||
|
||||
@ -68,13 +67,7 @@ symbols = [
|
||||
"bt",
|
||||
"wifi",
|
||||
"psram",
|
||||
"psram_dma",
|
||||
"octal_psram",
|
||||
"ulp_riscv_core",
|
||||
"timg_timer1",
|
||||
"very_large_intr_status",
|
||||
"gpio_bank_1",
|
||||
"spi_octal",
|
||||
|
||||
# ROM capabilities
|
||||
"rom_crc_le",
|
||||
@ -90,7 +83,4 @@ symbols = [
|
||||
"uart_support_wakeup_int",
|
||||
"ulp_supported",
|
||||
"riscv_coproc_supported",
|
||||
|
||||
# Other capabilities
|
||||
"psram_dma",
|
||||
]
|
||||
227
esp-hal-common/devices/esp32s3/efuse.csv
Normal file
227
esp-hal-common/devices/esp32s3/efuse.csv
Normal file
@ -0,0 +1,227 @@
|
||||
|
||||
# field_name, | efuse_block, | bit_start, | bit_count, |comment #
|
||||
# | (EFUSE_BLK0 | (0..255) | (1-256) | #
|
||||
# | EFUSE_BLK1 | | | #
|
||||
# | ...) | | | #
|
||||
##########################################################################
|
||||
# !!!!!!!!!!! #
|
||||
# After editing this file, run the command manually "idf.py efuse-common-table"
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 6925129eca795b8b087d31be539740ec
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
WR_DIS.DIS_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_ICACHE
|
||||
WR_DIS.DIS_DCACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DCACHE
|
||||
WR_DIS.DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_ICACHE
|
||||
WR_DIS.DIS_DOWNLOAD_DCACHE, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_DCACHE
|
||||
WR_DIS.DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_FORCE_DOWNLOAD
|
||||
WR_DIS.DIS_USB_OTG, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_USB] wr_dis of DIS_USB_OTG
|
||||
WR_DIS.DIS_TWAI, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_CAN] wr_dis of DIS_TWAI
|
||||
WR_DIS.DIS_APP_CPU, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_APP_CPU
|
||||
WR_DIS.DIS_PAD_JTAG, EFUSE_BLK0, 2, 1, [WR_DIS.HARD_DIS_JTAG] wr_dis of DIS_PAD_JTAG
|
||||
WR_DIS.DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
WR_DIS.DIS_USB_JTAG, EFUSE_BLK0, 2, 1, [] wr_dis of DIS_USB_JTAG
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 2, 1, [WR_DIS.DIS_USB_DEVICE] wr_dis of DIS_USB_SERIAL_JTAG
|
||||
WR_DIS.STRAP_JTAG_SEL, EFUSE_BLK0, 2, 1, [] wr_dis of STRAP_JTAG_SEL
|
||||
WR_DIS.USB_PHY_SEL, EFUSE_BLK0, 2, 1, [] wr_dis of USB_PHY_SEL
|
||||
WR_DIS.VDD_SPI_XPD, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_XPD
|
||||
WR_DIS.VDD_SPI_TIEH, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_TIEH
|
||||
WR_DIS.VDD_SPI_FORCE, EFUSE_BLK0, 3, 1, [] wr_dis of VDD_SPI_FORCE
|
||||
WR_DIS.WDT_DELAY_SEL, EFUSE_BLK0, 3, 1, [] wr_dis of WDT_DELAY_SEL
|
||||
WR_DIS.SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, [] wr_dis of SPI_BOOT_CRYPT_CNT
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 5, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE0
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 6, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE1
|
||||
WR_DIS.SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 7, 1, [] wr_dis of SECURE_BOOT_KEY_REVOKE2
|
||||
WR_DIS.KEY_PURPOSE_0, EFUSE_BLK0, 8, 1, [WR_DIS.KEY0_PURPOSE] wr_dis of KEY_PURPOSE_0
|
||||
WR_DIS.KEY_PURPOSE_1, EFUSE_BLK0, 9, 1, [WR_DIS.KEY1_PURPOSE] wr_dis of KEY_PURPOSE_1
|
||||
WR_DIS.KEY_PURPOSE_2, EFUSE_BLK0, 10, 1, [WR_DIS.KEY2_PURPOSE] wr_dis of KEY_PURPOSE_2
|
||||
WR_DIS.KEY_PURPOSE_3, EFUSE_BLK0, 11, 1, [WR_DIS.KEY3_PURPOSE] wr_dis of KEY_PURPOSE_3
|
||||
WR_DIS.KEY_PURPOSE_4, EFUSE_BLK0, 12, 1, [WR_DIS.KEY4_PURPOSE] wr_dis of KEY_PURPOSE_4
|
||||
WR_DIS.KEY_PURPOSE_5, EFUSE_BLK0, 13, 1, [WR_DIS.KEY5_PURPOSE] wr_dis of KEY_PURPOSE_5
|
||||
WR_DIS.SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, [] wr_dis of SECURE_BOOT_EN
|
||||
WR_DIS.SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 16, 1, [] wr_dis of SECURE_BOOT_AGGRESSIVE_REVOKE
|
||||
WR_DIS.FLASH_TPUW, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TPUW
|
||||
WR_DIS.DIS_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of DIS_DOWNLOAD_MODE
|
||||
WR_DIS.DIS_DIRECT_BOOT, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_LEGACY_SPI_BOOT] wr_dis of DIS_DIRECT_BOOT
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 18, 1, [WR_DIS.UART_PRINT_CHANNEL] wr_dis of DIS_USB_SERIAL_JTAG_ROM_PRINT
|
||||
WR_DIS.FLASH_ECC_MODE, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_ECC_MODE
|
||||
WR_DIS.DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 18, 1, [WR_DIS.DIS_USB_DOWNLOAD_MODE] wr_dis of DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE
|
||||
WR_DIS.ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 18, 1, [] wr_dis of ENABLE_SECURITY_DOWNLOAD
|
||||
WR_DIS.UART_PRINT_CONTROL, EFUSE_BLK0, 18, 1, [] wr_dis of UART_PRINT_CONTROL
|
||||
WR_DIS.PIN_POWER_SELECTION, EFUSE_BLK0, 18, 1, [] wr_dis of PIN_POWER_SELECTION
|
||||
WR_DIS.FLASH_TYPE, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_TYPE
|
||||
WR_DIS.FLASH_PAGE_SIZE, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_PAGE_SIZE
|
||||
WR_DIS.FLASH_ECC_EN, EFUSE_BLK0, 18, 1, [] wr_dis of FLASH_ECC_EN
|
||||
WR_DIS.FORCE_SEND_RESUME, EFUSE_BLK0, 18, 1, [] wr_dis of FORCE_SEND_RESUME
|
||||
WR_DIS.SECURE_VERSION, EFUSE_BLK0, 18, 1, [] wr_dis of SECURE_VERSION
|
||||
WR_DIS.DIS_USB_OTG_DOWNLOAD_MODE, EFUSE_BLK0, 19, 1, [] wr_dis of DIS_USB_OTG_DOWNLOAD_MODE
|
||||
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
|
||||
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 19, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
|
||||
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
|
||||
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
|
||||
WR_DIS.SPI_PAD_CONFIG_CLK, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CLK
|
||||
WR_DIS.SPI_PAD_CONFIG_Q, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_Q
|
||||
WR_DIS.SPI_PAD_CONFIG_D, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D
|
||||
WR_DIS.SPI_PAD_CONFIG_CS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_CS
|
||||
WR_DIS.SPI_PAD_CONFIG_HD, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_HD
|
||||
WR_DIS.SPI_PAD_CONFIG_WP, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_WP
|
||||
WR_DIS.SPI_PAD_CONFIG_DQS, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_DQS
|
||||
WR_DIS.SPI_PAD_CONFIG_D4, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D4
|
||||
WR_DIS.SPI_PAD_CONFIG_D5, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D5
|
||||
WR_DIS.SPI_PAD_CONFIG_D6, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D6
|
||||
WR_DIS.SPI_PAD_CONFIG_D7, EFUSE_BLK0, 20, 1, [] wr_dis of SPI_PAD_CONFIG_D7
|
||||
WR_DIS.WAFER_VERSION_MINOR_LO, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_LO
|
||||
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
|
||||
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MINOR
|
||||
WR_DIS.K_RTC_LDO, EFUSE_BLK0, 20, 1, [] wr_dis of K_RTC_LDO
|
||||
WR_DIS.K_DIG_LDO, EFUSE_BLK0, 20, 1, [] wr_dis of K_DIG_LDO
|
||||
WR_DIS.V_RTC_DBIAS20, EFUSE_BLK0, 20, 1, [] wr_dis of V_RTC_DBIAS20
|
||||
WR_DIS.V_DIG_DBIAS20, EFUSE_BLK0, 20, 1, [] wr_dis of V_DIG_DBIAS20
|
||||
WR_DIS.DIG_DBIAS_HVT, EFUSE_BLK0, 20, 1, [] wr_dis of DIG_DBIAS_HVT
|
||||
WR_DIS.WAFER_VERSION_MINOR_HI, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR_HI
|
||||
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
|
||||
WR_DIS.ADC2_CAL_VOL_ATTEN3, EFUSE_BLK0, 20, 1, [] wr_dis of ADC2_CAL_VOL_ATTEN3
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.BLK_VERSION_MAJOR, EFUSE_BLK0, 21, 1, [] wr_dis of BLK_VERSION_MAJOR
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.OCODE, EFUSE_BLK0, 21, 1, [] wr_dis of OCODE
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC2_INIT_CODE_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC2_INIT_CODE_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_INIT_CODE_ATTEN1
|
||||
WR_DIS.ADC2_INIT_CODE_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_INIT_CODE_ATTEN2
|
||||
WR_DIS.ADC2_INIT_CODE_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN1
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN2
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
WR_DIS.ADC2_CAL_VOL_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC2_CAL_VOL_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_CAL_VOL_ATTEN1
|
||||
WR_DIS.ADC2_CAL_VOL_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC2_CAL_VOL_ATTEN2
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
WR_DIS.BLOCK_KEY1, EFUSE_BLK0, 24, 1, [WR_DIS.KEY1] wr_dis of BLOCK_KEY1
|
||||
WR_DIS.BLOCK_KEY2, EFUSE_BLK0, 25, 1, [WR_DIS.KEY2] wr_dis of BLOCK_KEY2
|
||||
WR_DIS.BLOCK_KEY3, EFUSE_BLK0, 26, 1, [WR_DIS.KEY3] wr_dis of BLOCK_KEY3
|
||||
WR_DIS.BLOCK_KEY4, EFUSE_BLK0, 27, 1, [WR_DIS.KEY4] wr_dis of BLOCK_KEY4
|
||||
WR_DIS.BLOCK_KEY5, EFUSE_BLK0, 28, 1, [WR_DIS.KEY5] wr_dis of BLOCK_KEY5
|
||||
WR_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 29, 1, [WR_DIS.SYS_DATA_PART2] wr_dis of BLOCK_SYS_DATA2
|
||||
WR_DIS.USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, [] wr_dis of USB_EXCHG_PINS
|
||||
WR_DIS.USB_EXT_PHY_ENABLE, EFUSE_BLK0, 30, 1, [WR_DIS.EXT_PHY_ENABLE] wr_dis of USB_EXT_PHY_ENABLE
|
||||
WR_DIS.SOFT_DIS_JTAG, EFUSE_BLK0, 31, 1, [] wr_dis of SOFT_DIS_JTAG
|
||||
RD_DIS, EFUSE_BLK0, 32, 7, [] Disable reading from BlOCK4-10
|
||||
RD_DIS.BLOCK_KEY0, EFUSE_BLK0, 32, 1, [RD_DIS.KEY0] rd_dis of BLOCK_KEY0
|
||||
RD_DIS.BLOCK_KEY1, EFUSE_BLK0, 33, 1, [RD_DIS.KEY1] rd_dis of BLOCK_KEY1
|
||||
RD_DIS.BLOCK_KEY2, EFUSE_BLK0, 34, 1, [RD_DIS.KEY2] rd_dis of BLOCK_KEY2
|
||||
RD_DIS.BLOCK_KEY3, EFUSE_BLK0, 35, 1, [RD_DIS.KEY3] rd_dis of BLOCK_KEY3
|
||||
RD_DIS.BLOCK_KEY4, EFUSE_BLK0, 36, 1, [RD_DIS.KEY4] rd_dis of BLOCK_KEY4
|
||||
RD_DIS.BLOCK_KEY5, EFUSE_BLK0, 37, 1, [RD_DIS.KEY5] rd_dis of BLOCK_KEY5
|
||||
RD_DIS.BLOCK_SYS_DATA2, EFUSE_BLK0, 38, 1, [RD_DIS.SYS_DATA_PART2] rd_dis of BLOCK_SYS_DATA2
|
||||
DIS_ICACHE, EFUSE_BLK0, 40, 1, [] Set this bit to disable Icache
|
||||
DIS_DCACHE, EFUSE_BLK0, 41, 1, [] Set this bit to disable Dcache
|
||||
DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, [] Set this bit to disable Icache in download mode (boot_mode[3:0] is 0; 1; 2; 3; 6; 7)
|
||||
DIS_DOWNLOAD_DCACHE, EFUSE_BLK0, 43, 1, [] Set this bit to disable Dcache in download mode ( boot_mode[3:0] is 0; 1; 2; 3; 6; 7)
|
||||
DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, [] Set this bit to disable the function that forces chip into download mode
|
||||
DIS_USB_OTG, EFUSE_BLK0, 45, 1, [DIS_USB] Set this bit to disable USB function
|
||||
DIS_TWAI, EFUSE_BLK0, 46, 1, [DIS_CAN] Set this bit to disable CAN function
|
||||
DIS_APP_CPU, EFUSE_BLK0, 47, 1, [] Disable app cpu
|
||||
SOFT_DIS_JTAG, EFUSE_BLK0, 48, 3, [] Set these bits to disable JTAG in the soft way (odd number 1 means disable ). JTAG can be enabled in HMAC module
|
||||
DIS_PAD_JTAG, EFUSE_BLK0, 51, 1, [HARD_DIS_JTAG] Set this bit to disable JTAG in the hard way. JTAG is disabled permanently
|
||||
DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 52, 1, [] Set this bit to disable flash encryption when in download boot modes
|
||||
USB_EXCHG_PINS, EFUSE_BLK0, 57, 1, [] Set this bit to exchange USB D+ and D- pins
|
||||
USB_EXT_PHY_ENABLE, EFUSE_BLK0, 58, 1, [EXT_PHY_ENABLE] Set this bit to enable external PHY
|
||||
VDD_SPI_XPD, EFUSE_BLK0, 68, 1, [] SPI regulator power up signal
|
||||
VDD_SPI_TIEH, EFUSE_BLK0, 69, 1, [] If VDD_SPI_FORCE is 1; determines VDD_SPI voltage {0: "VDD_SPI connects to 1.8 V LDO"; 1: "VDD_SPI connects to VDD3P3_RTC_IO"}
|
||||
VDD_SPI_FORCE, EFUSE_BLK0, 70, 1, [] Set this bit and force to use the configuration of eFuse to configure VDD_SPI
|
||||
WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, [] RTC watchdog timeout threshold; in unit of slow clock cycle {0: "40000"; 1: "80000"; 2: "160000"; 3: "320000"}
|
||||
SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, [] Enables flash encryption when 1 or 3 bits are set and disabled otherwise {0: "Disable"; 1: "Enable"; 3: "Disable"; 7: "Enable"}
|
||||
SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, [] Revoke 1st secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, [] Revoke 2nd secure boot key
|
||||
SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, [] Revoke 3rd secure boot key
|
||||
KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, [KEY0_PURPOSE] Purpose of Key0
|
||||
KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, [KEY1_PURPOSE] Purpose of Key1
|
||||
KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, [KEY2_PURPOSE] Purpose of Key2
|
||||
KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, [KEY3_PURPOSE] Purpose of Key3
|
||||
KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, [KEY4_PURPOSE] Purpose of Key4
|
||||
KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, [KEY5_PURPOSE] Purpose of Key5
|
||||
SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, [] Set this bit to enable secure boot
|
||||
SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, [] Set this bit to enable revoking aggressive secure boot
|
||||
DIS_USB_JTAG, EFUSE_BLK0, 118, 1, [] Set this bit to disable function of usb switch to jtag in module of usb device
|
||||
DIS_USB_SERIAL_JTAG, EFUSE_BLK0, 119, 1, [DIS_USB_DEVICE] Set this bit to disable usb device
|
||||
STRAP_JTAG_SEL, EFUSE_BLK0, 120, 1, [] Set this bit to enable selection between usb_to_jtag and pad_to_jtag through strapping gpio10 when both reg_dis_usb_jtag and reg_dis_pad_jtag are equal to 0
|
||||
USB_PHY_SEL, EFUSE_BLK0, 121, 1, [] This bit is used to switch internal PHY and external PHY for USB OTG and USB Device {0: "internal PHY is assigned to USB Device while external PHY is assigned to USB OTG"; 1: "internal PHY is assigned to USB OTG while external PHY is assigned to USB Device"}
|
||||
FLASH_TPUW, EFUSE_BLK0, 124, 4, [] Configures flash waiting time after power-up; in unit of ms. If the value is less than 15; the waiting time is the configurable value. Otherwise; the waiting time is twice the configurable value
|
||||
DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, [] Set this bit to disable download mode (boot_mode[3:0] = 0; 1; 2; 3; 6; 7)
|
||||
DIS_DIRECT_BOOT, EFUSE_BLK0, 129, 1, [DIS_LEGACY_SPI_BOOT] Disable direct boot mode
|
||||
DIS_USB_SERIAL_JTAG_ROM_PRINT, EFUSE_BLK0, 130, 1, [UART_PRINT_CHANNEL] USB printing {0: "Enable"; 1: "Disable"}
|
||||
FLASH_ECC_MODE, EFUSE_BLK0, 131, 1, [] Flash ECC mode in ROM {0: "16to18 byte"; 1: "16to17 byte"}
|
||||
DIS_USB_SERIAL_JTAG_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, [DIS_USB_DOWNLOAD_MODE] Set this bit to disable UART download mode through USB
|
||||
ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, [] Set this bit to enable secure UART download mode
|
||||
UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, [] Set the default UART boot message output mode {0: "Enable"; 1: "Enable when GPIO46 is low at reset"; 2: "Enable when GPIO46 is high at reset"; 3: "Disable"}
|
||||
PIN_POWER_SELECTION, EFUSE_BLK0, 136, 1, [] Set default power supply for GPIO33-GPIO37; set when SPI flash is initialized {0: "VDD3P3_CPU"; 1: "VDD_SPI"}
|
||||
FLASH_TYPE, EFUSE_BLK0, 137, 1, [] SPI flash type {0: "4 data lines"; 1: "8 data lines"}
|
||||
FLASH_PAGE_SIZE, EFUSE_BLK0, 138, 2, [] Set Flash page size
|
||||
FLASH_ECC_EN, EFUSE_BLK0, 140, 1, [] Set 1 to enable ECC for flash boot
|
||||
FORCE_SEND_RESUME, EFUSE_BLK0, 141, 1, [] Set this bit to force ROM code to send a resume command during SPI boot
|
||||
SECURE_VERSION, EFUSE_BLK0, 142, 16, [] Secure version (used by ESP-IDF anti-rollback feature)
|
||||
DIS_USB_OTG_DOWNLOAD_MODE, EFUSE_BLK0, 159, 1, [] Set this bit to disable download through USB-OTG
|
||||
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 160, 1, [] Disables check of wafer version major
|
||||
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 161, 1, [] Disables check of blk version major
|
||||
MAC_FACTORY, EFUSE_BLK1, 0, 48, [MAC_FACTORY] MAC address
|
||||
SPI_PAD_CONFIG_CLK, EFUSE_BLK1, 48, 6, [] SPI_PAD_configure CLK
|
||||
SPI_PAD_CONFIG_Q, EFUSE_BLK1, 54, 6, [] SPI_PAD_configure Q(D1)
|
||||
SPI_PAD_CONFIG_D, EFUSE_BLK1, 60, 6, [] SPI_PAD_configure D(D0)
|
||||
SPI_PAD_CONFIG_CS, EFUSE_BLK1, 66, 6, [] SPI_PAD_configure CS
|
||||
SPI_PAD_CONFIG_HD, EFUSE_BLK1, 72, 6, [] SPI_PAD_configure HD(D3)
|
||||
SPI_PAD_CONFIG_WP, EFUSE_BLK1, 78, 6, [] SPI_PAD_configure WP(D2)
|
||||
SPI_PAD_CONFIG_DQS, EFUSE_BLK1, 84, 6, [] SPI_PAD_configure DQS
|
||||
SPI_PAD_CONFIG_D4, EFUSE_BLK1, 90, 6, [] SPI_PAD_configure D4
|
||||
SPI_PAD_CONFIG_D5, EFUSE_BLK1, 96, 6, [] SPI_PAD_configure D5
|
||||
SPI_PAD_CONFIG_D6, EFUSE_BLK1, 102, 6, [] SPI_PAD_configure D6
|
||||
SPI_PAD_CONFIG_D7, EFUSE_BLK1, 108, 6, [] SPI_PAD_configure D7
|
||||
WAFER_VERSION_MINOR_LO, EFUSE_BLK1, 114, 3, [] WAFER_VERSION_MINOR least significant bits
|
||||
PKG_VERSION, EFUSE_BLK1, 117, 3, [] Package version
|
||||
BLK_VERSION_MINOR, EFUSE_BLK1, 120, 3, [] BLK_VERSION_MINOR
|
||||
K_RTC_LDO, EFUSE_BLK1, 141, 7, [] BLOCK1 K_RTC_LDO
|
||||
K_DIG_LDO, EFUSE_BLK1, 148, 7, [] BLOCK1 K_DIG_LDO
|
||||
V_RTC_DBIAS20, EFUSE_BLK1, 155, 8, [] BLOCK1 voltage of rtc dbias20
|
||||
V_DIG_DBIAS20, EFUSE_BLK1, 163, 8, [] BLOCK1 voltage of digital dbias20
|
||||
DIG_DBIAS_HVT, EFUSE_BLK1, 171, 5, [] BLOCK1 digital dbias when hvt
|
||||
WAFER_VERSION_MINOR_HI, EFUSE_BLK1, 183, 1, [] WAFER_VERSION_MINOR most significant bit
|
||||
WAFER_VERSION_MAJOR, EFUSE_BLK1, 184, 2, [] WAFER_VERSION_MAJOR
|
||||
ADC2_CAL_VOL_ATTEN3, EFUSE_BLK1, 186, 6, [] ADC2 calibration voltage at atten3
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
BLK_VERSION_MAJOR, EFUSE_BLK2, 128, 2, [] BLK_VERSION_MAJOR of BLOCK2 {0: "No calib"; 1: "ADC calib V1"}
|
||||
TEMP_CALIB, EFUSE_BLK2, 132, 9, [] Temperature calibration data
|
||||
OCODE, EFUSE_BLK2, 141, 8, [] ADC OCode
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 149, 8, [] ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN1, EFUSE_BLK2, 157, 6, [] ADC1 init code at atten1
|
||||
ADC1_INIT_CODE_ATTEN2, EFUSE_BLK2, 163, 6, [] ADC1 init code at atten2
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 169, 6, [] ADC1 init code at atten3
|
||||
ADC2_INIT_CODE_ATTEN0, EFUSE_BLK2, 175, 8, [] ADC2 init code at atten0
|
||||
ADC2_INIT_CODE_ATTEN1, EFUSE_BLK2, 183, 6, [] ADC2 init code at atten1
|
||||
ADC2_INIT_CODE_ATTEN2, EFUSE_BLK2, 189, 6, [] ADC2 init code at atten2
|
||||
ADC2_INIT_CODE_ATTEN3, EFUSE_BLK2, 195, 6, [] ADC2 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 201, 8, [] ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN1, EFUSE_BLK2, 209, 8, [] ADC1 calibration voltage at atten1
|
||||
ADC1_CAL_VOL_ATTEN2, EFUSE_BLK2, 217, 8, [] ADC1 calibration voltage at atten2
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 225, 8, [] ADC1 calibration voltage at atten3
|
||||
ADC2_CAL_VOL_ATTEN0, EFUSE_BLK2, 233, 8, [] ADC2 calibration voltage at atten0
|
||||
ADC2_CAL_VOL_ATTEN1, EFUSE_BLK2, 241, 7, [] ADC2 calibration voltage at atten1
|
||||
ADC2_CAL_VOL_ATTEN2, EFUSE_BLK2, 248, 7, [] ADC2 calibration voltage at atten2
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
KEY1, EFUSE_BLK5, 0, 256, [BLOCK_KEY1] Key1 or user data
|
||||
KEY2, EFUSE_BLK6, 0, 256, [BLOCK_KEY2] Key2 or user data
|
||||
KEY3, EFUSE_BLK7, 0, 256, [BLOCK_KEY3] Key3 or user data
|
||||
KEY4, EFUSE_BLK8, 0, 256, [BLOCK_KEY4] Key4 or user data
|
||||
KEY5, EFUSE_BLK9, 0, 256, [BLOCK_KEY5] Key5 or user data
|
||||
SYS_DATA_PART2, EFUSE_BLK10, 0, 256, [BLOCK_SYS_DATA2] System data part 2 (reserved)
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@ -8,10 +8,6 @@ PROVIDE(__zero_bss = default_mem_hook);
|
||||
PROVIDE(__init_data = default_mem_hook);
|
||||
PROVIDE(__post_init = default_post_init);
|
||||
|
||||
PROVIDE(__level_1_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_2_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_3_interrupt = handle_interrupts);
|
||||
|
||||
INCLUDE exception.x
|
||||
|
||||
/* ESP32 fixups */
|
||||
@ -19,16 +15,22 @@ INCLUDE "fixups/rtc_fast_rwdata_dummy.x"
|
||||
/* END ESP32 fixups */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "rtc_slow.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
/* an uninitialized section for use as the wifi-heap in esp-wifi */
|
||||
SECTIONS {
|
||||
.dram2_uninit (NOLOAD) : ALIGN(4) {
|
||||
*(.dram2_uninit)
|
||||
} > dram2_seg
|
||||
}
|
||||
|
||||
EXTERN(DefaultHandler);
|
||||
|
||||
EXTERN(WIFI_EVENT); /* Force inclusion of WiFi libraries */
|
||||
@ -25,18 +25,10 @@ MEMORY
|
||||
* The segment dram2_seg after the rom data space is not mentioned in the esp32 linker scripts in esp-idf, instead the space after is used as heap space.
|
||||
* It seems not all rom data space is reserved, but only "core"/"important" ROM functions that may be called after booting from ROM.
|
||||
*/
|
||||
reserved_rom_data_pro : ORIGIN = 0x3ffe0000, len = 1088
|
||||
reserved_rom_data_app : ORIGIN = 0x3ffe3f20, len = 1072
|
||||
reserved_rom_data_pro : ORIGIN = 0X3FFE0000, len = 1088
|
||||
reserved_rom_data_app : ORIGIN = 0X3FFE3F20, len = 1072
|
||||
|
||||
/*
|
||||
* The following values are derived from the __stack and _stack_sentry values from ROM.
|
||||
* They represent the stacks used for each core setup by ROM code. In theory both of these
|
||||
* can be reclaimed once both cores are running, but for now we play it safe and reserve them both.
|
||||
*/
|
||||
reserved_rom_stack_pro : ORIGIN = 0x3ffe1320, len = 11264
|
||||
reserved_rom_stack_app : ORIGIN = 0x3ffe5230, len = 11264
|
||||
|
||||
dram2_seg : ORIGIN = 0x3ffe7e30, len = 98767 /* the rest of DRAM after the rom data segments and rom stacks in the middle */
|
||||
dram2_seg : ORIGIN = 0x3FFE4350, len = 111k /* the rest of DRAM after the rom data segments in the middle */
|
||||
|
||||
/* external flash
|
||||
The 0x20 offset is a convenience for the app binary image generation.
|
||||
29
esp-hal-common/ld/esp32/rom-functions.x
Normal file
29
esp-hal-common/ld/esp32/rom-functions.x
Normal file
@ -0,0 +1,29 @@
|
||||
PROVIDE(ets_delay_us = 0x40008534);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40008550);
|
||||
PROVIDE(rom_i2c_writeReg = 0x400041a4);
|
||||
PROVIDE(rom_i2c_writeReg_Mask = 0x400041fc);
|
||||
PROVIDE(rtc_get_reset_reason = 0x400081d4);
|
||||
PROVIDE(software_reset = 0x4000824c);
|
||||
PROVIDE(software_reset_cpu = 0x40008264);
|
||||
|
||||
PROVIDE ( ets_efuse_get_spiconfig = 0x40008658 );
|
||||
PROVIDE ( esp_rom_efuse_get_flash_gpio_info = ets_efuse_get_spiconfig );
|
||||
PROVIDE ( esp_rom_gpio_connect_out_signal = gpio_matrix_out );
|
||||
PROVIDE ( gpio_matrix_out = 0x40009f0c );
|
||||
PROVIDE ( gpio_matrix_in = 0x40009edc );
|
||||
PROVIDE ( esp_rom_gpio_connect_in_signal = gpio_matrix_in );
|
||||
PROVIDE ( esp_rom_spiflash_config_clk = 0x40062bc8 );
|
||||
PROVIDE ( g_rom_spiflash_dummy_len_plus = 0x3ffae290 );
|
||||
PROVIDE ( g_rom_flashchip = 0x3ffae270 );
|
||||
PROVIDE ( cache_sram_mmu_set_rom = 0x400097f4 );
|
||||
|
||||
PROVIDE (esp_rom_crc32_be = 0x4005d024);
|
||||
PROVIDE (esp_rom_crc16_be = 0x4005d09c);
|
||||
PROVIDE (esp_rom_crc8_be = 0x4005d114);
|
||||
PROVIDE (esp_rom_crc32_le = 0x4005cfec);
|
||||
PROVIDE (esp_rom_crc16_le = 0x4005d05c);
|
||||
PROVIDE (esp_rom_crc8_le = 0x4005d0e0);
|
||||
|
||||
PROVIDE (esp_rom_md5_init = 0x4005da7c);
|
||||
PROVIDE (esp_rom_md5_update = 0x4005da9c);
|
||||
PROVIDE (esp_rom_md5_final = 0x4005db1c);
|
||||
@ -36,6 +36,14 @@ PROVIDE(_mp_hook = default_mp_hook);
|
||||
PROVIDE(_start_trap = default_start_trap);
|
||||
|
||||
/* esp32c2 fixups */
|
||||
SECTIONS {
|
||||
.text.dummy (NOLOAD) :
|
||||
{
|
||||
/* This section is intended to make _stext address work */
|
||||
. = ABSOLUTE(_stext);
|
||||
} > ROTEXT
|
||||
}
|
||||
INSERT BEFORE .text;
|
||||
|
||||
SECTIONS {
|
||||
.trap : ALIGN(4)
|
||||
@ -80,12 +88,11 @@ PROVIDE(__global_pointer$ = _data_start + 0x800);
|
||||
/* end of esp32c2 fixups */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
INCLUDE "debug.x"
|
||||
@ -12,14 +12,12 @@ MEMORY
|
||||
[0x4037C000, 0x403C0000, "IRAM"]]
|
||||
*/
|
||||
|
||||
/* 272K of on soc RAM, 16K reserved for cache */
|
||||
ICACHE : ORIGIN = 0x4037C000, LENGTH = 16K
|
||||
/* Instruction RAM */
|
||||
IRAM : ORIGIN = 0x4037C000 + LENGTH(ICACHE), LENGTH = 186k
|
||||
IRAM : ORIGIN = 0x4037C000 + 16K, LENGTH = 272K - 16K
|
||||
/* Data RAM */
|
||||
DRAM : ORIGIN = 0x3FCA0000, LENGTH = 186k
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(DRAM) + LENGTH(DRAM), len = 0x3fcdeb70 - (ORIGIN(DRAM) + LENGTH(DRAM))
|
||||
DRAM : ORIGIN = 0x3FCA0000, LENGTH = 0x30000
|
||||
|
||||
/* External flash */
|
||||
/* Instruction ROM */
|
||||
18
esp-hal-common/ld/esp32c2/rom-functions.x
Normal file
18
esp-hal-common/ld/esp32c2/rom-functions.x
Normal file
@ -0,0 +1,18 @@
|
||||
PROVIDE(ets_delay_us = 0x40000044);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40000774);
|
||||
PROVIDE(rom_i2c_writeReg = 0x400022f4);
|
||||
PROVIDE(rom_i2c_writeReg_Mask = 0x400022fc);
|
||||
PROVIDE(rtc_get_reset_reason = 0x40000018);
|
||||
PROVIDE(software_reset = 0x40000088);
|
||||
PROVIDE(software_reset_cpu = 0x4000008c);
|
||||
|
||||
PROVIDE(esp_rom_crc32_be = 0x40000808);
|
||||
PROVIDE(esp_rom_crc16_be = 0x4000080c);
|
||||
PROVIDE(esp_rom_crc8_be = 0x40000810);
|
||||
PROVIDE(esp_rom_crc32_le = 0x400007fc);
|
||||
PROVIDE(esp_rom_crc16_le = 0x40000800);
|
||||
PROVIDE(esp_rom_crc8_le = 0x40000804);
|
||||
|
||||
PROVIDE(esp_rom_mbedtls_md5_starts_ret = 0x40002be4);
|
||||
PROVIDE(esp_rom_mbedtls_md5_update_ret = 0x40002be8);
|
||||
PROVIDE(esp_rom_mbedtls_md5_finish_ret = 0x40002bec);
|
||||
@ -36,6 +36,14 @@ PROVIDE(_mp_hook = default_mp_hook);
|
||||
PROVIDE(_start_trap = default_start_trap);
|
||||
|
||||
/* esp32c3 fixups */
|
||||
SECTIONS {
|
||||
.text.dummy (NOLOAD) :
|
||||
{
|
||||
/* This section is intended to make _stext address work */
|
||||
. = ABSOLUTE(_stext);
|
||||
} > ROTEXT
|
||||
}
|
||||
INSERT BEFORE .text;
|
||||
|
||||
SECTIONS {
|
||||
.trap : ALIGN(4)
|
||||
@ -80,13 +88,12 @@ PROVIDE(__global_pointer$ = _data_start + 0x800);
|
||||
/* end of esp32c3 fixups */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
INCLUDE "debug.x"
|
||||
@ -13,15 +13,14 @@ MEMORY
|
||||
[0x50000000, 0x50002000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50002000, "RTC_DRAM"],
|
||||
[0x600FE000, 0x60100000, "MEM_INTERNAL2"]]
|
||||
|
||||
*/
|
||||
/* 400K of on soc RAM, 16K reserved for cache */
|
||||
ICACHE : ORIGIN = 0x4037C000, LENGTH = 0x4000
|
||||
/* Instruction RAM */
|
||||
IRAM : ORIGIN = 0x4037C000 + 0x4000, LENGTH = 313K - 0x4000
|
||||
IRAM : ORIGIN = 0x4037C000 + 0x4000, LENGTH = 400K - 0x4000
|
||||
/* Data RAM */
|
||||
DRAM : ORIGIN = 0x3FC80000, LENGTH = 313K
|
||||
DRAM : ORIGIN = 0x3FC80000, LENGTH = 0x50000
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(DRAM) + LENGTH(DRAM), len = 0x3fcde710 - (ORIGIN(DRAM) + LENGTH(DRAM))
|
||||
|
||||
/* External flash */
|
||||
/* Instruction ROM */
|
||||
25
esp-hal-common/ld/esp32c3/rom-functions.x
Normal file
25
esp-hal-common/ld/esp32c3/rom-functions.x
Normal file
@ -0,0 +1,25 @@
|
||||
ets_printf = 0x40000040;
|
||||
PROVIDE(esp_rom_printf = ets_printf);
|
||||
PROVIDE(cache_invalidate_icache_all = 0x400004d8);
|
||||
PROVIDE(cache_suspend_icache = 0x40000524);
|
||||
PROVIDE(cache_resume_icache = 0x40000528);
|
||||
PROVIDE(cache_ibus_mmu_set = 0x40000560);
|
||||
PROVIDE(cache_dbus_mmu_set = 0x40000564);
|
||||
PROVIDE(ets_delay_us = 0x40000050);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40000588);
|
||||
PROVIDE(rom_i2c_writeReg = 0x4000195c);
|
||||
PROVIDE(rom_i2c_writeReg_Mask = 0x40001960);
|
||||
PROVIDE(rtc_get_reset_reason = 0x40000018);
|
||||
PROVIDE(software_reset = 0x40000090);
|
||||
PROVIDE(software_reset_cpu = 0x40000094);
|
||||
|
||||
PROVIDE(esp_rom_crc32_be = 0x4000062c);
|
||||
PROVIDE(esp_rom_crc16_be = 0x40000634);
|
||||
PROVIDE(esp_rom_crc8_be = 0x4000063c);
|
||||
PROVIDE(esp_rom_crc32_le = 0x40000628);
|
||||
PROVIDE(esp_rom_crc16_le = 0x40000630);
|
||||
PROVIDE(esp_rom_crc8_le = 0x40000638);
|
||||
|
||||
PROVIDE(esp_rom_md5_init = 0x40000614);
|
||||
PROVIDE(esp_rom_md5_update = 0x40000618);
|
||||
PROVIDE(esp_rom_md5_final = 0x4000061c);
|
||||
@ -72,13 +72,12 @@ INSERT BEFORE .rodata;
|
||||
/* end of esp32c6 fixups */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
INCLUDE "debug.x"
|
||||
@ -21,9 +21,6 @@ MEMORY
|
||||
*/
|
||||
RAM : ORIGIN = 0x40800000 , LENGTH = 0x6E610
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM), len = 0x4087e610 - (ORIGIN(RAM) + LENGTH(RAM))
|
||||
|
||||
/* External flash */
|
||||
/* Instruction and Data ROM */
|
||||
ROM : ORIGIN = 0x42000000 + 0x20, LENGTH = 0x400000 - 0x20
|
||||
25
esp-hal-common/ld/esp32c6/rom-functions.x
Normal file
25
esp-hal-common/ld/esp32c6/rom-functions.x
Normal file
@ -0,0 +1,25 @@
|
||||
ets_printf = 0x40000028;
|
||||
ets_update_cpu_frequency = ets_update_cpu_frequency_rom;
|
||||
PROVIDE(esp_rom_printf = ets_printf);
|
||||
PROVIDE(cache_invalidate_icache_all = 0x4000064c);
|
||||
PROVIDE(cache_suspend_icache = 0x40000698);
|
||||
PROVIDE(cache_resume_icache = 0x4000069c);
|
||||
/* TODO PROVIDE(cache_ibus_mmu_set = 0x40000560); */
|
||||
/* TODO PROVIDE(cache_dbus_mmu_set = 0x40000564); */
|
||||
PROVIDE(ets_delay_us = 0x40000040);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40000048);
|
||||
PROVIDE(rtc_get_reset_reason = 0x40000018);
|
||||
ets_update_cpu_frequency = 0x40000048;
|
||||
PROVIDE(software_reset = 0x40000090);
|
||||
PROVIDE(software_reset_cpu = 0x40000094);
|
||||
|
||||
PROVIDE(esp_rom_crc32_be = 0x40000764);
|
||||
PROVIDE(esp_rom_crc16_be = 0x40000768);
|
||||
PROVIDE(esp_rom_crc8_be = 0x4000076c);
|
||||
PROVIDE(esp_rom_crc32_le = 0x40000758);
|
||||
PROVIDE(esp_rom_crc16_le = 0x4000075c);
|
||||
PROVIDE(esp_rom_crc8_le = 0x40000760);
|
||||
|
||||
PROVIDE(esp_rom_md5_init = 0x4000074c);
|
||||
PROVIDE(esp_rom_md5_update = 0x40000750);
|
||||
PROVIDE(esp_rom_md5_final = 0x40000754);
|
||||
@ -65,13 +65,12 @@ SECTIONS {
|
||||
INSERT BEFORE .rodata;
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
INCLUDE "debug.x"
|
||||
@ -17,14 +17,11 @@ MEMORY
|
||||
|
||||
/* 320K of on soc RAM, 16K reserved for cache */
|
||||
/* Instruction and Data RAM
|
||||
0x4083EFD0 = 2nd stage bootloader iram_loader_seg start address
|
||||
0x4086E610 = 2nd stage bootloader iram_loader_seg start address
|
||||
see https://github.com/espressif/esp-idf/blob/03414a15508036c8fc0f51642aed7a264e9527df/components/esp_system/ld/esp32h2/memory.ld.in#L26
|
||||
*/
|
||||
RAM : ORIGIN = 0x40800000, LENGTH = 0x3EFD0
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM), len = 0x4084fee0 - (ORIGIN(RAM) + LENGTH(RAM))
|
||||
|
||||
/* External flash */
|
||||
/* Instruction and Data ROM */
|
||||
ROM : ORIGIN = 0x42000000, LENGTH = 0x400000
|
||||
25
esp-hal-common/ld/esp32h2/rom-functions.x
Normal file
25
esp-hal-common/ld/esp32h2/rom-functions.x
Normal file
@ -0,0 +1,25 @@
|
||||
ets_printf = 0x40000028;
|
||||
ets_update_cpu_frequency = ets_update_cpu_frequency_rom;
|
||||
PROVIDE(esp_rom_printf = ets_printf);
|
||||
PROVIDE(cache_invalidate_icache_all = 0x40000620);
|
||||
PROVIDE(cache_suspend_icache = 0x4000066c);
|
||||
PROVIDE(cache_resume_icache = 0x40000670);
|
||||
/* TODO PROVIDE(cache_ibus_mmu_set = 0x40000560); */
|
||||
/* TODO PROVIDE(cache_dbus_mmu_set = 0x40000564); */
|
||||
PROVIDE(ets_delay_us = 0x40000040);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40000048);
|
||||
PROVIDE(rtc_get_reset_reason = 0x40000018);
|
||||
ets_update_cpu_frequency = 0x40000048;
|
||||
PROVIDE(software_reset = 0x40000090);
|
||||
PROVIDE(software_reset_cpu = 0x40000094);
|
||||
|
||||
PROVIDE(esp_rom_crc32_be = 0x40000730);
|
||||
PROVIDE(esp_rom_crc16_be = 0x40000734);
|
||||
PROVIDE(esp_rom_crc8_be = 0x40000738);
|
||||
PROVIDE(esp_rom_crc32_le = 0x40000724);
|
||||
PROVIDE(esp_rom_crc16_le = 0x40000728);
|
||||
PROVIDE(esp_rom_crc8_le = 0x4000072c);
|
||||
|
||||
PROVIDE(esp_rom_md5_init = 0x40000718);
|
||||
PROVIDE(esp_rom_md5_update = 0x4000071c);
|
||||
PROVIDE(esp_rom_md5_final = 0x40000720);
|
||||
@ -8,10 +8,6 @@ PROVIDE(__zero_bss = default_mem_hook);
|
||||
PROVIDE(__init_data = default_mem_hook);
|
||||
PROVIDE(__post_init = default_post_init);
|
||||
|
||||
PROVIDE(__level_1_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_2_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_3_interrupt = handle_interrupts);
|
||||
|
||||
INCLUDE exception.x
|
||||
|
||||
/* Fixups for esp32s2 */
|
||||
@ -27,14 +23,13 @@ INCLUDE "fixups/rtc_fast_rwdata_dummy.x"
|
||||
/* End of fixups for esp32s2 */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "rtc_slow.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
EXTERN(DefaultHandler);
|
||||
@ -15,14 +15,11 @@ VECTORS_SIZE = 0x400;
|
||||
/* Specify main memory areas */
|
||||
MEMORY
|
||||
{
|
||||
vectors_seg ( RX ) : ORIGIN = 0x40020000 + RESERVE_CACHES, len = VECTORS_SIZE
|
||||
iram_seg ( RX ) : ORIGIN = 0x40020000 + RESERVE_CACHES + VECTORS_SIZE, len = 188k - RESERVE_CACHES - VECTORS_SIZE
|
||||
vectors_seg ( RX ) : ORIGIN = 0x40020000 + RESERVE_CACHES, len = VECTORS_SIZE /* SRAM0 */
|
||||
iram_seg ( RX ) : ORIGIN = 0x40020000 + RESERVE_CACHES + VECTORS_SIZE, len = 192k - RESERVE_CACHES - VECTORS_SIZE /* SRAM0 */
|
||||
|
||||
dram_seg ( RW ) : ORIGIN = 0x3FFB0000 + RESERVE_CACHES + VECTORS_SIZE, len = 188k - RESERVE_CACHES - VECTORS_SIZE
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(dram_seg) + LENGTH(dram_seg), len = 0x3ffffa10 - (ORIGIN(dram_seg) + LENGTH(dram_seg))
|
||||
|
||||
/* external flash
|
||||
The 0x20 offset is a convenience for the app binary image generation.
|
||||
Flash cache has 64KB pages. The .bin file which is flashed to the chip
|
||||
29
esp-hal-common/ld/esp32s2/rom-functions.x
Normal file
29
esp-hal-common/ld/esp32s2/rom-functions.x
Normal file
@ -0,0 +1,29 @@
|
||||
PROVIDE(ets_delay_us = 0x4000d888);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x4000d8a4);
|
||||
PROVIDE(rom_i2c_writeReg = 0x4000a9a8);
|
||||
PROVIDE(rom_i2c_writeReg_Mask = 0x4000aa00);
|
||||
PROVIDE(rtc_get_reset_reason = 0x4000ff58);
|
||||
PROVIDE(software_reset = 0x40010068);
|
||||
PROVIDE(software_reset_cpu = 0x40010080);
|
||||
|
||||
PROVIDE ( cache_dbus_mmu_set = 0x40018eb0 );
|
||||
PROVIDE ( Cache_Allocate_SRAM = 0x40018d6c );
|
||||
PROVIDE ( Cache_Invalidate_DCache_All = 0x4001842c );
|
||||
PROVIDE ( Cache_Set_DCache_Mode = 0x40018074 );
|
||||
PROVIDE ( ets_efuse_get_spiconfig = 0x4000e4a0 );
|
||||
PROVIDE ( esp_rom_efuse_get_flash_gpio_info = ets_efuse_get_spiconfig );
|
||||
PROVIDE ( esp_rom_efuse_get_flash_wp_gpio = ets_efuse_get_wp_pad );
|
||||
PROVIDE ( ets_efuse_get_wp_pad = 0x4000e444 );
|
||||
PROVIDE ( esp_rom_spiflash_select_qio_pins = SelectSpiQIO );
|
||||
PROVIDE ( SelectSpiQIO = 0x40015b88 );
|
||||
PROVIDE ( esp_rom_spi_set_op_mode = 0x400179e8 );
|
||||
PROVIDE ( esp_rom_spi_cmd_start = 0x40017ba8 );
|
||||
PROVIDE ( esp_rom_spi_cmd_config = 0x40017c58 );
|
||||
|
||||
PROVIDE(esp_rom_crc32_le = 0x400119dc);
|
||||
PROVIDE(esp_rom_crc16_le = 0x40011a10);
|
||||
PROVIDE(esp_rom_crc8_le = 0x40011a4c);
|
||||
|
||||
PROVIDE(esp_rom_md5_final = 0x4000530c);
|
||||
PROVIDE(esp_rom_md5_init = 0x4000526c);
|
||||
PROVIDE(esp_rom_md5_update = 0x4000528c);
|
||||
@ -7,10 +7,6 @@ PROVIDE(__zero_bss = default_mem_hook);
|
||||
PROVIDE(__init_data = default_mem_hook);
|
||||
PROVIDE(__post_init = default_post_init);
|
||||
|
||||
PROVIDE(__level_1_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_2_interrupt = handle_interrupts);
|
||||
PROVIDE(__level_3_interrupt = handle_interrupts);
|
||||
|
||||
INCLUDE exception.x
|
||||
|
||||
/* ESP32S3 fixups */
|
||||
@ -41,14 +37,13 @@ INCLUDE "fixups/rodata_dummy.x"
|
||||
/* End of ESP32S3 fixups */
|
||||
|
||||
/* Shared sections - ordering matters */
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "text.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rodata.x"
|
||||
INCLUDE "rwtext.x"
|
||||
INCLUDE "rwdata.x"
|
||||
INCLUDE "rtc_fast.x"
|
||||
INCLUDE "rtc_slow.x"
|
||||
INCLUDE "stack.x"
|
||||
INCLUDE "dram2.x"
|
||||
/* End of Shared sections */
|
||||
|
||||
EXTERN(DefaultHandler);
|
||||
@ -24,9 +24,6 @@ MEMORY
|
||||
iram_seg ( RX ) : ORIGIN = 0x40370000 + RESERVE_ICACHE + VECTORS_SIZE, len = 328k - VECTORS_SIZE - RESERVE_ICACHE
|
||||
dram_seg ( RW ) : ORIGIN = 0x3FC88000 , len = 345856
|
||||
|
||||
/* memory available after the 2nd stage bootloader is finished */
|
||||
dram2_seg ( RW ) : ORIGIN = ORIGIN(dram_seg) + LENGTH(dram_seg), len = 0x3fced710 - (ORIGIN(dram_seg) + LENGTH(dram_seg))
|
||||
|
||||
/* external flash
|
||||
The 0x20 offset is a convenience for the app binary image generation.
|
||||
Flash cache has 64KB pages. The .bin file which is flashed to the chip
|
||||
36
esp-hal-common/ld/esp32s3/rom-functions.x
Normal file
36
esp-hal-common/ld/esp32s3/rom-functions.x
Normal file
@ -0,0 +1,36 @@
|
||||
PROVIDE(ets_delay_us = 0x40000600);
|
||||
PROVIDE(ets_update_cpu_frequency_rom = 0x40043164);
|
||||
PROVIDE(rom_i2c_writeReg = 0x40005d60);
|
||||
PROVIDE(rom_i2c_writeReg_Mask = 0x40005d6c);
|
||||
PROVIDE(rtc_get_reset_reason = 0x4000057c);
|
||||
PROVIDE(rom_config_instruction_cache_mode = 0x40001a1c);
|
||||
PROVIDE(software_reset = 0x400006d8);
|
||||
PROVIDE(software_reset_cpu = 0x400006e4);
|
||||
PROVIDE(cache_dbus_mmu_set = 0x400019b0);
|
||||
PROVIDE(ets_efuse_get_spiconfig = 0x40001f74);
|
||||
PROVIDE(esp_rom_efuse_get_flash_gpio_info = ets_efuse_get_spiconfig);
|
||||
PROVIDE(esp_rom_efuse_get_flash_wp_gpio = ets_efuse_get_wp_pad);
|
||||
PROVIDE(esp_rom_spiflash_select_qio_pins = 0x40000a68 );
|
||||
PROVIDE(esp_rom_spi_set_op_mode = 0x400008a0 );
|
||||
PROVIDE(esp_rom_spi_cmd_start = 0x40000888);
|
||||
PROVIDE(esp_rom_spi_cmd_config = 0x4000087c);
|
||||
PROVIDE(Cache_Suspend_DCache = 0x400018b4 );
|
||||
PROVIDE(Cache_Resume_DCache = 0x400018c0 );
|
||||
PROVIDE(rom_config_data_cache_mode = 0x40001a28 );
|
||||
PROVIDE(rom_config_instruction_cache_mode = 0x40001a1c );
|
||||
PROVIDE(ets_efuse_get_wp_pad = 0x40001fa4);
|
||||
|
||||
PROVIDE(esp_rom_crc32_be = 0x40001ca4);
|
||||
PROVIDE(esp_rom_crc16_be = 0x40001cbc);
|
||||
PROVIDE(esp_rom_crc8_be = 0x40001cd4);
|
||||
PROVIDE(esp_rom_crc32_le = 0x40001c98);
|
||||
PROVIDE(esp_rom_crc16_le = 0x40001cb0);
|
||||
PROVIDE(esp_rom_crc8_le = 0x40001cc8);
|
||||
|
||||
PROVIDE(esp_rom_md5_init = 0x40001c5c);
|
||||
PROVIDE(esp_rom_md5_update = 0x40001c68);
|
||||
PROVIDE(esp_rom_md5_final = 0x40001c74);
|
||||
|
||||
PROVIDE (esp_rom_opiflash_exec_cmd = 0x400008b8);
|
||||
PROVIDE( esp_rom_spi_set_dtr_swap_mode = 0x4000093c );
|
||||
PROVIDE( esp_rom_opiflash_pin_config = 0x40000894 );
|
||||
@ -25,12 +25,10 @@ SECTIONS {
|
||||
. = ALIGN(4);
|
||||
} > RTC_FAST_RWDATA
|
||||
|
||||
.rtc_fast.persistent (NOLOAD) :
|
||||
.rtc_fast.noinit (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_rtc_fast_persistent_start = ABSOLUTE(.);
|
||||
*(.rtc_fast.persistent .rtc_fast.persistent.*)
|
||||
_rtc_fast_persistent_end = ABSOLUTE(.);
|
||||
*(.rtc_fast.noinit .rtc_fast.noinit.*)
|
||||
. = ALIGN(4);
|
||||
} > RTC_FAST_RWDATA
|
||||
}
|
||||
@ -25,12 +25,10 @@ SECTIONS {
|
||||
. = ALIGN(4);
|
||||
} > rtc_slow_seg
|
||||
|
||||
.rtc_slow.persistent (NOLOAD) :
|
||||
.rtc_slow.noinit (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_rtc_slow_persistent_start = ABSOLUTE(.);
|
||||
*(.rtc_slow.persistent .rtc_slow.persistent.*)
|
||||
_rtc_slow_persistent_end = ABSOLUTE(.);
|
||||
*(.rtc_slow.noinit .rtc_slow.noinit.*)
|
||||
. = ALIGN(4);
|
||||
} > rtc_slow_seg
|
||||
}
|
||||
@ -5,17 +5,6 @@ SECTIONS {
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
. = ALIGN (4);
|
||||
|
||||
#IF ESP_HAL_PLACE_SWITCH_TABLES_IN_RAM
|
||||
*(.rodata.*_esp_hal_internal_handler*)
|
||||
*(.rodata..Lswitch.table.*)
|
||||
*(.rodata.cst*)
|
||||
#ENDIF
|
||||
|
||||
#IF ESP_HAL_PLACE_ANON_IN_RAM
|
||||
*(.rodata..Lanon .rodata..Lanon.*)
|
||||
#ENDIF
|
||||
|
||||
*(.sdata .sdata.* .sdata2 .sdata2.*);
|
||||
*(.data .data.*);
|
||||
*(.data1)
|
||||
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
SECTIONS {
|
||||
.rwtext : ALIGN(4)
|
||||
{
|
||||
@ -34,10 +34,3 @@ PROVIDE(_stack_start = ORIGIN(RWDATA) + LENGTH(RWDATA));
|
||||
PROVIDE(_stack_start_cpu0 = ORIGIN(RWDATA) + LENGTH(RWDATA));
|
||||
|
||||
#ENDIF
|
||||
|
||||
/*
|
||||
Provide the stack_guard for `stack-protector`
|
||||
|
||||
Ideally the offset should be configurable - should be done once we have https://github.com/esp-rs/esp-hal/issues/1111
|
||||
*/
|
||||
PROVIDE(__stack_chk_guard = _stack_end + 4096);
|
||||
@ -1,7 +1,11 @@
|
||||
use crate::aes::{Aes, Aes128, Aes192, Aes256, AesFlavour, Endianness, Mode, ALIGN_SIZE};
|
||||
use crate::{
|
||||
aes::{Aes, Aes128, Aes192, Aes256, AesFlavour, Endianness, ALIGN_SIZE},
|
||||
system::{Peripheral as PeripheralEnable, PeripheralClockControl},
|
||||
};
|
||||
|
||||
impl Aes<'_> {
|
||||
impl<'d> Aes<'d> {
|
||||
pub(super) fn init(&mut self) {
|
||||
PeripheralClockControl::enable(PeripheralEnable::Aes);
|
||||
self.write_endianness(
|
||||
Endianness::BigEndian,
|
||||
Endianness::BigEndian,
|
||||
@ -16,19 +20,17 @@ impl Aes<'_> {
|
||||
let key_len = self.aes.key_iter().count();
|
||||
debug_assert!(key.len() <= key_len * ALIGN_SIZE);
|
||||
debug_assert_eq!(key.len() % ALIGN_SIZE, 0);
|
||||
self.alignment_helper
|
||||
.volatile_write_regset(self.aes.key(0).as_ptr(), key, key_len);
|
||||
Self::write_to_regset(key, key_len, self.aes.key(0).as_ptr());
|
||||
}
|
||||
|
||||
pub(super) fn write_block(&mut self, block: &[u8]) {
|
||||
let text_len = self.aes.text_iter().count();
|
||||
debug_assert_eq!(block.len(), text_len * ALIGN_SIZE);
|
||||
self.alignment_helper
|
||||
.volatile_write_regset(self.aes.text(0).as_ptr(), block, text_len);
|
||||
Self::write_to_regset(block, text_len, self.aes.text(0).as_ptr());
|
||||
}
|
||||
|
||||
pub(super) fn write_mode(&self, mode: Mode) {
|
||||
self.aes.mode().write(|w| unsafe { w.bits(mode as _) });
|
||||
pub(super) fn write_mode(&mut self, mode: u32) {
|
||||
self.aes.mode().write(|w| unsafe { w.bits(mode) });
|
||||
}
|
||||
|
||||
/// Configures how the state matrix would be laid out
|
||||
@ -51,8 +53,8 @@ impl Aes<'_> {
|
||||
self.aes.endian().write(|w| unsafe { w.bits(to_write) });
|
||||
}
|
||||
|
||||
pub(super) fn write_start(&self) {
|
||||
self.aes.start().write(|w| w.start().set_bit());
|
||||
pub(super) fn write_start(&mut self) {
|
||||
self.aes.start().write(|w| w.start().set_bit())
|
||||
}
|
||||
|
||||
pub(super) fn read_idle(&mut self) -> bool {
|
||||
@ -62,19 +64,24 @@ impl Aes<'_> {
|
||||
pub(super) fn read_block(&self, block: &mut [u8]) {
|
||||
let text_len = self.aes.text_iter().count();
|
||||
debug_assert_eq!(block.len(), text_len * ALIGN_SIZE);
|
||||
self.alignment_helper
|
||||
.volatile_read_regset(self.aes.text(0).as_ptr(), block, text_len);
|
||||
Self::read_from_regset(block, text_len, &self.aes.text(0));
|
||||
}
|
||||
}
|
||||
|
||||
impl AesFlavour for Aes128 {
|
||||
type KeyType<'b> = &'b [u8; 16];
|
||||
const ENCRYPT_MODE: u32 = 0;
|
||||
const DECRYPT_MODE: u32 = 4;
|
||||
}
|
||||
|
||||
impl AesFlavour for Aes192 {
|
||||
type KeyType<'b> = &'b [u8; 24];
|
||||
const ENCRYPT_MODE: u32 = 1;
|
||||
const DECRYPT_MODE: u32 = 5;
|
||||
}
|
||||
|
||||
impl AesFlavour for Aes256 {
|
||||
type KeyType<'b> = &'b [u8; 32];
|
||||
const ENCRYPT_MODE: u32 = 2;
|
||||
const DECRYPT_MODE: u32 = 6;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user