Generic exception handler, how to know WHY?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Generic exception handler, how to know WHY?

ソリューションへジャンプ
3,192件の閲覧回数
holyhope
Contributor III

Hi to all, Debugging several time my app I encountred many time the generic default exception handelr;

I'm, developing with KDS 2.0.0 with K20, K60, K64 uP...

How to know what is the specific event that generated the exception? Several time with "GDB trace" I found important information but not everytime! I suppose that there is a way to know what is the event that generated excpetion or, it will be perfect, what line or C instruction (not assembly but C code line) generated theat!

Can someone help me?

Generic excpetion handler that I encountred many time is this:

 

 

 

    .pool

    .size Reset_Handler, . - Reset_Handler

 

 

    .align 1

    .thumb_func

    .weak DefaultISR

    .type DefaultISR, %function

DefaultISR:

    b DefaultISR

    .size DefaultISR, . - DefaultISR

 

 

/*    Macro to define default handlers. Default handler

*    will be weak symbol and just dead loops. They can be

*    overwritten by other handlers */

    .macro def_irq_handler handler_name

    .weak \handler_name

    .set  \handler_name, DefaultISR

    .endm

 

 

/* Exception Handlers */

    def_irq_handler    NMI_Handler

    def_irq_handler    HardFault_Handler

    def_irq_handler    MemManage_Handler

    def_irq_handler    BusFault_Handler

    def_irq_handler    UsageFault_Handler

    def_irq_handler    SVC_Handler

    def_irq_handler    DebugMon_Handler

    def_irq_handler    PendSV_Handler

    def_irq_handler    SysTick_Handler

    def_irq_handler    DMA0_IRQHandler

    def_irq_handler    DMA1_IRQHandler

    def_irq_handler    DMA2_IRQHandler

    def_irq_handler    DMA3_IRQHandler

    def_irq_handler    DMA4_IRQHandler

    def_irq_handler    DMA5_IRQHandler

    def_irq_handler    DMA6_IRQHandler

    def_irq_handler    DMA7_IRQHandler

    def_irq_handler    DMA8_IRQHandler

    def_irq_handler    DMA9_IRQHandler

    def_irq_handler    DMA10_IRQHandler

    def_irq_handler    DMA11_IRQHandler

    def_irq_handler    DMA12_IRQHandler

    def_irq_handler    DMA13_IRQHandler

    def_irq_handler    DMA14_IRQHandler

    def_irq_handler    DMA15_IRQHandler

    def_irq_handler    DMA_Error_IRQHandler

    def_irq_handler    MCM_IRQHandler

    def_irq_handler    FTFL_IRQHandler

    def_irq_handler    Read_Collision_IRQHandler

    def_irq_handler    LVD_LVW_IRQHandler

    def_irq_handler    LLW_IRQHandler

    def_irq_handler    WDOG_EWM_IRQHandler

    def_irq_handler    RNG_IRQHandler

    def_irq_handler    I2C0_IRQHandler

    def_irq_handler    I2C1_IRQHandler

    def_irq_handler    SPI0_IRQHandler

    def_irq_handler    SPI1_IRQHandler

    def_irq_handler    SPI2_IRQHandler

    def_irq_handler    CAN0_ORed_Message_buffer_IRQHandler

    def_irq_handler    CAN0_Bus_Off_IRQHandler

    def_irq_handler    CAN0_Error_IRQHandler

    def_irq_handler    CAN0_Tx_Warning_IRQHandler

    def_irq_handler    CAN0_Rx_Warning_IRQHandler

    def_irq_handler    CAN0_Wake_Up_IRQHandler

    def_irq_handler    I2S0_Tx_IRQHandler

    def_irq_handler    I2S0_Rx_IRQHandler

    def_irq_handler    CAN1_ORed_Message_buffer_IRQHandler

    def_irq_handler    CAN1_Bus_Off_IRQHandler

    def_irq_handler    CAN1_Error_IRQHandler

    def_irq_handler    CAN1_Tx_Warning_IRQHandler

    def_irq_handler    CAN1_Rx_Warning_IRQHandler

    def_irq_handler    CAN1_Wake_Up_IRQHandler

    def_irq_handler    Reserved59_IRQHandler

    def_irq_handler    UART0_LON_IRQHandler

    def_irq_handler    UART0_RX_TX_IRQHandler

    def_irq_handler    UART0_ERR_IRQHandler

    def_irq_handler    UART1_RX_TX_IRQHandler

    def_irq_handler    UART1_ERR_IRQHandler

    def_irq_handler    UART2_RX_TX_IRQHandler

    def_irq_handler    UART2_ERR_IRQHandler

    def_irq_handler    UART3_RX_TX_IRQHandler

    def_irq_handler    UART3_ERR_IRQHandler

    def_irq_handler    UART4_RX_TX_IRQHandler

    def_irq_handler    UART4_ERR_IRQHandler

    def_irq_handler    UART5_RX_TX_IRQHandler

    def_irq_handler    UART5_ERR_IRQHandler

    def_irq_handler    ADC0_IRQHandler

    def_irq_handler    ADC1_IRQHandler

    def_irq_handler    CMP0_IRQHandler

    def_irq_handler    CMP1_IRQHandler

    def_irq_handler    CMP2_IRQHandler

    def_irq_handler    FTM0_IRQHandler

    def_irq_handler    FTM1_IRQHandler

    def_irq_handler    FTM2_IRQHandler

    def_irq_handler    CMT_IRQHandler

    def_irq_handler    RTC_IRQHandler

    def_irq_handler    RTC_Seconds_IRQHandler

    def_irq_handler    PIT0_IRQHandler

    def_irq_handler    PIT1_IRQHandler

    def_irq_handler    PIT2_IRQHandler

    def_irq_handler    PIT3_IRQHandler

    def_irq_handler    PDB0_IRQHandler

    def_irq_handler    USB0_IRQHandler

    def_irq_handler    USBDCD_IRQHandler

    def_irq_handler    ENET_1588_Timer_IRQHandler

    def_irq_handler    ENET_Transmit_IRQHandler

    def_irq_handler    ENET_Receive_IRQHandler

    def_irq_handler    ENET_Error_IRQHandler

    def_irq_handler    Reserved95_IRQHandler

    def_irq_handler    SDHC_IRQHandler

    def_irq_handler    DAC0_IRQHandler

    def_irq_handler    DAC1_IRQHandler

    def_irq_handler    TSI0_IRQHandler

    def_irq_handler    MCG_IRQHandler

    def_irq_handler    LPTMR0_IRQHandler

    def_irq_handler    Reserved102_IRQHandler

    def_irq_handler    PORTA_IRQHandler

    def_irq_handler    PORTB_IRQHandler

    def_irq_handler    PORTC_IRQHandler

    def_irq_handler    PORTD_IRQHandler

    def_irq_handler    PORTE_IRQHandler

    def_irq_handler    Reserved108_IRQHandler

    def_irq_handler    Reserved109_IRQHandler

    def_irq_handler    SWI_IRQHandler

    def_irq_handler    Reserved111_IRQHandler

    def_irq_handler    Reserved112_IRQHandler

    def_irq_handler    Reserved113_IRQHandler

    def_irq_handler    Reserved114_IRQHandler

    def_irq_handler    Reserved115_IRQHandler

    def_irq_handler    Reserved116_IRQHandler

    def_irq_handler    Reserved117_IRQHandler

    def_irq_handler    Reserved118_IRQHandler

    def_irq_handler    Reserved119_IRQHandler

 

 

    .end

