Semihost with fsl_debug_console blocks other threads

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Semihost with fsl_debug_console blocks other threads

1,675 次查看
rans
Senior Contributor I

Hello,

I try to use semohist (vrtual com) with fsl_debug_console.h:

#define SDK_DEBUGCONSOLE 0U
#define _SDK_DEBUGCONSOLE_UART

But it only works with baremetal, with freertos, the thread is keep waiting on fgetc().

Is there a way to overcome this ?

Thanks,

ranran

标签 (1)
7 回复数

1,568 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ranran,

   What the RT board you are using? Do you try the SDK code freertos sample code directly?

   What's the IDE you are using now? I will help you to check it .


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.
-------------------------------------------------------------------------------

0 项奖励

1,569 次查看
rans
Senior Contributor I

Hi,

>What the RT board you are using?

imxRT1050

>Do you try the SDK code freertos sample code directly?

Yes, can this code works with both freertos+semihost (instead of uart), or is it that semihost can only be done with baremetal ?

I have changed in fsl_debug_console.h to: (maybe this is not the correct changes that should be done?)

#define SDK_DEBUGCONSOLE 0U
#define _SDK_DEBUGCONSOLE_UART

> What's the IDE you are using now? 

IAR 

Thank you very much for any idea,

ranran

0 项奖励

1,569 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ranshalit,

    As I know, the MCUXpresso IDE project can select it to semihost or UART  directly.

   So, do you mind to try the MCUXPresso project?
pastedImage_1.png

pastedImage_2.png

You can find it can printf to the console directly.


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.
-------------------------------------------------------------------------------

1,569 次查看
rans
Senior Contributor I

Hi Kerry,

Thank yo very much for the help!

I understand that the project (with freeRTOS) demonstrate "printf".

Yet, the big question is if it can also use fgetc (wait for a character input), while still are threads are keep running  ?

Thanks,

ranran

0 项奖励

1,569 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ranran,

   You can create a new task, then use the GETCHAR.

static void hello_task(void *pvParameters)
{
    char ch;
    for (;;)
    {
       // PRINTF("Hello world.\r\n");
      //  vTaskSuspend(NULL);
        ch = GETCHAR();
        PUTCHAR(ch);
    }
}

pastedImage_4.png

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.
-------------------------------------------------------------------------------

1,569 次查看
rans
Senior Contributor I

Hello Kerry,

I think it won't work becuase GETCHAR is fgetc, which is non blocking, and is sory of busy wait, without freeing the thread to any other running threads.

Did you try it ?

Thanks,

ranran

0 项奖励

1,569 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ranran,

  I think you totally can try it on your side at first, if you want to add any other task.

  And, it is freertos usage now, not the RT chip question.

  At least, if I try one task, it works OK.

  You can test it, if you still have any other question, you can post the freertos question and let us know, thank 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.
-------------------------------------------------------------------------------

0 项奖励