Configuration

The µC/TFTPs module has to be configured according to your specific needs. Template configuration files (tftp-s_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/TFTPs include code to validate arguments that are passed to it. Specifically, μC/TFTPs 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
TFTPs_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

Trace Configuration 

Constant
Description
Possible Values
TFTPs_TRACE_HIST_SIZEConfigures the Trace history size.Minimum value is 16.

Runtime-Time Configuration

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

Listing - µC/TFTPs Configuration Structure
const  TFTPs_CFG  TFTPs_Cfg = {
/*
*--------------------------------------------------------------------------------------------------------
*                                    TFTP SERVER CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/
                                                        /* Configure socket type  :                */
        TFTPs_SOCK_SEL_IPv4,
														/* TFTPs_SOCK_SEL_IPv4       Accept Only IPv4.          */
                                                        /* TFTPs_SOCK_SEL_IPv6       Accept Only IPv6.          */

 														/* TFTP Server port number.                                     */
         69,
                                                      
/*
*--------------------------------------------------------------------------------------------------------
*                                     TIMEOUT CONFIGURATION
*--------------------------------------------------------------------------------------------------------
*/
         5000,                                          /* Maximum inactivity time (ms) on RX.                          */
         5000                                           /* Maximum inactivity time (ms) on TX.                          */
};

Task Configuration

µC/TFTPs also requires a task configuration that must be passed during the initialization.

Listing - µC/TFTPs Task Configuration Structure
const  TFTPs_TASK_CFG  TFTPs_TaskCfg = {
        15u,                                                    /* .Prio         (TFTPs task priority)                  */
        2048,                                                   /* .StkSizeBytes (TFTPs task stack size in bytes)       */
        DEF_NULL,                                               /* .StkPtr       (TFTPs task stack pointer)             */
};