Skip to content

Commit

Permalink
Merge pull request apache#16 from midokura/feature/sdc-integration-ge…
Browse files Browse the repository at this point in the history
…nnerat-images-devkit

Feature/sdc integration generation images for devkit
  • Loading branch information
royfengsss authored Jun 5, 2020
2 parents e899bc9 + e61f31f commit 6295f93
Show file tree
Hide file tree
Showing 9 changed files with 4,052 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tools/esp32/esptool"]
path = tools/esp32/esptool
url = https://github.com/espressif/esptool.git
8 changes: 8 additions & 0 deletions boards/xtensa/esp32/esp32-core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ config ESP32CORE_FLASH_IMAGE
---help---
Create flash_image.bin mainly used for QEMU.

config ESP32CORE_FLASH_IMAGES_DEVKIT
depends on !ESP32CORE_FLASH_IMAGE
bool "Create esp32 flash images for DevKit"
default n
---help---
Create 3 flash images(nuttx.bin, bootloader.bin and partitions.bin)
for ESP32 DevKit HW.

endif # ARCH_BOARD_ESP32CORE
50 changes: 50 additions & 0 deletions boards/xtensa/esp32/esp32-core/scripts/Config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
# archive. These replace the default definitions at tools/Config.mk

# POSTBUILD -- Perform post build operations
# Product configuration: Build and download
DOWNLOAD_PARAM_PORT=/dev/ttyUSB0
DOWNLOAD_PARAM_BAUD=115200
DOWNLOAD_PARAM_BEFORE=default_reset
DOWNLOAD_PARAM_AFTER=hard_reset
DOWNLOAD_PARAM_FLASH_MODE=dio # choose from 'keep','qio','qout','dio','dout'
DOWNLOAD_PARAM_FLASH_FREQ=40m #choose from 'keep', '40m', '26m', '20m', '80m'
DOWNLOAD_PARAM_FLASH_SIZE=4MB #For DevKitC
DOWNLOAD_PARAM_BOOTLOADER_OFFSET=0x1000
DOWNLOAD_PARAM_PARTITION_OFFSET=0x8000
DOWNLOAD_PARAM_APP_OFFSET=0x10000
PARTITION_TABLE_PARAM_FLASH_SIZE=$(DOWNLOAD_PARAM_FLASH_SIZE)
PARTITION_TABLE_PARAM_OFFSET=$(DOWNLOAD_PARAM_PARTITION_OFFSET)
BOOTLOADER_BLOB_DIRECT_COPY=$(TOPDIR)/tools/esp32/blob/bootloader/bootloader.bin

ifdef BLOBDIR
BOOTLOADER=${BLOBDIR}/esp32core/bootloader.bin
PARTITION_TABLE=${BLOBDIR}/esp32core/partition-table.bin
Expand Down Expand Up @@ -58,3 +73,38 @@ define POSTBUILD
fi
endef
endif

ifeq ($(CONFIG_ESP32CORE_FLASH_IMAGES_DEVKIT),y)
define POSTBUILD
@echo "MKIMAGE: ESP32 binary"; \
echo "Generating: $(NUTTXNAME).bin (ESP32 compatible)"; \
python tools/esp32/esptool/esptool.py --chip esp32 elf2image --flash_mode dio --flash_size $(DOWNLOAD_PARAM_FLASH_SIZE) -o $(NUTTXNAME).bin nuttx; \
echo "Generated: $(NUTTXNAME).bin (ESP32 compatible)"; \
echo " Copying bootloader from $(BOOTLOADER_BLOB_DIRECT_COPY) directly ..."; \
cp $(BOOTLOADER_BLOB_DIRECT_COPY) ./bootloader.bin; \
echo " Generating parition table from csv ..."; \
python tools/esp32/partitions/gen_esp32part.py -q --flash-size $(PARTITION_TABLE_PARAM_FLASH_SIZE) --offset $(PARTITION_TABLE_PARAM_OFFSET) tools/esp32/partitions/partitions.csv ./partitions.bin; \
echo " List .bin file to be flashed here:"; \
ls -1 *.bin
endef

define DOWNLOAD
@echo "Download with $(DOWNLOAD_PARAM_PORT)"; \
if test -e $(DOWNLOAD_PARAM_PORT); then \
python tools/esp32/esptool/esptool.py --chip esp32 \
--port $(DOWNLOAD_PARAM_PORT) \
--baud $(DOWNLOAD_PARAM_BAUD) \
--before $(DOWNLOAD_PARAM_BEFORE) \
--after $(DOWNLOAD_PARAM_AFTER) \
write_flash -z \
--flash_mode $(DOWNLOAD_PARAM_FLASH_MODE) \
--flash_freq $(DOWNLOAD_PARAM_FLASH_FREQ) \
--flash_size $(DOWNLOAD_PARAM_FLASH_SIZE) \
$(DOWNLOAD_PARAM_BOOTLOADER_OFFSET) ./bootloader.bin \
$(DOWNLOAD_PARAM_PARTITION_OFFSET) ./partitions.bin \
$(DOWNLOAD_PARAM_APP_OFFSET) ./nuttx.bin; \
else \
echo "$(DOWNLOAD_PARAM_PORT) is not exist!"; \
fi
endef
endif
Binary file added tools/esp32/blob/bootloader/bootloader.bin
Binary file not shown.
Binary file added tools/esp32/blob/bootloader/bootloader.elf
Binary file not shown.
3,448 changes: 3,448 additions & 0 deletions tools/esp32/blob/bootloader/bootloader.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tools/esp32/esptool
Submodule esptool added at a66ee2
Loading

0 comments on commit 6295f93

Please sign in to comment.