I'm working on a TI-RTOS application with the CC3200 Launchpad based on some example projects, and I have a problem where when one task connects to WiFi, another tasks stops running. I believe this is a stack or memory allocation issue.
I have a main task which is started based on the ti-rtos cfg file, and has a stack size of 15000. When that main task starts, it creates another task, which is responsible for periodically connecting to the Internet, performing some operations and disconnecting. After the main task starts the second task, it continues performing some other data collection operations (e.g. reading sensors).
If I let the main task connect to WiFi, the main task data collection continues fine, while the second task accesses the Internet. If however I have the second task make the connection (ultimately through sl_WlanConnect), the first task stops at the same moment the connection is made. This doesn't happen to other tasks, for example I have another task that monitors other inputs. This task continues running (along with the second task) when the main task stops. Also, the main task has priority 1, and the second and third tasks have priorities 2 and 3 respectively.
As I mentioned I suspect stack overflow or some similar issue. But I'm not too clear how to test for or resolve this. I was reading the TI-RTOS user's guide which mentions the ROV, and I tried to use this in CCS but I get this error: Plug-in com.ti.dvt.gridview was unable to load class com.ti.dvt.ui.views.core.PaneView.
I increased the stack sizes for all the tasks, and I also increased the SRAM_CODE and SRAM_DATA size in the .cmd file but this didn't seem to help. There are also some other settings (like Program.heap and Program.stack) defined in the ti-rtos .cfg file which I tried adjusting, but that also wasn't fruitful. I'm not too clear about these settings. I understand the stack is for hardware and software interrupts. So would I be safe to assume this stack size doesn't need to be very big? Right now it's 0x6000, but I see the SDK examples folder was app.cfg with this setting to 0x2000. The heap is set to 0x8000.
Where are the various task stacks located in RAM? After the bootloader, SRAM_CODE and the 'used' SRAM_DATA segments, there is some gap, and then the Program.stack size is located. Do all the stacks for the tasks I create like I mentioned above have to fit in the space in between, or is that all just heap? Or does the Program.stack size actually encompass all the task stacks? If I have no gap, will the extra available space above the Program.stack area be used for heap?
I'm listing the map file below. Currently I have my second and third tasks stack sizes at about 4000 and 2000 bytes (not 0x4000 and 0x2000). But I tried increasing the one the seems to cause the problem even up to 15kB and it didn't change anything. I tried trimming the SRAM_CODE and SRAM_DATA size to what was being used, and also tried increasing it since the .stack section is placed at the top of the SRAM_DATA segment and needs to fit in the 'unused portion of the SRAM_DATA segment (along with the task stacks and/or heap?). Note: I'm using the production version of the CC3200 launchpad.
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
SRAM_CODE 20004000 00019000 000160c0 00002f40 RW X
SRAM_DATA 2001d000 00023000 000141ee 0000ee12 RW X
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
20004000 20004000 000160c8 000160c8 r-x
20004000 20004000 0000030c 0000030c r-- .resetVecs
2000430c 2000430c 0001319e 0001319e r-x .text
200174ac 200174ac 0000284e 0000284e r-- .const
20019d00 20019d00 000003c8 000003c8 r-- .cinit
2001d000 2001d000 0000e1f4 00000000 rw-
2001d000 2001d000 0000dab2 00000000 rw- .bss
2002aab8 2002aab8 0000073c 00000000 rw- .data
2003a000 2003a000 00006000 00000000 rw-
2003a000 2003a000 00006000 00000000 rw- .stack
Can anyone shed some light on my questions and perhaps offer some suggestions on what might be happening or how I can tell? I was hoping to get some of the CCS debugger tools to help, or add some run-time logging/monitoring. For example I see a “Check for task stack overflow” option in the rtos config, but what happens if it detects it? Do I need to call some kernel function at run-time to retrieve this? Any idea how to get the ROV working?
Thanks,
Angelo