2020-03-19 19:22:36 +08:00
|
|
|
############################################################################
|
2021-02-03 22:55:59 +08:00
|
|
|
# tools/esp32/Config.mk
|
2020-03-19 19:22:36 +08:00
|
|
|
#
|
|
|
|
# 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
|
2020-08-27 19:41:30 +08:00
|
|
|
# and assemble source files and to insert the resulting object files into an
|
2020-03-19 19:22:36 +08:00
|
|
|
# archive. These replace the default definitions at tools/Config.mk
|
|
|
|
|
|
|
|
# POSTBUILD -- Perform post build operations
|
2020-08-27 19:41:30 +08:00
|
|
|
|
2020-03-23 05:47:51 +08:00
|
|
|
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
|
2020-03-19 19:22:36 +08:00
|
|
|
|
2021-02-04 09:01:44 +08:00
|
|
|
ifeq ($(CONFIG_ESP32_FLASH_2M),y)
|
|
|
|
FLASH_SIZE="2MB"
|
|
|
|
else ifeq ($(CONFIG_ESP32_FLASH_4M),y)
|
|
|
|
FLASH_SIZE="4MB"
|
|
|
|
else ifeq ($(CONFIG_ESP32_FLASH_8M),y)
|
|
|
|
FLASH_SIZE="8MB"
|
|
|
|
else ifeq ($(CONFIG_ESP32_FLASH_16M),y)
|
|
|
|
FLASH_SIZE="16MB"
|
|
|
|
endif
|
|
|
|
|
2021-02-03 06:08:54 +08:00
|
|
|
ifeq ($(CONFIG_ESP32_QEMU_IMAGE),y)
|
2021-02-05 05:41:01 +08:00
|
|
|
MK_QEMU_IMG=$(TOPDIR)/tools/esp32/mk_qemu_img.sh $(BOOTLOADER) $(PARTITION_TABLE)
|
2021-02-03 06:08:54 +08:00
|
|
|
else
|
|
|
|
MK_QEMU_IMG=
|
|
|
|
endif
|
|
|
|
|
2020-03-19 19:22:36 +08:00
|
|
|
define POSTBUILD
|
2021-02-04 09:01:44 +08:00
|
|
|
$(Q) echo "MKIMAGE: ESP32 binary"
|
2021-02-04 06:12:14 +08:00
|
|
|
$(Q) if ! esptool.py version 1>/dev/null 2>&1; then \
|
2020-03-19 19:22:36 +08:00
|
|
|
echo ""; \
|
2021-02-04 06:12:14 +08:00
|
|
|
echo "esptool.py not found. Please run: \"pip install esptool.py\""; \
|
2021-02-04 09:01:44 +08:00
|
|
|
echo "Or run: \"make -C $(TOPDIR)/tools/esp32\" to install all IDF tools."; \
|
2020-03-19 19:22:36 +08:00
|
|
|
echo ""; \
|
2021-02-04 06:12:14 +08:00
|
|
|
echo "Run make again to create the nuttx.bin image."; \
|
2021-02-05 03:18:32 +08:00
|
|
|
exit 1; \
|
2020-03-19 19:22:36 +08:00
|
|
|
else \
|
2021-02-04 09:01:44 +08:00
|
|
|
if [ -z $(FLASH_SIZE) ]; then \
|
|
|
|
echo "Missing Flash memory size configuration for the ESP32 chip."; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
esptool.py --chip esp32 elf2image --flash_mode dio --flash_size $(FLASH_SIZE) -o nuttx.bin nuttx; \
|
2021-02-05 05:41:01 +08:00
|
|
|
echo "Generated: nuttx.bin (ESP32 compatible)"; \
|
2020-03-19 19:22:36 +08:00
|
|
|
fi
|
2021-02-04 09:01:44 +08:00
|
|
|
$(Q) $(MK_QEMU_IMG)
|
2020-03-19 19:22:36 +08:00
|
|
|
endef
|