마이크로 칩 ICD3 장치에서 프로그램을 실행하는 동안 예외 처리가 이상하게 보입니다. 예외가 발생하는 동안 프로그램이 응답을 중지합니다. 코드를 확인하면서 default-general-exception-handler.c가 무한 루프를 생성한다는 것을 알았습니다. 오류가 발생한 위치와 원인을 알 수 없기 때문에 실제로 혼란 스럽습니다. 이는 마이크로 칩이 예외 처리를 지원하지 않는다는 것을 의미합니까? 아니면 오류 메시지를 읽을 수있는 방법이 있습니까?마이크로 칩 예외 처리
무한 루프하십시오 _general_exception_handler를 정의함으로써
--- \home\c11067\work\C32\builds\pic32-microchip-release-1.12-20101221-rc2-20101221\pic32-libs\libc\stubs\default-general-exception-handler.c
9D00DD28 1000FFFF beq zero,zero,0x9d00dd28
9D00DD2C 00000000 nop
, 그것은 작동한다!
// declared static in case exception condition would prevent
// auto variable being created
static enum {
EXCEP_IRQ = 0, // interrupt
EXCEP_AdEL = 4, // address error exception (load or ifetch)
EXCEP_AdES, // address error exception (store)
EXCEP_IBE, // bus error (ifetch)
EXCEP_DBE, // bus error (load/store)
EXCEP_Sys, // syscall
EXCEP_Bp, // breakpoint
EXCEP_RI, // reserved instruction
EXCEP_CpU, // coprocessor unusable
EXCEP_Overflow, // arithmetic overflow
EXCEP_Trap, // trap (possible divide by zero)
EXCEP_IS1 = 16, // implementation specfic 1
EXCEP_CEU, // CorExtend Unuseable
EXCEP_C2E // coprocessor 2
} _excep_code;
static unsigned int _epc_code;
static unsigned int _excep_addr;
// this function overrides the normal _weak_ generic handler
void _general_exception_handler(void)
{
asm volatile("mfc0 %0,$13" : "=r" (_excep_code));
asm volatile("mfc0 %0,$14" : "=r" (_excep_addr));
_excep_code = (_excep_code & 0x0000007C) >> 2;
while (1) {
// Examine _excep_code to identify the type of exception
// Examine _excep_addr to find the address that caused the exception
}
}
http://www.microchip.com/forums/m455278.aspx 나는 내 자신에 의해 예외 처리 함수를 정의해야 할 것 같습니다을 등록합니다. – lucemia