Skip to content

cpu/esp32: fixes LINKFLAGS in Makefile.include#10460

Merged
gschorcht merged 2 commits intoRIOT-OS:masterfrom
gschorcht:esp32_fix_baslibs
Nov 28, 2018
Merged

cpu/esp32: fixes LINKFLAGS in Makefile.include#10460
gschorcht merged 2 commits intoRIOT-OS:masterfrom
gschorcht:esp32_fix_baslibs

Conversation

@gschorcht
Copy link
Contributor

Contribution description

This PR adds the ESP32 vendor libraries for WLAN to the BASELIBS variable. This avoids having to define in the variable LINKFLAGS an additional archive group containing these vendor libraries and again the RIOT module archive files with symbols referenced by these vendor libraries.

Testing procedure

Testing is done just by compiling an application that is using networkting

USEMODULE="spiffs esp_now" make BOARD=esp32-wroom-32 -C examples/gnrc_networking

The compilation has to be successful.

This commit adds the ESP32 vendor libraries for WLAN to the BASELIBS variable. This avoids having to define an additional archive group in the LINKGFLAGS variable which contains these vendor libraries and again RIOT module archive files with the symbols that are refered by these vendor libraries.
@gschorcht gschorcht requested a review from cladmi November 23, 2018 17:12
@gschorcht gschorcht added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Nov 23, 2018
@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: cpu Area: CPU/MCU ports labels Nov 23, 2018
@cladmi
Copy link
Contributor

cladmi commented Nov 23, 2018

I cannot really review the test command but I tested executing the compile command with docker.

BUILD_IN_DOCKER=1 DOCKER="sudo docker" USEMODULE="spiffs esp_now" make BOARD=esp32-wroom-32 -C examples/gnrc_networking

Compiling works both with this PR:

   text    data     bss     dec     hex filename
 132181    4960   23696  160837   27445 /data/riotbuild/riotproject/examples/gnrc_networking/bin/esp32-wroom-32/gnrc_networking.elf

and master:

   text    data     bss     dec     hex filename
 132137    4960   23696  160793   27419 /data/riotbuild/riotproject/examples/gnrc_networking/bin/esp32-wroom-32/gnrc_networking.elf

The size increased a little bit a show in the output, but I get the same output for the symbols in master and this PR using the following debug command (the one used to debug the fix linking PR):

objdump -t bin/esp32-wroom-32/*.elf | grep -v ' df ' | sort -k6 | cut -f1 -d" " --complement

@gschorcht Did you tried running the firmware and check if the behavior was still ok ?

@gschorcht
Copy link
Contributor Author

@cladmi Yes, of course 😄

@cladmi
Copy link
Contributor

cladmi commented Nov 26, 2018

By taking into account this comment explaining why it was there (#10362 (comment)) I agree with the change.

I only have a last curiosity question to try understanding, do you know why

LINKFLAGS += -lhal -lg -lc -lg

does not need to be put in BASELIBS ?

https://github.com/RIOT-OS/RIOT/pull/10460/files#diff-a264f1e32b7ec79a7db68441a4a75e90R127

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 26, 2018
@gschorcht
Copy link
Contributor Author

gschorcht commented Nov 26, 2018

@cladmi Double checked it

LINKFLAGS += -lhal -lg -lc

has not to be in the group. Archive groups have to be defined to be able to resolve circular references. The linker goes through all archives of a group again and again until it can resolve the symbols. So I think, as long as all symbols are defined in the -l... list in the order from right to left, you don't need to put them in a group.

BTW, I realized that

LINKFLAGS += -lhal -lg -lc -lg

contained libg.a two times 😟 I fixed it.

@cladmi
Copy link
Contributor

cladmi commented Nov 26, 2018

@gschorcht thanks for the update, my goal is to have a reason in case someone ends up here in the future. When I tested in #10362 (comment) it also did not compile when putting them in BASELIBS and I did not debug further.

You currently have two commits with the same commit message, which is disturbing for me, and the second has no description.
Please update the second commit message to be describe the change.

I will approve after this.

@gschorcht
Copy link
Contributor Author

@cladmi The second just removes the double entry of -lg. Should I squash them to have only one commit with the detailed description from the first one?

@cladmi
Copy link
Contributor

cladmi commented Nov 27, 2018

@gschorcht I would prefer a second commit with its own description.
Also I just noticed that the commit (and PR title) are saying Makfile.include instead of Makefile.include.
You can rewrite them both directly.

removes the duplicate entry of -lg in LINKFLAGS
@gschorcht
Copy link
Contributor Author

@cladmi Done

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 28, 2018
@cladmi
Copy link
Contributor

cladmi commented Nov 28, 2018

@gschorcht Thank you, I re-triggered murdock due to an unrelated failure.

Copy link
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

ACK, agree with the changes and justifications. I only tested compiling but as the maintainer of the board tested it is good for me :)

You can merge when murdock is green.

@gschorcht gschorcht merged commit 061e32b into RIOT-OS:master Nov 28, 2018
@gschorcht gschorcht deleted the esp32_fix_baslibs branch November 28, 2018 14:49
@cladmi
Copy link
Contributor

cladmi commented Nov 28, 2018

Thank you for doing the fix and following the review :)

@cladmi cladmi changed the title cpu/esp32: fixes LINKFLAGS in Makfile.include cpu/esp32: fixes LINKFLAGS in Makefile.include Nov 28, 2018
@aabadie aabadie added this to the Release 2019.01 milestone Dec 2, 2018
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 Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants