Hi,
I have one question about Cortexm3 from smartfusion device from actel. Could you pls help me? I add follwing codes into retarget.c and then add retarget.c into source code group and find : printf function works.however scanf function doesn't. anybody knows why?
int fputc(int ch, FILE *f) { return ((int)ITM_SendChar(ch)); } int fgetc(FILE *f) { int i=0; i=ITM_ReceiveChar(); if((-1)!=i) return ((int)ITM_SendChar((uint32_t)i)); else return (0); }
printf("hello world\n\r"); // when executed, string displayed in debug(printf)window scanf("%s",str); // when executed, hard fault occurs
Hello Martin Günther,
Thank you very much. Yes, It works even in real hardware.
You are so kind.
Have a nice weekend.
Hello Per Westermark and Andrew Neil,
also, Thank a lot for your kindly help. wish you both a nice weekend.
Best regards, Fisher Cheng
Hi, could you please post your code in ITM_Sendchar to retarget to debug (printf) viewer via ITM. I've encountered a problem on how to view the printf output in the debug(printf) viewer. I know how to retarget to real UART connected to PC via Hypertermial using retarget.c. However I don't know how to retarget to debug(printf) windows via ITM. I've read a lot forums about ITM codes but unfortunately it didn't work on mine as i've applied in my program. Thanks.
Hello,
Neglect about the ITM_SendChar I already have the latest version of CMIS core support. My only problem is unable to view the printf Output display in the Debug Printf Viewer during debugging using the ULINK debugger. I already configured the necessary settings but still it can't display. If I used SIMULATION everything works fine. Is their another setup to configure in order to enable my Debug printf viewer? Thanks.
Pls check the codes above from Martin Günther. It does works in real kit.