OpenCores
no use no use 1/1 no use no use
calling a function defined in .text section
by krantikumar.t on May 22, 2012
krantikumar.t
Posts: 7
Joined: Aug 12, 2010
Last seen: May 3, 2017
Hi,
I have defined a section name ".isrsec" and then a function "extint_isr()" is placed into that section by using following:

extern void extint_isr() __attribute__ ((section (".isrsec")));

With this, the .lst file showing the extint_isr function at the address specified at .isrsec section, which is fine.

Now, can we call a function, say wr(addr, data) which is by default placed in .text section in extint_isr function ??

If I do so, below is my observation:
In .lst file, at calling of wr function has the jump to current section addr + actual wr function offset.
ex :
// .text sec
wr() { } is @ 0x1478

//.isrsec sec
extint_isr { @ 0xf0000f5c
....
wr() // l.jal 0xf0001478
}

But I want the l.jal should be 0x1478.

Thanks,
Kranti
RE: calling a function defined in .text section
by krantikumar.t on Aug 10, 2012
krantikumar.t
Posts: 7
Joined: Aug 12, 2010
Last seen: May 3, 2017
any help in this regard ?
RE: calling a function defined in .text section
by firefalcon on Aug 10, 2012
firefalcon
Posts: 99
Joined: Jan 10, 2011
Last seen: Mar 26, 2024
Hi,
I have defined a section name ".isrsec" and then a function "extint_isr()" is placed into that section by using following:

extern void extint_isr() __attribute__ ((section (".isrsec")));

With this, the .lst file showing the extint_isr function at the address specified at .isrsec section, which is fine.

Now, can we call a function, say wr(addr, data) which is by default placed in .text section in extint_isr function ??

If I do so, below is my observation:
In .lst file, at calling of wr function has the jump to current section addr + actual wr function offset.
ex :
// .text sec
wr() { } is @ 0x1478

//.isrsec sec
extint_isr { @ 0xf0000f5c
....
wr() // l.jal 0xf0001478
}

But I want the l.jal should be 0x1478.

Thanks,
Kranti


The instruction you actually want is something like l.jal 0x04000147 (0x0400_0147 sll 2 = 0x1000_051C, then 0xF000_0F5C + 0x0x1000_051C = 0x00001478). Note that I got this by looking at the instruction in the OR1200 architecture reference manual. The manual also reports that the space reserved for the immediate is 26 bits, but the length of your jump requires an immediate of 27 bits. So the instruction l.jal 0x04000147 is trimmed to l.jal 0x147 which produces a jump to 0xF000_1478. Even if the field for the immediate was 27-bits, you would have a problem as the immediate is sign extended.
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.