python /opt/esp32/esp-idf/tools/idf_monitor.py --baud 115200 --port "/dev/ttyUSB2" --toolchain-prefix "xtensa-esp32-elf-" --make "make" /u1/Projects/Esp32/hello_world/build/hello-world.elfThe monitor is a 620 line python file. Why not just use picocom as I always do? The hint is the option to read the ELF file. Why would a mere terminal emulator need to do that? Apparently it offers some curious support in terms of looking up addresses and even launching gdb. More to learn about.
The command to actually flash the chip is easy to get and is shown to us as part of the normal build process:
To flash all build output, run 'make flash' or: python /opt/esp32/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB2 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /u1/Projects/Esp32/hello_world/build/bootloader/bootloader.bin 0x10000 /u1/Projects/Esp32/hello_world/build/hello-world.bin 0x8000 /u1/Projects/Esp32/hello_world/build/partitions_singleapp.bin
Reading makefile '/opt/esp32/esp-idf/make/project.mk' Reading makefile '/opt/esp32/esp-idf/make/common.mk' Reading makefile '/opt/esp32/esp-idf/make/project_config.mk' File 'menuconfig' does not exist. Considering target file '/opt/esp32/esp-idf/tools/kconfig/mconf'. MENUCONFIGSo, "make menuconfig" is sneaky and more digging will be required. One way, give the above printout of "MENUCONFIG" is this:
cd /opt/esp32/esp-idf grep -r MENUCONFIG .This reveals that the file ./make/project_config.mk is the one of interest. This is a mere 101 line makefile (albeit with lots of dependencies). The line in question is:
$(summary) MENUCONFIGSome examination of the Makefile leads to the following directory which contains source for several programs (mconf and conf) and merits further study.
/opt/esp32/esp-idf/tools/kconfig
The blink demo gives a nice example though of a connection between menuconfig and our code. The GPIO that is used to blink the LED is configured by menuconfig and discovered as the setting of the macro CONFIG_BLINK_GPIO. The gets set in the file sdkconfig.h, which as it turns out is hiding in the directory blink/build/include/sdkconfig.h and is pulled into the program in the usual way:
#include "sdkconfig.h"
PROJECT_NAME := hello-world include $(IDF_PATH)/make/project.mkproject.mk is a 579 line monster that in turn includes other Makefiles.
Tom's Computer Info / [email protected]