-
Notifications
You must be signed in to change notification settings - Fork 2k
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/efm32: cleanup #13174
cpu/efm32: cleanup #13174
Conversation
That's a very nice refactoring I never thought of. It's still very maintainable. I have to test this in detail, hope to do that this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few inline comments.
cpu/efm32/efm32-vars.mk
Outdated
@@ -0,0 +1,139 @@ | |||
CPU_FAM_INDEX = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW @basilfx I didn't keep the message that was in cpu.txt
:
# This file is automatically generated, and should not be changed. There is
# probably little reason to edit this file anyway, since it should already
# contain all information for the EFM32GG family of CPUs.
since this wasn't generated automatically but I did copy paste everything so not data was changed.
20c314d
to
0dcfdd5
Compare
Rebased and fixed typo. |
There are changes related to kinetis (introduced by 9bcc51d), but unrelated to this PR and stk3700 builds are failing (there might be others) |
@aabadie murdock is passing now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on slstk3402a
: build is successful, examples/default
works. I also confirm the perform improvements introduced by this PR:
- System calls:
This PR
BOARD=slstk3402a strace -ff -e trace=execve make --no-print-directory -C examples/hello-world/ info-debug-variable-QUIET 2>&1 | grep 'execve' | wc -l
101
master
BOARD=slstk3402a strace -ff -e trace=execve make --no-print-directory -C examples/hello-world/ info-debug-variable-QUIET 2>&1 | grep 'execve' | wc -l
7667
- Dependency resolution time
this PR
time BOARD=slstk3402a make --no-print-directory -C examples/hello-world/ info-debug-variable-USEMODULE
auto_init board boards_common_silabs core core_init core_msg core_panic cortexm_common cortexm_common_periph cortexm_fpu cpu cpu_efm32pg12b gecko_sdk_emlib gecko_sdk_emlib_extra newlib newlib_nano newlib_syscalls_default periph periph_common periph_gpio periph_pm periph_uart pm_layered silabs_aem silabs_bc stdio_uart sys
real 0m0,080s
user 0m0,074s
sys 0m0,011s
master
time BOARD=slstk3402a make --no-print-directory -C examples/hello-world/ info-debug-variable-USEMODULE
auto_init board boards_common_silabs core core_init core_msg core_panic cortexm_common cortexm_common_periph cortexm_fpu cpu cpu_efm32pg12b gecko_sdk_emlib gecko_sdk_emlib_extra newlib newlib_nano newlib_syscalls_default periph periph_common periph_gpio periph_pm periph_uart pm_layered silabs_aem silabs_bc stdio_uart sys
real 0m1,472s
user 0m1,008s
sys 0m0,568s
ACK
@basilfx can you test this PR ? If not, are you ok with it ?
Sorry for not being that active these weeks. I have other work that has priority. I do have a few comments.
@fjmolinas I really like the improvements, and I want this to be merged. But let me check if I can propose some changes (I'll do that right away). |
@fjmolinas I have modified a few things that I think keeps things more self-contained. I have three additional commit in my own branch here. Here is the summary:
Using the I want to stress out that I don't want to annoy you by fixing some things myself, after you and @aabadie have almost finished this. But I hope you can consider my changes. You did the hard work, I only find-replaced/moved some parts. If you like them, then please take them over (no need for credit). |
Hi @basilfx thanks for your feedback, some comments
I don't mind removing this. - DIRS += families/$(EFM32_FAMILY)
+ DIRS += families/$(CPU_FAM) This shouldn't be done, because If you can recall or find that discussion it would be great, to either make clear that
As I said in the PR eventually we will have to move towards #12407, which will mean one directory per |
I'm guessing its probably a comment made by @cladmi no? |
@fjmolinas I've send you an email to maybe discuss/explain this ;-) |
Maybe it is usefull for new boards? |
TL;DR; I would not have exported either The reason I would not have exported Then adding the With this being declarative, and moving the definition earlier in the build, it could allow moving this |
I've updated the PR to remove that column as well. Makes sense!
I guess that could be a next improvement? I see that this one already saves a lot, and the other approach would also include work outside of the EFM32 CPU folder, right? |
Exactly. I only answered to the why not |
9c15674
to
670291d
Compare
I squashed and re-wrote the commit history to make it cleaner, it was compiling on every commit. I rebased to make sure I wasn't making any changes with respect to the past history, the only changes were to remove unneeded If name-spacing is not wanted for the |
I prefer to have the folder in |
Ok, I'll se when I have time to do this. Probably not soon. |
670291d
to
9fc0602
Compare
Well did it right away, I think you will he happy with what is now @basilfx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some "tabs instead of spaces" nit in cpu/efm32/Makefile.
You can squash directly.
9fc0602
to
2a95dd8
Compare
Move INCLUDES and VECTORS_O to Makefile.include duplicate EFM32_HEADER while cpu.txt is not migrated.
2a95dd8
to
9a7ddde
Compare
The CI is green, @basilfx are you ok with the current state of this PR ? |
ACK from my side, but please @basilfx take a final look! |
I approve. Thanks for the hard work @fjmolinas! |
GG |
# This file is automatically generated, and should not be changed. There is | ||
# probably little reason to edit this file anyway, since it should already | ||
# contain all information for the EFM32GG family of CPUs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to add support to another member of the efm32 family and now I wonder what tool was used to generate that kind of file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to look here: https://github.com/basilfx/EFM2RIOT/tree/develop/dist
It should be reasonably up to date and contain all supported chips already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh that's nice.
@aabadie did something very similar for stm32.
I take we can't do that on the fly as Gecko SDK is required. But I don't like copying around folders either.
But we could just import that wholesale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is necessary to do it on-the-fly. These families are quite stable (only new ones are added).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how about we import https://github.com/basilfx/EFM2RIOT/tree/develop/dist/cpu/efm32/families into RIOT as a whole?
@@ -0,0 +1,47 @@ | |||
# This file is automatically generated, and should not be changed. There is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basilfx I have a THUNDERBOARD EFM32GG12 here, for whose MCU there is no entry in this file. Is this file really created automatically and if so, how. Or does the entry have to be added manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is generated using https://github.com/basilfx/EFM2Riot. That script parses the Gecko SDK and generates the necessary files. I'll admit that it's a bit outdated now.
Contribution description
efm32
uses shell calls to resolve a series ofCPU
parameters from theCPU_MODEL
. All these shell calls are slow and make building and testing anyefm32
slower than it needs to be.This PR fixes this by aggregating all that data into one single file and using
MAKE
functions to extract the data.A benchmark example is that building and running all tests without this PR takes about 1:49 on my machine, and it now takes 1:15.
This also move those variables to Makefile.include or Makefile.features respectively according to where they should be.
Names are changed to use the already existing and exported
CPU_ARCH
andCPU_FAM
.Testing procedure
Look a t the number of execv calls in this PR vs master:
You can also compare time used to resolve simple make targets e.g.:
-pr
Issues/PRs references
Relates to #10850
Also relates to #9913
This is a first cleanup step, when #12407 is merged and agreed I will move towards a folder based approach.