We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I download the uart example form NXP.com I port it to RTX for keil,base on RTX_Traffic. but can't crash at Dabt_handler. help me !! :( the ISR : macro: static DWORD sysreg; /* used as LR register */ #define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode } #define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }
void UART0Handler (void) __irq { BYTE IIRValue, LSRValue; BYTE Dummy = Dummy;
IENABLE; /* handles nested interrupt */ IIRValue = U0IIR;
IIRValue >>= 1; /* skip pending bit in IIR */ IIRValue &= 0x07; /* check bit 1~3, interrupt identification */ if ( IIRValue == IIR_RLS ) /* Receive Line Status */ { LSRValue = U0LSR; /* Receive Line Status */ if ( LSRValue & (LSR_OE|LSR_PE|LSR_FE|LSR_RXFE|LSR_BI) ) { /* There are errors or break interrupt */ /* Read LSR will clear the interrupt */ UART0Status = LSRValue; Dummy = U0RBR; /* Dummy read on RX to clear interrupt, then bail out */ IDISABLE; VICVectAddr = 0; /* Acknowledge Interrupt */ return; } if ( LSRValue & LSR_RDR ) /* Receive Data Ready */ { /* If no error on RLS, normal ready, save into the data buffer. */ /* Note: read RBR will clear the interrupt */ UART0Buffer[UART0Count] = U0RBR; UART0Count++; if ( UART0Count == BUFSIZE ) { UART0Count = 0; /* buffer overflow */ } } } else if ( IIRValue == IIR_RDA ) /* Receive Data Available */ { /* Receive Data Available */ UART0Buffer[UART0Count] = U0RBR; UART0Count++; if ( UART0Count == BUFSIZE ) { UART0Count = 0; /* buffer overflow */ } } else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */ { /* Character Time-out indicator */ UART0Status |= 0x100; /* Bit 9 as the CTI error */ } else if ( IIRValue == IIR_THRE ) /* THRE, transmit holding register empty */ { /* THRE interrupt */ LSRValue = U0LSR; /* Check status in the LSR to see if valid data in U0THR or not */ if ( LSRValue & LSR_THRE ) { UART0TxEmpty = 1; } else { UART0TxEmpty = 0; } }
IDISABLE; VICVectAddr = 0; /* Acknowledge Interrupt */ }
"I port it to RTX for keil"
Well, if your porting was as careless as your reading of the instructions for posting source code, it's not surprising that it didn't work!
Please read the instructions on how to post source code: www.danlhenry.com/.../keil_code.png
Most people would probably consider it good that you can't crash at the data abort handler.
By the way, have you made sure that your stacks are correctly aligned?