<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: GNU assembler Cortex-M3 syntax - what is register ip?</title>
		<link>http://forums.leaflabs.com/topic.php?id=1298</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:13:56 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1298" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "GNU assembler Cortex-M3 syntax - what is register ip?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1298#post-7831</link>
			<pubDate>Sun, 22 Jan 2012 19:13:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7831@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I have found the answer to my own question!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.ethernut.de/en/documents/arm-inline-asm.html&#34; rel=&#34;nofollow&#34;&#62;http://www.ethernut.de/en/documents/arm-inline-asm.html&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;says in the section &#34;Register Usage&#34;:&#60;br /&#62;
r10 	sl 	Stack limit&#60;br /&#62;
r11 	fp 	Argument pointer&#60;br /&#62;
r12 	ip 	Temporary workspace&#60;br /&#62;
r13 	sp 	Stack pointer&#60;br /&#62;
r14 	lr 	Link register Workspace &#60;/p&#62;
&#60;p&#62;I will leave the question in case anyone else is puzzled.&#60;/p&#62;
&#60;p&#62;Edit: Pete Harrison found&#60;br /&#62;
&#60;a href=&#34;http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf&#34; rel=&#34;nofollow&#34;&#62;http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf&#60;/a&#62;&#60;br /&#62;
Which says:&#60;br /&#62;
&#34;Register r12 (IP) may be used by a linker as a scratch register between a routine and any subroutine it calls (for details, see §5.3.1.1, Use of IP by the linker). It can also be used within a routine to hold intermediate values between subroutine calls.&#34;&#60;/p&#62;
&#60;p&#62;ala42 Thank you very much for looking. I apologise for taking your time, I 'd written this but forgot to post (due to a food-shortage distraction).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "GNU assembler Cortex-M3 syntax - what is register ip?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1298#post-7829</link>
			<pubDate>Sun, 22 Jan 2012 18:52:28 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">7829@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#60;a href=&#34;http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ARM-Assembler.html&#34; rel=&#34;nofollow&#34;&#62;http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ARM-Assembler.html&#60;/a&#62; says:&#60;br /&#62;
Registers are specified by their names r0 through r15, with the aliases pc, lr, sp, ip and fp provided for convenience. Note that ip means intra procedure call scratch register (r12) and does not refer to the instruction pointer.&#60;br /&#62;
Also see &#60;a href=&#34;http://www.cl.cam.ac.uk/teaching/2002/CompDesig/lecture4.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.cl.cam.ac.uk/teaching/2002/CompDesig/lecture4.pdf&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "GNU assembler Cortex-M3 syntax - what is register ip?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1298#post-7826</link>
			<pubDate>Sun, 22 Jan 2012 17:42:15 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7826@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I've been reading the ARM assembly language output produced by arm-none-eabi-gcc (the gcc compiler than comes within the Maple IDE).&#60;/p&#62;
&#60;p&#62;I thought registers are either r0 to r15, or&#60;br /&#62;
Stack ptr register: sp&#60;br /&#62;
Frame ptr register: fp&#60;br /&#62;
Link (return) register: lr&#60;br /&#62;
Instruction Pointer/Program Counter: ip&#60;/p&#62;
&#60;p&#62;For example, those are the meanings in microcross.com/GNU-ARM-Assy-Quick-Ref.pdf&#60;/p&#62;
&#60;p&#62;Irritatingly, the documentation at CodeSourcery for as, the assembler says:&#60;br /&#62;
&#34;9.3.2.3 Register Names&#60;br /&#62;
*TODO* Explain about ARM register naming, and the predefined names.&#34;&#60;/p&#62;
&#60;p&#62;So I had thought &#34;ip&#34; was the name of the Instruction Pointer/Program Counter, but can't find a definitive answer.&#60;/p&#62;
&#60;p&#62;But ip = program counter that makes these weird:&#60;br /&#62;
cmp     ip, #32     // I think this is position independent code, or relocatable code&#60;br /&#62;
...&#60;br /&#62;
...&#60;br /&#62;
movs    r5, #1&#60;br /&#62;
...&#60;br /&#62;
and     ip, ip, r5  // &#34;The definitive guide to the Cortex-M3&#34;, ed 2, says this is illegal&#60;/p&#62;
&#60;p&#62;even these seem a bit odd:&#60;br /&#62;
mov     ip, r4      // a computed branch?&#60;/p&#62;
&#60;p&#62;str     ip, [r6, #12] // store the value in ip to a peripheral pin address?&#60;/p&#62;
&#60;p&#62;add     ip, ip, #2  // skip a thumb instruction?&#60;/p&#62;
&#60;p&#62;I am very inclined to believe ip is not the program counter, but what else might it be?&#60;br /&#62;
Can anyone confirm that ip is the program counter, or tell me the correct meaning?&#60;/p&#62;
&#60;p&#62;Edit: I am pretty sure some of the assembly language instructions in the program are illegal if ip is the program counter.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
