Hello Everyone
I am new to iMXRT1166 eval
MCUXpresso SDK 2.x_MIMXRT1160-EVK
there is an example "evkmimxrt1160_shell_cm7" which works fine.
It runs ins "baremetal" mode.
I can see thant "fsl_shell" supports OS like Free RTOS and "OSA" (OS abstraction)
There is a packet in the SDK "osa", which seems to be correct.
I would like to use it with AZURE RTOS threadx
When enabling, it refers to "fsl_os_abstraction_threadx.c"
This is not part of the SDK.
Is there an instance of these files somewhere?
I found this one :
https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h
but it seesm to be incomplete.
thank you
Johannes
I made shell work with Azure RTOS.
I found a problem in fsl_shell.c
typedef struct _shell_context_handle
{
list_label_t commandContextListHead; /*!< Command shellContextHandle list queue head */
serial_handle_t serialHandle; /*!< Serial manager handle */
uint8_t
serialWriteHandleBuffer[SERIAL_MANAGER_WRITE_HANDLE_SIZE]; /*!< The buffer for serial manager write handle */
serial_write_handle_t serialWriteHandle; /*!< The serial manager write handle */
uint8_t serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; /*!< The buffer for serial manager read handle */
serial_read_handle_t serialReadHandle; /*!< The serial manager read handle */
char *prompt; /*!< Prompt string */
#if (defined(SHELL_NON_BLOCKING_MODE) && (SHELL_NON_BLOCKING_MODE > 0U))
#if defined(OSA_USED)
#if (defined(SHELL_USE_COMMON_TASK) && (SHELL_USE_COMMON_TASK > 0U))
common_task_message_t commontaskMsg; /*!< Message for common task */
#else
uint8_t event[OSA_EVENT_HANDLE_SIZE] ; /*!< Event instance */
uint8_t taskId[OSA_TASK_HANDLE_SIZE] ; /*!< Task handle */
#endif
#endif
#endif
char line[SHELL_BUFFER_SIZE]; /*!< Consult buffer */
char hist_buf[SHELL_HISTORY_COUNT][SHELL_BUFFER_SIZE]; /*!< History buffer*/
char printBuffer[SHELL_SPRINTF_BUFFER_SIZE]; /*!< Buffer for print */
uint32_t printLength; /*!< All length has been printed */
uint16_t hist_current; /*!< Current history command in hist buff*/
uint16_t hist_count; /*!< Total history command in hist buff*/
enum _fun_key_status stat; /*!< Special key status */
uint8_t cmd_num; /*!< Number of user commands */
uint8_t l_pos; /*!< Total line position */
uint8_t c_pos; /*!< Current line position */
volatile uint8_t notificationPost; /*!< The serial manager notification is post */
uint8_t exit; /*!< Exit Flag*/
uint8_t printBusy : 1; /*!< Print is busy */
uint8_t taskBusy : 1; /*!< Task is busy */
} shell_context_handle_t;
uint8_t taskId[OSA_TASK_HANDLE_SIZE] is used to host a struct of TX_THREAD.
I don't know, why this placeholder of type uint8_t is necessary, but the effect is, that the portion "taskId" ends up on a non-aligned memory address and causes the task creation to crash
this fixes the issue, (in fsl_shell.c)
#else
uint8_t event[OSA_EVENT_HANDLE_SIZE] __attribute__((aligned (4))); /*!< Event instance */
uint8_t taskId[OSA_TASK_HANDLE_SIZE] __attribute__((aligned (4))); /*!< Task handle */
#endif
this is working now.
I attached the whole project.
It uses the missing OSA abstraction files for threadx from here:
https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h
Johannes