You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/02/03 21:16:08 UTC

[incubator-nuttx] branch master updated (07792a6 -> 053a560)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 07792a6  RV64: handle relocation type R_RISCV_CALL_PLT in PIC build.
     new afad13d  esp32: Refactor QEMU image generation on POSTBUILD
     new 053a560  esp32: Make esp32 boards share a common Config.mk with POSTBUILD command

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 boards/xtensa/esp32/common/Kconfig                 |  6 +++
 boards/xtensa/esp32/esp32-devkitc/Kconfig          |  6 +--
 .../xtensa/esp32/esp32-devkitc/scripts/Make.defs   |  2 +-
 boards/xtensa/esp32/esp32-ethernet-kit/Kconfig     |  6 +--
 .../esp32/esp32-ethernet-kit/scripts/Config.mk     | 62 ----------------------
 .../esp32/esp32-ethernet-kit/scripts/Make.defs     |  2 +-
 boards/xtensa/esp32/esp32-wrover-kit/Kconfig       |  6 +--
 .../esp32/esp32-wrover-kit/scripts/Config.mk       | 62 ----------------------
 .../esp32/esp32-wrover-kit/scripts/Make.defs       |  2 +-
 .../scripts => tools/esp32}/Config.mk              | 22 ++++----
 tools/esp32/mk_qemu_img.sh                         | 60 +++++++++++++++++++++
 11 files changed, 81 insertions(+), 155 deletions(-)
 delete mode 100644 boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
 delete mode 100644 boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
 rename {boards/xtensa/esp32/esp32-devkitc/scripts => tools/esp32}/Config.mk (71%)
 create mode 100755 tools/esp32/mk_qemu_img.sh


[incubator-nuttx] 01/02: esp32: Refactor QEMU image generation on POSTBUILD

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit afad13dfaadb734c2e18edb968a02b29340a01ad
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Tue Feb 2 19:08:54 2021 -0300

    esp32: Refactor QEMU image generation on POSTBUILD
---
 boards/xtensa/esp32/common/Kconfig                 |  6 +++
 boards/xtensa/esp32/esp32-devkitc/Kconfig          |  6 +--
 .../xtensa/esp32/esp32-devkitc/scripts/Config.mk   | 20 +++-----
 boards/xtensa/esp32/esp32-ethernet-kit/Kconfig     |  6 +--
 .../esp32/esp32-ethernet-kit/scripts/Config.mk     | 20 +++-----
 boards/xtensa/esp32/esp32-wrover-kit/Kconfig       |  6 +--
 .../esp32/esp32-wrover-kit/scripts/Config.mk       | 20 +++-----
 tools/esp32/mk_qemu_img.sh                         | 60 ++++++++++++++++++++++
 8 files changed, 93 insertions(+), 51 deletions(-)

diff --git a/boards/xtensa/esp32/common/Kconfig b/boards/xtensa/esp32/common/Kconfig
index f72f3c0..334b83c 100644
--- a/boards/xtensa/esp32/common/Kconfig
+++ b/boards/xtensa/esp32/common/Kconfig
@@ -2,3 +2,9 @@
 # For a description of the syntax of this configuration file,
 # see the file kconfig-language.txt in the NuttX tools repository.
 #
+
+config ESP32_QEMU_IMAGE
+	bool "ESP32 binary image for QEMU"
+	default n
+	---help---
+		Create a binary flash image used for QEMU.
diff --git a/boards/xtensa/esp32/esp32-devkitc/Kconfig b/boards/xtensa/esp32/esp32-devkitc/Kconfig
index 84eff9f..48006c6 100644
--- a/boards/xtensa/esp32/esp32-devkitc/Kconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/Kconfig
@@ -38,11 +38,7 @@ config ESP32_DEVKITC_RUN_IRAM
 		allows interoperability with the esp-idf system but makes you
 		reliant on the esp-idf design for these parts. Both are possible.
 
