With nano-specs I can't get printf statements like this to work where it needs to take in values from a variable.
printf ("Data1 %d\n", data1);
A simpler printf with just characters work ok.
printf ("abc\n");
Per the standard CMSDK setup, I am retargetting the printf to UART.
Point to note, when not using nano-specs (no specific specs specified) it works ok. I suppose there must be something different with nano-specs.
Running any code with the top statement in RTL simulation will not output anything from the UART.
Appreciate any inputs in this matter. Thanks
Hi Joey,
I'm quite sure it was an int printf with %d. Are there any special functions that I need to override in retarget.c for nanospecs? At the moment I am jsut using the default CMSDK retarget code as below.
/******************************************************************************/ /* Retarget functions for GNU Tools for ARM Embedded Processors */ /******************************************************************************/ #include <stdio.h> #include <sys/stat.h> extern unsigned char UartPutc(unsigned char my_ch); __attribute__ ((used)) int _write (int fd, char *ptr, int len) { size_t i; for (i=0; i<len;i++) { UartPutc(ptr[i]); // call character output function } return len; } #endif