Specifications

1–26 Chapter 1: Using the NicheStack TCP/IP Stack
Important NicheStack TCP/IP Stack Concepts
Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial June 2011 Altera Corporation
TK_NETTICK_TPRIO
, defined in ipport.h, sets the priority to a value of 3 for the
NicheStack TCP/IP Stack time-keeping task, launched by
netmain()
. The NicheStack
TCP/IP Stack uses this task to keep track of time-based events in the networking
stack. Altera recommends that you set the priority of this task to one priority level
lower than
TK_NETMAIN_TPRIO
.
Networking Initialization Task
SSS_INITIAL_TASK_PRIORITY
is set to a value of 5 for the first task that MicroC/OS-II
runs. This task creates the resources and all the other tasks before deleting itself. This
task is given a high priority, not due to its high time-period rate or low latency
requirement, but to create all the real-time operating system resources and tasks
before the other tasks start using the resources.
User Networking Tasks
SSS_NIOS_II_SIMPLE_SOCKET_SERVER_TASK_PRIORITY
is set to a value of 10, a priority
that is lower than the consumer task
LEDManagementTask()
. The priority of this
application task is set lower than all of the software components’ system service tasks.
This practice allows for the best overall scheduling latency, because the software
component tasks are designed to operate for as short a period of time as possible.
User Non-Networking Tasks
LED_MANAGEMENT_TASK_PRIORITY
is set to a value of 7. This task’s function is to receive
LED command messages from the
SSSNiosIISimpleSocketServerTask
.
LED_BLINK_TASK_PRIORITY
is set to a value of 11. The priority of this application task is
set lower than the rest of the tasks in the system because it requires very little of the
Nios II processor’s cycles to operate.
PHY Monitoring Task
SSS_MONITOR_PHY_TASK_PRIORITY
is set to value 9. This task monitors the status of a
single network PHY and acts to maintain the network connection.
Task Stack Size
Task stack space requirements depend on how the Nios II processor, HAL, RTOS, and
individual software components are configured. A quick empirical check of the
Stk[]
array values at runtime, via the Nios II SBT for Eclipse memory window, is an easy
way to examine the top of a task stack. Examination of a task’s
Stk[]
array reveals
differing values representing the used portion of the stack followed by multiple zeros
where the stack has not yet reached. The number of zeros until the beginning of the
next adjacent task stack shows how deep the stack has grown since the last system
reset.
All tasks that make run-time library calls have space allocated from the top of the
stack for the approximately 900-byte
_reent
structure. Each task has its own copy of
the structure positioned on the task’s stack. The size of this structure alone reduces the
amount of available stack space.