Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

uC/OS-II Stack Size always at maximum defined

Hi,

I need help in understanding what could be the cause of the phenomena I see.

I have a webserver application (started from the altera example) to which I added a couple of other threads

- Database - a thread polling a large number of periphery components (i2c, Avalon-MM) and updates the latest value in a global array

- Http - accepts connections, fetches files from ZipFS, parses them and replaces certain strings with the values from the large array

- watchdog, etc...

- terminal --> I have also implemented a stack checking command.

Scenario:

  1. application up, no link -> Http not started; DATABASE uses ~4KB of stack

  2. http started, 1st request -> Database uses maximum defined.

Interesting, if I allocate 64KB or 4MB (which it uses completely), the application is stable in both cases, no difference.

The whole application uses ~ 1MB, so the I can't explain how it reaches those numbers...

My questions:

  1. What could be the reason the OSStatChk is reporting me these numbers?

  2. From my observation, this numbers returned by OSStatChk are the maximum ever used since startup. Is there a way to reset these counters?


*********************************************************
*** OS_TASK ***         used         free  
*********************************************************
HTTP_TASK               28356           37180
TERMINAL_TASK           3776            4416
DATABASE_TASK           262144          0
PHYMON_TASK             3968            4224
WATCHDOG_TASK           3812            4380
TELNET_TASK             5996            10388

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Moving to the new "Other Operating Systems" forum. This is where all non-Linux OS related questions will go moving forward.