-config ESP32_DEVKITC_FLASH_IMAGE
-	bool "esp32 flash image"
-	default n
-	---help---
-		Create flash_image.bin mainly used for QEMU.
+source boards/xtensa/esp32/common/Kconfig
 
 choice
   prompt "SPIFLASH File System"
diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk b/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
index 8b74d41..9ba9717 100644
--- a/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
+++ b/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
@@ -32,10 +32,15 @@ else
 	PARTITION_TABLE=$(IDF_PATH)/hello_world/build/partition_table/partition-table.bin
 endif
 
-ifeq ($(CONFIG_ESP32_DEVKITC_FLASH_IMAGE),y)
+ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
+	MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE) $(NUTTXNAME)
+else
+	MK_QEMU_IMG=
+endif
+
 define POSTBUILD
 	@echo "MKIMAGE: ESP32 binary"
-        $(Q) if ! esptool.py version ; then \
+	$(Q) if ! esptool.py version ; then \
 		echo ""; \
 		echo "Please install ESP-IDF tools"; \
 		echo ""; \
@@ -48,15 +53,6 @@ define POSTBUILD
 		echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
 		esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
 		echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
-		echo "Generating: flash_image.bin"; \
-		echo "  Bootloader: $(BOOTLOADER)"; \
-		echo "  Parition Table: $(PARTITION_TABLE)"; \
-		dd if=/dev/zero bs=1024 count=4096 of=flash_image.bin && \
-		dd if=$(BOOTLOADER) bs=1 seek=$(shell printf "%d" 0x1000) of=flash_image.bin conv=notrunc && \
-		dd if=$(PARTITION_TABLE) bs=1 seek=$(shell printf "%d" 0x8000) of=flash_image.bin conv=notrunc && \
-		dd if=$(NUTTXNAME).bin bs=1 seek=$(shell printf "%d" 0x10000) of=flash_image.bin conv=notrunc && \
-		echo "Generated: flash_image.bin (it can be run with 'qemu-system-xtensa -nographic -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw')"; \
-		echo "flash_image.bin" >> $(NUTTXNAME).manifest; \
 	fi
+	$(MK_QEMU_IMG)
 endef
-endif
diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/Kconfig b/boards/xtensa/esp32/esp32-ethernet-kit/Kconfig
index 8605747..6b4f996 100644
--- a/boards/xtensa/esp32/esp32-ethernet-kit/Kconfig
+++ b/boards/xtensa/esp32/esp32-ethernet-kit/Kconfig
@@ -38,10 +38,6 @@ config ESP32_ETHERNETKIT_RUN_IRAM
 		allows interoperability with the esp-idf system but makes you
 		reliant on the esp-idf design for these parts. Both are possible.
 
-config ESP32_ETHERNETKIT_FLASH_IMAGE
-	bool "esp32 flash image"
-	default n
-	---help---
-		Create flash_image.bin mainly used for QEMU.
+source boards/xtensa/esp32/common/Kconfig
 
 endif # ARCH_BOARD_ESP32_ETHERNETKIT
diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
index 11397d9..6891b49 100644
--- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
+++ b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
@@ -32,10 +32,15 @@ else
 	PARTITION_TABLE=$(IDF_PATH)/hello_world/build/partition_table/partition-table.bin
 endif
 
-ifeq ($(CONFIG_ESP32_ETHERNETKIT_FLASH_IMAGE),y)
+ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
+	MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE) $(NUTTXNAME)
+else
+	MK_QEMU_IMG=
+endif
+
 define POSTBUILD
 	@echo "MKIMAGE: ESP32 binary"
-        $(Q) if ! esptool.py version ; then \
+	$(Q) if ! esptool.py version ; then \
 		echo ""; \
 		echo "Please install ESP-IDF tools"; \
 		echo ""; \
@@ -48,15 +53,6 @@ define POSTBUILD
 		echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
 		esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
 		echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
