<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDE中的主题 Re: Code efficiency</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584227#M26178</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by woodchuck on Thu Sep 16 13:18:17 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't speak authoritatively about code size optimizations, but I've observed that the code_red/gcc optimizations for speed are very impressive!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 00:05:44 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T00:05:44Z</dc:date>
    <item>
      <title>Code efficiency</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584223#M26174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by qili on Tue Sep 14 17:48:52 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am curious as to how efficient the code red compiler (gnu?) is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I compiled the following code under lpcxpresso 3.5 for 1343.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;/*
===============================================================================
 Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : main.c
 Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 
 Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :
 Copyright&amp;nbsp;&amp;nbsp; : Copyright (C)
 Description : main definition
===============================================================================
*/

#ifdef __USE_CMSIS
#include "LPC13xx.h"
#endif

// TODO: insert other include files here

// TODO: insert other definitions and declarations here
#define LED_PORTLPC_GPIO0-&amp;gt;DATA//FIOPIN for Keil
#define LED_DDRLPC_GPIO0-&amp;gt;DIR//FIODIR for Keil
#define LED(1&amp;lt;&amp;lt;7)
#define DLY_MS1000//delay time, in ms

volatile unsigned long SysTickCnt=0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SysTick Counter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */

void SysTick_Handler (void) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SysTick Interrupt Handler (1ms)&amp;nbsp;&amp;nbsp;&amp;nbsp; */
SysTickCnt++;
}

void Delay (unsigned long tick) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Delay Function&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp; unsigned long systick;
&amp;nbsp; //unsigned long tick_cnt = tick;

&amp;nbsp; systick = SysTickCnt;//systickcnt has the start-up time
&amp;nbsp; while ((SysTickCnt - systick) &amp;lt; tick);
}

void mcu_init(void) {
SystemInit();//reset mcu
/* Generate interrupt each 1 ms&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; SysTick_Config(SystemCoreClock/1000 - 1);//=SystemFrequency for Keil

LED_PORT &amp;amp;=~(LED);//clear led
LED_DDR |= (LED);//led as output
}

int main(void) {
unsigned char i;
mcu_init();//reset mcu
while (1) {
for (i=0; i&amp;lt;0xff; i++) {
LED_PORT ^= (LED);
Delay(i&amp;lt;&amp;lt;1);//delay some time
}
for (i=0xff; i&amp;gt;0x00; i--) {
LED_PORT ^= (LED);
Delay(i&amp;lt;&amp;lt;1);//delay some time
}
}
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the code compiled to about 2.5kb - enabling optimization didn't make much of an impact.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with a certain commercial compiler, I got anywhere between 0.9Kb to 1.1kb (no optimization at all).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;has anyone done a more systemic assessment on that front?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:05:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584223#M26174</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Code efficiency</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584224#M26175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by domen on Tue Sep 14 23:17:41 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course that is not all that lands in the binary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What are your gcc options? Try [font=courier]-Os[/font], [font=courier]-ffunction-sections[/font], maybe [font=courier]-fno-builtin[/font], if you can get away with that. And then the linker option [font=courier]--gc-sections[/font].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, analyse resulting code with [font=courier]nm -S --size-sort[/font] and [font=courier]objdump -xd[/font], to get a feel what's using all the FLASH.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:05:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584224#M26175</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Code efficiency</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584225#M26176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Tue Sep 14 23:41:38 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;When I build your example (and CMSIS) for release, I end up with a code size of 1.7k.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you comparing eggs with eggs. Are you building the exact same code (including CMSIS) with both toolchains?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Don't forget that for noddy examples like this, the library code&amp;nbsp; (startup code, CMSIS, and C runtime) tends to dominate. When you start&amp;nbsp; adding more of your own code, then your code will dominate over the library code. In our experiments, in terms of code size, GCC is pretty close to 'commercial' - sometimes it is bigger, sometimes it is smaller.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:05:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584225#M26176</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Code efficiency</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584226#M26177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Jesse.Rosenberg on Wed Sep 15 16:22:01 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You may also find this application note useful in terms of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Assessing the stack up of code size for a particular application&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Finding ways to improve your code size&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;""AN10963 Reducing code size for LPC11XX with LPCXpresso"&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://ics.nxp.com/support/documents/microcontrollers/zip/an10963.zip&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that's useful&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:05:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584226#M26177</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Code efficiency</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584227#M26178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by woodchuck on Thu Sep 16 13:18:17 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't speak authoritatively about code size optimizations, but I've observed that the code_red/gcc optimizations for speed are very impressive!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:05:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Code-efficiency/m-p/584227#M26178</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:05:44Z</dc:date>
    </item>
  </channel>
</rss>

