LOG(x) redirect from Semihost console to UART console

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LOG(x) redirect from Semihost console to UART console

1,050 Views
MarcinChelminsk
Contributor IV

Good morning!

I am playing with one of the examples available for eIQ for i.MXRT1060.

For printing there are used as follows:

#define LOG(x) std::cout

and later in the code for example:

LOG(FATAL) << "Failed\r\n";

LOG(INFO) << "Some info message\r\n";

By default, text goes to Semihost console.

Any hints how to redirect the output to UART Console for example TeraTerm?

I have seen the way to go to Quick Settings -> SDK Debug Console -> UART Console but unfortunately it does not work in this example.

Any hints more than welcome! Thanks in advance!

Labels (1)
0 Kudos
5 Replies

887 Views
MarcinChelminsk
Contributor IV

Hi jeremyzhou‌ ,

the example is called "tensorflow_lite_label_image", SDK version 2.6.0, i.MXRT1060-EVK

And please see my notes above I posted in the meantime

0 Kudos

887 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Marcin Chelminski,

Thanks for your reply.
I think the above method doesn't work because of the tensorflow_lite_label_image uses the C++ instead of the C language.
You can follow the below steps to print the message via the UART.
1.  Switch from Semihosting via UART(Quick Settings -> SDK Debug Console -> UART Console).
2. Add #include "fsl_debug_console.h" in the lable_image.cpp
3. Use the macro PRINT to output the message, likes
  PRINTF("Label image example using a TensorFlow Lite model\r\n");  


Please give a try.
Have a great day,
TIC

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

887 Views
MarcinChelminsk
Contributor IV

Hi jeremyzhou‌ ,

have you tried this with "tensorflow_lite_label_image" when importing project from SDK examples?

  1. when I choose UART output during project import, I can see the output in the TeraTerm (in project properties I can see that SDK_DEBUGCONSOLE=1, so sounds good)
  2. when I switch between UART and Semihosting (using Quick Settings -> SDK Debug Console -> UART Console), I can see the output in the MCUXpresso Console (in project properties I can see that SDK_DEBUGCONSOLE=0, so this sounds good as well)
  3. when I try to switch back from Semihosting to UART, then I can not see the output in the TeraTerm (even though in project properties I can see that SDK_DEBUGCONSOLE=1 again, like in the 1st point)

Does it work in the same way on your side?

Any explanation what is going here, why after importing the project with UART settings I can see the output in the TeraTerm, but after changing Quick Settings -> SDK Debug Console -> Semihost Console and then go back Quick Settings -> SDK Debug Console -> UART Console I can not see the output in the TeraTerm anymore?

0 Kudos

887 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Marcin Chelminski ,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Whether you can tell me which exactly do you test with, as I'd like to do some testing on my site.

Looking forward to your reply.
Have a great day,
TIC

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

887 Views
MarcinChelminsk
Contributor IV

I have been looking for a solution for a while, using the links

https://community.nxp.com/thread/476503

https://community.nxp.com/docs/DOC-334074

and what I did notice:

  1. when I choose UART output during project import, I can see the output in the TeraTerm (in project properties I can see that SDK_DEBUGCONSOLE=1, so sounds good)
  2. when I switch between UART and Semihosting (using Quick Settings -> SDK Debug Console -> UART Console), I can see the output in the MCUXpresso Console (in project properties I can see that SDK_DEBUGCONSOLE=0, so this sounds good as well)
  3. when I try to switch back from Semihosting to UART, then I can not see the output in the TeraTerm (even though in project properties I can see that SDK_DEBUGCONSOLE=1 again, like in the 1st point)

sounds like bug? or I missed something?

0 Kudos