Skip to content

Instantly share code, notes, and snippets.

@adahl5
Created July 27, 2020 22:24
Show Gist options
  • Save adahl5/40db59015e682173e4452d523eac321d to your computer and use it in GitHub Desktop.
Save adahl5/40db59015e682173e4452d523eac321d to your computer and use it in GitHub Desktop.
# Location of top-level MicroPython directory
ESP_IDF_DIR = $HOME/esp/esp-idf/
# Name of module
MOD = test
# Source files (.c or .py)
SRC = test.c
# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin)
ARCH = xtensawin
BUILD = build
ESPIDFMOD_MODULE = $(BUILD)/espidfmod/test.c
ESPIDFMOD_PP = $(BUILD)/espidfmod/test.pp.c
ESPIDFMOD_SOURCE = ./test.h
SDKCONFIG_H = ./sdkconfig.h
# paths to ESP IDF and its components
ifeq ($(ESPIDF),)
ifneq ($(IDF_PATH),)
ESPIDF = $(IDF_PATH)
else
$(info The ESPIDF variable has not been set, please set it to the root of the esp-idf repository.)
$(info See README.md for installation instructions.)
dummy := $(call print_supported_git_hash)
$(error ESPIDF not set)
endif
endif
CONFIG_BT_NIMBLE_ENABLED = 1
ESPCOMP = $(ESPIDF)/components
INC_ESPCOMP += -I$(ESPCOMP)/bootloader_support/include
INC_ESPCOMP += -I$(ESPCOMP)/bootloader_support/include_bootloader
INC_ESPCOMP += -I$(ESPCOMP)/console
INC_ESPCOMP += -I$(ESPCOMP)/driver/include
INC_ESPCOMP += -I$(ESPCOMP)/driver/include/driver
INC_ESPCOMP += -I$(ESPCOMP)/efuse/include
INC_ESPCOMP += -I$(ESPCOMP)/efuse/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/espcoredump/include
INC_ESPCOMP += -I$(ESPCOMP)/soc/include
INC_ESPCOMP += -I$(ESPCOMP)/soc/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/heap/include
INC_ESPCOMP += -I$(ESPCOMP)/log/include
INC_ESPCOMP += -I$(ESPCOMP)/nvs_flash/include
INC_ESPCOMP += -I$(ESPCOMP)/freertos/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_ringbuf/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_event/include
INC_ESPCOMP += -I$(ESPCOMP)/tcpip_adapter/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/lwip/src/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/port/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/apps
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/apps/sntp
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/mbedtls/include
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/port/include
INC_ESPCOMP += -I$(ESPCOMP)/mdns/include
INC_ESPCOMP += -I$(ESPCOMP)/mdns/private_include
INC_ESPCOMP += -I$(ESPCOMP)/spi_flash/include
INC_ESPCOMP += -I$(ESPCOMP)/ulp/include
INC_ESPCOMP += -I$(ESPCOMP)/vfs/include
INC_ESPCOMP += -I$(ESPCOMP)/xtensa-debug-module/include
INC_ESPCOMP += -I$(ESPCOMP)/wpa_supplicant/include
INC_ESPCOMP += -I$(ESPCOMP)/wpa_supplicant/port/include
INC_ESPCOMP += -I$(ESPCOMP)/app_trace/include
INC_ESPCOMP += -I$(ESPCOMP)/app_update/include
INC_ESPCOMP += -I$(ESPCOMP)/pthread/include
INC_ESPCOMP += -I$(ESPCOMP)/smartconfig_ack/include
INC_ESPCOMP += -I$(ESPCOMP)/sdmmc/include
INC_ESPCOMP += -I$(ESPCOMP)/esp32-camera/driver/include
INC_ESPCOMP += -I$(ESPCOMP)/esp32-camera/conversions/include
ifeq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH_V4))
INC_ESPCOMP += -I$(ESPCOMP)/esp_common/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_eth/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_event/private_include
INC_ESPCOMP += -I$(ESPCOMP)/esp_rom/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_wifi/include
INC_ESPCOMP += -I$(ESPCOMP)/esp_wifi/esp32/include
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/apps/sntp
INC_ESPCOMP += -I$(ESPCOMP)/spi_flash/private_include
INC_ESPCOMP += -I$(ESPCOMP)/wpa_supplicant/include/esp_supplicant
INC_ESPCOMP += -I$(ESPCOMP)/xtensa/include
INC_ESPCOMP += -I$(ESPCOMP)/xtensa/esp32/include
ifeq ($(CONFIG_BT_NIMBLE_ENABLED),y)
INC_ESPCOMP += -I$(ESPCOMP)/bt/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/common/osi/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/common/btc/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/common/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/porting/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/port/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/ans/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/bas/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/gap/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/gatt/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/ias/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/lls/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/services/tps/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/util/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/store/ram/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/nimble/host/store/config/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/porting/npl/freertos/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/nimble/ext/tinycrypt/include
INC_ESPCOMP += -I$(ESPCOMP)/bt/host/nimble/esp-hci/include
endif
else
INC_ESPCOMP += -I$(ESPCOMP)/ethernet/include
INC_ESPCOMP += -I$(ESPCOMP)/expat/expat/expat/lib
INC_ESPCOMP += -I$(ESPCOMP)/expat/port/include
INC_ESPCOMP += -I$(ESPCOMP)/json/include
INC_ESPCOMP += -I$(ESPCOMP)/json/port/include
INC_ESPCOMP += -I$(ESPCOMP)/micro-ecc/micro-ecc
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/port/include
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/nghttp2/lib/includes
ifeq ($(CONFIG_NIMBLE_ENABLED),y)
INC_ESPCOMP += -I$(ESPCOMP)/bt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/porting/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/port/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/ans/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/bas/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/gap/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/gatt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/ias/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/lls/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/services/tps/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/util/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/store/ram/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/nimble/host/store/config/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/porting/npl/freertos/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/nimble/ext/tinycrypt/include
INC_ESPCOMP += -I$(ESPCOMP)/nimble/esp-hci/include
endif
endif
ALL_ESPIDFMOD_SRC = $(shell find $(subst -I,,$(INC_ESPCOMP)) -type f) $(ESPIDFMOD_SOURCE) $(SDKCONFIG_H)
INC += -I.
INC += -I$(TOP)
INC += -I$(TOP)/lib/mp-readline
INC += -I$(TOP)/lib/netutils
INC += -I$(TOP)/lib/timeutils
INC += -I$(BUILD)
INC += -I/Users/adam/Downloads/pycparser-e1a1d737be66308b633215fa26ac5ed30e890103/utils/fake_libc_include
INC += -I/Users/adam/esp/xtensa-esp32-elf/xtensa-esp32-elf/include
INC += -I/Users/adam/Documents/Development/microPython/project/micropython
INC += -I/Users/adam/Documents/Development/microPython/project/micropython/ports/esp32/boards/GENERIC
INC += -I/Users/adam/Documents/Development/microPython/project/micropython/ports/esp32
INC += -I/Users/adam/Documents/Development/microPython/project/micropython/ports/esp32/build-GENERIC
$(ESPIDFMOD_MODULE): $(ALL_ESPIDFMOD_SRC) ../../gen/gen_mpy.py
$(info ESPIDFMOD-GEN $@)
mkdir -p $(dir $@)
/Users/adam/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-cpp -DPYCPARSER -nostdinc -w -Wno-deprecated-declarations $(INC_ESPCOMP) $(INC) ./test.h >> $(ESPIDFMOD_PP)
python3 ../../gen/gen_mpy.py $(INC_ESPCOMP) $(CFLAGS) -M $(MOD) -MP $(MOD) -E $(ESPIDFMOD_PP) ./test.h > $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment