Closed kohlerj closed 10 months ago
@kohlerj, thanks for taking your time to report this bug, will look into it and update.
Also reminding you to open a discussion on the FreeRTOS forum before opening bug report for better visibility.
@kohlerj
Thank you for reporting this problem. I am also setting up the environment to reproduce. Below is my setting:
Target
Host
To Reproduce
void vLaunch( void )
{
vTaskStartScheduler();
for(;;);
}
$ diff FreeRTOSConfig.h ori_FreeRTOSConfig.h
80d79
< #define configKERNEL_PROVIDED_STATIC_MEMORY 1
130c129,131
< #define configASSERT(x) assert(x)
---
> extern void vAssertCalled(unsigned long ulLine, const char* const pcFileName);
> #define configASSERT(x) \
> if ((x) == 0) vAssertCalled(__LINE__, __FILE__)
Currently, I am able to run this test application for more than 30 minutes and no hardfault observed. I would like to double confirm with you about my environment setup.
Can you help to take a look at the test project to see if there is something different from yours? It would be great help to us if we can also reproduce the problem.
I have same issue on Visual Studio 2022 with Visual GDB and Pico W. But when I turn off SMP, It works Fine. Program exited when reached function vPortStartFirstTask(). I guesss maybe the new passive idle hook will conflicts with SMP?
Update: After Changed to the SMP branch on https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/ae3a498e435cecdb25b889f2740ea99027dd0cb1 the problem disappears, so I guess it may be the code problem.
@kohlerj
Thank you for reporting this problem. I am also setting up the environment to reproduce. Below is my setting:
Target
- Development board: Raspberry Pi Pico ( no wifi version )
- cmake and ninja are used
- Toolchain and version: GCC 9.2.1 (GNU Tools for Arm Embedded Processors 9-2019-q4-major)
Host
- Host OS: Windows 10
To Reproduce
- Reference the test project in this commit
- main function
void vLaunch( void ) { vTaskStartScheduler(); for(;;); }
- FreeRTOSConfig.h only change assert and static memory configuration
$ diff FreeRTOSConfig.h ori_FreeRTOSConfig.h 80d79 < #define configKERNEL_PROVIDED_STATIC_MEMORY 1 130c129,131 < #define configASSERT(x) assert(x) --- > extern void vAssertCalled(unsigned long ulLine, const char* const pcFileName); > #define configASSERT(x) \ > if ((x) == 0) vAssertCalled(__LINE__, __FILE__)
Currently, I am able to run this test application for more than 30 minutes and no hardfault observed. I would like to double confirm with you about my environment setup.
Can you help to take a look at the test project to see if there is something different from yours? It would be great help to us if we can also reproduce the problem.
Hi @chinglee-iot, and @kohlerj After 5 hours work, I finally reproduce this problem in VScode. Target
Host
@pressdot
Thank you for your information. The API to get idle task memory for SMP is updated in this PR. vApplicationGetIdleTaskMemory
is different from single core with xCoreID
parameter. The task memory for passive idle tasks should now be provided with this API as well. It may cause the problem if the vApplicationGetIdleTaskMemory is not implemented correctly.
Thank you for your information. This is something we should improve to prevent user from this problem.
@pressdot Thank you for your information. The API to get idle task memory for SMP is updated in this PR.
vApplicationGetIdleTaskMemory
is different from single core withxCoreID
parameter. The task memory for passive idle tasks should now be provided with this API as well. It may cause the problem if the vApplicationGetIdleTaskMemory is not implemented correctly.Thank you for your information. This is something we should improve to prevent user from this problem.
I am glad to help, Thank you for replying!
Hi all,
Sorry for me not replying sooner, I had a lot going at the moment.
I can confirm that I was missing the xCoreID
parameter in vApplicationGetIdleTaskMemory
. I took @pressdot's implementation of it and the problem is gone.
Maybe a note here https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html or here https://www.freertos.org/symmetric-multiprocessing-introduction.html would suffice to avoid this issue for other users?
Thank you for your help both of you!
@kohlerj @pressdot
PR #890 which also addresses the problem is merged.
Instead of changing the prototype of vApplicationGetIdleTaskMemory
for SMP, another callback function vApplicationGetPassiveIdleTaskMemory
is introduced in this PR. This ensures that a SMP application can be built with configNUMBER_OF_CORES == 1
without any modification or using compile option.
Sorry for the inconvenient for updating the prototype.
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize );
#if ( configNUMBER_OF_CORES > 1 )
void vApplicationGetPassiveIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize,
BaseType_t xPassiveIdleTaskIndex );
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
The issue will be closed. Feel free to reopen it if any problem.
Describe the bug
Jumping from commit 92a4d175e6f6273ac6ec6af8a2bd0310ac098f05 to commit 4bfb9b2d707304917f35fd5e7dcf692abb3d0cb2, an isr_hardfault appears right after launching the scheduler.
Digging a little one quickly sees that it is actually a panic unsupported cause by a task being unexpectedly exited, see screenshot below.
I added
#define configUSE_PASSIVE_IDLE_HOOK 0
to be compatible with this new passive idle hook. I previously had#define configUSE_MINIMAL_IDLE_HOOK 0
.Target
Host
To Reproduce
Expected behavior In the case that the minimal idle hook was not used (=0), I expect the same behaviour if passive idle hook is not used as well.
Screenshots
Additional context
Here is my config: