overwrite weak function not working always
overwrite weak function not working always
Hi,
See this thread
viewtopic.php?f=13&t=7583&p=38611#p38611
When I define my overwrite esp_task_wdt_isr_user_handler in main.cpp it works.
but if defined in another files it does not. not 100% reliable make -j and linking on Windows 7 platform which generate .map. I can see in map file. override is not happening.
My project in C++ with all .cpp files.
Is there know issue for it.
Thanks,
Naeem
See this thread
viewtopic.php?f=13&t=7583&p=38611#p38611
When I define my overwrite esp_task_wdt_isr_user_handler in main.cpp it works.
but if defined in another files it does not. not 100% reliable make -j and linking on Windows 7 platform which generate .map. I can see in map file. override is not happening.
My project in C++ with all .cpp files.
Is there know issue for it.
Thanks,
Naeem
Re: overwrite weak function not working always
Can some one reply and share your experience. I guess there are not many people using gcc and msys32on windows platform.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: overwrite weak function not working always
Does the overriding function have its own .c/.cpp file? If so, it may be ignored entirely by the linker as it does not contain unresolved symbols.
Re: overwrite weak function not working always
Here is example. Do i need to define in .c file instead of .cppESP_Sprite wrote: ↑Sat Feb 16, 2019 4:48 amDoes the overriding function have its own .c/.cpp file? If so, it may be ignored entirely by the linker as it does not contain unresolved symbols.
It is working for when I defined in my C++ main.cpp file as but i define in new file e.g WatchDog.cpp. it gets ignored.
extern "C" {
/***************************************************************************//**
\brief This function is called by task_wdt_isr function (ISR for when TWDT times out).
\details It can be redefined in user code to handle twdt events.
Note: It has the same limitations as the interrupt function.
Do not use ESP_LOGI functions inside.
*******************************************************************************/
void esp_task_wdt_isr_user_handler(void)
{
/* restart firmware */
esp_restart();
}
}
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: overwrite weak function not working always
So yes, that is the issue you have. .c or .cpp shouldn't matter. Can you see if this solves the issue for you?
Re: overwrite weak function not working always
yes it solve for if define in main.c/main.cpp. not elegant but works.ESP_Sprite wrote: ↑Sun Feb 17, 2019 12:21 pmSo yes, that is the issue you have. .c or .cpp shouldn't matter. Can you see if this solves the issue for you?
Can i do esp_restart within this override function. I do not want default behavior which is panic handler just stop device/firmware.
I want to restart when watchdog happens.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: overwrite weak function not working always
Erm, you know that you can select panic behaviour in 'make menuconfig'? Restarting quietly is one of the options there.
Re: overwrite weak function not working always
I cannot see this option.ESP_Sprite wrote: ↑Mon Feb 18, 2019 2:24 amErm, you know that you can select panic behaviour in 'make menuconfig'? Restarting quietly is one of the options there.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: overwrite weak function not working always
It's under Component config -> ESP32-specific -> Panic handler behaviour.
Re: overwrite weak function not working always
ok, got it.ESP_Sprite wrote: ↑Tue Feb 19, 2019 3:14 amIt's under Component config -> ESP32-specific -> Panic handler behaviour.
Who is online
Users browsing this forum: Google [Bot] and 168 guests