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/TDA2P-ACD: Processor SDK 03.03 custom board binaries work in Debug mode but not in Release mode

Part Number: TDA2P-ACD

Tool/software: TI-RTOS

Hello All,

We have compiled PSDK 03.03 for our TDA2P based custom board. I have added a new module for Accelerometer and done necessary pinmux & PRCM settings in pad config file "ti_components\drivers\pdk_01_09_00_17\packages\ti\drv\stw_lld\platform\src\tda2xx\platform_tda2xx_pad_config.c".

Accelerometer is connected to TDA2P over McSPI3. When we execute our code in debug mode it works fine. But while running the same code in release mode, we get error in "GIO_issue()" API as below,

"

  status = GIO_issue(mcspiHandle, &issueDataparam, size, NULL);

        if (status != IOM_PENDING && status != IOM_COMPLETED)
        {
            Vps_printf("\r\nFailed to issue empty buffer to stream\r\n");
        }

"

Is there anything that we need to take care of while running the code in release mode.

Thanks,

Abhay

  • Hello All,

    One thing I tried. I tried to make optimization level from O3 to O2 in "makerules\rules_m4.mk" and the code executes fine. But for our final customer release we will have to keep it to O3. And with O3, code gives above error. How do I fix this.

    Regards,
    Abhay
  • Abhay,

    Kindly refer to the implementation of mcspi access from GIO drivers in ti_components\drivers\pdk_01_09_00_12\packages\ti\drv\vps\src\devices\radar_ar12xx\src\bspdrv_ar12xxMcspiCfgPriv.c

    This file has been tried with O3 option in release mode and it has been confirmed to work.

    Thanks and Regards,
    Piyali
  • Hi Piyali,

    I just want to know why the debug build works and release build doesn't.
    And just by changing to O2, the whole chain is working. Can you suggest us how to fix this issue as our MCSPI (GIO issue reclaim) is working fine in debug mode.

    Thanks,
    Abhay
  • Hi Abhay,

    It is hard to suggest what could go wrong without knowing how you are using the API and setting up the parameters. Can you please compare your implementation with the one I have shared above ?

    Thanks and Regards,
    Piyali
  • Hi Piyali,

    I am using the same implementation as was used in the example you referred. But still I am not able to fix the issue.

    Regards,
    Abhay
  • Hi Piyali,

    I also referred to one of you threads,
    e2e.ti.com/.../2392591

    The solution provided by you then is also working for me by changing to O2 level for a single file. But I am not able to run the code with O3.

    Regards,
    Abhay
  • Abhay,

    Which file have you converted to the O2? The calling function.

    Can you please check by single stepping through the code at the point at which the function is getting called the values that you are passing to GIO Issue is different in the two optimization levels?

    Thanks and Regards,
    Piyali
  • Hi Piyali,

    I have converted by AccelGyro module's .c file to O2 as it is not working with O3.
    Also as I mentioned earlier, our accelerometer code is working in debug mode with O3, so single stepping will surely work. This we have already verified.
    Are you suggesting to do single stepping in release mode ?

    Regards,
    Abhay
  • Abhay,

    Yes.. at least at a top level the input values to the GIO Issue would be good to check between release and debug mode. You don't have to step through every thing.. just place a breakpoint at entry to GIO_Issue and check what is the input values.

    Thanks and Regards,
    Piyali
  • Abhay,

    We have not heard back from you on this one. I assume you were able to proceed.

    Thanks and Regards,
    Piyali
  • Hi Piyali,

    Currently we have kept the file for release build with O2 level optimizations. I was busy with other tasks so couldn't test it further.

    I will test this again and update the status sometime in next week.

    Regards,

    Abhay

  • Hi Piyali,

    As per your suggestions, I checked the values that are going as input to GIO_Issue in both release and debug mode, and they are same. But in release mode, I get below error while calling GIO_issue,

    "Failed to issue buffer to stream"

    But If I compile my source file with O2 optimization in release mode, it works but the code seems to run very slow.
    How do I fix this.

    Regards,
    Abhay
  • Hi Piyali,

    Do you have any suggestions for us to try out.

    Thanks,
    Abhay
  • Hi Abhay,

    I have looped in our McSPI expert to help you.

    Thanks and Regards,
    Piyali
  • Hi,

    Can you check what is the error code returned from the driver?

    The GIO_Issue will internally call hte driver function "mcspiMdSubmitChan" from file
    pdk_install_dir\packages\ti\drv\bsp_lld\mcspi\src\bsp_mcspi.c
    Can you check the parameters passed in case of debug vs release modes
    also can you check where the driver returns an error?

    Regards,
    Prasad

  • Hi Abhay,

    Is there any update on this. Were you able to proceed.

    Regards,
    Prasad

  • Hi Prasad,

    Sorry for the delay. I will update the results today for "mcspiMdSubmitChan".

    Regards,
    Abhay
  • Hi Prasad,

    When I can my accelGyro module in release mode, I get below error. Below logs also shows the values passed to "mcspiMdSubmitChan" and the return status ,

    ""
    [IPU1-0] Configure McSPI2 Successful
    [IPU1-0] 16.404471 s:
    [IPU1-0] 16.404776 s: mcspiMdSubmitChan() : Ptr chanp = 84d56cb8
    [IPU1-0] 16.404867 s:
    [IPU1-0] 16.405081 s: mcspiMdSubmitChan() : ioPacket->addr = 84b8f588
    [IPU1-0] 16.405172 s:
    [IPU1-0] 16.405386 s: mcspiMdSubmitChan() : ioPacket->size = 2
    [IPU1-0] 16.405447 s:
    [IPU1-0] 16.405630 s: mcspiMdSubmitChan() : ioPacket->arg = 0
    [IPU1-0] 16.405721 s:
    [IPU1-0] 16.405904 s: mcspiMdSubmitChan() : ioPacket->cmd = 1
    [IPU1-0] 16.405965 s:
    [IPU1-0] 16.406179 s: mcspiMdSubmitChan() : ioPacket->status = 0
    [IPU1-0] 16.406240 s:
    [IPU1-0] 16.406453 s: mcspiMdSubmitChan() : ioPacket->misc = 1
    [IPU1-0] 16.406545 s:
    [IPU1-0] 16.406758 s: mcspiMdSubmitChan() : Return status value = -1
    [IPU1-0] 16.406850 s:
    [IPU1-0] regWriteoverSPI: Failed to issue buffer to stream
    ""


    The same code if I run in debug mode, it works and I dont get any error. Below logs shows the values of parameters passed to "mcspiMdSubmitChan" and the return status for debug mode,

    ""
    [IPU1-0] Configure McSPI2 Successful
    [IPU1-0] 23.374458 s:
    [IPU1-0] 23.374733 s: mcspiMdSubmitChan() : Ptr chanp = 849a6c84
    [IPU1-0] 23.374824 s:
    [IPU1-0] 23.375129 s: mcspiMdSubmitChan() : ioPacket->addr = 84c21ed0
    [IPU1-0] 23.375221 s:
    [IPU1-0] 23.375434 s: mcspiMdSubmitChan() : ioPacket->size = 2
    [IPU1-0] 23.375800 s:
    [IPU1-0] 23.376075 s: mcspiMdSubmitChan() : ioPacket->arg = 0
    [IPU1-0] 23.376166 s:
    [IPU1-0] 23.376380 s: mcspiMdSubmitChan() : ioPacket->cmd = 1
    [IPU1-0] 23.376441 s:
    [IPU1-0] 23.376685 s: mcspiMdSubmitChan() : ioPacket->status = 0
    [IPU1-0] 23.376776 s:
    [IPU1-0] 23.377020 s: mcspiMdSubmitChan() : ioPacket->misc = 1
    [IPU1-0] 23.377173 s:
    [IPU1-0] 23.377447 s: mcspiMdSubmitChan() : Return status value = 0
    ""

    In release mode, the error "Failed to issue buffer to stream" comes after first call to "GIO_issue()" API is made.

    Regards,
    Abhay

  • Hi Prasad,

    I also checked the parameters passed to "GIO_issue" for the first time. Below are the parameters passed to
    "GIO_issue(handle, &issueDataparam, size, NULL)" in release mode,

    ""
    [IPU1-0] 19.338071 s: regWriteoverSPI: handle = 846cf400
    [IPU1-0] 19.338162 s: regWriteoverSPI: issueDataparam.bufLen = 2
    [IPU1-0] 19.338223 s: regWriteoverSPI: issueDataparam.inBuffer = 0
    [IPU1-0] 19.338315 s: regWriteoverSPI: issueDataparam.outBuffer = 3
    [IPU1-0] 19.338376 s: regWriteoverSPI: size = 2

    regWriteoverSPI: Failed to issue buffer to stream
    ""

    Below are the parameters passed to "GIO_issue()" in debug mode,

    ""
    [IPU1-0] 21.721893 s: regWriteoverSPI: handle = 846cf100
    [IPU1-0] 21.721954 s: regWriteoverSPI: issueDataparam.bufLen = 2
    [IPU1-0] 21.722045 s: regWriteoverSPI: issueDataparam.inBuffer = 0
    [IPU1-0] 21.722137 s: regWriteoverSPI: issueDataparam.outBuffer = 3
    [IPU1-0] 21.722198 s: regWriteoverSPI: size = 2
    ""

    Apart from the value of "handle", all other values are same.

    Regards,
    Abhay
  • Abhay,

    Can you print the return value of GIO_Issue when it fails.

    Also Can you check building only the file "pdk\packages\ti\drv\bsp_lld\mcspi\src\bsp_mcspi.c" with debug build options and remaining with release build options and check?

    Regards,
    Prasad

  • Hi Prasad,

    As the project is now closed I couldn't try out the things you had suggested. We had to release the code with O2 level for our source code.
    I will close the thread for now and if I get free time I will try out again.
    Thanks for your help.

    Regards,
    Abhay