-		echo "Generating: flash_image.bin"; \
-		echo "  Bootloader: $(BOOTLOADER)"; \
-		echo "  Parition Table: $(PARTITION_TABLE)"; \
-		dd if=/dev/zero bs=1024 count=4096 of=flash_image.bin && \
-		dd if=$(BOOTLOADER) bs=1 seek=$(shell printf "%d" 0x1000) of=flash_image.bin conv=notrunc && \
-		dd if=$(PARTITION_TABLE) bs=1 seek=$(shell printf "%d" 0x8000) of=flash_image.bin conv=notrunc && \
-		dd if=$(NUTTXNAME).bin bs=1 seek=$(shell printf "%d" 0x10000) of=flash_image.bin conv=notrunc && \
-		echo "Generated: flash_image.bin (it can be run with 'qemu-system-xtensa -nographic -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw')"; \
-		echo "flash_image.bin" >> $(NUTTXNAME).manifest; \
 	fi
+	$(MK_QEMU_IMG)
 endef
-endif
diff --git a/boards/xtensa/esp32/esp32-wrover-kit/Kconfig b/boards/xtensa/esp32/esp32-wrover-kit/Kconfig
index a06be3c..6e16fb8 100644
--- a/boards/xtensa/esp32/esp32-wrover-kit/Kconfig
+++ b/boards/xtensa/esp32/esp32-wrover-kit/Kconfig
@@ -38,10 +38,6 @@ config ESP32_WROVERKIT_RUN_IRAM
 		allows interoperability with the esp-idf system but makes you
 		reliant on the esp-idf design for these parts. Both are possible.
 
-config ESP32_WROVERKIT_FLASH_IMAGE
-	bool "esp32 flash image"
-	default n
-	---help---
-		Create flash_image.bin mainly used for QEMU.
+source boards/xtensa/esp32/common/Kconfig
 
 endif # ARCH_BOARD_ESP32_WROVERKIT
diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
index cec7497..428c35f 100644
--- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
+++ b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
@@ -32,10 +32,15 @@ else
 	PARTITION_TABLE=$(IDF_PATH)/hello_world/build/partition_table/partition-table.bin
 endif
 
-ifeq ($(CONFIG_ESP32_WROVERKIT_FLASH_IMAGE),y)
+ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
+	MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE) $(NUTTXNAME)
+else
+	MK_QEMU_IMG=
+endif
+
 define POSTBUILD
 	@echo "MKIMAGE: ESP32 binary"
-        $(Q) if ! esptool.py version ; then \
+	$(Q) if ! esptool.py version ; then \
 		echo ""; \
 		echo "Please install ESP-IDF tools"; \
 		echo ""; \
@@ -48,15 +53,6 @@ define POSTBUILD
 		echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
 		esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
 		echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
-		echo "Generating: flash_image.bin"; \
-		echo "  Bootloader: $(BOOTLOADER)"; \
-		echo "  Parition Table: $(PARTITION_TABLE)"; \
-		dd if=/dev/zero bs=1024 count=4096 of=flash_image.bin && \
-		dd if=$(BOOTLOADER) bs=1 seek=$(shell printf "%d" 0x1000) of=flash_image.bin conv=notrunc && \
-		dd if=$(PARTITION_TABLE) bs=1 seek=$(shell printf "%d" 0x8000) of=flash_image.bin conv=notrunc && \
-		dd if=$(NUTTXNAME).bin bs=1 seek=$(shell printf "%d" 0x10000) of=flash_image.bin conv=notrunc && \
-		echo "Generated: flash_image.bin (it can be run with 'qemu-system-xtensa -nographic -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw')"; \
-		echo "flash_image.bin" >> $(NUTTXNAME).manifest; \
 	fi
+	$(MK_QEMU_IMG)
 endef
