Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Assign proper gpio pins to nRF52-DK #1097
Pull Request Overview
This pull request was tested on
TODO or Help Wanted
What do you mean "not efficient" and "can't go into the registers"? Do you mean the arguments passed to the common intializer don't fit in registers and therefore it's probably wasting stack space? My guess is actually that it's likely just inlined, so doesn't make a difference in practice.
It is getting a bit messy, and might be worth having a utlity struct or something to make it more readable, but i think it's fine for this pull request.
Yupp, I meant there too many arguments to go in the registers and goes via the stack instead! But, bad phrasing from my side I should have been more explicit. If I'm not mistaken I think ARM passes the first four arguments into r0-r3 (assuming 32-bit sized) and the rest on the stack. But, you are probably right w.r.t inlining (haven't checked the assembly)
On Jul 8, 2018, at 10:49 AM, Niklas Adolfsson ***@***.***> wrote: But, you are probably right w.r.t inlining (haven't checked the assembly)
I’d caution from assuming the compiler will make optimizations for you. It’s good when it does, but if there’s a big cost when it doesn’t then you want to preclude it. E.g., make sure arguments don’t spill to the stack by only having 4. Otherwise you start to get weird failure cases. For example, a change in one part of the kernel happens to change inlining in some somewhat related code, which then causes stack overflows. The exact same call chain succeeds in one kernel but fails in the other, with no code changes in any of the functions in the call chain. Phil