ラベル(1)
1 解決策
1,549件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Massimiliano Sturla:

If the default handler is launched by an interrupt which does not have a Service Routine defined, then you can know which interrupt triggered it by checking the ICSR register, at address 0xE000ED04. Below the bit assignment:

pastedImage_2.png

In this case the VECTACTIVE space would tell you the interrupt vector number.

Otherwise, if the cause is a hardfault, then it is not as easy. You need to have a dedicated handler to help you track the offending instruction. Check the next post by colleague Derek Snell and the links provided by him:

Tracking down Hard Faults

I hope this helps.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

2 返答(返信)
1,550件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Massimiliano Sturla:

If the default handler is launched by an interrupt which does not have a Service Routine defined, then you can know which interrupt triggered it by checking the ICSR register, at address 0xE000ED04. Below the bit assignment:

pastedImage_2.png

In this case the VECTACTIVE space would tell you the interrupt vector number.

Otherwise, if the cause is a hardfault, then it is not as easy. You need to have a dedicated handler to help you track the offending instruction. Check the next post by colleague Derek Snell and the links provided by him:

Tracking down Hard Faults

I hope this helps.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,549件の閲覧回数
holyhope
Contributor III

Ok, many thanks!

i will try as soon as possible to track hard faults.

For ISR I willl check ICSR

Many thanks,

Massimiliano

0 件の賞賛
返信