From 5f8c058539b471281ef87d4af6279a41166098eb Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 8 Jul 2024 16:58:22 +0100 Subject: [PATCH] Attempt to build C3 binary with GitHub actions --- .github/workflows/build.yml | 2 +- make/targets/ESP32_IDF4.make | 21 +++++++++++++++------ targets/esp32/README_flash_C3.txt | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 targets/esp32/README_flash_C3.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2ea7e026e..f8e56291d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: strategy: # devices to build for matrix: - board: [LINUX, ESP32, ESP8266_BOARD, ESP8266_4MB, MICROBIT1, MICROBIT2] + board: [LINUX, ESP32, ESP8266_BOARD, ESP8266_4MB, MICROBIT1, MICROBIT2, ESP32C3_IDF4] # try and build for all devices even if one fails fail-fast: false steps: diff --git a/make/targets/ESP32_IDF4.make b/make/targets/ESP32_IDF4.make index 21e7b4dc42..a6e32331aa 100644 --- a/make/targets/ESP32_IDF4.make +++ b/make/targets/ESP32_IDF4.make @@ -43,15 +43,24 @@ $(CMAKEFILE): $(PROJ_NAME).bin: $(CMAKEFILE) $(PLATFORM_CONFIG_FILE) $(PININFOFILE).h $(PININFOFILE).c $(WRAPPERFILE) - cp ${ROOT}/targets/esp32/IDF4/${SDKCONFIG} $(BINDIR)/sdkconfig - cp ${ROOT}/targets/esp32/IDF4/CMakeLists.txt $(BINDIR) - cp ${ROOT}/targets/esp32/IDF4/partitions.csv $(BINDIR) + $(Q)cp ${ROOT}/targets/esp32/IDF4/${SDKCONFIG} $(BINDIR)/sdkconfig + $(Q)cp ${ROOT}/targets/esp32/IDF4/CMakeLists.txt $(BINDIR) + $(Q)cp ${ROOT}/targets/esp32/IDF4/partitions.csv $(BINDIR) cd $(BINDIR) && idf.py build + $(Q)cp $(BINDIR)/build/espruino.bin $(PROJ_NAME).bin -#$(ESP_ZIP): $(PROJ_NAME).bin +$(ESP_ZIP): $(PROJ_NAME).bin + $(Q)rm -rf $(PROJ_NAME) + $(Q)mkdir -p $(PROJ_NAME) + $(Q)cp $(PROJ_NAME).bin $(PROJ_NAME)/espruino-esp32c3.bin + $(Q)cp $(BINDIR)/build/partition_table/partition-table.bin $(PROJ_NAME)/partition-table.bin + $(Q)cp $(BINDIR)/build/bootloader/bootloader.bin $(PROJ_NAME)/bootloader.bin + $(Q)cp targets/esp32/README_flash_C3.txt $(PROJ_NAME) + $(Q)$(TAR) -zcf $(ESP_ZIP) $(PROJ_NAME) --transform='s/$(PROJ_NAME)\///g' + @echo "Created $(ESP_ZIP)" -proj: $(PROJ_NAME).bin -#depend on $(ESP_ZIP) +proj: $(ESP_ZIP) +#depend on $(PROJ_NAME).bin flash: $(PROJ_NAME).bin cd $(BINDIR) && idf.py flash -p $(PORT) diff --git a/targets/esp32/README_flash_C3.txt b/targets/esp32/README_flash_C3.txt new file mode 100644 index 0000000000..dbe12799cb --- /dev/null +++ b/targets/esp32/README_flash_C3.txt @@ -0,0 +1,16 @@ +How to flash Espruino ESP32C3 +=========================== + +To flash an ESP32 using the serial port use: + +``` +esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset \ + --chip esp32c3 write_flash \ + --flash_mode dio --flash_size detect --flash_freq 80m \ + 0x0 bootloader.bin \ + 0x8000 partition-table.bin \ + 0x10000 espruino-esp32c3.bin +``` + +On Windows, you can use the flash tools from espressif found here: +http://espressif.com/sites/default/files/tools/flash_download_tools_v3.4.4.zip