AnsweredAssumed Answered

On MacOS ITM_ReceiveChar macro stops working

Question asked by Deniz Can Cigsar on Dec 27, 2018
Latest reply on Jan 2, 2019 by ZhangJennie

The following code captures only 2 characters, than it stops capturing on MacOS.. For instance, if user presses "abc" and presses enter, only ab is captured. Than ITM_ReceiveChar always returns -1..

 

int i = 0;

while (i < 100)

{

     int c = ITM_ReceiveChar();

     if (c == -1)

         continue;

     if (c == 'A')

         i++;

     if (c == 'S')

         i--;

}

 

The code works OK in Windows.. Additionaly, if the code starts transmitting characters on very first instance of the boot through ITM port 0, the ITM Console clears out the incomming data.. Adding 2 seconds of delay to the code fixes that problem but it is inconvenient..

 

Btw: Transmitting with enter, and echoing is a little discomforting. I implemented shell interface with history, with this way I cannot use the history by pressing "up" key etc..

Outcomes