-
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
boards/cpu: add support for efm32lg and stk3600 #4824
Conversation
Looking manageable now on first sight :-) Just did quick compile run, and I have to say I stay with my opinion about vendor libs:
So for hello world this is 150% and for default still 133% the code size of the direct implementation. Randomly picked looking at the code for the GPIO and the TIMER periph drivers show, that the implementations without But again, these are quick and not in-depth observations. Looking for example at the To conclude, I am not at all convinced of using the |
Thank you for looking into this so quickly :-) Some explanation of the code size:
Using LTO also shrinks the size (~4000 bytes for examples/default), but it fails to run :-) Have you also looked at the benchmarks I did? Some boards have similar code sizes. You can click the numbers in the text/data/bss column to see which archive/library is using so how much space (sorry for hidden links/bad UI). I'll see if I can further reduce the code size. What would be acceptable, given the features provided by emlib (proper clock setup, resetting peripherals, low-power support, chip errata, supported chips/generations)? |
For
I noticed that GCC 5.2 (which I have installed here) produces slightly bigger binaries compared to GCC 4.9. |
Let's take a look at the features:
What proper is can be argued about, but this can be done writing some registers directly without any trouble
When programming peripherals directly on register level, this comes for free
again, by just picking the power states we need and just use them (instead of everything), we can save code size
this is indeed something useful, but we could just copy that part out of the
When only implementing a sub-set of features that we actually need in RIOT, we are also only effected by a sub-set of the diffs between chip generations and family members. I think this can actually be handled But to make sure: I think importing the board(s) using the |
Sorry for late reply. Some comments:
I consider proper as the way the developers of emlib have written it. They know about the hardware details, so I assume they know the ins-and-outs.
I was referring to the low-power peripherals, e.g. LEUART or LETIMER. I could change it to include defines to pick which peripherals to support. For instance, the STK3200 has it's STDIO connected to a LEUART. In this case, disabling USART would be better for the code size if it is not used.
Using emlib, it was rather easy to support the new Gemstone chips, without it costing too much time. I see that as an advantage.
Agreed. I'm currently revising the code to optimize code size a bit and improve readability. I'll update this PR whenever I think it's ready again :-) |
17fc36c
to
891b971
Compare
With the new commits (work in progress, somewhat inspired by/depending on #4862 and #4780), I have the numbers below. I stripped my port to resemble the existing SLWSTK6220A board as much as possible.
Baseline versus old:
Baseline versus new:
Baseline versus equal:
|
Inspired by #4866:
emlib uses bit banding, where applicable. I see it is used in GPIO, Timer, USART, RTC and other abstractions. Now I understand why, I see this as an advantage that also increases code size a bit. |
891b971
to
45406af
Compare
The numbers look indeed slightly better. I won't oppose using the emlib, though I have to say (and looking at the code), I still don't like it at all. I won't have the time to review this in depth this or next week. @thomaseichinger: would you mind to take a look? |
b290a9d
to
f472b5a
Compare
I will update this PR once all the peripheral-changing PRs are merged. |
4e7efd0
to
a9215e8
Compare
a9215e8
to
125b393
Compare
I have updated this PR to work with the API changes proposed in the last few months. For the record, emlib now supports 20 different EFM32 families, for which I generate code. |
The branch works well for me (I'm new to RIOT, building own examples based on hello-world example, using a Giant Gecko STK instead of a Leopard Gecko; didn't test jlink for programming, but it works with OpenOCD out of the box). When I find bugs or shortcomings (eg. wrong pin direction in usart RX pin setup, baud rates not achieved for lack of CMU_ClockDivSet), do you prefer me to report them here, or to open dedicated bugs against RIOT once this is merged? |
You can fork my branch, make the fix and I will pull it in :-) I use a generator to bootstrap this port as long as it not merged yet. I do this because it creates the files for all the different EFM32 families automatically. You can also make a PR over there: https://github.com/basilfx/EFM2Riot |
125b393
to
3e61266
Compare
I know it's a big PR, but I'd like to receive some feedback sometime :-) |
Sorry for the delay - the assigned maintainer (@haukepetersen) has been offline for a loooong time. Maybe another maintainer is willing to take over? @kaspar030, @gebart, @thomaseichinger, @PeterKietzmann? |
Feature freeze -> postponed. |
We could close this PR and continue with #5652. Most of this code is part of OK? |
Makes sense to me. |
Ok, let's continue in #5652. |
This PR supersedes #4722 and only contains five commits to add:
I remove all other EFM32LG CPUs except the one that is on the STK3600. Eventually, I would like to add them again.
The comments of #4722 still apply. Compared to the previous PR, I have improved I2C, fixed timer issues, corrected comments and adapted peripheral driver changes.
You may want to skip commit e671c47 and d7d7bfb, as they contain a lot of vendor files. The other commits should be browser-compatible.
All files
Benchmarks