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.

OMAP-L138, ARM9, SYS/BIOS 6.33.5.46, E_prefetchAbort exception

Other Parts Discussed in Thread: SYSBIOS

Hello,

I have a problem with E_prefetchAbort exception. In my code I am creating object inside main function like that:

ClassType Object;

and passing its pointer to created task (lets call it MainTask). Inside the MainTask I have the pointer and I am calling an INIT non-static method of this class. It is still OK at this point. Inside Object->Init method I am creating another task (lets call it ProcessingTask) with higher priority and this is a static method of another class. So it is called immediatelly. Inside ProcessingTask static method I received an argument of pointer to a class which is a member of 'ClassType Object' and I want to call its method but here I am receiving this exception.

What is more interesting if I will change "ClassType Object;" inside main to "static ClassType Object" or "ClassType *Object = new ClassType()" or I will make it global outside main function I am not receiving this exception anymore. Can somebody explain me why it is like that?

  • Hi Damian,

    By having just the ClassType Object defined in main(), it is allocated on the stack. I need to look into how local variables are maintain on the stack when they are defined in main().

    I do have a couple questions.

    1. What is the is exception?

    2. What version of BIOS are you using?

    Todd

  • Damian,

    This sounds like a mismatched pointer type de-referencing problem to me.

    If you're using CCS, you might be able to get a better understanding of the problem by following the stack back trace up to the moment of the exception.

    The following FAQ describes how to coerce the CCS debugger into providing you a stack back trace after an exception:

        http://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs#4_Exception_Dump_Decoding_Using_the_CCS_Register_View

    Alan

  • This is the exception info:

    [ARM9_0] Exception occurred in ThreadType_Task.
    Task handle: 0xc3092d20.
    Task stack base: 0xc3092d68.
    Task stack size: 0x10000.
    R0 = 0xc3922788 R8 = 0xffffffff
    R1 = 0x00000000 R9 = 0xffffffff
    R2 = 0xc3926af8 R10 = 0xffffffff
    R3 = 0xc300fec8 R11 = 0xffffffff
    R[ARM9_0] 4 = 0xffffffff R12 = 0x00000000
    R5 = 0xffffffff SP(R13) = 0xc30a2d40
    R6 = 0xffffffff LR(R14) = 0xc3926b28
    R7 = 0xffffffff PC(R15) = 0x00100000
    PSR = 0x600000df
    ti.sysbios.family.arm.exc.Exception: line 170: E_prefetchAbort: pc = 0x00100000, lr = 0xc392[ARM9_0] 6b28.
    xdc.runtime.Error.raise: terminating execution

    I am using SYS/BIOS 6.33.5.46. After doing like its written in 'Exception Dump Decoding using the CCS register view' I have results showed in attached file.

    And here is the disassembly. The BLX inctruction generates the exception.

    I understand that this is a memory problem but strange thing is that it happens only when I declare the class object inside the main function.

  • Hi Damian,

    main() uses the system stack (Hwi stack). So your local variable is being placed on it. Once BIOS_start is ran, the stack is used by the Hwi and Swi threads. The stack is used from the bottom, thus corrupting any thing that was on it from main...namely your object. So you should make your object global or "new" it (and then it comes from a heap).

    Todd

  • Hello Todd,

    Thank you for your answer.

    I am just curious why it is working when you are creating task in main? When you create new project (SYS/BIOS typical template) it declares two variables in main: 

    Task_Handle task;
    Error_Block eb;

    and it doesn't have this problem. What is the difference? 

  • Those are just local variables. You don't use "eb" or "task" after main.

    Todd

  • Ok, I understand that you don't use those variables after task creation so they can be overwritten but I feel that it should not be this way, because 'BIOS_start();' function doesn't return when software is launched. In 'C' you have many global variables but in 'C++' you rather don't use them and instead of it usually you are declaring something like 'ApplicationClass App' object in main function and make it run. Of course this is not a problem because I can make it dynamically allocated and it will be working.

    Thank you for the answer!