millwood0 发表于 2012-9-25 08:27:33

iar vs. gcc vs. arduino

I was just doing some simple pin flipping on atmega328, using iar, gcc and arduino.

arduino: about 31khz;
gcc: about 41khz;
iar: about 83khz.

all on default optimization.

hat's off to IAR. wow.

millwood0 发表于 2012-9-25 08:32:03

all running at 8Mhz crystal, 8:1 divider -> 1MIPS.

chinabn 发表于 2012-9-25 08:43:09

all on default optimization.
=========================
默认优化级别还是有区别的。
如果全部采用最高速优化,性能差别应该不会太大。

mowin 发表于 2012-9-25 08:47:16

gcc设置-o3优化试试,想知道结果

millwood0 发表于 2012-9-25 09:06:02

gcc设置-o3优化试试,想知道结果

100khz.

weakdancer 发表于 2013-2-12 21:12:58

arduino 不就是基于 avr-gcc 的吗?
http://www.robopeak.net/blog/?p=42
这个项目挺好的。

timberg 发表于 2013-2-13 16:14:16

gcc, arduino 免费
IAR 多少刀?

i55x 发表于 2013-2-13 16:16:03

以我在几年前用avr的经验看,gcc -o3出来的代码经常不能用,-o2倒是可以用,但是比iar大50%左右。

t3486784401 发表于 2013-2-13 19:02:00

用内嵌汇编呢?

millwood0 发表于 2013-2-13 19:46:27

用内嵌汇编呢?

That would be very fast: writing to the DDRx bits can flip the corresponding PORTx bits. So two instructions / clock cycles per flip-flop -> 8Mhz on a 16MIPS avr, not counting the loop overhead (with a jump likely). so 4 - 5Mhz quite doable.

tsb0574 发表于 2013-2-13 21:50:48

不用比,你的实验有问题!

笑笑我笑了 发表于 2013-2-13 22:17:21

一般AVR-GCC只用-Os优化,O2或者O3总有莫名其妙的问题
页: [1]
查看完整版本: iar vs. gcc vs. arduino