Hi there,
I'd like to use the fsl_shell utility with FreeRTOS, using static memory allocation. The example included in the SDK runs on bare metal and I'm kind of falling down a rabbit hole of #defines and compilation errors trying to get it to work in a non-blocking manner. There must be a simpler way to do it. Can someone give me an example?
Thanks,
L.M.
Hi Luke Marvin ,
About the shell examples, we still don't have the freertos version, just have the code under SDK:
SDK_2.7.0_EVK-MIMXRT1060\boards\evkmimxrt1060\demo_apps\shell
I think you can make the baremetal code works at first, then try to add it to the freertos project.
Wish it helps you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kerry,
Yes I have the baremetal example implemented and it works great. I'm working on implementing it in a FreeRTOS task but having trouble. I was hoping for some instruction on that aspect.
L.M.
Hi Luke Marvin,
If you set the baremetal function as the one freertos task, whether that works or not?
If you can't, what's the detail problem you are using?
Wish it helps you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kerry,
I have been able to get the shell module to work in a task. I needed to set the priority of the shell task to be lower than all the others and make sure that all other tasks have a vTaskDelay() in them.
However this implementation isn't ideal for me because I can't really control how often the shell task is called.
I'm looking into SHELL_NON_BLOCKING_MODE. It looks like I define DEBUG_CONSOLE_TRANSFER_NON_BLOCKING, which sets SERIAL_MANAGER_NON_BLOCKING_MODE=1.
Since I am using static memory allocation in my project this causes an error when using the function xSemaphoreCreateMutex(). I've made the following change in fsl_debug_console.c
- #define DEBUG_CONSOLE_CREATE_MUTEX_SEMAPHORE(mutex) ((mutex) = xSemaphoreCreateMutex())
+ StaticSemaphore_t xMutexBuffer; // allocate the memory
+ #define DEBUG_CONSOLE_CREATE_MUTEX_SEMAPHORE(mutex) ((mutex) = xSemaphoreCreateMutexStatic(&xMutexBuffer))
The project will compile but when I run it in debug it hangs in the SerialManager_Write() function in serial_manager.c in the while-loop on line 660.
if (kSerialManager_TransmissionBlocking == mode)
{
while (serialWriteHandle->transfer.length > serialWriteHandle->transfer.soFar)
{
#if defined(__GIC_PRIO_BITS)
if ((__get_CPSR() & CPSR_M_Msk) == 0x13)
#else
if (__get_IPSR() != 0U) // This is never not zero
#endif
{
SerialManager_IsrFunction(handle);
}
}
}
return kStatus_SerialManager_Success;
I see that this happens because it is using kSerialManager_TransmissionBlocking mode. Should I be able to do a blocking write even though the serial manager is configured for non-blocking?
L.M.
Hi Luke Marvin,
I will help you to check it with our RTOS engineer after I am back to work.
Now, we are in Chinese Spring Festival, and because of the Corona virus, we will back to work on Feb. 10th.
So, please give me more time, after I back to work, I will help you to check it with our internal RTOS engineer.
If you are in hurry, you also can create the new question post about it, then our other RT RTOS engineer will help you!
Best Regards,
Kerry