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.

Compiler/TM4C129ENCPDT: Getting terminated

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI C/C++ Compiler

Hi all,

my code is going into 


Error:E_usageFault: INVPC: Invalid PC

Error:E_memFault: IACCVIOL: Instruction Access Violation, address: e000ed34
FSR = 0x0004
HFSR = 0x40000000
DFSR = 0x00000000
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000
Terminating execution...

during the execution time. Not all the time, only few times during debugging. I dont kow why it is going there? Any idea?

Thanks

  • Hello Akhilesh,

    Is this occurring with TivaWare or TI-RTOS?

    Our general fault debugging guide is: www.ti.com/.../spma043.pdf

  • Hi Ralph,

    I am using ti rtos. 

    Thanks

  • Hi,

    I am getting this 

    0xFFFFFFFC (no symbols are defined). 

    Cant get much idea. 

  • Hi

    I am attaching the screenshot.  The lowe 8 bit of xPSR register is 3 which means processor exception occurs. (Seen from the datasheet of tm4c129encpdt).

    I am not able to trace it out what actually has happened. 

    Please let me know.

    Thanks 

  • Hi All,

    I am getting the exception at line no 161

    ======== ti_sysbios_family_arm_m3_Hwi_initStacks__E ========
    ; set up dual stacks
    ; only called if tasking is enabled
    ; otherwise, msp = the only stack.
    ; msp = handlers (isr Stack)
    ; psp = threads (task Stacks)
    ;
    ti_sysbios_family_arm_m3_Hwi_initStacks__E:
    .asmfunc
    push {lr}
    mrs r2, xpsr
    tst r2, #0xff ; check if we're in handler mode
    beq $1
    ;
    ; Here if CPU was not reset before starting the program
    ; and the last
    ; program halted while in handler mode.
    ; must unwind from handler mode before
    ; configuring control register
    ;
    mov r2, sp
    sub r2, #(8*4) ; make room for dummy stack frame
    msr psp, r2 ; update PSP
    mvn lr, #2
    str r0, [r2, #0] ; save passed R0 on ISR stack
    mov r1, #0x01000000 ; dummy xPSR with T bit set
    str r1, [r2, #28]
    ldr r1, $1Addr
    str r1, [r2, #24] ; return PC to $1 below
    bx lr ; "return" from ISR

    $1
    pop {lr}    ///////////////////////// line no 161
    mov r1, sp
    msr psp, r1 ; psp = task stacks
    msr msp, r0 ; msp = isrStack
    mov r0, #2
    mrs r1, control
    msr control, r0 ; split stacks now.

    .if __TI_VFP_SUPPORT__
    ldr r0, fpccr ; clear APSEN and LSPEN
    ldr r1, [r0] ; get current fpccr
    bic r1, r1, #0xc0000000 ; clear upper 2 bits
    str r1, [r0] ; save/restore manually
    .endif
    bx lr ; return on psp

    $1Addr
    .word $1

    .if __TI_VFP_SUPPORT__
    fpccr:
    .word 0xe000ef34
    .endif
    .endasmfunc
    .end

  • What does ROV->Hwi->Exception say? It looks like the application just started. All the Task stack peaks are the same, as if the tasks have not ran yet. Also why do you think it is in ti_sysbios_family_arm_m3_Hwi_initStacks__E? This function is called as part of BIOS_start.

    Todd

  • Hi Todd, 

    It says for INVLDPC. I don't know why it is there. I just followed the above-mentioned steps to trace out where the exception was coming and I found this. I have no idea. 

    AKhilesh

  • Can you show a picture of the ROV->Hwi->Exception view?

  • Hi Todd, 

    It says this

    Decoded exception,   

    Decoded,Hard Fault: FORCED: USAGE: INVPCBUSFAULT: IBUSERR

    Exception context,
    $addr,0x200342b4
    $type,ti.sysbios.family.arm.m3.Hwi.ExcContext
    threadType,ti.sysbios.BIOS.ThreadType_Task
    threadHandle,0x20000ee8
    threadStack,0x20000f38
    threadStackSize,768
    r0,0x20034418
    r1,0x0
    r2,0x0
    r3,0x0
    r4,0x20031d10
    r5,0x20
    r6,0x11
    r7,0x0
    r8,0xfffffff1
    r9,0xffffffff
    r10,0xffffffff
    r11,0xffffffff
    r12,0x0
    sp,0x2003438c
    lr,0x0
    pc,0x3cf4d
    psr,0x1000000
    ICSR,0x3
    MMFSR,0x0
    BFSR,0x1
    UFSR,0x4
    HFSR,0x40000000
    DFSR,0x0
    MMAR,0xe000ed34
    BFAR,0xe000ed38
    AFSR,0x0 


    Exception call stack,
    0 ti_sysbios_family_arm_m3_Hwi_initStacks__E() at Hwi_asm_switch.sv7M:161,PC = 0x0003CF4D FP = 0x2003438C

  • Does this exception occur immediately after starting the program, or does it come after some time that the program has already been running (seconds or minutes, just not right away)?

    When it happens, can you take a look at the MMAR address 0xe000ed34 and BFAR address 0xe000ed38 in a memory browser and report those values back here?

    Hwi_initStacks() is normally called very early during startup (somewhere after BIOS_start() is called).  I'm wondering if it is somehow bogusly re-entering during normal runtime.  If you were to place a BP on Hwi_initStacks() and run from the start then you should hit that BP once right away and never again after that.  If you hit the BP for a 2nd time, hopefully some standard traceback debugging can be done to figure out how you got there.

    However, I can't think of any reason that line 161 in Hwi_initStacks  (pop {lr}) would cause an invalid PC exception.

    - Rob

  • Hi Rob.

    This exception occurs immediately after the BIOST_start() is called.  I set the breakpoint there and observed what you are saying. Just after hitting the bp, when I am proceeding forward,  the program shows the same error. After Hwi_initStacks, the execution goes into abort(). 

    The MMAR address 0xe000ed34 shows this- 


    0xe000ed34  NVIC_NVIC_MM_ADDR
    0xe000ed38  E000EDF8
    0xe000ed38  NVIC_NVIC_FAULT_ADDR

    I am stuck with all my tasks because of this error. Any leads would be highly appreciable

    Thanks

  • Can you single-step through Hwi_initStacks() with CCS?  If so, I'm hoping that you will see the exception as it happens instead of going through the handler with potential double fault messing up initial exception information.

    Is this something I could run on my own?  If so, please attach the executable for me to try.

    Regards,

    - Rob

  • Addition to fine advise from others:

    Also have a look at ROV Hwi interrupts that were executing prior to fault exception. Often gives a clue after several resets, watch what changes each time you restart after CPU reset. Most always Bus Fault is peripheral related interrupt cause that crashes TIRTOS but can be task related too.

    Look at NVIC register, check if bus fault was precise or imprecise, then look down at fault memory address, if precise check datasheet memory table for what hardware is at that address.  if imprecise the memory fault address is unknown or bogus. TM4C1294 PDF datasheet explains each type exception. 

  • Akhilesh,

    Did this get resolved?

    Todd

  • No Todd. Now I am getting something different. PFA.

    Please check and let me know.

  • I don't know what actually happens. The same code was working fine a few days back. I didn't make any changes. I always use the debugger for my testing purpose> Doing restart or reset, sometimes it goes into abort(). But now every time I run my program, it is going into abort(). I have attached the image in the previous reply. Let me know.

    Thanks

  • Akhilesh Gangwar said:

    The MMAR address 0xe000ed34 shows this- 


    0xe000ed34  NVIC_NVIC_MM_ADDR
    0xe000ed38  E000EDF8
    0xe000ed38  NVIC_NVIC_FAULT_ADDR

    This doesn't look like the contents of that memory, it looks more like a symbol table.

    Using CCS, can you show what values lie at memory addresses 0xe000ed34 & 0xe000ed38 in a Memory Browser window?

    Is it possible for you to share your executable?

    Regards,

    - Rob

  • It's working fine now. I traced back and got bug in my code. 

    Thanks

  • Akhilesh,

    Glad to hear you found the issue. Thanks for letting us know.

    Todd

  •  Hi Rob,

    This was something else and I got a different exception.

    The whole project was built using CCS6 and it was working pretty well there. No exceptions at all. Now I imported whole project into CCS9.1 and the problem started now. I was using tirtos_tivac_2_16_01_14 and xdc 3.32 version. Everything the same I installed in CCS9 but when I run it, the different exceptions occur. Once such occurs immediately after BIOS starts. I have mentioned about this.

    What are the changed between CCS6 and CC9? Is there a library change by which these things are happening?

    Let me know because we can not release software with such exceptions into the market.

    Thanks,

    Akhilesh

  • Having deja-vu riding a horse with no name lost in the desert...

  • Please start a new thread on the new issue.