| Details | Message |
|---|
Read-Only Author Dieter Joachim Posted 2-Sep-2010 11:00 GMT Toolset ARM |  OVERWRITE EXCEPTION HANDLER Dieter Joachim Hello, I use the NXP LPC 2368 and want to write a function to save the exceptions Data Abort Error, Undefined Instruction Error and Pre-fetch Abort Error in a seriel EEPROM and after reset the CPU. How can I overwrite the dummy exception handler Undef_Handler, PAbt_Handler and DAbt_Handler with C code? I found the technical support: http://www.keil.com/support/docs/3027.htm If I write the irq-functions there is no warning and no error so far so good. But if I test the irq the PC stuck always in the dummy function in startup and not in my own function! Somebody have a idea? |
|
Read-Only Author Dragi Pandeliev Posted 2-Sep-2010 13:02 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dragi Pandeliev If your handler is called ProgramAbortHandler(), then in your startup file find PAbt_Addr DCD PAbt_Handler and replace it with PAbt_Addr DCD ProgramAbortHandler |
|
Read-Only Author Dieter Joachim Posted 2-Sep-2010 15:11 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dieter Joachim Thanks for the tip. But now the Compiler Error: "system\LPC2300.s(615): error: A1516E: Bad symbol 'ProgramAbortHandler', not defined or external" comes. Here my Code: Startup-File
; Exception Vectors
; Mapped to Address 0.
; Absolute addressing mode must be used.
; Dummy Handlers are implemented as infinite loops which can be modified.
Vectors LDR PC, Reset_Addr
LDR PC, Undef_Addr
LDR PC, SWI_Addr
LDR PC, PAbt_Addr
LDR PC, DAbt_Addr
NOP ; Reserved Vector
; LDR PC, IRQ_Addr
LDR PC, [PC, #-0x0120] ; Vector from VicVectAddr
LDR PC, FIQ_Addr
Reset_Addr DCD Reset_Handler
Undef_Addr DCD Undef_Handler
SWI_Addr DCD SWI_Handler
PAbt_Addr DCD ProgramAbortHandler
DAbt_Addr DCD DAbt_Handler
DCD 0 ; Reserved Address
IRQ_Addr DCD IRQ_Handler
FIQ_Addr DCD FIQ_Handler
IMPORT SWI_Handler
Undef_Handler B Undef_Handler
;SWI_Handler B SWI_Handler
;Don't need the dummy PAbt handler
;PAbt_Handler B PAbt_Handler
DAbt_Handler B DAbt_Handler
IRQ_Handler B IRQ_Handler
FIQ_Handler B FIQ_Handler
File irq.c
void ProgramAbortHandler(void) __irq
{
// For Test
while(1);
}
I think I have to declare the function because it is defined in another file. How can I do this in Assembler? Thanks
|
|
Read-Only Author Robert Rostohar Posted 3-Sep-2010 06:48 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Robert Rostohar Add the following line to the startup before referencing your function:
IMPORT ProgramAbortHandler
|
|
Read-Only Author Dragi Pandeliev Posted 3-Sep-2010 06:51 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dragi Pandeliev Just add
IMPORT IntSPI_isr
at the beginning of your startup file and i think that would be it :)
|
|
Read-Only Author Dragi Pandeliev Posted 3-Sep-2010 06:59 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dragi Pandeliev I write too slowly :) And the answer above is better than mine, because I used the name of my own handler :D |
|
Read-Only Author Dieter Joachim Posted 6-Sep-2010 15:25 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dieter Joachim Thank you very much for the help. The startup assembler is very hard to understand for me. The solution above works! But now I get a warning (after the linking process): Warning: L6306W: '~PRES8' section lpc2300.o(RESET) should not use the address of 'REQ8' function ProgramAbortHandler. In the technical Support I read this: http://www.keil.com/support/docs/3268.htm So what I did was PRESERVE8 put in the first line of my start up code. But after i get a compiler error: error: A1355U: A Label was found which was in no AREA Now the Joke of the Day: The label is the PRESERVE8 comand! First I think I wrote wrong. But I copy and paste it of the technical support document! So the solution of the technical support is not the best way. Anybody know why there is a linker-warning and how I can solve it? |
|
Read-Only Author scott douglass Posted 6-Sep-2010 16:33 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER scott douglass Like all directives in asm, the PRESERVE8 needs to have some whitespace before it. If it starts in column 1 then it's a label and not a directive. |
|
Read-Only Author Dieter Joachim Posted 8-Sep-2010 08:34 GMT Toolset ARM |  RE: OVERWRITE EXCEPTION HANDLER Dieter Joachim Hello, thank you very much for the fast help. After I insert a space before the asm PRESERVE8 everything works fine! I am sorry for my lack of knowledge. So I wrote now Exception Handlers for the PAbt, DAbt and Undef Instructions. I use the RTX OS so I additinal check for the stack overflow and wrote my own os_stk_overflow function. Somebody know further exceptions so I can handle? If no so I thank again very much for the good help. |
|