cpu: centralized cortex initialization and some defines#3100
cpu: centralized cortex initialization and some defines#3100jnohlgard merged 16 commits intoRIOT-OS:masterfrom
Conversation
|
Impressive work |
|
is this WIP? |
|
not really WIP, I just forgot the |
|
Let's try to get this merged asap so that we don't accumulate more dependencies. |
|
+1! |
|
added those missing calls to |
|
OK to squash. |
|
will do when I rebase after the merge of #3023. |
|
#3023 is merged, please rebase |
7f2ebd1 to
8b739fa
Compare
|
did, but broke something... Fixing it as we speak. |
8b739fa to
8c81e59
Compare
|
fixed. Ready for final review, Travis and hopefully merging. |
There was a problem hiding this comment.
This TODO reference is something that I have been curious about for some time, what does it mean? Is there an open issue for this? Is this related to the COREIF_NG definition found in most (all?) platform makefiles?
There was a problem hiding this comment.
yes, there is: #1892
Once in a time, boards/cpus used dINT and eINT macros for enabling/disabling interrupts. Then the current API with enableIRQ and disableIRQ was introduced. But there are still some occurances of the old calls left, so we were not able to remove them so far...
|
How are the Cortex-M common IRQs affected by this change? Will they have a higher priority than the vendor specific IRQs since the default IRQ prio is set to 1? |
|
I think the code looks good, waiting for Travis. The question of IRQ priorities is something to keep in mind though, since the preemption order of the ISR may have been affected. @haukepetersen Thank you for doing this large and somewhat ungrateful work for the long term greater good of the OS. |
|
They are not. We use only two of them, |
|
@gebart: by the way, did you notice the implicitly included solution on handling cortex-M4 CPUs without FPU? This should be taken care of for once and all... |
That clears things up. Thanks for the explanation
I did see some special handling of M4F in the makefiles, but the context switching is still broken with regards to floating point registers, right? |
|
@haukepetersen but the M4F stuff was in #3023, I am not sure what you mean. |
|
oh yep, it was in #3023. I just had looked at your comment in #1366 in wanted to point out that that concern is solved... But you are right, the handling of the FPU registers on context switching is still not implement. This could lead to corrupted data if more than one thread is using the FPU simultaneously... |
Shouldn't we then disable hard FPU until this is sorted out? |
|
might not be the worst idea. But unrelated to this PR... How about we move that discussion to #1366? |
There was a problem hiding this comment.
Could we leave this in but commented out, until #1366 is resolved?
There was a problem hiding this comment.
Not really. If we leave this out, the CPU goes into hardfault as soon as it encounters a 'float' somewhere. We can only leave this out, as soon as we disabled the FPU compiler options or changed them to use soft float explicitly... I will prepare another PR for this.
There was a problem hiding this comment.
And remember, as long as there is only one thread using the FPU at a time, everything works fine at the moment... :-)
There was a problem hiding this comment.
I smell hard-to-find bugs...
There was a problem hiding this comment.
IMHO we should make this an opt-in pseudomodule until this is sorted out.
There was a problem hiding this comment.
Thats why I'm just preparing a PR to fix this...
There was a problem hiding this comment.
done: #3112
Regarding the FPU initialization above: I makes much sense to leave it in. With #3112 the FPU should not be used. But if it is under some unforeseeable circumstances is used (though I don't know how this could happen), this initialization would prevent the CPU from going into hard-fault.
d948843 to
9ea6b83
Compare
|
fixed issues with |
There was a problem hiding this comment.
is not cpu_conf.h always included by cpu.h?
There was a problem hiding this comment.
not on the arm7 and the msp430...
There was a problem hiding this comment.
on these platforms it will be as soon as we clean them up and move them to the current structure...
- added a centralized core implementation for all cortex CPUs - moved default stack size defines to cpu.h in cortexm_common - moved uart0 bufsize define to cpu.h in cortexm_common - moved typed of panic_t to cpu.h in cortexm_common
9ea6b83 to
e2cb8e7
Compare
|
something went wrong while rebasing with the |
Some CPUs (e.g. cortex-m based ones) define the UART0_BUFSIZE in cpu.h. So also include this file here.
|
ACK |
cpu: centralized cortex initialization and some defines
Based on #3023
EDIT:
Forgot to explain one feature: The device specific interrupt priorities are now initialized on startup to a default value. As we are using only one interrupt priority for everything to prevent interrupt preemtion, this saves the need to set the interrupt priority in during peripheral initialization -> helps to keep the periph code smaller.