Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The first step before including µC/HTTP-client 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/HTTP-client 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/HTTP-clientTFTPc. Then you can follow the steps to build and run your first µC/HTTP-client TFTPc sample application shown below.

Including µC/

...

TFTPc Stack Source Code

...

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

\Micrium\Software\uC-HTTPTFTPc

Copying and Modifying Template Files

Copy the files file from the uC-HTTP-client µC/TFTPc configuration folder into your application as illustrated below.


Panel
titleFigure - TFTPc Template File Copy

Image Added


Adding µC/TFTPc Example Application Code

...

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


Code Block
languagecpp
titleListing - TFTPc Example Application Code
#define  TFTPc_TEST_SERVER_IP               "192.168.1.102"
#define  TFTPc_TEST_SERVER_PORT                         69 
            
#define  TFTPc_TEST_FILE_NAME_LOCAL          "\\file_local"
#define  TFTPc_TEST_FILE_NAME_REMOTE_GET  "file_remote_get"
#define  TFTPc_TEST_FILE_NAME_REMOTE_PUT  "test_remote_put"
            
static  void  App_TestTFTPc (void) 
{ 
    NET_IP_ADDR  ip_server; 
    NET_ERR      err_net; 
    TFTPc_ERR    err; 
            
            
    ip_server = NetASCII_Str_to_IP(TFTPc_TEST_SERVER_IP,                                     /* See Note #1. */
                                  &err_net); 
    if (err_net != NET_ASCII_ERR_NONE) { 
        printf("Error - NetASCII_Str_to_IP: %d\n\r", err_net);   
        return; 
    }
     
    TFTPc_Init(&TFTPc_Cfg, &err);                                                            /* See Note #2. */
    if (err != TFTPc_ERR_NONE) {
        printf("Error - TFTPc Initialization: %d\n\r", err);  
        return; 
    }
 
    (void)TFTPc_Get(DEF_NULL,                                                                /*See Note #3. */
                    TFTPc_TEST_FILE_NAME_LOCAL, 
                    TFTPc_TEST_FILE_NAME_REMOTE_GET, 
                    TFTPc_MODE_NETASCII,
                   &err); 
    if (err != TFTPc_ERR_NONE) { 
        printf("Error - TFTPc_Get: %d\n\r", err); 
    } 
             
    (void)TFTPc_Put(DEF_NULL,                                                                /*See Note #4. */
                    TFTPc_TEST_FILE_NAME_LOCAL, 
                    TFTPc_TEST_FILE_NAME_REMOTE_PUT, 
                    TFTPc_MODE_NETASCII,
                   &err);  
    if (err != TFTPc_ERR_NONE) { 
        printf("Error - TFTPc_Put: %d\n\r", err); 
    }
}


Panel
bgColor#f0f0f0
  1. Converts the ASCII dotted-decimal notation to a network protocol IPv4 address.
  2. Initializes the TFPTc suite.
  3. Initiates a “GET” request, that is a request for reading (RRQ) from the default server configuration.
  4. Initiates a “PUT” request, that is a request for writing (WRQ) to the default server configuration.