This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS static Task intitialization crash

Other Parts Discussed in Thread: TM4C123GH6PM, SYSBIOS

Context:

Using Launchpad TM4C123GH6PM

CCS  Version: 6.0.1.00040

TI-RTOS for TivaC (IDE Client)    2.10.1.38

Problem: Whenever I delete a task using XGCONF and download the debug code the target system crashes.

I've traced it to the following instruction in the task "Task_startCore(UInt coreId)" routine in Task.c.

    /* start first task by way of enter() */
    Task_SupportProxy_swap((Ptr)&prevTask->context, (Ptr)&Task_module->curTask->context);

In "TI-RTOS > Products > SYSBIOS > Scheduling > Task - Module Settings": even after I have unchecked the "Add the Task threads module to my configuration" check box (which, by the way, erases all tasks from XGCONF) this routine still exists, still executes and still crashes.

If anyone could enlighten me about what is happening here I would be most grateful.

Thanks,

Dave

  • Hi Dave,

    Can you try cleaning your project, rebuilding all, and then reload/rerun?

    Steve
  • Thanks Steven,
    I thot i had tried that several times but it was very late at night and perhaps my thinking was confused.
    I tried it again and its working now.
    Also I might have confused it with a concurrent crash that was, i think, being caused by a System_printf/flush from a clock IRQ function (which like hwis and swis cannot be printed from, yes?). After I moved printf to a task and posted a semaphore to trigger the printing that crashing also stopped. (Being new to this have yet to read about debugging tools).
    On a related topic: I would like to have many Tasks but the system has only 32K RAM.
    1)Why are the stacks associated with Tasks so huge (2K default)? (all my experience 'til now has been with 8bit systems)
    2) can I reduce stack size to 256 bytes or even less?
    3) Is the large size necessary to accommodate all the interrupts that the system might experience while the task runs?
    4) Which one debugging tool would be the most helpful to learn first to ease program development in RTOS? (aside from getting enough sleep).
    Thanks again.
    Dave
  • Hi Dave,

    1)Why are the stacks associated with Tasks so huge (2K default)? (all my experience 'til now has been with 8bit systems)
    2) can I reduce stack size to 256 bytes or even less?

    You can certainly adjust the Task stack sizes, both individually and the default size for all Tasks, via the XGCONF tool (double click your *.cfg file in your project view in CCS):

    4) Which one debugging tool would be the most helpful to learn first to ease program development in RTOS?

    CCS is a good starting point for an IDE, although many people use IAR.

    The ROV tool (RTOS object viewer, accessed under the CCS Tools menu) is an extremely useful tool, which will show you the state of the kernel, what's running in it and various properties (note target must be halted).

    Steve

  • Thanks Steve,

    Late reply due to distraction involving getting interrupts happening on 5 GPIO pins on 3 different ports. As it turns out, one needs to create a separate "Hwi_Struct callbackHwi" for each port but only one "gpioHWAttrs[EK_TM4C123GXL_GPIOCOUNT]" in file EK_TM4C123GXL.c.

    After reading more I see that the interrupt stack frame (where all the core registers are saved before the ISR is called) is quite large (over 100 bytes) hence the large stack size.

    If a "Task" has no local variables then is it reasonable to make the stack size for that task just large enough (plus maybe a few bytes) to hold one stack frame? Reasoning thus: when the task is interrupted the stack is filled and some other routine starts executing. If that other routine is interrupted it will have its own stack like the shared one for hwis, clocks etc.. Is this correct? Or does RTOS need to put extra stuff on the task stack during the interruption?

    Thanks again Steve,

    Cheers,

    Dave

  • Hi Dave,

    You're on the right track. Your Task stack should be large enough to handle two interrupting Hwi contexts.

    I think the details you are looking for can be found in the BIOS User's Guide, Chapter 3.5.3 Task Stacks.

    You can find this document in your BIOS installation. For example, it's here on my PC:

    C:\ti\BIOS\bios_6_41_02_41\docs\Bios_User_Guide.pdf

    Steve
  • Hi Steve,

    I've read C:\ti\BIOS\bios_6_41_02_41\docs\Bios_User_Guide.pdf which is in
    C:\ti\tirtos_tivac_2_10_01_38\products\bios_6_41_00_26\docs on my system

    It covers the topic nicely and answers all my 'task stack' related problems.

    Thanks Steve,
    Cheers,
    Dave