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.

Error when using Cache_wbInv

Other Parts Discussed in Thread: SYSBIOS

Hello,

I'm using VisionMid with 4 cores on it ( A8, videoM3, VpssM3 and DSP) (SYS/BIOS)

Now I try to move 1 task from DSP to A8. 

After modifying some setting(like core ID, task table...), I can build the code and execute it.

But there is an exception in run time.

This is the error message display on the console.

-------
[CortexA8] Exception occurred in ThreadType_Task.
[CortexA8] Task handle: 0x819516f8.
[CortexA8] Task stack base: 0x81951748.
[CortexA8] Task stack size: 0x2800.
[CortexA8] R0 = 0x00000000 R8 = 0x2476e681
[CortexA8] R1 = 0x2476e680 R9 = 0x00000001
[CortexA8] R2 = 0x81953ec0 R10 = 0x00000001
[CortexA8] R3 = 0x00000000 R11 = 0x81953ec0
[CortexA8] R4 = 0x2476e680 R12 = 0x2476e680
[CortexA8] R5 = 0x00000000 SP(R13) = 0x81953e60
[CortexA8] R6 = 0x88102480 LR(R14) = 0x810af5a8
[CortexA8] R7 = 0x00000000 PC(R15) = 0x8104473c
[CortexA8] PSR = 0x2000019f
[CortexA8] ti.sysbios.family.arm.exc.Exception: line 176: E_dataAbort: pc = 0x8104473c, lr = 0x810af5a8.
[CortexA8] xdc.runtime.Error.raise: terminating execution

-------

I find the exception occurs on this code

Cache_wbInv((Ptr) (pCurOutFrame->nTimeStamp), sizeof(uint32_t), Cache_Type_ALL, TRUE);

Is there anyone know why does it happen? 

Because when this task run in DSP, there is no error...

Thank you!

Regards,

Killo

  • Hi Killo,

    You are seeing a data abort exception so that means a read/write from/to a bad address. Can you put a breakpoint just before PC = (0x8104473C) and run to it. Once the breakpoint is hit, single step through the code. That should give you an idea about what code is executing when the exception occurs.

    Try to see what address is the instruction at 0x8104473C trying to access. The next thing to do would be to ensure that address is mapped in the MMU.

    Best,

    Ashish

  • HI Ashish,

    Thank you for reply.

    I have tried to set the breakpoint, and run into the code.

    I can see where the PC stop, but my question is -- why does it happen? Because I think the logic of the program is correct since it can run correctly on DSP.

    If the same codes run well on DSP and crush on A8, there should be other reason maybe coming from configuration?

    I'm not sure of that, but I do not find the logic error on the current code.

    The attachment is the cfg file of A8.8726.BIOS_AVSDK_a8host.cfg

    Thank you .

    Killo

  • Hi Killo,

    Killo Lu said:

    I have tried to set the breakpoint, and run into the code.

    I can see where the PC stop, but my question is -- why does it happen? Because I think the logic of the program is correct since it can run correctly on DSP.

    Looking at the register contents in the exception dump, it looks unlikely that the exception occured in the Cache_wbInv() code. Can you put a breakpoint at PC and see what function (and instruction) is executing when the exception occurs ?

    Killo Lu said:

    If the same codes run well on DSP and crush on A8, there should be other reason maybe coming from configuration?

    I'm not sure of that, but I do not find the logic error on the current code.

    The attachment is the cfg file of A8.8726.BIOS_AVSDK_a8host.cfg

    I see that MMU.enableMMU is set to false in the *.cfg file. Do you enable the MMU at runtime ? Please note that if the MMU is disabled, data caching will not take place even if you enable the cache.

    Best,

    Ashish

  • Hi Ashish,


    Thank you for reply agian.

    I found that if I comment all the Cache_wbInv(), then the program can run.

    I see that MMU.enableMMU is set to false in the *.cfg file. Do you enable the MMU at runtime ? Please note that if the MMU is disabled, data caching will not take place even if you enable the cache.

    Referring to what you said above, then I think the season the exception occurred is that the MMU is disabled in the .cfg file and the program still uses cache function (such as Cache_wbInv()) ?

    Then I try to disable the MMU in .cfg file

    var Mmu = xdc.useModule('ti.sysbios.family.arm.a8.Mmu');
    Mmu.enableMMU = true;

    But the exception happens again...

    --

    Although the program can run by commenting all the cache functions, but I am worry if this will cause other problem?

    I would like to know what is the correct way to config and use these cache function.

    Thank you!

    Regards,

    Killo

  • Hi Killo,

    Killo Lu said:

    Although the program can run by commenting all the cache functions, but I am worry if this will cause other problem?

    I agree that you need to find what is causing the exception instead of working around it. Like I mentioned before, it does not look like the exception occurs in the Cache_wbInv() function. Can you check what instruction is at the PC address mentioned in the exception log ? You should also be able to determine the function name using the call stack in the debug view.

    Ideally you would want to put a breakpoint at the LR address mentioned in the exception log and single step through the code to know what happens just before the exception occurs. That should give you a clue as to what is causing the problem.

    Killo Lu said:

    I would like to know what is the correct way to config and use these cache function.

    The Cache APIs are documented in the SYS/BIOS cdoc which is present in your BIOS installation - bios_6_xx_xx_xx\docs\Bios_APIs.html. You can also access the cdoc through CCS help->Help Contents.

    Best,

    Ashish

  • When I read this thread, a simple question raised.

    You mentioned the following code caused the exception:

    Cache_wbInv((Ptr) (pCurOutFrame->nTimeStamp), sizeof(uint32_t), Cache_Type_ALL, TRUE); 

    Is pCurOutFrame->nTimeStamp variable or pointer ?

    Because it is named nTimeStamp, I wondered this was variable holding something "time-stamp counter value".
    If my understanding is correct, I believe you should do with the following code :

    Cache_wbInv((Ptr) &(pCurOutFrame->nTimeStamp), sizeof(uint32_t), Cache_Type_ALL, TRUE); 

    Sorry if this is negligible input.

    Best Regards,
    Kawada 

  • Good catch Kawada. It looks like Cache_wbInv() has an incorrect first argument.

  • Ashish and Kawada,

    I always focus on why it runs well on DSP and fail on A8 before,

    but now the question turns to why the wrong code can run well on DSP....

    Anyway, thank you both! 

    Regards,

    Killo

  • Hi Killo,

    Do you have the MPU (Memory Protection Unit) enabled on DSP ? If not, try enabling the MPU and then see if an exception gets generated if you try to write back invalidate an invalid address.

    Best,

    Ashish