<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22112/how-to-return-from-fiq-isr-in-assembly</link><description> 
I am writing an assembly FIQ ISR using GCC complier. I want to
change return address in FIQ ISR so that after ISR, it returns to the
requested address. the reason for doing that is because i am writing
a RTOS. 

 
what are the instruction for ISR return</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/124083?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 10:51:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:47085c02-93ab-4398-b4b4-e0ce2c24d470</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
Change&lt;/p&gt;

&lt;pre&gt;
 LDMFD R13!, {R0-R7,PC}
&lt;/pre&gt;

&lt;p&gt;
to&lt;/p&gt;

&lt;pre&gt;
 LDMFD R13!, {R0-R7,PC}^
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/113192?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 10:01:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9d48c4f1-a633-4880-8739-a4ddbe397a63</guid><dc:creator>cress w</dc:creator><description>&lt;p&gt;&lt;p&gt;
You mean if it is&lt;/p&gt;

&lt;pre&gt;
 LDMFD R13!, {R0-R7,R14}
&lt;/pre&gt;

&lt;p&gt;
the CPSR will remain the same.&lt;/p&gt;

&lt;p&gt;
But if it is:&lt;/p&gt;

&lt;pre&gt;
 LDMFD R13!, {R0-R7,PC}
&lt;/pre&gt;

&lt;p&gt;
the CPSR will replaced by SPSR_IRQ.&lt;/p&gt;

&lt;p&gt;
I have tried the second one, CPSR still remains the same, still in
FIQ mode.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/113193?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 09:40:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:005cbbea-1050-4a5a-8a63-a8a670128ab6</guid><dc:creator>cress w</dc:creator><description>&lt;p&gt;&lt;p&gt;
thanks, Robert.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/99625?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 09:14:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d24cb1a8-ba87-4363-8456-4dd20a10ba65</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;pre&gt;
 SUBS PC, R14, #4
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
will cause CPSR to be replaced by SPSR_FIQ&lt;/p&gt;

&lt;pre&gt;
 SUB PC, R14, #4
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
will cause CPSR to remain the same (not be replaced by SPSR_IRQ)&lt;/p&gt;

&lt;p&gt;
an LDM instruction that references the PC will cause CPSR to be
replaced by SPSR_FIQ.&lt;/p&gt;

&lt;p&gt;
If you are doing a task switch, you definately want to set the
CPSR to the correct value, and not what it currently is in the FIQ
routine (this usually means that you will need to put into SPSR_FIQ
the value that you would like CPSR to be after the return).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/75472?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 08:52:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0441f11d-9428-431b-92ad-f3ef063b6248</guid><dc:creator>cress w</dc:creator><description>&lt;p&gt;&lt;p&gt;
Does it mean when use&lt;/p&gt;

&lt;pre&gt;
 sub PC, R14, #4
&lt;/pre&gt;

&lt;p&gt;
, it will return to the interrupted task, and CPSR resumes from
SPSR_fiq automatically? Is it the only way for CPSR to resume from
SPSR_fiq automatically?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/48561?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 07:43:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:99d4f551-582a-4ea3-9084-0c2ac67d8cb3</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sure, that will cause a return from an FIQ ISR.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to return from FIQ ISR in assembly?</title><link>https://community.arm.com/thread/51126?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2007 07:42:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3b1ce94b-7c2e-45cc-9fb9-acf7bcdb62a2</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Look at the assembler output of the compiler to see what
instructions that are used by fast and normal interrupt handlers.&lt;/p&gt;

&lt;p&gt;
Remember that a RTOS doesn&amp;#39;t just switch return address - you have
to switch to a different stack and make sure that all registers (and
other important thread states) gets restored to the values of the
other task. That can be quite a lot of hard work, if you are not
familiar with the processor instructions.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>