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/AM5746: USB and PCIe stack size

Part Number: AM5746

Tool/software: TI-RTOS

Hi,

The question is how to determine the stack size of the USB and PCIe driver.
My customers want to know how to determine the value of stackSize set in the sample project.

■Sample Project
①C:\ti\pdk_am57xx_1_0_11\packages\ti\drv\usb\example\bios\dev_bulk_main.c
tskParams.stackSize = 0x4000;

②C:\ti\pdk_am57xx_1_0_11\packages\ti\drv\usb\example\bios\dev_audio_main.c
taskParams.stackSize = 0x1c00;

③C:\ti\pdk_am57xx_1_0_11\packages\ti\drv\pcie\example\sample\src\pcie_sample.c
params.stackSize =36824;

Question:
We want to prevent overflows and avoid taking too much stack size.
Would you tell me how to decide the stack size.

HW:AM574xIDK
SW:pdk_am57xx_1_0_11

Regards,
Rei

  • Hi,

    Those examples are standalone and set an arbitrarily large stack size. For you look for the best stack size (not too small or too big), please check https://training.ti.com/debugging-common-application-issues-ti-rtos. Then:

    PDFs for download

    Look at the pdf on how to check stack usage.

    Regards, Eric

  • Hi Eric,

    Thank you for your reply.
    I introduced this pdf to the customers.

    I would like to ask you one more question,
    Stack size of the sample projects are how was it decided?
    What are the limitations of these stack sizes?

    Regards,
    Rei

  • Hi,

    I thought the sample project stack size is just arbitrarily selected big enough, typically copied from one project to another. No one really tracked how big the stack is used else a overflow happened.

    The stack is an area of RAM where a program stores temporary data during the execution of code blocks. Typically statically allocated, the stack is operates on a “last in, first out” basis. The types of data stored in the stack include: local variables/return addresses/function arguments/compiler temporariesinterrupt contexts. I don't have answer to size limitation. I thought dozens of KB is big enough and AM57x has sufficient memory for this.

    Regards, Eric

  • Hi Eric,

    I am always grateful for your help.


    My customers want to know the lower limit of the stack size of the sample project.
    How much size do drivers need if we don't change sample code?

    The stack size of PCIe is about 36 KB, which is considered to be particularly large.

    Regards,
    Rei

  • Rei,

    Sorry we don't have such profiling of stack size for each driver.

    Regards, Eric