<?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: Code compatibility with other compilers</title>
		<link>http://forums.leaflabs.com/topic.php?id=1167</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:06: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=1167" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Code compatibility with other compilers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1167#post-7153</link>
			<pubDate>Sat, 12 Nov 2011 13:22:00 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7153@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;x893 - Okay, I think I understand.&#60;/p&#62;
&#60;p&#62;Does &#60;code&#62;voidFuncPtr handlers[0];&#60;/code&#62; work with ARMCC?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>x893 on "Code compatibility with other compilers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1167#post-7150</link>
			<pubDate>Sat, 12 Nov 2011 05:30:33 +0000</pubDate>
			<dc:creator>x893</dc:creator>
			<guid isPermaLink="false">7150@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;It's only example. I say about general idea for compatibility. So people can use libmaple not only with GCC and may be expand libmaple as alternative for ST standard library.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Code compatibility with other compilers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1167#post-7147</link>
			<pubDate>Fri, 11 Nov 2011 20:32:13 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7147@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;x893 - Are you sure the two declarations are equivalent? I don't think they are.&#60;/p&#62;
&#60;p&#62;for a struct ending with &#60;code&#62;voidFuncPtr handlers[];&#60;/code&#62; I'd expect to be able to create an instance with arbitrarily many voidFuncPtr  handlers, i.e. I'd expect to be able to create an instance  of a timer_dev embedding an array of 0 or more voidFuncPtr.&#60;/p&#62;
&#60;p&#62;But I'd expect to create a separate array of voidFuncPtr's pointed at by a &#60;code&#62;voidFuncPtr *handlers;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I must admit that I am not familiar with the syntax &#60;code&#62;{ [NR_ADV_HANDLERS - 1] = 0 }&#60;/code&#62; in&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;static timer_dev timer1 = {
    .regs         = { .adv = TIMER1_BASE },
    .clk_id       = RCC_TIMER1,
    .type         = TIMER_ADVANCED,
    .handlers     = { [NR_ADV_HANDLERS - 1] = 0 },
};&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I assume the array &#60;code&#62;handlers&#60;/code&#62; contains &#60;code&#62;NR_ADV_HANDLERS - 1&#60;/code&#62; voidFuncPtr instances, which is different from a &#60;code&#62;voidFuncPtr *&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;I'd change its name from &#60;code&#62;handlers&#60;/code&#62;, maybe to &#60;code&#62;handler_block&#60;/code&#62; (or something) so that the compiler would throw an error on every line that needs to be changed.&#60;/p&#62;
&#60;p&#62;I'd expect to create an array for each &#60;code&#62;timer_dev&#60;/code&#62; which is referenced by the &#60;code&#62;voidFuncPtr *handler_block;&#60;/code&#62; pointer:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;static voidFuncPtr _timer1_handlers[NR_ADV_HANDLERS - 1] = { NULL };
static timer_dev timer1 = {
    .regs         = { .adv = TIMER1_BASE },
    .clk_id       = RCC_TIMER1,
    .type         = TIMER_ADVANCED,
    .handler_block     = _timer1_handlers,
};&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>x893 on "Code compatibility with other compilers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1167#post-7144</link>
			<pubDate>Fri, 11 Nov 2011 12:25:14 +0000</pubDate>
			<dc:creator>x893</dc:creator>
			<guid isPermaLink="false">7144@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Current version of libmaple perfectly compiles with arm-none-eabi compiler but not compile with ARMCC. Problem in new features of GCC which not supported with RealView ARMCC. It's not a big changes to make code to comtible with other arm compilers.&#60;br /&#62;
For example&#60;/p&#62;
&#60;p&#62;typedef struct timer_dev {&#60;br /&#62;
    timer_reg_map	regs;		/**&#38;lt; Register map */&#60;br /&#62;
    rcc_clk_id		clk_id;		/**&#38;lt; RCC clock information */&#60;br /&#62;
    timer_type		type;		/**&#38;lt; Timer's type */&#60;br /&#62;
    voidFuncPtr 	handlers[];	/**&#38;lt; User IRQ handlers */&#60;br /&#62;
} timer_dev;&#60;/p&#62;
&#60;p&#62;initialization this structures not support by ARMCC but if you change&#60;/p&#62;
&#60;p&#62;    voidFuncPtr 	handlers[];	/**&#38;lt; User IRQ handlers */&#60;br /&#62;
to&#60;br /&#62;
    voidFuncPtr 	*handlers;	/**&#38;lt; User IRQ handlers */&#60;/p&#62;
&#60;p&#62;all OK&#60;/p&#62;
&#60;p&#62;Changes in codes minimal but your code can be used this other system - Keil, IAR and may be other. I check only with Keil and IAR
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
