Configuration

The µC/TFTPc module has to be configured according to your specific needs. Template configuration files (tftp-c_cfg.c/h) are included in the module package (see section Directories and Files), and those configuration files should be copied into your application path. 

Micriµm provides sample configuration code free of charge; however, most sample code will likely require modifications depending on specific feature requirements and memory limitation.

There are two groups of configuration parameters: the compile-time and the run-time configuration.

Compile-Time Configuration

Argument Checking Configuration 

All API functions in μC/TFTPc include code to validate arguments that are passed to it. Specifically, μC/TFTPc checks to see if passed pointers are NULL, if arguments are within valid ranges, etc. The following constant configures additional argument checking.

Constant
Description
Possible Values
TFTPc_CFG_ARG_CHK_EXT_ENIncludes generated code to check arguments for functions that can be called by the user as well as internal functions which receive arguments from an API that the user can call.DEF_ENABLED or DEF_DISABLED

Runtime-Time Configuration

µC/TFTPc requires a run-time configuration that must be passed during the initialization. TFTPc run-time configuration template file is provided (see Directories and Files). The run-time configuration template file  (tftp-c_cfg.c ) should be copied into the application folder and modified as per individual project requirements.


Listing - µC/TFTPc Configuration Structure
const  TFTPc_CFG  TFTPc_Cfg = {
/*
*--------------------------------------------------------------------------------------------------------
*                                    TFTP SERVER CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/
                                                        /* TFTP Server hostname or IP address.                          */
        "192.168.1.100",
                                                        /* TFTP Server port number.                                     */
         69,
                                                        /* Select IP family of address when DNS resolution is used:     */
         NET_IP_ADDR_FAMILY_NONE,
                                                        /* NET_IP_ADDR_FAMILY_NONE: No preference between IPv6 and IPv4.*/
                                                        /* NET_IP_ADDR_FAMILY_IPv4: Only IPv4 addr will be returned.    */
                                                        /* NET_IP_ADDR_FAMILY_IPv6: Only IPv6 addr will be returned.    */
/*
*--------------------------------------------------------------------------------------------------------
*                                     TIMEOUT CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/
         5000,                                          /* Maximum inactivity time (ms) on RX.                          */
         5000                                           /* Maximum inactivity time (ms) on TX.                          */
};