Building and Running an Example Application

Working Project with µC/TCP-IP

The first step before including µC/TFTPc is to have a working project with µC/TCP-IP. As previously mentioned, Micriµm may offer an example with the µC/OS-III kernel, µC/TCP-IP and even µC/TFTPc for many evalboards. 

If no project with µC/TCP-IP is available for your platform, you should follow the µC/TCP-IP Getting Started Guide to ensure you have a working project before installing µC/TFTPc. Then you can follow the steps to build and run your first µC/TFTPc sample application shown below.

Including µC/TFTPs Stack Source Code

Configuring Compiler settings

Add the following include paths to your project’s C compiler settings:

\Micrium\Software\uC-TFTPs

Copying and Modifying Template Files

Copy the file from the µC/TFTPs configuration folder into your application as illustrated below.

Figure - TFTPs Template File Copy

Adding µC/TFTPs Example Application Code

The file app.c contains the application code, and was written to illustrate the capabilities of the µC/TFTPs module. That code simply initializes the RTOS, µC/TCP-IP, and µC/FS, and creates a few tasks and other kernel objects that will give the user information about the state of the system.

Note that some sections of the source code have been removed or modified to help focus on the µC/TFTPs module use.

Listing - TFTPs Example Application Code
void  AppTaskStart (void  *parg) 
{ 
	TFTPs_ERR          err_tftps;

   
    App_InitFS();                                               /* See Note #1. */                              
	App_InitTCPIP();                                      		/* See Note #2. */   
           
	printf("Initialize TFTP server...\n\r");
	TFTPs_Init(&TFTPs_Cfg, &TFTPs_TaskCfg, &err_tftps);         /* See Note #3. */   
	TFTPs_En();													/* See Note #4. */
}
  1. Initialization of the µC/FS file system.
  2. Initialization of the µC/TCP-IP stack.
  3. Initialization of the µC/TFTPs module.
  4. Enable TFTP Server. When this function returns, the system is ready to accept TFTP requests from other hosts on the network.