I have Teensy 3.0 as well but I like to have this code running nicely on Uno for the sake of the microcontroller optimization challenge and exercise (: I haven't been writing asm for quite some time either, but maybe it's time to get a bit familiar with AVR asm.
res += (smp * vol) >> 8;
I haven't done it myself but you could try altering your build process to use the later avr-gcc program.
It's easy to do and works very well.
I would have to agree that the 'optimizer' is an optimistic name The game is given away by the flag -Os. In other words the gcc authors admit that they can deal with size (true), speed (doubtful) but not both at the same time. Hand assembly can do both at the same time, but I gave that up 20 years ago.
res+=(smp*vol)>>8; 383e: 0f 2f mov r16, r31 3840: 1e 2f mov r17, r30 3842: 10 03 mulsu r17, r16 3844: f0 01 movw r30, r0 3846: 11 24 eor r1, r1 3848: ef 2f mov r30, r31 384a: ff 0f add r31, r31 384c: ff 0b sbc r31, r31 384e: 2e 0f add r18, r30 3850: 3f 1f adc r19, r31
I updated the compiler to the latest one from Atmel (4.7.2)
How do you do that?
That should be a sticky somewhere.
I'll never remember that when I actually need to do it.
Yes, except do that with Atmel AVR Toolchain to get the latest version. Latest WinAVR is from 2010 and has GCC 4.3.3
A few folks claim avrdude from the Arduino download is necessary but I have not had any problems using the WinAVR / Atmel version. Maybe it's necessary for Mac / Linux users.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16