From db85fedbafd4fbaea01fa5e2e55f8574e1dd24e4 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Tue, 3 Mar 2026 20:55:04 -0600 Subject: [PATCH] riscv: Add support for Espressif Direct Boot This adds the ability to generate a binary image with an Espressif Direct Boot header. --- bsps/riscv/shared/start/start.S | 10 ++++++++++ .../bsps/riscv/optespressifdirectboot.yml | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 spec/build/bsps/riscv/optespressifdirectboot.yml diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S index 912a4967bc..468767647f 100644 --- a/bsps/riscv/shared/start/start.S +++ b/bsps/riscv/shared/start/start.S @@ -42,6 +42,16 @@ PUBLIC(_start) .option arch, +zicsr .option norelax +#ifdef ESPRESSIF_DIRECT_BOOT +/* + * These header values indicate to the ESP32 bootrom that the application in + * flash is to be run via direct boot and is not an application image to be + * unpacked. + */ + .word 0xaedb041d + .word 0xaedb041d +#endif + TYPE_FUNC(_start) SYM(_start): diff --git a/spec/build/bsps/riscv/optespressifdirectboot.yml b/spec/build/bsps/riscv/optespressifdirectboot.yml new file mode 100644 index 0000000000..7d62a80c3f --- /dev/null +++ b/spec/build/bsps/riscv/optespressifdirectboot.yml @@ -0,0 +1,19 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-boolean: null +- env-enable: null +- define-condition: null +build-type: option +copyrights: +- Copyright (C) 2026 Kinsey Moore +default: +- enabled-by: riscv/esp32c3db + value: true +- enabled-by: true + value: false +description: | + Enable direct boot for Espressif chips +enabled-by: true +links: [] +name: ESPRESSIF_DIRECT_BOOT +type: build