Serial debug when starting iot_monitor via script

roberthartman's picture

Is there a way to get application serial output (e,g, printf) when using the CUSTAPP/ script to start up something like the iot_monitor demo application? I realize this can be achieved by starting the application directly via adb shell, however I would like to be able to see my printfs when I've got things set up to autostart my iot_monitor-like application after the Linux OS boots.

jflynn129's picture

The problem is that when you start the application from the startup script via a daemon, the stdout is not defined and thus the output of the printf's are sent nowhere.  To get the output going to a non-standard IO (which is what is needed), you would have to open a UART and write to that output rather than stdout.

There is a lot of info out on the web (sorry I don't have a specific link at this time) that discusses this, it may be possible that you simply need to redirect stdout to the uart prior to running the program in the daemon. I've not done this, an easier way to do this (if you are just looking to debug the startup/execution) is to redirect the output to a file, e.g., ./iot_monitor > my_output.txt. Then when you startup, it will log the data to the file and you can later kill the process and dumpt the file.