Hallo
When I try to start the debugger, the application get flashed and the debugger starts. If I hit Run, the execution ends in the PAbt_Handler in the StartUp.s. Stopping the debugger, reset cpu and then run again makes the application run to main and the rest of the program. If I step through the startup.s file, it jumps to the PAbt handler after the BX R0!!
IMPORT __main LDR R0, =__main BX R0
Sometimes I do have to re-flash to get it to run right.
I use cross module optimization and MicroLIB. Im using uVision 4.03 and MDK-ARM 4.10. The MCU is a LPC2131 Running the application without the debugger (no JTAG) it starts and run every time...
Any idea what could be the problem?
After the jump to main in the startup.s file, there is some heap init stuff. It seems never to be called?
IMPORT __main LDR R0, =__main BX R0 IF :DEF:__MICROLIB EXPORT __heap_base EXPORT __heap_limit ELSE ; User Initial Stack & Heap AREA |.text|, CODE, READONLY IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + USR_Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ENDIF
/Thomas
Hi,
I know from one CM3 uC that it jump to an Abort handler if a peripheral, which is accessed, is not clocked (i.e. Clock disabled in Clock Gating).
. BR, /th.
Maybe see this:
http://www.keil.com/forum/docs/thread7444.asp
Hallo all
I have done some research in my problem and I think I have found out what happens. I guess it has something todo with the reset behaviour. See this article as ref: http://www.keil.com/support/docs/2767.htm
The reset from the debugger, does not clear all the CPU register including the vectored interrupt register. So when the starup code is executing, the peripherals (timer 0, 1 etc) continues to interrupt (Timer0 intterupts every 1 ms). But if I have downloaded new code, the ISR address can have moved, making the address in the VICVectAddrX bad causing the Data abort interrupt.
Pushing the hard reset on the target after download, makes everything works fine.
But isnt there anything todo about this?
What about clearing the VIC Vectors, stopping the timers etc, in the begining of the startup.s? Then no interrupts is generated, making it possible for the debugger to reset right and make the init code run before interrupt are generated.
It would be convenient just to start the debugger without having to reset the target etc..
/thomas
I don't work with a Cortex yet, but I think you can solve this by powering the peripherals you need in your program entry point, while building the program with all peripherals powered off (that should be an option in the startup file editor). In a device like a LPC2400, the register I refer to is called PCONP.