-
Notifications
You must be signed in to change notification settings - Fork 2.1k
SAM L21 update to ASF xdk 3.33 #6242
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
SAM L21 update to ASF xdk 3.33 #6242
Conversation
Can't give Atmel motives, but definitely in their recent ASF code they use the .reg stuff instead of the .bit one. If you have a cleaner solution to propose, I'll be happy to apply it. |
Well, in fact one comment sheds some light:
So it's basically optimization vs check enforcing. |
Yeah, I saw that comment too. But to me it does not make sense. The reason I bring this all up is that we're now going to modify our (perfectly working and nicely written) code because of something that Atmel did in their updated header files. But we don't know why they changed it. |
Please, let's try to get a more practical approach. My PR adds support for SAM L21 version B CPUs and only modifies some 20-odd lines of the drivers code. I2C support for SAM L21 is pending because of this PR. I would love someone to test it on real hardware, since I only possess SAML21E18B boards. @keestux : The comment in Atmel code is extremely clear. If you cannot understand it, then bring out your disassembler and look for yourself where the difference in code is. I personally did not bother - call me an insensible brute, but I really can't see where this supposed lost beauty is. Better yet, if this is so important to you, you might want to produce a prettier working code, or at least hint me on how to do it. |
I've tried your PR on saml21 Xplained board which use a SAML21J18A. But I notice a time offset each 10s in periph_rtt test... I've re-tested with and without this PR and the behavior is the same, so I think this problem is out the scope of this PR. |
@dylad , thanks a lot - glad to know that I've not broken anything that worked. |
@keestux I can understand your frustration but it seems Atmel does this modification in the whole ASF 3.33 not only for SAML21. Maybe it is time to update all the Atmel CMSIS files of RIOT to the same version ? |
If we really must avoid read-modify-write then maybe the current change in this PR is not correct either. Have a look at the SAMD21 code. For example uart.c has this equivalent piece.
In other words there is no |= but a plain assignment. This guarantees a write without a read first. BTW, I did just now look at the assembly code and that is why I am beginning to understand why they want the |
@keestux , many thanks for taking your time and dig into this matter further. I also thought that OR-ing would defeat the optimization, but did not try direct assignment because I really have no clue about what the side-effects are. In principle, assigment could flip other bits too - which is exactly the concern you expressed in the first place. If this is used correctly elsewhere, as you show for D21, then I can rework my patch in the same fashion. Antonio |
Hello, Thanks a lot, Antonio |
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.
ACK
@dylad removed. Sorry for the delay - I thought I did it before. |
AFAICT, this PR should now be OK: how about actually merging it? I have already updated my patches for SAML21 I2C support to work on top of it, and I'm just waiting for inclusion before opening a new PR. Thanks a lot! |
@haukepetersen green lights everywhere! Does your ACK hold? Please merge! |
Murdock is happy -> let's go! |
Just added on top of this PR: SAM L21 i2c support #6332 |
I've modified cpu/saml21/periph drivers in order to make the compiler happy. Tested with hello_world and default with a YARM board with SAML21E18B CPU.