-
Notifications
You must be signed in to change notification settings - Fork 3k
Add a function to transfer control to another app #3748
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
Conversation
5bc7425
to
ae5be6d
Compare
CC: @LiyouZhou |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputBuild failed! |
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.
A few nits. Looks quite good but will need some strong worded docs about assumptions made when transferring control regarding systick, scb and nvic
|
||
#include<stdint.h> | ||
|
||
#define MBED_APPLICATION_SUPPORT (defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7)) |
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.
What will be different in M0 and can it be added now?
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.
On the M0 the VTOR is optional. Devices that have a VTOR could be supported easily, but I'm not sure if there is a good way to tell that. Alternatively, for M0 the reset sequence could be to jump to the reset handler and leave it up to the application to remap interrupts as necessary.
#endif | ||
|
||
/** | ||
* Start the application at the given address. This function does |
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.
all documentation reads '... start application ...' but the function name is application_start. Just difficult to read. Should the func be mbed_start_application(addr);
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.
I'll rename so it makes more sense to users. The function was named like this so the prefix matched the filename, similar to mbed_stats_heap_get.
platform/mbed_application.c
Outdated
BX R1 | ||
} | ||
|
||
#elif defined (__GNUC__) |
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.
Can the IAR and GNU implementation be unified? What about ARM compiler?
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.
ARMCC has its own syntax so it can't be unified. As is the GCC and IAR function can be unified, but I'm not sure if this is a good idea. I don't know how much of the syntax is different between these two assemblers.
ae5be6d
to
35ec0cd
Compare
/morph test |
platform/mbed_application.c
Outdated
void *pc; | ||
|
||
// Interrupts are re-enabled in start_new_application | ||
core_util_critical_section_enter(); |
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.
is there anywhere exit called? I can see interrupts are enabled in the asm functions below. I am asking as critical sections can be nested (contain counters), thus this would lead that there's currently still one active critical section?
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.
There is no call to critical section exit, instead right before jumping to the next application, interrupts are re-enabled with "msr primask, r2" where r2=0.
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.
yes, but that is incorrect, every enter should have counterpart exit?
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
35ec0cd
to
7047d0f
Compare
Updated PR to replace core_util_critical_section_enter with __disable_irq, add parameter and clobber list in start_new_application and combine GCC and IAR assembly. |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
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.
One last nit, sorry :(
platform/mbed_application.c
Outdated
|
||
void mbed_start_application(uintptr_t address) | ||
{ | ||
|
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.
extra /n
7047d0f
to
590fff4
Compare
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Add the function mbed_start_application() which allows a bootloader to transfer control to an application.
590fff4
to
36cbae6
Compare
rebased the PR in the hopes it will restart the Cam-CI |
/morph test |
1 similar comment
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Add the function mbed_application_start() which allows a bootloader to transfer control to an application.