nuttx/tools/esp32/Config.mk

55 lines
2.1 KiB
Makefile
Raw Normal View History

2020-03-19 12:22:36 +01:00
############################################################################
# tools/esp32/Config.mk
2020-03-19 12:22:36 +01: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
# and assemble source files and to insert the resulting object files into an
2020-03-19 12:22:36 +01:00
# 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
2020-03-19 12:22:36 +01:00
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
2020-03-19 12:22:36 +01:00
define POSTBUILD
$(Q)echo "MKIMAGE: ESP32 binary"
$(Q) if ! esptool.py version 1>/dev/null 2>&1; then \
2020-03-19 12:22:36 +01:00
echo ""; \
echo "esptool.py not found. Please run: \"pip install esptool.py\""; \
echo "Or run: \"make -C tools/esp32\" to install all IDF tools."; \
2020-03-19 12:22:36 +01:00
echo ""; \
echo "Run make again to create the nuttx.bin image."; \
2020-03-19 12:22:36 +01:00
else \
esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o $(NUTTXNAME).bin nuttx; \
2020-03-19 12:22:36 +01:00
echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
fi
$(MK_QEMU_IMG)
2020-03-19 12:22:36 +01:00
endef