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_common: fix the dependency of the flash image on the ELF file #14041

Merged

Conversation

gschorcht
Copy link
Contributor

Contribution description

This PR fixes the dependency of the flash image on the ELF file for the ESP* make system.

Flashing an ESP board first requires the creation of a flash image from the ELF file. This is realized in the preflash target. However, the preflash target only depends on the variable BUILD_BEFORE_FLASH but on the ELF file. Therefore, the variable BUILD_BEFORE_FLASH must be set to the ELF file to ensure that when using multiple make processes, the compilation of the ELF file is completed before the flash image is created.

Testing procedure

  • In examples/hello-world run make BOARD=esp32-wroom-32 -j flash term.
  • Change the text in main.c, better yet print it in a while(1) loop.
  • Run make BOARD=esp32-wroom-32 -j flash term again

Issues/PRs references

Fixes #13492

Flashing an ESP board first requires the creation of a flash image from the ELF file.  This is realized in the `preflash` target. However, the `preflash` target only depends on the variable `BUILD_BEFORE_FLASH` but on the ELF file. Therefore, the variable `BUILD_BEFORE_FLASH` must be set to the ELF file to ensure that when using multiple make processes, the compilation of the ELF file is completed before the flash image is created.
@gschorcht gschorcht requested a review from benpicco May 8, 2020 09:09
@gschorcht gschorcht added Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels May 8, 2020
@gschorcht gschorcht changed the title cpu/esp_common: fix the dependency of flash image on the ELF file cpu/esp_common: fix the dependency of the flash image on the ELF file May 8, 2020
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

Thank you for investigating this!
Now make -j flash works reliable as it should.

@benpicco benpicco merged commit 0bbc86a into RIOT-OS:master May 8, 2020
@kaspar030
Copy link
Contributor

This broke "make flash-only".

@kaspar030
Copy link
Contributor

This is on master:

[kaspar@ng riot/examples/hello-world (master)]$ BOARD=esp32-wroom-32 make 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
ccache: error: Could not find compiler "xtensa-esp32-elf-gcc" in PATH
make[1]: *** [/home/kaspar/src/riot/Makefile.base:108: /home/kaspar/src/riot/examples/hello-world/bin/esp32-wroom-32/application_hello-world/main.o] Error 1
make: *** [/home/kaspar/src/riot/examples/hello-world/../../Makefile.include:568: /home/kaspar/src/riot/examples/hello-world/bin/esp32-wroom-32/application_hello-world.a] Error 2

make flash-only is required by CI testing to not recompile...

@kaspar030
Copy link
Contributor

Maybe FLASH_FILE should be the .bin? The compile worker could then create that.
We'd have to override the rule that creates the .bin to do the current preflasher stuff.

RIOT/Makefile.include

Lines 583 to 585 in 2444f06

%.bin: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Obinary $< $@

@gschorcht
Copy link
Contributor Author

gschorcht commented May 12, 2020

I'm under pressure due to the online summer term so that I'm not able to spend time at the moment. Maybe, we should revert this commit for the moment and reopen issue #13492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make -j flash broken on esp* (will always flash the previous binary)
4 participants