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.

Local Variable taking garbage value



Hi

I am facing weird issue of local variable taking garbage value when tcp2 interrupt is issued. When i print the address of local variable it shows some garbage location not falling in stack.

This problem started coming when turbo decoder was integrated in the code. Is is some stack pointer corruption issue???

Need help in this.....

  • Hi Ronak,

    Can you please explain alittle bit more like what board you are using, what are you trying to do.

     

    thanks,

    arun.

  • I am trying to integrate tcp2 for turbo decoding in existing WiMAX code base.....code base which i have taken has no issues but after integrating the turbo decoder (tcp2) the same code started behaving differently....it fails at multiple place and everytime some operation on local variable is not getting executed like increment doesnt happenn in particular case. Some places where problem was coming i disabled the compiler optimization and problem got solved for those particular file.

    In different modulation and code rate, code behaves differently. other problem is code has become unstable and sys_abort is getting called and its going to UTL_halt because of some run time exception. it shows invalid opcode or instruction fetch error.

    I can provide the screen shots of the problems seen..... I am new to Bios debugging so kindly provide me some inputs.

    thanks

    Ronak 

     

  • I am using TI himaliya 6482 board.......

  • maybe this value is stored in register? Can u make this variable volatile and print the address?

  • I have tried making the variable volatile.............

  • Ronak,

    - Have you tried increasing the system stack size. If not, could you please try that.

    - Is you local variable present as part of the ISR or the application thread?

    Regards,

    Nag

  • Hello

    Previously system stack was 25k, i tried with 40k of stack size but the problem is same.....i have checked top of the stack over flow is not happening.....

    local variable is part of application thread not the ISR........Software architecture is SWI base not the tast based......

    Thanks

    Ronak

     

  • Ronak,

    Thanks for the info. I hope you also would have tried increasing the stack size of the task and SWI you are using.

    Are you using BIOS5 or BIOS6?

    Regards,

    Nag

  • Hello

    SWI uses system stack only correct me if i am wrong....so i have tried increasing it but it didn't make difference....

    I am not sure abt the BIOS version.....

    Thanks

    Ronak 

  • Ronak,

    Yes, you are correct. The SWI makes use of system stack. 

    How are you invoking the SWI. Is it getting invoked from the HWI. Also I suggest, please go through the BIOS user guide (swi section) to look into other aspects of SWI, since the issue is in the SWI.

    Regards,

    Nag

  • Hi

    I am using bios version 5.31.02

    Thanks

    Ronak

  • One problem which i saw was while posting a SWI address for the handle is correct but when BIOS starts the execution of the SWI it starts with garbage location of the SWI handle and exception handler is called.

    All the SWI handles are global.

  • Yes i am posting the SWI from the HWI handler. But problem is not coming in the SWI which is called from HWI. Problem comes in the SWI which is in execution and because of HWI it is preemted.

  • Ronak said:

    Yes i am posting the SWI from the HWI handler. But problem is not coming in the SWI which is called from HWI. Problem comes in the SWI which is in execution and because of HWI it is preemted.

    Ronak,

    In case the SWI is allowed to execute to completion without any preemption by the HWI, have you observed that this problem of corruption of temporary variable in the SWI does not happen? If you have already not done this, can you please check this by avoiding the HWI preemption while the SWI is running?

    If you confirm that the temp variable corruption in SWI happens only when the HWI preemption occurs and not when there is no preemption, then I still suspect the problem is with system stack which is used by both SWI and HWI.

    If the temp variable in SWI gets corrupted even if it is allowed to run to completion with the HWI preemption, then the problem is some thing else and I am not sure why this can happen.

    Regards,

    Nag

  • Hi

    "In case the SWI is allowed to execute to completion without any preemption by the HWI, have you observed that this problem of corruption of temporary variable in the SWI does not happen?" how do i do this? I need some inputs for configuring non preempting SWI on HWI interrupt.

    I am using DSP bios for hooking ISR to particular EDMA event ( i.e tcp2 completion)

    Thanks

    Ronak

  • One trick which i used was to disable HWI interrupt using BIOS call in SWI where corruption was happening. It got solved for the particular SWI but since its just delaying the precessing it was causing an issue in some other process.

    I thought what i am doing is not the solution to a problem so wanted to pursue the problem.

     

  • Ronak said:

    One trick which i used was to disable HWI interrupt using BIOS call in SWI where corruption was happening. It got solved for the particular SWI but since its just delaying the precessing it was causing an issue in some other process.

    Ronak,

    Thanks for trying this out and confirming. So the issue seems to be only when the SWI is preempted by the HWI. I suggest you to please look into the probable causes for this like the stack size, common variables usage between SWI and HWI etc.

    Regards,

    Nag

    (If your question is answered, please click the  Verify Answer  button below)