GAS LISTING /tmp/ccdbR7aK.s page 1 1 .file "test.c" 2 __SP_H__ = 0x3e 3 __SP_L__ = 0x3d 4 __SREG__ = 0x3f 5 __tmp_reg__ = 0 6 __zero_reg__ = 1 9 .text 10 .Ltext0: 111 .global delay_ms 113 delay_ms: 114 .stabd 46,0,0 1:test.c **** #include 2:test.c **** #include 3:test.c **** #include 4:test.c **** #include 5:test.c **** #include "huetabler.h" 6:test.c **** 7:test.c **** void delay_ms(uint32_t time) { 116 .LM0: 117 .LFBB1: 118 0000 0F93 push r16 119 0002 1F93 push r17 120 /* prologue: function */ 121 /* frame size = 0 */ 122 /* stack size = 2 */ 123 .L__stack_usage = 2 8:test.c **** uint32_t i; 9:test.c **** for (i = 0; i < time; i++) { 125 .LM1: 126 0004 00E0 ldi r16,0 127 0006 10E0 ldi r17,0 128 0008 9801 movw r18,r16 129 .L2: 131 .LM2: 132 000a 0617 cp r16,r22 133 000c 1707 cpc r17,r23 134 000e 2807 cpc r18,r24 135 0010 3907 cpc r19,r25 136 0012 01F0 breq .L5 137 .LBB8: 138 .LBB9: 140 .Ltext1: 1:/usr/lib/avr/include/util/delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz 2:/usr/lib/avr/include/util/delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch 3:/usr/lib/avr/include/util/delay.h **** Copyright (c) 2007 Florin-Viorel Petrov 4:/usr/lib/avr/include/util/delay.h **** All rights reserved. 5:/usr/lib/avr/include/util/delay.h **** 6:/usr/lib/avr/include/util/delay.h **** Redistribution and use in source and binary forms, with or without 7:/usr/lib/avr/include/util/delay.h **** modification, are permitted provided that the following conditions are met: 8:/usr/lib/avr/include/util/delay.h **** 9:/usr/lib/avr/include/util/delay.h **** * Redistributions of source code must retain the above copyright 10:/usr/lib/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer. 11:/usr/lib/avr/include/util/delay.h **** 12:/usr/lib/avr/include/util/delay.h **** * Redistributions in binary form must reproduce the above copyright 13:/usr/lib/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer in 14:/usr/lib/avr/include/util/delay.h **** the documentation and/or other materials provided with the 15:/usr/lib/avr/include/util/delay.h **** distribution. GAS LISTING /tmp/ccdbR7aK.s page 2 16:/usr/lib/avr/include/util/delay.h **** 17:/usr/lib/avr/include/util/delay.h **** * Neither the name of the copyright holders nor the names of 18:/usr/lib/avr/include/util/delay.h **** contributors may be used to endorse or promote products derived 19:/usr/lib/avr/include/util/delay.h **** from this software without specific prior written permission. 20:/usr/lib/avr/include/util/delay.h **** 21:/usr/lib/avr/include/util/delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22:/usr/lib/avr/include/util/delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23:/usr/lib/avr/include/util/delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24:/usr/lib/avr/include/util/delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25:/usr/lib/avr/include/util/delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26:/usr/lib/avr/include/util/delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27:/usr/lib/avr/include/util/delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28:/usr/lib/avr/include/util/delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29:/usr/lib/avr/include/util/delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30:/usr/lib/avr/include/util/delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31:/usr/lib/avr/include/util/delay.h **** POSSIBILITY OF SUCH DAMAGE. */ 32:/usr/lib/avr/include/util/delay.h **** 33:/usr/lib/avr/include/util/delay.h **** /* $Id: delay.h.in 2251 2011-09-14 08:20:33Z joerg_wunsch $ */ 34:/usr/lib/avr/include/util/delay.h **** 35:/usr/lib/avr/include/util/delay.h **** #ifndef _UTIL_DELAY_H_ 36:/usr/lib/avr/include/util/delay.h **** #define _UTIL_DELAY_H_ 1 37:/usr/lib/avr/include/util/delay.h **** 38:/usr/lib/avr/include/util/delay.h **** #ifndef __HAS_DELAY_CYCLES 39:/usr/lib/avr/include/util/delay.h **** #define __HAS_DELAY_CYCLES 1 40:/usr/lib/avr/include/util/delay.h **** #endif 41:/usr/lib/avr/include/util/delay.h **** 42:/usr/lib/avr/include/util/delay.h **** #include 43:/usr/lib/avr/include/util/delay.h **** #include 44:/usr/lib/avr/include/util/delay.h **** #include 45:/usr/lib/avr/include/util/delay.h **** 46:/usr/lib/avr/include/util/delay.h **** /** \file */ 47:/usr/lib/avr/include/util/delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops 48:/usr/lib/avr/include/util/delay.h **** \code 49:/usr/lib/avr/include/util/delay.h **** #define F_CPU 1000000UL // 1 MHz 50:/usr/lib/avr/include/util/delay.h **** //#define F_CPU 14.7456E6 51:/usr/lib/avr/include/util/delay.h **** #include 52:/usr/lib/avr/include/util/delay.h **** \endcode 53:/usr/lib/avr/include/util/delay.h **** 54:/usr/lib/avr/include/util/delay.h **** \note As an alternative method, it is possible to pass the 55:/usr/lib/avr/include/util/delay.h **** F_CPU macro down to the compiler from the Makefile. 56:/usr/lib/avr/include/util/delay.h **** Obviously, in that case, no \c \#define statement should be 57:/usr/lib/avr/include/util/delay.h **** used. 58:/usr/lib/avr/include/util/delay.h **** 59:/usr/lib/avr/include/util/delay.h **** The functions in this header file are wrappers around the basic 60:/usr/lib/avr/include/util/delay.h **** busy-wait functions from . They are meant as 61:/usr/lib/avr/include/util/delay.h **** convenience functions where actual time values can be specified 62:/usr/lib/avr/include/util/delay.h **** rather than a number of cycles to wait for. The idea behind is 63:/usr/lib/avr/include/util/delay.h **** that compile-time constant expressions will be eliminated by 64:/usr/lib/avr/include/util/delay.h **** compiler optimization so floating-point expressions can be used 65:/usr/lib/avr/include/util/delay.h **** to calculate the number of delay cycles needed based on the CPU 66:/usr/lib/avr/include/util/delay.h **** frequency passed by the macro F_CPU. 67:/usr/lib/avr/include/util/delay.h **** 68:/usr/lib/avr/include/util/delay.h **** \note In order for these functions to work as intended, compiler 69:/usr/lib/avr/include/util/delay.h **** optimizations must be enabled, and the delay time 70:/usr/lib/avr/include/util/delay.h **** must be an expression that is a known constant at 71:/usr/lib/avr/include/util/delay.h **** compile-time. If these requirements are not met, the resulting 72:/usr/lib/avr/include/util/delay.h **** delay will be much longer (and basically unpredictable), and GAS LISTING /tmp/ccdbR7aK.s page 3 73:/usr/lib/avr/include/util/delay.h **** applications that otherwise do not use floating-point calculations 74:/usr/lib/avr/include/util/delay.h **** will experience severe code bloat by the floating-point library 75:/usr/lib/avr/include/util/delay.h **** routines linked into the application. 76:/usr/lib/avr/include/util/delay.h **** 77:/usr/lib/avr/include/util/delay.h **** The functions available allow the specification of microsecond, and 78:/usr/lib/avr/include/util/delay.h **** millisecond delays directly, using the application-supplied macro 79:/usr/lib/avr/include/util/delay.h **** F_CPU as the CPU clock frequency (in Hertz). 80:/usr/lib/avr/include/util/delay.h **** 81:/usr/lib/avr/include/util/delay.h **** */ 82:/usr/lib/avr/include/util/delay.h **** 83:/usr/lib/avr/include/util/delay.h **** #if !defined(__DOXYGEN__) 84:/usr/lib/avr/include/util/delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); 85:/usr/lib/avr/include/util/delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); 86:/usr/lib/avr/include/util/delay.h **** #endif 87:/usr/lib/avr/include/util/delay.h **** 88:/usr/lib/avr/include/util/delay.h **** #ifndef F_CPU 89:/usr/lib/avr/include/util/delay.h **** /* prevent compiler error by supplying a default */ 90:/usr/lib/avr/include/util/delay.h **** # warning "F_CPU not defined for " 91:/usr/lib/avr/include/util/delay.h **** # define F_CPU 1000000UL 92:/usr/lib/avr/include/util/delay.h **** #endif 93:/usr/lib/avr/include/util/delay.h **** 94:/usr/lib/avr/include/util/delay.h **** #ifndef __OPTIMIZE__ 95:/usr/lib/avr/include/util/delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" 96:/usr/lib/avr/include/util/delay.h **** #endif 97:/usr/lib/avr/include/util/delay.h **** 98:/usr/lib/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 99:/usr/lib/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 100:/usr/lib/avr/include/util/delay.h **** __STDC_HOSTED__ 101:/usr/lib/avr/include/util/delay.h **** # include 102:/usr/lib/avr/include/util/delay.h **** #endif 103:/usr/lib/avr/include/util/delay.h **** 104:/usr/lib/avr/include/util/delay.h **** /** 105:/usr/lib/avr/include/util/delay.h **** \ingroup util_delay 106:/usr/lib/avr/include/util/delay.h **** 107:/usr/lib/avr/include/util/delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). 108:/usr/lib/avr/include/util/delay.h **** 109:/usr/lib/avr/include/util/delay.h **** The macro F_CPU is supposed to be defined to a 110:/usr/lib/avr/include/util/delay.h **** constant defining the CPU clock frequency (in Hertz). 111:/usr/lib/avr/include/util/delay.h **** 112:/usr/lib/avr/include/util/delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. 113:/usr/lib/avr/include/util/delay.h **** 114:/usr/lib/avr/include/util/delay.h **** When the user request delay which exceed the maximum possible one, 115:/usr/lib/avr/include/util/delay.h **** _delay_ms() provides a decreased resolution functionality. In this 116:/usr/lib/avr/include/util/delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing 117:/usr/lib/avr/include/util/delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The 118:/usr/lib/avr/include/util/delay.h **** user will not be informed about decreased resolution. 119:/usr/lib/avr/include/util/delay.h **** 120:/usr/lib/avr/include/util/delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) 121:/usr/lib/avr/include/util/delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For 122:/usr/lib/avr/include/util/delay.h **** values greater than the maximal possible delay, overflows results in 123:/usr/lib/avr/include/util/delay.h **** no delay i.e., 0ms. 124:/usr/lib/avr/include/util/delay.h **** 125:/usr/lib/avr/include/util/delay.h **** Conversion of __us into clock cycles may not always result in integer. 126:/usr/lib/avr/include/util/delay.h **** By default, the clock cycles rounded up to next integer. This ensures that 127:/usr/lib/avr/include/util/delay.h **** the user gets atleast __us microseconds of delay. 128:/usr/lib/avr/include/util/delay.h **** 129:/usr/lib/avr/include/util/delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ GAS LISTING /tmp/ccdbR7aK.s page 4 130:/usr/lib/avr/include/util/delay.h **** to round down and round to closest integer. 131:/usr/lib/avr/include/util/delay.h **** 132:/usr/lib/avr/include/util/delay.h **** Note: The new implementation of _delay_ms(double __ms) with 133:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. 134:/usr/lib/avr/include/util/delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. 135:/usr/lib/avr/include/util/delay.h **** Also, the backward compatible 136:/usr/lib/avr/include/util/delay.h **** algorithm will be chosen if the code is compiled in a freestanding 137:/usr/lib/avr/include/util/delay.h **** environment (GCC option \c -ffreestanding), as the math functions 138:/usr/lib/avr/include/util/delay.h **** required for rounding are not available to the compiler then. 139:/usr/lib/avr/include/util/delay.h **** 140:/usr/lib/avr/include/util/delay.h **** */ 141:/usr/lib/avr/include/util/delay.h **** void 142:/usr/lib/avr/include/util/delay.h **** _delay_ms(double __ms) 143:/usr/lib/avr/include/util/delay.h **** { 144:/usr/lib/avr/include/util/delay.h **** uint16_t __ticks; 145:/usr/lib/avr/include/util/delay.h **** double __tmp ; 146:/usr/lib/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 147:/usr/lib/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 148:/usr/lib/avr/include/util/delay.h **** __STDC_HOSTED__ 149:/usr/lib/avr/include/util/delay.h **** uint32_t __ticks_dc; 150:/usr/lib/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); 151:/usr/lib/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; 152:/usr/lib/avr/include/util/delay.h **** 153:/usr/lib/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) 154:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); 155:/usr/lib/avr/include/util/delay.h **** 156:/usr/lib/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) 157:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); 158:/usr/lib/avr/include/util/delay.h **** 159:/usr/lib/avr/include/util/delay.h **** #else 160:/usr/lib/avr/include/util/delay.h **** //round up by default 161:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); 162:/usr/lib/avr/include/util/delay.h **** #endif 163:/usr/lib/avr/include/util/delay.h **** 164:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); 142 .LM3: 143 0014 E7E8 ldi r30,lo8(4999) 144 0016 F3E1 ldi r31,hi8(4999) 145 0018 3197 1: sbiw r30,1 146 001a 01F4 brne 1b 147 001c 00C0 rjmp . 148 001e 0000 nop 149 .LBE9: 150 .LBE8: 152 .Ltext2: 154 .LM4: 155 0020 0F5F subi r16,-1 156 0022 1F4F sbci r17,-1 157 0024 2F4F sbci r18,-1 158 0026 3F4F sbci r19,-1 159 0028 00C0 rjmp .L2 160 .L5: 161 /* epilogue start */ 10:test.c **** _delay_ms(1); 11:test.c **** } 12:test.c **** } 163 .LM5: GAS LISTING /tmp/ccdbR7aK.s page 5 164 002a 1F91 pop r17 165 002c 0F91 pop r16 166 002e 0895 ret 171 .Lscope1: 173 .stabd 78,0,0 174 .section .text.startup,"ax",@progbits 176 .global main 178 main: 179 .stabd 46,0,0 13:test.c **** 14:test.c **** #define NOOP asm volatile("nop" ::) 15:test.c **** 16:test.c **** 17:test.c **** static void setup_clock( void ) 18:test.c **** { 19:test.c **** /*Examine Page 33*/ 20:test.c **** 21:test.c **** CLKPR = 0x80; /*Setup CLKPCE to be receptive*/ 22:test.c **** CLKPR = 0x00; /*No scalar*/ 23:test.c **** OSCCAL = 0xE0; //B8 is bottom E8 is top. 24:test.c **** } 25:test.c **** 26:test.c **** #define WSPORT PORTB 27:test.c **** #define WSPIN _BV(3) 28:test.c **** 29:test.c **** #define SEND_WS( var ) \ 30:test.c **** mask = 0x80; \ 31:test.c **** v = var; \ 32:test.c **** while( mask ) \ 33:test.c **** { \ 34:test.c **** if( mask & v ) \ 35:test.c **** { \ 36:test.c **** WSPORT &=~WSPIN; mask>>=1; \ 37:test.c **** NOOP; NOOP; NOOP; NOOP; \ 38:test.c **** NOOP; NOOP; NOOP; NOOP; NOOP; NOOP;\ 39:test.c **** WSPORT |= WSPIN; NOOP; NOOP; NOOP; NOOP;\ 40:test.c **** } \ 41:test.c **** else \ 42:test.c **** { \ 43:test.c **** WSPORT &=~WSPIN; NOOP; NOOP;\ 44:test.c **** WSPORT |= WSPIN; \ 45:test.c **** mask>>=1; \ 46:test.c **** NOOP; NOOP; NOOP; NOOP;NOOP; NOOP; NOOP;\ 47:test.c **** } \ 48:test.c **** \ 49:test.c **** } 50:test.c **** 51:test.c **** #define HUE(x) pgm_read_byte( &huetable[(x)&0xff] ) 52:test.c **** 53:test.c **** 54:test.c **** int main( ) 55:test.c **** { 181 .LM6: 182 .LFBB2: 183 /* prologue: function */ 184 /* frame size = 0 */ 185 /* stack size = 0 */ GAS LISTING /tmp/ccdbR7aK.s page 6 186 .L__stack_usage = 0 56:test.c **** int i = 0, j; 57:test.c **** uint8_t k; 58:test.c **** uint8_t v, mask; 59:test.c **** cli(); 188 .LM7: 189 /* #APP */ 190 ; 59 "test.c" 1 191 0000 F894 cli 192 ; 0 "" 2 193 /* #NOAPP */ 194 .LBB16: 195 .LBB17: 21:test.c **** CLKPR = 0x80; /*Setup CLKPCE to be receptive*/ 197 .LM8: 198 0002 80E8 ldi r24,lo8(-128) 199 0004 86BD out 0x26,r24 22:test.c **** CLKPR = 0x00; /*No scalar*/ 201 .LM9: 202 0006 16BC out 0x26,__zero_reg__ 23:test.c **** OSCCAL = 0xE0; //B8 is bottom E8 is top. 204 .LM10: 205 0008 80EE ldi r24,lo8(-32) 206 000a 81BF out 0x31,r24 207 .LBE17: 208 .LBE16: 60:test.c **** setup_clock(); 61:test.c **** DDRB = _BV(3); 210 .LM11: 211 000c 88E0 ldi r24,lo8(8) 212 000e 87BB out 0x17,r24 56:test.c **** int i = 0, j; 214 .LM12: 215 0010 80E0 ldi r24,0 216 0012 90E0 ldi r25,0 217 .L20: 62:test.c **** 63:test.c **** while(1) 64:test.c **** { 65:test.c **** i++; 219 .LM13: 220 0014 0196 adiw r24,1 66:test.c **** if( i == 255 ) i = 0; 222 .LM14: 223 0016 8F3F cpi r24,-1 224 0018 9105 cpc r25,__zero_reg__ 225 001a 01F4 brne .L7 226 001c 80E0 ldi r24,0 227 001e 90E0 ldi r25,0 228 .L7: 67:test.c **** #define WHITE 68:test.c **** #ifdef WHITE 69:test.c **** for( j = 0; j < 1; j++ ) 70:test.c **** { 71:test.c **** SEND_WS( i|0xfe ); 230 .LM15: 231 0020 582F mov r21,r24 GAS LISTING /tmp/ccdbR7aK.s page 7 232 0022 482F mov r20,r24 233 0024 4E6F ori r20,lo8(-2) 234 0026 20E8 ldi r18,lo8(-128) 235 .L11: 237 .LM16: 238 0028 622F mov r22,r18 239 002a 6423 and r22,r20 240 002c 322F mov r19,r18 241 002e 3695 lsr r19 242 0030 C398 cbi 0x18,3 243 0032 6623 tst r22 244 0034 01F0 breq .L8 246 .LM17: 247 0036 232F mov r18,r19 248 /* #APP */ 249 ; 71 "test.c" 1 250 0038 0000 nop 251 ; 0 "" 2 252 ; 71 "test.c" 1 253 003a 0000 nop 254 ; 0 "" 2 255 ; 71 "test.c" 1 256 003c 0000 nop 257 ; 0 "" 2 258 ; 71 "test.c" 1 259 003e 0000 nop 260 ; 0 "" 2 261 ; 71 "test.c" 1 262 0040 0000 nop 263 ; 0 "" 2 264 ; 71 "test.c" 1 265 0042 0000 nop 266 ; 0 "" 2 267 ; 71 "test.c" 1 268 0044 0000 nop 269 ; 0 "" 2 270 ; 71 "test.c" 1 271 0046 0000 nop 272 ; 0 "" 2 273 ; 71 "test.c" 1 274 0048 0000 nop 275 ; 0 "" 2 276 ; 71 "test.c" 1 277 004a 0000 nop 278 ; 0 "" 2 279 /* #NOAPP */ 280 004c C39A sbi 0x18,3 281 004e 00C0 rjmp .L22 282 .L8: 284 .LM18: 285 /* #APP */ 286 ; 71 "test.c" 1 287 0050 0000 nop 288 ; 0 "" 2 289 ; 71 "test.c" 1 290 0052 0000 nop 291 ; 0 "" 2 GAS LISTING /tmp/ccdbR7aK.s page 8 292 /* #NOAPP */ 293 0054 C39A sbi 0x18,3 294 0056 232F mov r18,r19 295 /* #APP */ 296 ; 71 "test.c" 1 297 0058 0000 nop 298 ; 0 "" 2 299 ; 71 "test.c" 1 300 005a 0000 nop 301 ; 0 "" 2 302 ; 71 "test.c" 1 303 005c 0000 nop 304 ; 0 "" 2 305 /* #NOAPP */ 306 .L22: 307 /* #APP */ 308 ; 71 "test.c" 1 309 005e 0000 nop 310 ; 0 "" 2 311 ; 71 "test.c" 1 312 0060 0000 nop 313 ; 0 "" 2 314 ; 71 "test.c" 1 315 0062 0000 nop 316 ; 0 "" 2 317 ; 71 "test.c" 1 318 0064 0000 nop 319 ; 0 "" 2 320 /* #NOAPP */ 321 0066 3111 cpse r19,__zero_reg__ 322 0068 00C0 rjmp .L11 324 .LM19: 325 006a 20E8 ldi r18,lo8(-128) 326 .L15: 72:test.c **** SEND_WS( i|0xfe); 328 .LM20: 329 006c 622F mov r22,r18 330 006e 6423 and r22,r20 331 0070 322F mov r19,r18 332 0072 3695 lsr r19 333 0074 C398 cbi 0x18,3 334 0076 6623 tst r22 335 0078 01F0 breq .L12 337 .LM21: 338 007a 232F mov r18,r19 339 /* #APP */ 340 ; 72 "test.c" 1 341 007c 0000 nop 342 ; 0 "" 2 343 ; 72 "test.c" 1 344 007e 0000 nop 345 ; 0 "" 2 346 ; 72 "test.c" 1 347 0080 0000 nop 348 ; 0 "" 2 349 ; 72 "test.c" 1 350 0082 0000 nop GAS LISTING /tmp/ccdbR7aK.s page 9 351 ; 0 "" 2 352 ; 72 "test.c" 1 353 0084 0000 nop 354 ; 0 "" 2 355 ; 72 "test.c" 1 356 0086 0000 nop 357 ; 0 "" 2 358 ; 72 "test.c" 1 359 0088 0000 nop 360 ; 0 "" 2 361 ; 72 "test.c" 1 362 008a 0000 nop 363 ; 0 "" 2 364 ; 72 "test.c" 1 365 008c 0000 nop 366 ; 0 "" 2 367 ; 72 "test.c" 1 368 008e 0000 nop 369 ; 0 "" 2 370 /* #NOAPP */ 371 0090 C39A sbi 0x18,3 372 0092 00C0 rjmp .L23 373 .L12: 375 .LM22: 376 /* #APP */ 377 ; 72 "test.c" 1 378 0094 0000 nop 379 ; 0 "" 2 380 ; 72 "test.c" 1 381 0096 0000 nop 382 ; 0 "" 2 383 /* #NOAPP */ 384 0098 C39A sbi 0x18,3 385 009a 232F mov r18,r19 386 /* #APP */ 387 ; 72 "test.c" 1 388 009c 0000 nop 389 ; 0 "" 2 390 ; 72 "test.c" 1 391 009e 0000 nop 392 ; 0 "" 2 393 ; 72 "test.c" 1 394 00a0 0000 nop 395 ; 0 "" 2 396 /* #NOAPP */ 397 .L23: 398 /* #APP */ 399 ; 72 "test.c" 1 400 00a2 0000 nop 401 ; 0 "" 2 402 ; 72 "test.c" 1 403 00a4 0000 nop 404 ; 0 "" 2 405 ; 72 "test.c" 1 406 00a6 0000 nop 407 ; 0 "" 2 408 ; 72 "test.c" 1 GAS LISTING /tmp/ccdbR7aK.s page 10 409 00a8 0000 nop 410 ; 0 "" 2 411 /* #NOAPP */ 412 00aa 3111 cpse r19,__zero_reg__ 413 00ac 00C0 rjmp .L15 73:test.c **** SEND_WS( i|0x80 ); 415 .LM23: 416 00ae 452F mov r20,r21 417 00b0 4068 ori r20,lo8(-128) 418 00b2 20E8 ldi r18,lo8(-128) 419 .L19: 421 .LM24: 422 00b4 522F mov r21,r18 423 00b6 5423 and r21,r20 424 00b8 322F mov r19,r18 425 00ba 3695 lsr r19 426 00bc C398 cbi 0x18,3 427 00be 5523 tst r21 428 00c0 01F0 breq .L16 430 .LM25: 431 00c2 232F mov r18,r19 432 /* #APP */ 433 ; 73 "test.c" 1 434 00c4 0000 nop 435 ; 0 "" 2 436 ; 73 "test.c" 1 437 00c6 0000 nop 438 ; 0 "" 2 439 ; 73 "test.c" 1 440 00c8 0000 nop 441 ; 0 "" 2 442 ; 73 "test.c" 1 443 00ca 0000 nop 444 ; 0 "" 2 445 ; 73 "test.c" 1 446 00cc 0000 nop 447 ; 0 "" 2 448 ; 73 "test.c" 1 449 00ce 0000 nop 450 ; 0 "" 2 451 ; 73 "test.c" 1 452 00d0 0000 nop 453 ; 0 "" 2 454 ; 73 "test.c" 1 455 00d2 0000 nop 456 ; 0 "" 2 457 ; 73 "test.c" 1 458 00d4 0000 nop 459 ; 0 "" 2 460 ; 73 "test.c" 1 461 00d6 0000 nop 462 ; 0 "" 2 463 /* #NOAPP */ 464 00d8 C39A sbi 0x18,3 465 00da 00C0 rjmp .L24 466 .L16: 468 .LM26: GAS LISTING /tmp/ccdbR7aK.s page 11 469 /* #APP */ 470 ; 73 "test.c" 1 471 00dc 0000 nop 472 ; 0 "" 2 473 ; 73 "test.c" 1 474 00de 0000 nop 475 ; 0 "" 2 476 /* #NOAPP */ 477 00e0 C39A sbi 0x18,3 478 00e2 232F mov r18,r19 479 /* #APP */ 480 ; 73 "test.c" 1 481 00e4 0000 nop 482 ; 0 "" 2 483 ; 73 "test.c" 1 484 00e6 0000 nop 485 ; 0 "" 2 486 ; 73 "test.c" 1 487 00e8 0000 nop 488 ; 0 "" 2 489 /* #NOAPP */ 490 .L24: 491 /* #APP */ 492 ; 73 "test.c" 1 493 00ea 0000 nop 494 ; 0 "" 2 495 ; 73 "test.c" 1 496 00ec 0000 nop 497 ; 0 "" 2 498 ; 73 "test.c" 1 499 00ee 0000 nop 500 ; 0 "" 2 501 ; 73 "test.c" 1 502 00f0 0000 nop 503 ; 0 "" 2 504 /* #NOAPP */ 505 00f2 3111 cpse r19,__zero_reg__ 506 00f4 00C0 rjmp .L19 74:test.c **** } 75:test.c **** #else 76:test.c **** for( j = 0; j < 1; j++ ) 77:test.c **** { 78:test.c **** SEND_WS( HUE(i) ); 79:test.c **** SEND_WS( HUE(i+85)); 80:test.c **** SEND_WS( HUE(i+170) ); 81:test.c **** } 82:test.c **** #endif 83:test.c **** WSPORT&=~WSPIN; 508 .LM27: 509 00f6 C398 cbi 0x18,3 510 .LBB18: 511 .LBB19: 513 .Ltext3: 515 .LM28: 516 00f8 EFE4 ldi r30,lo8(-15537) 517 00fa F3EC ldi r31,hi8(-15537) 518 00fc 3197 1: sbiw r30,1 GAS LISTING /tmp/ccdbR7aK.s page 12 519 00fe 01F4 brne 1b 520 0100 00C0 rjmp . 521 0102 0000 nop 522 .LBE19: 523 .LBE18: 525 .Ltext4: 84:test.c **** _delay_ms(10); 85:test.c **** WSPORT|= WSPIN; 527 .LM29: 528 0104 C39A sbi 0x18,3 529 .LBB20: 530 .LBB21: 532 .Ltext5: 165:/usr/lib/avr/include/util/delay.h **** 166:/usr/lib/avr/include/util/delay.h **** #else 167:/usr/lib/avr/include/util/delay.h **** __tmp = ((F_CPU) / 4e3) * __ms; 168:/usr/lib/avr/include/util/delay.h **** if (__tmp < 1.0) 169:/usr/lib/avr/include/util/delay.h **** __ticks = 1; 170:/usr/lib/avr/include/util/delay.h **** else if (__tmp > 65535) 171:/usr/lib/avr/include/util/delay.h **** { 172:/usr/lib/avr/include/util/delay.h **** // __ticks = requested delay in 1/10 ms 173:/usr/lib/avr/include/util/delay.h **** __ticks = (uint16_t) (__ms * 10.0); 174:/usr/lib/avr/include/util/delay.h **** while(__ticks) 175:/usr/lib/avr/include/util/delay.h **** { 176:/usr/lib/avr/include/util/delay.h **** // wait 1/10 ms 177:/usr/lib/avr/include/util/delay.h **** _delay_loop_2(((F_CPU) / 4e3) / 10); 178:/usr/lib/avr/include/util/delay.h **** __ticks --; 179:/usr/lib/avr/include/util/delay.h **** } 180:/usr/lib/avr/include/util/delay.h **** return; 181:/usr/lib/avr/include/util/delay.h **** } 182:/usr/lib/avr/include/util/delay.h **** else 183:/usr/lib/avr/include/util/delay.h **** __ticks = (uint16_t)__tmp; 184:/usr/lib/avr/include/util/delay.h **** _delay_loop_2(__ticks); 185:/usr/lib/avr/include/util/delay.h **** #endif 186:/usr/lib/avr/include/util/delay.h **** } 187:/usr/lib/avr/include/util/delay.h **** 188:/usr/lib/avr/include/util/delay.h **** /** 189:/usr/lib/avr/include/util/delay.h **** \ingroup util_delay 190:/usr/lib/avr/include/util/delay.h **** 191:/usr/lib/avr/include/util/delay.h **** Perform a delay of \c __us microseconds, using _delay_loop_1(). 192:/usr/lib/avr/include/util/delay.h **** 193:/usr/lib/avr/include/util/delay.h **** The macro F_CPU is supposed to be defined to a 194:/usr/lib/avr/include/util/delay.h **** constant defining the CPU clock frequency (in Hertz). 195:/usr/lib/avr/include/util/delay.h **** 196:/usr/lib/avr/include/util/delay.h **** The maximal possible delay is 768 us / F_CPU in MHz. 197:/usr/lib/avr/include/util/delay.h **** 198:/usr/lib/avr/include/util/delay.h **** If the user requests a delay greater than the maximal possible one, 199:/usr/lib/avr/include/util/delay.h **** _delay_us() will automatically call _delay_ms() instead. The user 200:/usr/lib/avr/include/util/delay.h **** will not be informed about this case. 201:/usr/lib/avr/include/util/delay.h **** 202:/usr/lib/avr/include/util/delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) 203:/usr/lib/avr/include/util/delay.h **** support, maximal possible delay is 4294967.295 us/ F_CPU in MHz. For 204:/usr/lib/avr/include/util/delay.h **** values greater than the maximal possible delay, overflow results in 205:/usr/lib/avr/include/util/delay.h **** no delay i.e., 0us. 206:/usr/lib/avr/include/util/delay.h **** 207:/usr/lib/avr/include/util/delay.h **** Conversion of __us into clock cycles may not always result in integer. 208:/usr/lib/avr/include/util/delay.h **** By default, the clock cycles rounded up to next integer. This ensures that GAS LISTING /tmp/ccdbR7aK.s page 13 209:/usr/lib/avr/include/util/delay.h **** the user gets atleast __us microseconds of delay. 210:/usr/lib/avr/include/util/delay.h **** 211:/usr/lib/avr/include/util/delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ 212:/usr/lib/avr/include/util/delay.h **** to round down and round to closest integer. 213:/usr/lib/avr/include/util/delay.h **** 214:/usr/lib/avr/include/util/delay.h **** Note: The new implementation of _delay_us(double __us) with 215:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. 216:/usr/lib/avr/include/util/delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. 217:/usr/lib/avr/include/util/delay.h **** Also, the backward compatible 218:/usr/lib/avr/include/util/delay.h **** algorithm will be chosen if the code is compiled in a freestanding 219:/usr/lib/avr/include/util/delay.h **** environment (GCC option \c -ffreestanding), as the math functions 220:/usr/lib/avr/include/util/delay.h **** required for rounding are not available to the compiler then. 221:/usr/lib/avr/include/util/delay.h **** 222:/usr/lib/avr/include/util/delay.h **** */ 223:/usr/lib/avr/include/util/delay.h **** void 224:/usr/lib/avr/include/util/delay.h **** _delay_us(double __us) 225:/usr/lib/avr/include/util/delay.h **** { 226:/usr/lib/avr/include/util/delay.h **** uint8_t __ticks; 227:/usr/lib/avr/include/util/delay.h **** double __tmp ; 228:/usr/lib/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ 229:/usr/lib/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ 230:/usr/lib/avr/include/util/delay.h **** __STDC_HOSTED__ 231:/usr/lib/avr/include/util/delay.h **** uint32_t __ticks_dc; 232:/usr/lib/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); 233:/usr/lib/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e6) * __us; 234:/usr/lib/avr/include/util/delay.h **** 235:/usr/lib/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) 236:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); 237:/usr/lib/avr/include/util/delay.h **** 238:/usr/lib/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) 239:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); 240:/usr/lib/avr/include/util/delay.h **** 241:/usr/lib/avr/include/util/delay.h **** #else 242:/usr/lib/avr/include/util/delay.h **** //round up by default 243:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); 244:/usr/lib/avr/include/util/delay.h **** #endif 245:/usr/lib/avr/include/util/delay.h **** 246:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); 534 .LM30: 535 0106 F6EA ldi r31,lo8(-90) 536 0108 FA95 1: dec r31 537 010a 01F4 brne 1b 538 010c 00C0 rjmp . 539 010e 00C0 rjmp .L20 540 .LBE21: 541 .LBE20: 546 .Lscope2: 548 .stabd 78,0,0 549 .global huetable 550 .section .progmem.data,"a",@progbits 553 huetable: 554 0000 00 .byte 0 555 0001 06 .byte 6 556 0002 0C .byte 12 557 0003 12 .byte 18 558 0004 18 .byte 24 559 0005 1E .byte 30 GAS LISTING /tmp/ccdbR7aK.s page 14 560 0006 24 .byte 36 561 0007 2A .byte 42 562 0008 30 .byte 48 563 0009 36 .byte 54 564 000a 3C .byte 60 565 000b 42 .byte 66 566 000c 48 .byte 72 567 000d 4E .byte 78 568 000e 54 .byte 84 569 000f 5A .byte 90 570 0010 60 .byte 96 571 0011 66 .byte 102 572 0012 6C .byte 108 573 0013 72 .byte 114 574 0014 78 .byte 120 575 0015 7E .byte 126 576 0016 84 .byte -124 577 0017 8A .byte -118 578 0018 90 .byte -112 579 0019 96 .byte -106 580 001a 9C .byte -100 581 001b A2 .byte -94 582 001c A8 .byte -88 583 001d AE .byte -82 584 001e B4 .byte -76 585 001f BA .byte -70 586 0020 C0 .byte -64 587 0021 C6 .byte -58 588 0022 CC .byte -52 589 0023 D2 .byte -46 590 0024 D8 .byte -40 591 0025 DE .byte -34 592 0026 E4 .byte -28 593 0027 EA .byte -22 594 0028 F0 .byte -16 595 0029 F6 .byte -10 596 002a FF .byte -1 597 002b FF .byte -1 598 002c FF .byte -1 599 002d FF .byte -1 600 002e FF .byte -1 601 002f FF .byte -1 602 0030 FF .byte -1 603 0031 FF .byte -1 604 0032 FF .byte -1 605 0033 FF .byte -1 606 0034 FF .byte -1 607 0035 FF .byte -1 608 0036 FF .byte -1 609 0037 FF .byte -1 610 0038 FF .byte -1 611 0039 FF .byte -1 612 003a FF .byte -1 613 003b FF .byte -1 614 003c FF .byte -1 615 003d FF .byte -1 616 003e FF .byte -1 GAS LISTING /tmp/ccdbR7aK.s page 15 617 003f FF .byte -1 618 0040 FF .byte -1 619 0041 FF .byte -1 620 0042 FF .byte -1 621 0043 FF .byte -1 622 0044 FF .byte -1 623 0045 FF .byte -1 624 0046 FF .byte -1 625 0047 FF .byte -1 626 0048 FF .byte -1 627 0049 FF .byte -1 628 004a FF .byte -1 629 004b FF .byte -1 630 004c FF .byte -1 631 004d FF .byte -1 632 004e FF .byte -1 633 004f FF .byte -1 634 0050 FF .byte -1 635 0051 FF .byte -1 636 0052 FF .byte -1 637 0053 FF .byte -1 638 0054 FF .byte -1 639 0055 FF .byte -1 640 0056 FF .byte -1 641 0057 FF .byte -1 642 0058 FF .byte -1 643 0059 FF .byte -1 644 005a FF .byte -1 645 005b FF .byte -1 646 005c FF .byte -1 647 005d FF .byte -1 648 005e FF .byte -1 649 005f FF .byte -1 650 0060 FF .byte -1 651 0061 FF .byte -1 652 0062 FF .byte -1 653 0063 FF .byte -1 654 0064 FF .byte -1 655 0065 FF .byte -1 656 0066 FF .byte -1 657 0067 FF .byte -1 658 0068 FF .byte -1 659 0069 FF .byte -1 660 006a FF .byte -1 661 006b FF .byte -1 662 006c FF .byte -1 663 006d FF .byte -1 664 006e FF .byte -1 665 006f FF .byte -1 666 0070 FF .byte -1 667 0071 FF .byte -1 668 0072 FF .byte -1 669 0073 FF .byte -1 670 0074 FF .byte -1 671 0075 FF .byte -1 672 0076 FF .byte -1 673 0077 FF .byte -1 GAS LISTING /tmp/ccdbR7aK.s page 16 674 0078 FF .byte -1 675 0079 FF .byte -1 676 007a FF .byte -1 677 007b FF .byte -1 678 007c FF .byte -1 679 007d FF .byte -1 680 007e FF .byte -1 681 007f FF .byte -1 682 0080 FF .byte -1 683 0081 F9 .byte -7 684 0082 F3 .byte -13 685 0083 ED .byte -19 686 0084 E7 .byte -25 687 0085 E1 .byte -31 688 0086 DB .byte -37 689 0087 D5 .byte -43 690 0088 CF .byte -49 691 0089 C9 .byte -55 692 008a C3 .byte -61 693 008b BD .byte -67 694 008c B7 .byte -73 695 008d B1 .byte -79 696 008e AB .byte -85 697 008f A5 .byte -91 698 0090 9F .byte -97 699 0091 99 .byte -103 700 0092 93 .byte -109 701 0093 8D .byte -115 702 0094 87 .byte -121 703 0095 81 .byte -127 704 0096 7B .byte 123 705 0097 75 .byte 117 706 0098 6F .byte 111 707 0099 69 .byte 105 708 009a 63 .byte 99 709 009b 5D .byte 93 710 009c 57 .byte 87 711 009d 51 .byte 81 712 009e 4B .byte 75 713 009f 45 .byte 69 714 00a0 3F .byte 63 715 00a1 39 .byte 57 716 00a2 33 .byte 51 717 00a3 2D .byte 45 718 00a4 27 .byte 39 719 00a5 21 .byte 33 720 00a6 1B .byte 27 721 00a7 15 .byte 21 722 00a8 0F .byte 15 723 00a9 09 .byte 9 724 00aa 00 .byte 0 725 00ab 00 .byte 0 726 00ac 00 .byte 0 727 00ad 00 .byte 0 728 00ae 00 .byte 0 729 00af 00 .byte 0 730 00b0 00 .byte 0 GAS LISTING /tmp/ccdbR7aK.s page 17 731 00b1 00 .byte 0 732 00b2 00 .byte 0 733 00b3 00 .byte 0 734 00b4 00 .byte 0 735 00b5 00 .byte 0 736 00b6 00 .byte 0 737 00b7 00 .byte 0 738 00b8 00 .byte 0 739 00b9 00 .byte 0 740 00ba 00 .byte 0 741 00bb 00 .byte 0 742 00bc 00 .byte 0 743 00bd 00 .byte 0 744 00be 00 .byte 0 745 00bf 00 .byte 0 746 00c0 00 .byte 0 747 00c1 00 .byte 0 748 00c2 00 .byte 0 749 00c3 00 .byte 0 750 00c4 00 .byte 0 751 00c5 00 .byte 0 752 00c6 00 .byte 0 753 00c7 00 .byte 0 754 00c8 00 .byte 0 755 00c9 00 .byte 0 756 00ca 00 .byte 0 757 00cb 00 .byte 0 758 00cc 00 .byte 0 759 00cd 00 .byte 0 760 00ce 00 .byte 0 761 00cf 00 .byte 0 762 00d0 00 .byte 0 763 00d1 00 .byte 0 764 00d2 00 .byte 0 765 00d3 00 .byte 0 766 00d4 00 .byte 0 767 00d5 00 .byte 0 768 00d6 00 .byte 0 769 00d7 00 .byte 0 770 00d8 00 .byte 0 771 00d9 00 .byte 0 772 00da 00 .byte 0 773 00db 00 .byte 0 774 00dc 00 .byte 0 775 00dd 00 .byte 0 776 00de 00 .byte 0 777 00df 00 .byte 0 778 00e0 00 .byte 0 779 00e1 00 .byte 0 780 00e2 00 .byte 0 781 00e3 00 .byte 0 782 00e4 00 .byte 0 783 00e5 00 .byte 0 784 00e6 00 .byte 0 785 00e7 00 .byte 0 786 00e8 00 .byte 0 787 00e9 00 .byte 0 GAS LISTING /tmp/ccdbR7aK.s page 18 788 00ea 00 .byte 0 789 00eb 00 .byte 0 790 00ec 00 .byte 0 791 00ed 00 .byte 0 792 00ee 00 .byte 0 793 00ef 00 .byte 0 794 00f0 00 .byte 0 795 00f1 00 .byte 0 796 00f2 00 .byte 0 797 00f3 00 .byte 0 798 00f4 00 .byte 0 799 00f5 00 .byte 0 800 00f6 00 .byte 0 801 00f7 00 .byte 0 802 00f8 00 .byte 0 803 00f9 00 .byte 0 804 00fa 00 .byte 0 805 00fb 00 .byte 0 806 00fc 00 .byte 0 807 00fd 00 .byte 0 808 00fe 00 .byte 0 809 00ff 00 .byte 0 811 .text 813 .Letext0: 814 .ident "GCC: (GNU) 4.8.2" GAS LISTING /tmp/ccdbR7aK.s page 19 DEFINED SYMBOLS *ABS*:0000000000000000 test.c /tmp/ccdbR7aK.s:2 *ABS*:000000000000003e __SP_H__ /tmp/ccdbR7aK.s:3 *ABS*:000000000000003d __SP_L__ /tmp/ccdbR7aK.s:4 *ABS*:000000000000003f __SREG__ /tmp/ccdbR7aK.s:5 *ABS*:0000000000000000 __tmp_reg__ /tmp/ccdbR7aK.s:6 *ABS*:0000000000000001 __zero_reg__ /tmp/ccdbR7aK.s:113 .text:0000000000000000 delay_ms /tmp/ccdbR7aK.s:178 .text.startup:0000000000000000 main /tmp/ccdbR7aK.s:553 .progmem.data:0000000000000000 huetable NO UNDEFINED SYMBOLS