Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/esp*: use FLASHFILE for esp32 and esp8266 boards #11648

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented Jun 6, 2019

Contribution description

Update to use FLASHFILE as file to be flashed on the board.

By using FLASHFILE=path_to_file BOARD=espXXXX make flash-only a board can be flashed from a machine without the toolchain and only pip installed esptool.py installed

esp32 requires ESPTOOL set currently to esptool.py but it is fixed by #11646

Testing procedure

Both esp32 and esp8266 can still be flashed as in master.

The flash-only output is the same right now as in master

ESPTOOL=esptool.py BOARD=esp32-wroom-32 make --no-print-directory -C examples/default/ flash-only

ESPTOOL=esptool.py BOARD=esp32-wroom-32 make --no-print-directory -C examples/default/ flash-only
ESP32_SDK_DIR should be defined as /path/to/esp-idf directory
ESP32_SDK_DIR is set by default to /opt/esp/esp-idf
esptool.py --chip esp32 elf2image -fm dout -fs 2MB -ff 40m    -o /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/default.elf.bin /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/default.elf; echo "" > /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv; echo "nvs, data, nvs, 0x9000, 0x6000" >> /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv; echo "phy_init, data, phy, 0xf000, 0x1000" >> /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv; echo -n "factory, app, factory, 0x10000, " >> /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv; ls -l /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/default.elf.bin | awk '{ print $5 }' >> /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv; python /home/harter/work/git/RIOT/cpu/esp32/gen_esp32part.py --disable-sha256sum --verify /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.csv /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.bin
esptool.py v2.6
Parsing CSV input...
esptool.py --chip esp32 -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset write_flash -z -fm dout -fs detect -ff 40m    0x1000 /home/harter/work/git/RIOT/cpu/esp32/bin/bootloader.bin 0x8000 /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/partitions.bin 0x10000 /home/harter/work/git/RIOT/examples/default/bin/esp32-wroom-32/default.elf.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 30:ae:a4:d3:46:00
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0320
Compressed 20608 bytes to 12166...
Wrote 20608 bytes (12166 compressed) at 0x00001000 in 0.3 seconds (effective 595.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 85...
Wrote 3072 bytes (85 compressed) at 0x00008000 in 0.0 seconds (effective 4235.5 kbit/s)...
Hash of data verified.
Compressed 103840 bytes to 49682...
Wrote 103840 bytes (49682 compressed) at 0x00010000 in 1.4 seconds (effective 599.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

BOARD=esp8266-esp-12x make --no-print-directory -C examples/default/ flash-only

BOARD=esp8266-esp-12x make --no-print-directory -C examples/default/ flash-only
ESP8266_NEWLIB_DIR should be defined as /path/to/newlib directory
ESP8266_NEWLIB_DIR is set by default to /opt/esp/newlib-xtensa
ESP8266_SDK_DIR should be defined as /path/to/sdk directory
ESP8266_SDK_DIR is set by default to /opt/esp/esp-open-sdk/sdk
esptool.py elf2image -fs 8m /home/harter/work/git/RIOT/examples/default/bin/esp8266-esp-12x/default.elf
WARNING: Flash size arguments in megabits like '8m' are deprecated.
Please use the equivalent size '1MB'.
Megabit arguments may be removed in a future release.
esptool.py v2.6
Creating image for ESP8266...
esptool.py -p /dev/ttyUSB0 -b 460800 write_flash -fm dout 0 /home/harter/work/git/RIOT/examples/default/bin/esp8266-esp-12x/default.elf-0x00000.bin 0x10000 /home/harter/work/git/RIOT/examples/default/bin/esp8266-esp-12x/default.elf-0x10000.bin; esptool.py -p /dev/ttyUSB0 run
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 68:c6:3a:ac:a1:fb
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 23456 bytes to 12030...
Wrote 23456 bytes (12030 compressed) at 0x00000000 in 0.3 seconds (effective 699.7 kbit/s)...
Hash of data verified.
Compressed 62904 bytes to 44608...
Wrote 62904 bytes (44608 compressed) at 0x00010000 in 1.0 seconds (effective 499.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 68:c6:3a:ac:a1:fb
Uploading stub...
Running stub...
Stub running...
Hard resetting via RTS pin...

The file to flash can be configured from the environment using FLASHFILE.
Remove all other files in bin directory than the default.elf and this works:

FLASHFILE='$(RIOTBASE)/examples/default/bin/$(BOARD)/default.elf' BOARD=esp8266-esp-12x make --no-print-directory -C
examples/hello-world/ flash-only term
# Get the default shell
FLASHFILE='$(RIOTBASE)/examples/default/bin/$(BOARD)/default.elf' ESPTOOL=esptool.py BOARD=esp32-wroom-32 make --no-print-directory -C examples/hello-world/ flash-only term
# Get the default shell

Issues/PRs references

Part of the FLASHFILE introduction #8838
Required for #11646

Real way of setting FLASHFILE that would be useful for #11449

gschorcht added 2 commits June 6, 2019 14:59
Use ELFFILE as FLASHFILE as all files are created from this
one using esptool.
Use ELFFILE as FLASHFILE as all files are created from this
one using esptool.
@cladmi cladmi added Area: build system Area: Build system Area: tools Area: Supplementary tools labels Jun 6, 2019
@cladmi cladmi added this to the Release 2019.07 milestone Jun 6, 2019
@MrKevinWeiss MrKevinWeiss self-requested a review June 6, 2019 13:49
@cladmi cladmi requested a review from gschorcht June 7, 2019 09:38
@MrKevinWeiss MrKevinWeiss added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 14, 2019
Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on the esp32-wroom-32 and esp8266-12x. I flashed the default. Then I tried to flash test/leds with FLASHFILE set to the default elf file and it flash the default as expected.

I think it is OK, ACK.

@MrKevinWeiss MrKevinWeiss added the Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation label Jun 14, 2019
@cladmi
Copy link
Contributor Author

cladmi commented Jun 14, 2019

I would not calling "Cleanup" it is updating to a new feature there.

@cladmi cladmi added Type: new feature The issue requests / The PR implemements a new feature for RIOT and removed Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Jun 14, 2019
@MrKevinWeiss
Copy link
Contributor

As long as it is something!

@MrKevinWeiss
Copy link
Contributor

*sometype

@MrKevinWeiss MrKevinWeiss merged commit f44740e into RIOT-OS:master Jun 14, 2019
@cladmi
Copy link
Contributor Author

cladmi commented Jun 14, 2019

Thank you for the review.

@cladmi cladmi deleted the pr/esp/use_flashfile branch June 14, 2019 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants