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
Unicore bootloader causes extra reset with multi core app (IDFGH-9336) #10714
Comments
I have found a workaround by overriding the app entry point and initializing the second core in the app. I cannot call the mmu_init(1): that leads to crashes. Is this a problem, if so, what to do to be able to call this? Overriding the entry in and then somewhere in the app:
|
Hi @arjanmels! |
All below is using esp-idf 4.4.4:
Best Regards, Arjan |
Hi @arjanmels! Thanks for bringing up this question. |
On my workaround, I'm a bit concerned that I cannot execute the "mmu_init(1)". Any feedback on that specifically? I realize it is not a very common scenario and not best practise. What happened is that I initially developed for unicore (as I was not yet certain of the target chip) and that I programmed and put into the field a limited number of devices with unicore bootloader (but dualcore devices). Later I decided to start using the multicore features and that is when I encountered this problem. Possible solutions I see:
|
Hi @arjanmels! About the final solution, it has not undecided yet. Yes, definitely we will need to update the doc and probably mention this workaround, I am not sure about backporting this workaround because this fix does not work for all versions. Need to do some additional cache settings. *) multicore app with this fix.
|
Thank you for the confirmation on the mmu_init(1). For me the workaround is then ok for the moment (I do not plan to migrate to v5.0.1 yet). |
I would be very grateful for a workaround for v5.0.1 since I mistakenly shipped some devices with CONFIG_FREERTOS_UNICORE=y. Here is the log output when I tried the previously mentioned workaround:
|
Hi @revtronix ! diff --git a/components/esp_system/port/cpu_start.c b/components/esp_system/port/cpu_start.c
index abd5dc8..68309c7 100644
--- a/components/esp_system/port/cpu_start.c
+++ b/components/esp_system/port/cpu_start.c
@@ -241,12 +241,24 @@ static void start_other_core(void)
}
#endif // !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
+#include "hal/cache_ll.h"
+#include "hal/mmu_hal.h"
+#include "hal/mmu_ll.h"
+
/*
* We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized,
* and the app CPU is in reset. We do have a stack, so we can do the initialization in C.
*/
void IRAM_ATTR call_start_cpu0(void)
{
+#if 1
+ Cache_Read_Disable(1);
+ Cache_Flush(1);
+ DPORT_REG_SET_BIT(DPORT_APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR);
+ DPORT_REG_CLR_BIT(DPORT_APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR);
+ uint32_t bus_mask = DPORT_REG_READ(DPORT_PRO_CACHE_CTRL1_REG);
+ DPORT_REG_WRITE(DPORT_APP_CACHE_CTRL1_REG, bus_mask);
+#endif
#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
soc_reset_reason_t rst_reas[SOC_CPU_CORES_NUM];
#else
|
Yes, I can confirm that this patch works! Here is the startup log output:
|
…gs unconditionally at startup app It makes multicore app runnable by unicore bootloader Closes espressif/esp-idf#10714
…gs unconditionally at startup app It makes multicore app runnable by unicore bootloader Closes espressif/esp-idf#10714
…gs unconditionally at startup app It makes multicore app runnable by unicore bootloader Closes #10714
…gs unconditionally at startup app It makes multicore app runnable by unicore bootloader Closes #10714
Answers checklist.
IDF version.
v4.4.4
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
Custom Board
Power Supply used.
Battery
What is the expected behavior?
When booting should not trigger RTC Watchdog when using bootloader built with unicore and app with multicore.
What is the actual behavior?
On first boot it trigger RTC watchdog the first time, then the second time boto is succesfull
Steps to reproduce.
Software or hardware reset.
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: