Hello!I am running a FreeRTOS TCP Echo Server example on a Arm Virtual Hardware target. The echo part works perfectly, however, I would like to print out the amount of ticks it took to run the client echo from xTaskGetTickCount() in the telnet terminal that the virtual target is hosted on but the printf() does not seem to print anything in my case when the echo is done. The Client part is ran on the Ubuntu Host as a python script. From the information that I've gathered I have to do some sort of retargeting to utilize printf() properly to be able to print in the telnet terminal. I found this GetStarted example https://github.com/ARM-software/AVH-GetStarted/blob/main/basic/main.c where they managed to use printf()'s in their main function and I'm wondering how I can do the same for my project. I've tried to follow this example (https://www.keil.com/pack/doc/compiler/RetargetIO/html/Retarget_Examples_UART.html) without any success. Below I've included the project example that could be downloaded from MCUXpresso but I'm running it on Keil Uvision. The path to the project file is tcpecho\boards\frdmk64f\lwip_examples\lwip_tcpecho\freertos\mdk. The printf() are in the tcpecho.c file which is located in lwip/contrib/apps/tcpecho from line 62-94.
I suggest you start with a more simple example - you will find a Blinky example that you can use for Corstone-300. Therein you will find the retargeting of fputc() within serial.c, allowing printf to be used with the serial port.
Hi! I took a look at the Blinky example however, I'm still not quite sure how to implement the serial.c to my project since there seemed to be a few header files that needed to be included such as device specific header files, and I'm not sure how to translate it to the Cortex-M4. How should I proceed to make sure I can get all the right header files included for my serial.c? I was not able to find all the header files in the Blinky folder either but even then I'm not sure if that would work since I'm targeting the Cortex-M4 and not Corstone-300. I tried to copy the serial.c and serial.h files straight to my project but couldn't manage to have the same tree structure in the project window. Furthermore, I also took a look at a Blinky example for a Cortex-M4 device (FRDM-k64F) but it did not have a retargeting. How can I get all these header files below, and how can I make the tree structure look the same for my project?
UPDATE: Most of the header files I attained by building the project. I got the Driver_USART.h by adding it to my Software Components in the "Manage Run-Time Environment" menu however, this seemed to break my project and I got tons of errors/warnings for "Warning: Implicit declaration of function is invalid in C99". So out of these includes(below) in the serial.c file I managed to fix all of them except for the device_cfg.h but for that one I could set the Baudrate manually. So in the end the main problem seems to be with the USART driver that completely breaks my program. Not quite sure how to fix that problem.#include <stdio.h>#include <string.h>#include "device_cfg.h"#include "Driver_USART.h"#include "serial.h"
This happens when I build after enabling the CMSIS Driver USART (API).
These files are provided by CMSIS Packs... your example seems to have these files hard-copied into your project.
You should instead select them from the Manage Run-Time Environment pane. For example, from the Blinky example, you see UART driver code (and others) enabled.
I don't have a "Native Driver" under my Software Component in the Manage Run-Time Environment pane. As I mentioned in the update the CMSIS Pack that seems to break my project is the USART (API) one under CMSIS Driver or is it because I don't have the CMSIS Packs for Native Driver?
The errors and warnings that are shown in the previous screenshot only appears after enabling the USART (API) CMSIS Pack.