Hi I am using uVision 3 and i have written a source code to enable Timer Counter 0 interrupt in at91sam7x256. My program compiles successfully and debugger starts well until TC0 interrupt occurs. It jumps suddenly to address 0x00000018 and so show me the very famous keil error message: no execute/read permission I have tried my projects RAM.ini file memory map in debuuger settings and so on. but the problem is not that the place my code is stored there or the place in memory that debugger starts from. The problem is that when Interrupt occurs debugger jumps to a memory space that is not address of my interrupt routine. This is my code:
#include <AT91SAM7X256.H> /* #include <lib_AT91SAM7X256.h> #define AIC_SVR_TC0IP AT91C_AIC_PRIOR_HIGHEST void mainTimer_isr () __irq{ timer++; AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC); } int main (void) { // Enable the Clock of the PIO AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 << AT91C_ID_PIOA); AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 << AT91C_ID_PIOB); AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, 1 << AT91C_ID_TC0); //* Disable the interrupt on the interrupt controller AT91C_BASE_AIC->AIC_IDCR = 0x1 << AT91C_ID_TC0 ; //* Save the interrupt handler routine pointer and the interrupt priority AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (unsigned int) mainTimer_isr ; /*This address stored well in SVR register. the address is like 0x001000840 but debugger didn't jumped to it. It jumps to address 0x00000018 all the time:( */ //* Store the Source Mode Register AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = AT91C_AIC_SRCTYPE_HIGH_LEVEL | AIC_SVR_TC0IP ; //* Clear the interrupt on the interrupt controller AT91C_BASE_AIC->AIC_ICCR = 0x1 << AT91C_ID_TC0 ; AT91F_AIC_EnableIt(AT91C_BASE_AIC,AT91C_ID_TC0); AT91C_BASE_TCB->TCB_BCR=0; AT91C_BASE_TC0->TC_CMR=AT91C_TC_CLKS_TIMER_DIV1_CLOCK|AT91C_TC_WAVE; AT91C_BASE_TC0->TC_CCR=5; AT91C_BASE_TC0->TC_IER=AT91C_TC_CPAS; AT91C_BASE_TC0->TC_RA=0x002C; }
Do you know why debugger jumps to 0x00000018 like this? How could I solve that? Thanks a lot.
your debugger is probably configured to load and execute the code from RAM. but the vector table is inside internal flash...if you remap your program to start at 0x0 - hence, remove ram.ini, remove linker directive --entry from linker tab and adjust target window by clicking on ROM1 checkbox and filling in 0x0 as start point - you should be alright. and, and advised already: read the manual of everything: your chip, uv3, the whole smack. HOW can you complain about famous error messages if you don't even understand them?!?!?!?!?!