Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12590 Discussions

lwIP, uCOSII and task priority ranges

Altera_Forum
Honored Contributor II
1,062 Views

Came over this while trying to figure out why object "sys_stack" occupied half my RAM size in the .elf.  

In sys_arch.h: 

# define LWIP_MAX_TASKS OS_LOWEST_PRIO /* Number of LwIP tasks */# define LWIP_START_PRIO 0 /* Defined the lowest LwIP task priority */# define LWIP_STACK_SIZE 2048 /* Stack size for LwIP tasks */ 

/* Note:  

Task priorities, LWIP_START_PRIO through (LWIP_START_PRIO+LWIP_MAX_TASKS-1) must be reserved 

for LwIP and must not used by other applications outside. */ 

 

In sys_arch.c: 

OS_STK sys_stack[LWIP_MAX_TASKS][LWIP_STACK_SIZE]; 

So, this explains my big sys_stack, since I have set OS_LOWEST_PRIO to 63.  

 

My question now, however, is:  

If you reserve the range 0 to OS_LOWEST_PRIO for lwIP tasks, is there any prios left for other tasks? Presumption: OS_LOWEST_PRIO = highest number any task can have for priority. 

 

 

Frode,  

Norway
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
321 Views

Have put my task priorities closer together and reduced OS_LOWEST_PRIO, hence making sys_stack smaller and saving memory. Did not change anything in sys_arch.* 

 

All tasks seems to work in harmony. 

 

Is it so that lwIP doesn't use any other priorities than those I can control from the app as arguments to lwip_stack_init(), lwip_devices_init() and calls to sys_thread_new()? 

 

In case the Note comment in sys_arch.h makes any sense, wouldn't the constant LWIP_MAX_TASKS be better off configured from the IDE, rather than set to OS_LOWEST_PRIO? 

 

Frode,  

Norway
0 Kudos
Reply