-endif
diff --git a/tools/esp32/mk_qemu_img.sh b/tools/esp32/mk_qemu_img.sh
new file mode 100755
index 0000000..2e81360
--- /dev/null
+++ b/tools/esp32/mk_qemu_img.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+############################################################################
+# tools/esp32/mk_qemu_img.sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+SCRIPT_NAME=$(basename "${0}")
+USAGE="USAGE: ${SCRIPT_NAME} <bootloader_img> <partition_table_img> [nuttx_name]"
+
+# Make sure we have the required argument(s)
+
+if [ -z "${1}" ] || [ -z "${2}" ] ; then
+  printf "%s requires the bootloader and partition table binary images.\n " "${SCRIPT_NAME}"
+  printf "%s\n " "${USAGE}"
+  exit 1
+fi
+
+BOOTLOADER=${1}
+PARTITION_TABLE=${2}
+NUTTXNAME=${3}
+
+if [ -z "${NUTTXNAME}" ]; then
+  NUTTXNAME="nuttx"
+  printf "NUTTXNAME not provided, assuming \"%s\".\n" "${NUTTXNAME}"
+fi
+
+printf "Generating esp32_qemu_image.bin...\n"
+printf "\tBootloader: %s\n" "${BOOTLOADER}"
+printf "\tPartition Table: %s\n" "${PARTITION_TABLE}"
+
+dd if=/dev/zero bs=1024 count=4096 of=esp32_qemu_image.bin && \
+  dd if="${BOOTLOADER}" bs=1 seek="$(printf '%d' 0x1000)" of=esp32_qemu_image.bin conv=notrunc && \
+  dd if="${PARTITION_TABLE}" bs=1 seek="$(printf '%d' 0x8000)" of=esp32_qemu_image.bin conv=notrunc && \
+  dd if="${NUTTXNAME}".bin bs=1 seek="$(printf '%d' 0x10000)" of=esp32_qemu_image.bin conv=notrunc
+
+if [ ${?} -ne 0 ]; then
+  printf "Failed to generate esp32_qemu_image.bin.\n"
+  exit 1
+fi
+
+printf "Generated esp32_qemu_image.bin successfully!\n"
+printf "You can use QEMU for executing it with the following command line:\n"
+printf "\tqemu-system-xtensa -nographic -machine esp32 -drive file=esp32_qemu_image.bin,if=mtd,format=raw\n"
+
+echo "esp32_qemu_image.bin" >> "${NUTTXNAME}".manifest


[incubator-nuttx] 02/02: esp32: Make esp32 boards share a common Config.mk with POSTBUILD command

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 053a560aa127599f151815bc8f7664f1471562f6
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Wed Feb 3 11:55:59 2021 -0300

    esp32: Make esp32 boards share a common Config.mk with POSTBUILD command
---
 .../xtensa/esp32/esp32-devkitc/scripts/Make.defs   |  2 +-
 .../esp32/esp32-ethernet-kit/scripts/Config.mk     | 58 ----------------------
 .../esp32/esp32-ethernet-kit/scripts/Make.defs     |  2 +-
 .../esp32/esp32-wrover-kit/scripts/Config.mk       | 58 ----------------------
 .../esp32/esp32-wrover-kit/scripts/Make.defs       |  2 +-
 .../scripts => tools/esp32}/Config.mk              |  2 +-
 6 files changed, 4 insertions(+), 120 deletions(-)

diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
index 669ca47..0b4d7f6 100644
--- a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
+++ b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
@@ -35,7 +35,7 @@
 
 include $(TOPDIR)/.config
 include $(TOPDIR)/tools/Config.mk
-include $(TOPDIR)/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
+include $(TOPDIR)/tools/esp32/Config.mk
 include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
 
 LDSCRIPT1 = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
