Keil MDKv5.1 CMSIS-DAP printf not function

11 Feb 2014

Dear all

Recently i'm testing CMSIS-DAP debug. The Helloworld testing is done successfully.

Normal I/O with step debugging is working fine but printf is not function. May i know this the CMSIS-DAP limitation?

Thank you, Wq

12 Feb 2014

Hello Wen qian,

What do you mean by "printf is not function" ?

Regards,
0xc0170

12 Feb 2014

Hello Martin Kojtal,

Thanks for your reply.

Means in the code i have call the printf function and...

printf simulation code

#include "mbed.h"

DigitalOut myled(LED1);
Serial     pc(USBTX, USBRX); // tx, rx

int main() {
    pc.printf("Hello World\n\r");
    
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

wish to simulate the UART with using Keil UART debug tool. /media/uploads/bc/debug_-printf-_viewer.jpg

In the UART viewer it didn't show "Hello World".

Is it i have miss configure any setting?

Best Regards, Wq

12 Feb 2014

Hello,

that debug viewer is through ITM, more information http://www.keil.com/support/man/docs/ulinkpro/ulinkpro_trace_itm_viewer.htm. mbed redirects printf to the default uart module, which for example on KL25Z is UART0 module and this module is connected to interface UART. I believe debug viewer is not supported at the moment.

An article about semihosting with mbed is on feabhas blog : ]]http://blog.feabhas.com/2013/04/rehosting-armcc-for-the-mbed-with-cmsis-dap/]]. It was posted a while ago, cmsis-dap has changed so might not be up to date.

Regards,
0xc0170

13 Feb 2014

Hello Martin Kojtal,

I also found something on feabhas blog: http://blog.feabhas.com/2013/04/rehosting-armcc-for-the-mbed-with-cmsis-dap/

I still testing it. Have not success yet. Have you try this basic before? and can you guide me how to do it? Now i have connection between mbed and Teraterm problem haven't fix yet and i can't simulate/debug my program with using UART.

Thank you, Wq

04 Feb 2015

Hi, I have the same problem with KEIL V5.12, but only working with ULINK2. With JLINK the printf function over Debug (printf) viewer its OK.