-
Notifications
You must be signed in to change notification settings - Fork 3k
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
mbed sdk boot: copy vectors addition #4503
Conversation
hi, also there some code that could be shared between rtos boot code and bare metal code like nvic_cpy and the declaration of sdk_init, mbed_main. |
How for IAR ? I would like to eliminate cmain.s . Because I could not find any hooks for IAR besides the one RTX uses (low level code is not good for this one, I excluded it). Thus cmain.s is in the code base. We could use weak linkage for software hook?
Thats correct I had a version unified but first, did not look that clean (look how iar startup does things , it is split to two stages), and second, would need to push update to rtx to change this. If you have ideas, please provide details. Third, the startup for mbed 2 and mbed 5 differs and will even more, so for mbed 2 it was kept as it was, unified for mbed OS 5 (this one can be changed as there are other modules and features involved). I realized that copy nvic in here would work only for bare metal builds, we need to fix that. |
Latest cmsis files provide virtual nvic implementation, therefore all nvic set/get vectors were removed. As the result, we did not reallocate vectors for mbed SDK. This should fix it for most of the platforms (cortex m0 and cortex a9 need to provide own if they need it).
This was probably deleted during the rebase, as mbed sdk boot needs to be own object file due to using weak functions.
b2d1cc4
to
278634a
Compare
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.
Looks good at first glance - will need to test.
@LMESTM Let me know the test results. I'll continue as well as Russ fixed the IAR . If you combine this PR, with other 2 that are there ( trap enabled and cortex m0 realloc, mbed 2 tests should be green) |
I merged locally all 3 related PR to fix mbed 2 builds, run test on one cortex m0 device and m4 (random projects for random toolchains plus run some tests , sharing results here). Results
vtor realloc should be restored and tests functional as they were (mbed 2). |
/morph test |
Tested OK on L476RG |
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.
review ok (and tested ok)
Thanks @LMESTM ! |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@0xc0170 -today I tested on master after this PR was merged. MBED2 tests boot ok on NUCLEO_L476RG as I reported last week, but I still fail to boot on NUCLEO_F334R8. If I roll back before CMSIS5 update, this is ok again ... |
This was a breakage from the latest cmsis5 boot process unification. However, this PR does not completely fixes it. It fixes for non cortex-m0. We will need to address removal of this functionality for cortex-m0.
Without this patch, ticker test would end up in the hard fault..
With this patch, interrupts are properly running.
Note: if anyone test only this patch with debug profile and with ARM toolchain, there is another problem at least with ticker test. This test invokes
fflush
from ISR and we now define MBED_TRAP_ERRORS_ENABLED, thus this ends calling exit() via error() function :/ Not saying this is correct - https://github.com/ARMmbed/mbed-os/blob/master/features/unsupported/tests/mbed/ticker/main.cpp#L7 :-) Just that I did not realized fflush is related to this changeset (adding trap errors!).cc @LMESTM @bcostm This should help to pass some tests for mbed 2. Please read the note, there might be more problems like this in our tests !
I added here also mbed_sdk_boot object file that should be there (I sent PR to cmsis5 to have it fixed, seems like one of the rebased we did removed this).
copy nvic function is a duplication with mbed 5 - no it is not, uvisor is involved first, then we might do some other things there, therefore I created own in the mbed 2 boot process. I expect this won't change in mbed 2 , but might change in mbed 5.
@c1728p9 Please review, and lets discuss how to fix cortex-m0 targets