deleted file mode 100644
index 6891b49..0000000
--- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-############################################################################
-# boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-# These are the macros that will be used in the NuttX make system to compile
-# and assemble source files and to insert the resulting object files into an
-# archive.  These replace the default definitions at tools/Config.mk
-
-# POSTBUILD -- Perform post build operations
-
-ifdef BLOBDIR
-	BOOTLOADER=${BLOBDIR}/esp32core/bootloader.bin
-	PARTITION_TABLE=${BLOBDIR}/esp32core/partition-table.bin
-else
-	BOOTLOADER=$(IDF_PATH)/hello_world/build/bootloader/bootloader.bin
-	PARTITION_TABLE=$(IDF_PATH)/hello_world/build/partition_table/partition-table.bin
-endif
-
-ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
-	MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE) $(NUTTXNAME)
-else
-	MK_QEMU_IMG=
-endif
-
-define POSTBUILD
-	@echo "MKIMAGE: ESP32 binary"
-	$(Q) if ! esptool.py version ; then \
-		echo ""; \
-		echo "Please install ESP-IDF tools"; \
-		echo ""; \
-		echo "Check https://docs.espressif.com/projects/esp-idf/en/v4.0/get-started/index.html#installation-step-by-step or run the following command"; \
-		echo ""; \
-		echo "cd tools/esp32 && make && cd ../.."; \
-		echo ""; \
-		echo "run make again to create the nuttx.bin image."; \
-	else \
-		echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
-		esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
-		echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
-	fi
-	$(MK_QEMU_IMG)
-endef
diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs
index f5df0f3..920c9c4 100644
--- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs
+++ b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs
@@ -20,7 +20,7 @@
 
 include $(TOPDIR)/.config
 include $(TOPDIR)/tools/Config.mk
-include $(TOPDIR)/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Config.mk
+include $(TOPDIR)/tools/esp32/Config.mk
 include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
 
 LDSCRIPT1 = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
deleted file mode 100644
index 428c35f..0000000
--- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-############################################################################
-# boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-# These are the macros that will be used in the NuttX make system to compile
-# and assemble source files and to insert the resulting object files into an
-# archive.  These replace the default definitions at tools/Config.mk
-
-# POSTBUILD -- Perform post build operations
-
-ifdef BLOBDIR
-	BOOTLOADER=${BLOBDIR}/esp32core/bootloader.bin
-	PARTITION_TABLE=${BLOBDIR}/esp32core/partition-table.bin
-else
-	BOOTLOADER=$(IDF_PATH)/hello_world/build/bootloader/bootloader.bin
-	PARTITION_TABLE=$(IDF_PATH)/hello_world/build/partition_table/partition-table.bin
-endif
-
-ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
-	MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE) $(NUTTXNAME)
-else
-	MK_QEMU_IMG=
-endif
-
-define POSTBUILD
-	@echo "MKIMAGE: ESP32 binary"
-	$(Q) if ! esptool.py version ; then \
-		echo ""; \
-		echo "Please install ESP-IDF tools"; \
-		echo ""; \
-		echo "Check https://docs.espressif.com/projects/esp-idf/en/v4.0/get-started/index.html#installation-step-by-step or run the following command"; \
-		echo ""; \
-		echo "cd tools/esp32 && make && cd ../.."; \
-		echo ""; \
-		echo "run make again to create the nuttx.bin image."; \
-	else \
-		echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
-		esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
-		echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
-	fi
-	$(MK_QEMU_IMG)
-endef
diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs
index 09406c3..1ec0f24 100644
--- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs
+++ b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs
@@ -20,7 +20,7 @@
 
 include $(TOPDIR)/.config
 include $(TOPDIR)/tools/Config.mk
-include $(TOPDIR)/boards/xtensa/esp32/esp32-wrover-kit/scripts/Config.mk
+include $(TOPDIR)/tools/esp32/Config.mk
 include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
 
 LDSCRIPT1 = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk b/tools/esp32/Config.mk
similarity index 97%
rename from boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
rename to tools/esp32/Config.mk
index 9ba9717..04b63b6 100644
--- a/boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
+++ b/tools/esp32/Config.mk
@@ -1,5 +1,5 @@
 ############################################################################
-# boards/xtensa/esp32/esp32-devkitc/scripts/Config.mk
+# tools/esp32/Config.mk
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with