µC/FTPs Tasks Configuration
Tasks priorities configuration
The following configuration constants relate to the µC/FTPs OS port. For many OSs, the µC/FTPs task priority will need to be explicitly configured for the particular OS (consult the specific OS’s documentation for more information).
Constant | Description | Possible Values |
---|---|---|
FTPs_OS_CFG_SERVER_TASK_PRIO | Allows code to be generated to check arguments for functions that can be called by the user and, for functions which are internal but receive arguments from an API that the user can call. | Must be >= 1 |
FTPs_OS_CFG_CTRL_TASK_PRIO | Enable/disable μC/HTTPs debug information: Internal constants assigned to global variables. | Must be >= 1 |
We recommend to configure the Network Protocol Stack task priorities & FTP server tasks priorities as follows:
NET_OS_CFG_IF_TX_DEALLOC_TASK_PRIO (Highest)
FTPs_OS_CFG_SERVER_TASK_PRIO
FTPs_OS_CFG_CTRL_TASK_PRIO ( ... )
NET_OS_CFG_TMR_TASK_PRIO ( ... )
NET_OS_CFG_IF_RX_TASK_PRIO (Lowest )
We recommend that the uC/TCP-IP Timer task and network interface Receive task be lower priority than almost all other application tasks; but we recommend that the network interface Transmit De-allocation task be higher priority than all application tasks that use uC/TCP-IP network services.
However better performance can be observed when the web server instance is set with the lowest priority. So some experimentation could be required to identify the better task priority configuration.
Task Stack Size Configuration
In general, the size of µC/FTPs task stacks is dependent on the CPU architecture and compiler used.
The only guaranteed method of determining the required task stack sizes is to calculate the maximum stack usage for each task. Obviously, the maximum stack usage for a task is the total stack usage along the task’s most-stack-greedy function path plus the (maximum) stack usage for interrupts. Note that the most-stack-greedy function path is not necessarily the longest or deepest function path.
The easiest and best method for calculating the maximum stack usage for any task/function should be performed statically by the compiler or by a static analysis tool since these can calculate function/task maximum stack usage based on the compiler’s actual code generation and optimization settings. So for optimal task stack configuration, we recommend to invest in a task stack calculator tool compatible with your build toolchain.
On ARM processors, experience has shown that configuring the task stacks to 1024 OS_STK
entries (4,096 bytes) is sufficient for most applications. Certainly, the stack sizes may be examined and reduced accordingly once the run-time behavior of the device has been analyzed and additional stack space deemed to be unnecessary.
Constant | Description | Possible Values |
---|---|---|
FTPs_OS_CFG_SERVER_TASK_STK_SIZE | Allows code to be generated to check arguments for functions that can be called by the user and, for functions which are internal but receive arguments from an API that the user can call. | Must be >= 1 |
FTPs_OS_CFG_CTRL_TASK_STK_SIZE | Enable/disable μC/HTTPs debug information: Internal constants assigned to global variables. | Must be >= 1 1024 |