<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: fsl_os_abstraction_threadx in MCUXpresso SDK</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-os-abstraction-threadx/m-p/1603714#M4205</link>
    <description>&lt;P&gt;I made shell work with Azure RTOS.&amp;nbsp;&lt;BR /&gt;I found a problem in fsl_shell.c&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;typedef struct _shell_context_handle
{
    list_label_t commandContextListHead; /*!&amp;lt; Command shellContextHandle list queue head */
    serial_handle_t serialHandle;        /*!&amp;lt; Serial manager handle */
    uint8_t
        serialWriteHandleBuffer[SERIAL_MANAGER_WRITE_HANDLE_SIZE];   /*!&amp;lt; The buffer for serial manager write handle */
    serial_write_handle_t serialWriteHandle;                         /*!&amp;lt; The serial manager write handle */
    uint8_t serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; /*!&amp;lt; The buffer for serial manager read handle */
    serial_read_handle_t serialReadHandle;                           /*!&amp;lt; The serial manager read handle */
    char *prompt;                                                    /*!&amp;lt; Prompt string */
#if (defined(SHELL_NON_BLOCKING_MODE) &amp;amp;&amp;amp; (SHELL_NON_BLOCKING_MODE &amp;gt; 0U))

#if defined(OSA_USED)

#if (defined(SHELL_USE_COMMON_TASK) &amp;amp;&amp;amp; (SHELL_USE_COMMON_TASK &amp;gt; 0U))
    common_task_message_t commontaskMsg; /*!&amp;lt; Message for common task */
#else
    uint8_t event[OSA_EVENT_HANDLE_SIZE] ; /*!&amp;lt; Event instance */
    uint8_t taskId[OSA_TASK_HANDLE_SIZE] ; /*!&amp;lt; Task handle */
#endif

#endif

#endif
    char line[SHELL_BUFFER_SIZE];                          /*!&amp;lt; Consult buffer */
    char hist_buf[SHELL_HISTORY_COUNT][SHELL_BUFFER_SIZE]; /*!&amp;lt; History buffer*/
    char printBuffer[SHELL_SPRINTF_BUFFER_SIZE];           /*!&amp;lt; Buffer for print */
    uint32_t printLength;                                  /*!&amp;lt; All length has been printed */
    uint16_t hist_current;                                 /*!&amp;lt; Current history command in hist buff*/
    uint16_t hist_count;                                   /*!&amp;lt; Total history command in hist buff*/
    enum _fun_key_status stat;                             /*!&amp;lt; Special key status */
    uint8_t cmd_num;                                       /*!&amp;lt; Number of user commands */
    uint8_t l_pos;                                         /*!&amp;lt; Total line position */
    uint8_t c_pos;                                         /*!&amp;lt; Current line position */
    volatile uint8_t notificationPost;                     /*!&amp;lt; The serial manager notification is post */
    uint8_t exit;                                          /*!&amp;lt; Exit Flag*/
    uint8_t printBusy : 1;                                 /*!&amp;lt; Print is busy */
    uint8_t taskBusy : 1;                                  /*!&amp;lt; Task is busy */
} shell_context_handle_t;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;uint8_t taskId[OSA_TASK_HANDLE_SIZE]&amp;nbsp; is used to host a struct of TX_THREAD.&amp;nbsp;&lt;BR /&gt;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&amp;nbsp;&lt;/P&gt;&lt;P&gt;this fixes the issue, (in fsl_shell.c)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#else
    uint8_t event[OSA_EVENT_HANDLE_SIZE] __attribute__((aligned (4))); /*!&amp;lt; Event instance */
    uint8_t taskId[OSA_TASK_HANDLE_SIZE] __attribute__((aligned (4))); /*!&amp;lt; Task handle */
