|
Message
From: Mark<mark@j...>
Date: Sun Feb 3 17:03:15 CET 2008
Subject: [openrisc] ISR memory pointing in C testcase for ORP.
Rahul Wagh wrote: > Hi, > > I am using ORP and I have a problem related to interrupt service routines > written in C testcase. > > How does one specify in the C testcase that a particular C function/routine > (written as an ISR) is to be connected / written at a particular memory > location ? (e.g.0x500 for tick timer, 0x800 for external interrupt such as > from UART etc). I know that its possible in assembly testcase (.S file) by > using < .org 0x800 > syntax. But how do we do it in C test ? > > Those who know it, please throw light on how to do it. > I realize this is a really old post, but here's an idea:
__attribute__((__section(".tick.isr"))) void tick_isr(void) { /* Compiler allocates space on the stack for the frame */
/* Do whatever */
__asm__("l.lwz r2,0x0(r1)"); /* Restore stack */ __asm__("l.addi r1,r1,0x4"); __asm__("l.rfe"); /* Return from exception */ /* l.rfe has no delay slot */
/* The compiler will generate the regular return sequence here */ }
Then link with --section-start .tick.isr=0x500 (e.g., or32-elf-gcc -Wl,--section-start,.tick.isr=0x500 -o foo foo.c). You might have to do some other hacking since the or32-elf-gcc toolchain I'm most familiar with already defines all the interrupt vectors. Maybe write your own crt0.S or use -nostartfiles.
Anybody know how to do this such that tick_isr doesn't generate the standard call/return sequence (i.e., allocating room on the stack that needs to be freed, returning via "l.jr r9")?
|
 |