Simple boot-up code for an Atmel A91

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I'm still having an extremely hard time getting IRQ interrupts of any
sort to work on my AT91R40008.
Does anyone have a simple boot.s that sets up all the stacks for IRQ
interrupts and then can branch to C functions?
I am not using any debug monitors like Angel.
I am not using any pre-canned libraries (like Atmel's)
I am using gcc-3.2, and I am trying to implement my interrupt handlers
in C also.

Here is exactly what I'm trying to do:
- I'm not bothering with running from flash at the moment. Currently
I"m locating my code at 0x00, manually initiating a REMAP through my
JTAG interface and then loading the code (so it should be all loaded
into RAM)
- I have a small test program which toggles PIO pins every TIMER0
overflow interrupt.

The problems I've been having:
- The pin will go high (suggesting the reception of 1 interrupt) and
then stay high - halting the processor results in the PC being at
either Data Abort or Program Abort in the vector table (the first
- If I issue a RESET command, and then execute the program again (w/o
powering down the chip), the program runs fine and just loops
infinitely on my while(1) { } at the end of main, but there is no pin
toggling at all (suggesting no reception of interrupts)

I have been communicating with Tauno somewhat and he has been a great
help so far.

Here's what I understand I must do (but may not be implementing it
Setup the IRQ, SVC, and SYS stacks.
Enable Timer interrupts in the TC registers and the AIC (pretty sure I
have this correct).
Setup interrupt vector in the AIC (pretty sure I also have this
Writing to AIC_EOICR at the end of the interrupt handler (I have this

Re: Simple boot-up code for an Atmel A91
Go to the Atmel website and find the AT91 library or
the non-light version.  It's about a 9 MB download. In it find a Cstartup.s
file.  There are more than one, pick the one appropriate for your chip.  It
should have what you need and plenty of other example code.


Quoted text here. Click to load it

Re: Simple boot-up code for an Atmel A91

Quoted text here. Click to load it

we had a similar problem and the fix was to write 0, 8 times to the end
of interrupt register to make sure that all the queued interrupts have
been removed ~ do this as the last part of an initialisation process.
This efectively flushes all pending interrupts otherwise the whole
process gets out of kilter and problems ensue...

Re: Simple boot-up code for an Atmel A91

Quoted text here. Click to load it

James, remember to read the timer status register before EOI in the
interrupt service, to reset the internal request.

Tauno Voipio
tauno voipio @ iki fi

Site Timeline