#endif&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;this is working now.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I attached the whole project.&amp;nbsp;&lt;BR /&gt;It uses the missing OSA abstraction files for threadx from here:&lt;BR /&gt;&lt;A href="https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Johannes&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2023 14:06:09 GMT</pubDate>
    <dc:creator>johvis</dc:creator>
    <dc:date>2023-02-22T14:06:09Z</dc:date>
    <item>
      <title>fsl_os_abstraction_threadx</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-os-abstraction-threadx/m-p/1603655#M4204</link>
      <description>&lt;P&gt;Hello Everyone&amp;nbsp;&lt;BR /&gt;I am new to iMXRT1166 eval&lt;BR /&gt;MCUXpresso SDK 2.x_MIMXRT1160-EVK&lt;/P&gt;&lt;P&gt;there is an example "evkmimxrt1160_shell_cm7" which works fine.&amp;nbsp;&lt;BR /&gt;It runs ins "baremetal" mode.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see thant "fsl_shell" supports OS like Free RTOS and "OSA"&amp;nbsp; (OS abstraction)&lt;BR /&gt;There is a packet in the SDK "osa", which seems to be correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use it with AZURE RTOS&amp;nbsp; threadx&lt;/P&gt;&lt;P&gt;When enabling, it refers to "fsl_os_abstraction_threadx.c"&lt;/P&gt;&lt;P&gt;This is not part of the SDK.&lt;/P&gt;&lt;P&gt;Is there an instance of these files somewhere?&lt;BR /&gt;&lt;BR /&gt;I found this one :&lt;BR /&gt;&lt;A href="https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h" target="_blank"&gt;https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but it seesm to be incomplete.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thank you&amp;nbsp;&lt;BR /&gt;Johannes&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 11:02:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-os-abstraction-threadx/m-p/1603655#M4204</guid>
      <dc:creator>johvis</dc:creator>
      <dc:date>2023-02-22T11:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_os_abstraction_threadx</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-os-abstraction-threadx/m-p/1603714#M4205</link>
      <description>&lt;P&gt;I made shell work with Azure RTOS.&amp;nbsp;&lt;BR /&gt;I found a problem in fsl_shell.c&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;typedef struct _shell_context_handle
{
    list_label_t commandContextListHead; /*!&amp;lt; Command shellContextHandle list queue head */
    serial_handle_t serialHandle;        /*!&amp;lt; Serial manager handle */
    uint8_t
        serialWriteHandleBuffer[SERIAL_MANAGER_WRITE_HANDLE_SIZE];   /*!&amp;lt; The buffer for serial manager write handle */
    serial_write_handle_t serialWriteHandle;                         /*!&amp;lt; The serial manager write handle */
    uint8_t serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; /*!&amp;lt; The buffer for serial manager read handle */
    serial_read_handle_t serialReadHandle;                           /*!&amp;lt; The serial manager read handle */
    char *prompt;                                                    /*!&amp;lt; Prompt string */
#if (defined(SHELL_NON_BLOCKING_MODE) &amp;amp;&amp;amp; (SHELL_NON_BLOCKING_MODE &amp;gt; 0U))

#if defined(OSA_USED)

#if (defined(SHELL_USE_COMMON_TASK) &amp;amp;&amp;amp; (SHELL_USE_COMMON_TASK &amp;gt; 0U))
    common_task_message_t commontaskMsg; /*!&amp;lt; Message for common task */
#else
    uint8_t event[OSA_EVENT_HANDLE_SIZE] ; /*!&amp;lt; Event instance */
    uint8_t taskId[OSA_TASK_HANDLE_SIZE] ; /*!&amp;lt; Task handle */
#endif

#endif

#endif
    char line[SHELL_BUFFER_SIZE];                          /*!&amp;lt; Consult buffer */
    char hist_buf[SHELL_HISTORY_COUNT][SHELL_BUFFER_SIZE]; /*!&amp;lt; History buffer*/
    char printBuffer[SHELL_SPRINTF_BUFFER_SIZE];           /*!&amp;lt; Buffer for print */
    uint32_t printLength;                                  /*!&amp;lt; All length has been printed */
    uint16_t hist_current;                                 /*!&amp;lt; Current history command in hist buff*/
    uint16_t hist_count;                                   /*!&amp;lt; Total history command in hist buff*/
    enum _fun_key_status stat;                             /*!&amp;lt; Special key status */
    uint8_t cmd_num;                                       /*!&amp;lt; Number of user commands */
    uint8_t l_pos;                                         /*!&amp;lt; Total line position */
    uint8_t c_pos;                                         /*!&amp;lt; Current line position */
    volatile uint8_t notificationPost;                     /*!&amp;lt; The serial manager notification is post */
    uint8_t exit;                                          /*!&amp;lt; Exit Flag*/
    uint8_t printBusy : 1;                                 /*!&amp;lt; Print is busy */
    uint8_t taskBusy : 1;                                  /*!&amp;lt; Task is busy */
} shell_context_handle_t;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;uint8_t taskId[OSA_TASK_HANDLE_SIZE]&amp;nbsp; is used to host a struct of TX_THREAD.&amp;nbsp;&lt;BR /&gt;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&amp;nbsp;&lt;/P&gt;&lt;P&gt;this fixes the issue, (in fsl_shell.c)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#else
    uint8_t event[OSA_EVENT_HANDLE_SIZE] __attribute__((aligned (4))); /*!&amp;lt; Event instance */
    uint8_t taskId[OSA_TASK_HANDLE_SIZE] __attribute__((aligned (4))); /*!&amp;lt; Task handle */
#endif&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;this is working now.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I attached the whole project.&amp;nbsp;&lt;BR /&gt;It uses the missing OSA abstraction files for threadx from here:&lt;BR /&gt;&lt;A href="https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Masmiseim36/nxpSDK/blob/master/components/osa/fsl_os_abstraction_threadx.h&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Johannes&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 14:06:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-os-abstraction-threadx/m-p/1603714#M4205</guid>
      <dc:creator>johvis</dc:creator>
      <dc:date>2023-02-22T14:06:09Z</dc:date>
    </item>
  </channel>
</rss>

