Wrap software_init_hook

Wrap software_init_hook so that it can be used or extended from outside the
RTOS. This is desirable so that code can be added to the software_init_hook
without making the RTOS depend on new features or libraries.
pull/1753/head
Jaeden Amero 2016-06-09 18:18:55 +01:00 committed by Milosch Meriac
parent 61166870ed
commit 43e595aec3
4 changed files with 15 additions and 3 deletions

View File

@ -412,6 +412,18 @@ extern "C" WEAK void __cxa_pure_virtual(void) {
#endif
#if defined(TOOLCHAIN_GCC)
extern "C" WEAK void software_init_hook_rtos(void)
{
// Do nothing by default.
}
extern "C" void software_init_hook(void)
{
software_init_hook_rtos();
}
#endif
// ****************************************************************************
// mbed_main is a function that is called before main()
// mbed_sdk_init() is also a function that is called before main(), but unlike

View File

@ -339,7 +339,7 @@ void pre_main(void) {
main(0, NULL);
}
__attribute__((naked)) void software_init_hook (void) {
__attribute__((naked)) void software_init_hook_rtos (void) {
__asm (
".syntax unified\n"
".thumb\n"

View File

@ -447,7 +447,7 @@ __asm void __rt_entry (void) {
#elif defined (__GNUC__)
__attribute__((naked)) void software_init_hook (void) {
__attribute__((naked)) void software_init_hook_rtos (void) {
__asm (
".syntax unified\n"
".arm\n"

View File

@ -655,7 +655,7 @@ void pre_main(void) {
main(0, NULL);
}
__attribute__((naked)) void software_init_hook (void) {
__attribute__((naked)) void software_init_hook_rtos (void) {
__asm (
"bl osKernelInitialize\n"
#ifdef __MBED_CMSIS_RTOS_CM