From 7d5b2dc6ab70c6a1ba66acbbedfcafbee7be7055 Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Sun, 4 Dec 2016 02:07:01 -0500 Subject: Update -- with stuff most of the way through the livestream. --- tools/avr_codegen/test.c | 72 +++++++- tools/avr_codegen/test.elf | Bin 6740 -> 6908 bytes tools/avr_codegen/test.hex | 10 +- tools/avr_codegen/test.lst | 444 --------------------------------------------- tools/avr_codegen/test.map | 379 -------------------------------------- tools/avr_codegen/test.o | Bin 6048 -> 0 bytes 6 files changed, 75 insertions(+), 830 deletions(-) delete mode 100644 tools/avr_codegen/test.lst delete mode 100644 tools/avr_codegen/test.map delete mode 100644 tools/avr_codegen/test.o (limited to 'tools/avr_codegen') diff --git a/tools/avr_codegen/test.c b/tools/avr_codegen/test.c index e962e09..45f6962 100644 --- a/tools/avr_codegen/test.c +++ b/tools/avr_codegen/test.c @@ -19,7 +19,9 @@ static void setup_clock( void ) CLKPR = 0x80; /*Setup CLKPCE to be receptive*/ CLKPR = 0x00; /*No scalar*/ - OSCCAL = 0x80; //B8 is bottom E8 is top. + OSCCAL = 0x60; //B8 is bottom E8 is top. + + //This is gonna be about 1.8 MHz, turns out that's probably better than the 2MHz suggestion from the lighthouse-redox people. } int main( ) @@ -31,14 +33,78 @@ int main( ) while(1) { - marker = 0x05; + //0x05 says 0xa9 + //0x06 says 0xb3, 0xb4 + //0x07 says 0xc1 + //0x08 says 0xd4 + // 0xd4 - 0xa9 = 2b (43 base 10) + + //"marker" = Code from Vive (Operating at OSCCAL = 0x80 = 8 MHz) + //0x08 = 0xe1 + //0x05 = 0xb4 + //at OSCCAL = 0x70 + //0x05 = 0xa6 + //0x08 = 0xcb + // 12 = + // 13 = 0x85 0x01 + // 14 = 0x95 0x01 + // 15 = 0xa1 0x01 + //0x10 = 0xab 0x01 + marker = 10; + do{ + PORTB = _BV(4); + marker--; + PORTB = 0; + } while( marker ); + _delay_us(8); + marker = 10; + do{ + PORTB = _BV(4); + marker--; + PORTB = 0; + } while( marker ); + _delay_us(16); + marker = 20; do{ PORTB = _BV(4); marker--; PORTB = 0; } while( marker ); - _delay_us(1000000/60); + // t b6 b5 b4 b3 b2 b1 b0 t b13 b12 b11 b10 b9 b8 b7 + // 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 + // 8 5 0 8 + // + //One pulse; + //08 [a5] ... @05 + //08 [da 01] 54 a9 c6 a0 35 fe 2a @20? == 218 -> 436 + //08 [e2] e2 46 b3 14 49 3c b2 @10 + //08 [e9] e2 46 b3 14 49 3c b2 @11 + //08 [f5] @12 + //08 [82 01] @13 + //08 [a7 08] @93 + //08 [f7 03] @40 --> 1f7 --. 500(base 10) * 2 -> 750 + //08 [85 08] @80 --> 1029 + + //evverything after those 08 08 is two variable length fields of data + //one starting after the 0808, and one going in reverse from the end + + //For two pulses: + //08 08 [fc] [a2 01] [a6 01] / a3 42 ca / 4d e0 84 ef (@12) @10us between + //08 08 [9f 01] [a4 01] [c6 01] e6 53 33 / 76 7c c4 04 (@15) + //08 08 [a0 01] [b9 01] [c5 01] aa e9 cd / e6 da 0b cc (@15) @10us between + //08 08 [da 01] [b8 01] [c5 01] 90 9e 4a / d8 8a e1 55 (@20/@15) @10us between + //08 08 [db 01] [b8 01] [80 02] 1a f1 4a / a2 04 98 a0 (@20/@20) @10us between! + //08 08 [db 01] [a8] [9f 02] 99 27 07 5b / 7e 42 64 (@20/@20) @5us between! + //[sensor codes] [pulse time1] [length of time between pulses] [pulse time2] + + //3 pulses, equal length: + // [78 78 78] [f0 01] [c7] [aa 02] [c7] [aa 02] 9f df 90 7d 35 11 c5 + // (78) (78) (78) [b3 02] [94 01] [9b 02] [95 01] [9b 02] 97 5b 8c 14 af 08 43 + + + //_delay_us(1000000/60); + _delay_ms(10); } return 0; diff --git a/tools/avr_codegen/test.elf b/tools/avr_codegen/test.elf index 7f7fce9..c5bc028 100755 Binary files a/tools/avr_codegen/test.elf and b/tools/avr_codegen/test.elf differ diff --git a/tools/avr_codegen/test.hex b/tools/avr_codegen/test.hex index cf54bf7..8b3bb1a 100644 --- a/tools/avr_codegen/test.hex +++ b/tools/avr_codegen/test.hex @@ -1,10 +1,12 @@ :100000000EC015C014C013C012C011C010C00FC064 :100010000EC00DC00CC00BC00AC009C008C011241E -:100020001FBECFE5D2E0DEBFCDBF1AD02DC0E8CFD6 +:100020001FBECFE5D2E0DEBFCDBF1AD03FC0E8CFC4 :100030000F931F9300E010E0980106171707280799 :10004000390759F0EFECF7E03197F1F700C0000005 :100050000F5F1F4F2F4F3F4FF0CF1F910F9108950C -:10006000F89480E886BD16BC81BF80E187BB90E133 -:1000700085E098BB18BA8150E1F7E3E3F2E83197E5 -:0C008000F1F700C00000F4CFF894FFCFAF +:10006000F89480E886BD16BC80E681BF80E187BB3E +:100070009AE088BB18BA9150E1F795E19A95F1F7AB +:1000800000009AE088BB18BA9150E1F7EAE2EA95DD +:10009000F1F700C094E188BB18BA9150E1F7EFE1A5 +:1000A000FEE43197F1F700C00000E2CFF894FFCFF3 :00000001FF diff --git a/tools/avr_codegen/test.lst b/tools/avr_codegen/test.lst deleted file mode 100644 index 69e5020..0000000 --- a/tools/avr_codegen/test.lst +++ /dev/null @@ -1,444 +0,0 @@ -GAS LISTING /tmp/ccWx46oe.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: - 104 .global delay_ms - 106 delay_ms: - 107 .stabd 46,0,0 - 1:test.c **** #include - 2:test.c **** #include - 3:test.c **** #include - 4:test.c **** #include - 5:test.c **** - 6:test.c **** void delay_ms(uint32_t time) { - 109 .LM0: - 110 .LFBB1: - 111 0000 0F93 push r16 - 112 0002 1F93 push r17 - 113 /* prologue: function */ - 114 /* frame size = 0 */ - 115 /* stack size = 2 */ - 116 .L__stack_usage = 2 - 7:test.c **** uint32_t i; - 8:test.c **** for (i = 0; i < time; i++) { - 118 .LM1: - 119 0004 00E0 ldi r16,0 - 120 0006 10E0 ldi r17,0 - 121 0008 9801 movw r18,r16 - 122 .L2: - 124 .LM2: - 125 000a 0617 cp r16,r22 - 126 000c 1707 cpc r17,r23 - 127 000e 2807 cpc r18,r24 - 128 0010 3907 cpc r19,r25 - 129 0012 01F0 breq .L5 - 130 .LBB6: - 131 .LBB7: - 133 .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. - 16:/usr/lib/avr/include/util/delay.h **** - GAS LISTING /tmp/ccWx46oe.s page 2 - - - 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$ */ - 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 - 73:/usr/lib/avr/include/util/delay.h **** applications that otherwise do not use floating-point calculations - GAS LISTING /tmp/ccWx46oe.s page 3 - - - 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__ - 130:/usr/lib/avr/include/util/delay.h **** to round down and round to closest integer. - GAS LISTING /tmp/ccWx46oe.s page 4 - - - 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 **** double __tmp ; - 145:/usr/lib/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ - 146:/usr/lib/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ - 147:/usr/lib/avr/include/util/delay.h **** __STDC_HOSTED__ - 148:/usr/lib/avr/include/util/delay.h **** uint32_t __ticks_dc; - 149:/usr/lib/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); - 150:/usr/lib/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; - 151:/usr/lib/avr/include/util/delay.h **** - 152:/usr/lib/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) - 153:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); - 154:/usr/lib/avr/include/util/delay.h **** - 155:/usr/lib/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) - 156:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); - 157:/usr/lib/avr/include/util/delay.h **** - 158:/usr/lib/avr/include/util/delay.h **** #else - 159:/usr/lib/avr/include/util/delay.h **** //round up by default - 160:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); - 161:/usr/lib/avr/include/util/delay.h **** #endif - 162:/usr/lib/avr/include/util/delay.h **** - 163:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); - 135 .LM3: - 136 0014 EFEC ldi r30,lo8(1999) - 137 0016 F7E0 ldi r31,hi8(1999) - 138 0018 3197 1: sbiw r30,1 - 139 001a 01F4 brne 1b - 140 001c 00C0 rjmp . - 141 001e 0000 nop - 142 .LBE7: - 143 .LBE6: - 145 .Ltext2: - 147 .LM4: - 148 0020 0F5F subi r16,-1 - 149 0022 1F4F sbci r17,-1 - 150 0024 2F4F sbci r18,-1 - 151 0026 3F4F sbci r19,-1 - 152 0028 00C0 rjmp .L2 - 153 .L5: - 154 /* epilogue start */ - 9:test.c **** _delay_ms(1); - 10:test.c **** } - 11:test.c **** } - 156 .LM5: - 157 002a 1F91 pop r17 - 158 002c 0F91 pop r16 - GAS LISTING /tmp/ccWx46oe.s page 5 - - - 159 002e 0895 ret - 164 .Lscope1: - 166 .stabd 78,0,0 - 167 .section .text.startup,"ax",@progbits - 169 .global main - 171 main: - 172 .stabd 46,0,0 - 12:test.c **** - 13:test.c **** #define NOOP asm volatile("nop" ::) - 14:test.c **** - 15:test.c **** - 16:test.c **** static void setup_clock( void ) - 17:test.c **** { - 18:test.c **** /*Examine Page 33*/ - 19:test.c **** - 20:test.c **** CLKPR = 0x80; /*Setup CLKPCE to be receptive*/ - 21:test.c **** CLKPR = 0x00; /*No scalar*/ - 22:test.c **** OSCCAL = 0x80; //B8 is bottom E8 is top. - 23:test.c **** } - 24:test.c **** - 25:test.c **** int main( ) - 26:test.c **** { - 174 .LM6: - 175 .LFBB2: - 176 /* prologue: function */ - 177 /* frame size = 0 */ - 178 /* stack size = 0 */ - 179 .L__stack_usage = 0 - 27:test.c **** cli(); - 181 .LM7: - 182 /* #APP */ - 183 ; 27 "test.c" 1 - 184 0000 F894 cli - 185 ; 0 "" 2 - 186 /* #NOAPP */ - 187 .LBB12: - 188 .LBB13: - 20:test.c **** CLKPR = 0x00; /*No scalar*/ - 190 .LM8: - 191 0002 80E8 ldi r24,lo8(-128) - 192 0004 86BD out 0x26,r24 - 21:test.c **** OSCCAL = 0x80; //B8 is bottom E8 is top. - 194 .LM9: - 195 0006 16BC out 0x26,__zero_reg__ - 22:test.c **** } - 197 .LM10: - 198 0008 81BF out 0x31,r24 - 199 .LBE13: - 200 .LBE12: - 28:test.c **** setup_clock(); - 29:test.c **** DDRB = _BV(4); - 202 .LM11: - 203 000a 80E1 ldi r24,lo8(16) - 204 000c 87BB out 0x17,r24 - 30:test.c **** uint8_t marker; - 31:test.c **** - 32:test.c **** while(1) - GAS LISTING /tmp/ccWx46oe.s page 6 - - - 33:test.c **** { - 34:test.c **** marker = 0x05; - 35:test.c **** do{ - 36:test.c **** PORTB = _BV(4); - 206 .LM12: - 207 000e 90E1 ldi r25,lo8(16) - 208 .L8: - 26:test.c **** cli(); - 210 .LM13: - 211 0010 85E0 ldi r24,lo8(5) - 212 .L7: - 214 .LM14: - 215 0012 98BB out 0x18,r25 - 37:test.c **** marker--; - 38:test.c **** PORTB = 0; - 217 .LM15: - 218 0014 18BA out 0x18,__zero_reg__ - 219 0016 8150 subi r24,lo8(-(-1)) - 39:test.c **** } while( marker ); - 221 .LM16: - 222 0018 01F4 brne .L7 - 223 .LBB14: - 224 .LBB15: - 226 .Ltext3: - 164:/usr/lib/avr/include/util/delay.h **** - 165:/usr/lib/avr/include/util/delay.h **** #else - 166:/usr/lib/avr/include/util/delay.h **** uint16_t __ticks; - 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. - GAS LISTING /tmp/ccWx46oe.s page 7 - - - 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 - 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 **** double __tmp ; - 227:/usr/lib/avr/include/util/delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ - 228:/usr/lib/avr/include/util/delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ - 229:/usr/lib/avr/include/util/delay.h **** __STDC_HOSTED__ - 230:/usr/lib/avr/include/util/delay.h **** uint32_t __ticks_dc; - 231:/usr/lib/avr/include/util/delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); - 232:/usr/lib/avr/include/util/delay.h **** __tmp = ((F_CPU) / 1e6) * __us; - 233:/usr/lib/avr/include/util/delay.h **** - 234:/usr/lib/avr/include/util/delay.h **** #if defined(__DELAY_ROUND_DOWN__) - 235:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); - 236:/usr/lib/avr/include/util/delay.h **** - 237:/usr/lib/avr/include/util/delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) - 238:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); - 239:/usr/lib/avr/include/util/delay.h **** - 240:/usr/lib/avr/include/util/delay.h **** #else - 241:/usr/lib/avr/include/util/delay.h **** //round up by default - 242:/usr/lib/avr/include/util/delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); - 243:/usr/lib/avr/include/util/delay.h **** #endif - 244:/usr/lib/avr/include/util/delay.h **** - 245:/usr/lib/avr/include/util/delay.h **** __builtin_avr_delay_cycles(__ticks_dc); - 228 .LM17: - 229 001a E3E3 ldi r30,lo8(-32205) - 230 001c F2E8 ldi r31,hi8(-32205) - 231 001e 3197 1: sbiw r30,1 - 232 0020 01F4 brne 1b - 233 0022 00C0 rjmp . - 234 0024 0000 nop - 235 0026 00C0 rjmp .L8 - GAS LISTING /tmp/ccWx46oe.s page 8 - - - 236 .LBE15: - 237 .LBE14: - 239 .Lscope2: - 241 .stabd 78,0,0 - 242 .text - 244 .Letext0: - 245 .ident "GCC: (GNU) 4.9.2" - GAS LISTING /tmp/ccWx46oe.s page 9 - - -DEFINED SYMBOLS - *ABS*:0000000000000000 test.c - /tmp/ccWx46oe.s:2 *ABS*:000000000000003e __SP_H__ - /tmp/ccWx46oe.s:3 *ABS*:000000000000003d __SP_L__ - /tmp/ccWx46oe.s:4 *ABS*:000000000000003f __SREG__ - /tmp/ccWx46oe.s:5 *ABS*:0000000000000000 __tmp_reg__ - /tmp/ccWx46oe.s:6 *ABS*:0000000000000001 __zero_reg__ - /tmp/ccWx46oe.s:106 .text:0000000000000000 delay_ms - /tmp/ccWx46oe.s:171 .text.startup:0000000000000000 main - -NO UNDEFINED SYMBOLS diff --git a/tools/avr_codegen/test.map b/tools/avr_codegen/test.map deleted file mode 100644 index 7a68865..0000000 --- a/tools/avr_codegen/test.map +++ /dev/null @@ -1,379 +0,0 @@ -Archive member included to satisfy reference by file (symbol) - -/usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o (exit) - -Memory Configuration - -Name Origin Length Attributes -text 0x0000000000000000 0x0000000000002000 xr -data 0x0000000000800060 0x000000000000ffa0 rw !x -eeprom 0x0000000000810000 0x0000000000010000 rw !x -fuse 0x0000000000820000 0x0000000000000400 rw !x -lock 0x0000000000830000 0x0000000000000400 rw !x -signature 0x0000000000840000 0x0000000000000400 rw !x -user_signatures 0x0000000000850000 0x0000000000000400 rw !x -*default* 0x0000000000000000 0xffffffffffffffff - -Linker script and memory map - -LOAD /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o -LOAD /tmp/ccNW2tJG.o -START GROUP -LOAD /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a -LOAD /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/libm.a -LOAD /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/libc.a -LOAD /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/libattiny85.a -END GROUP - -.hash - *(.hash) - -.dynsym - *(.dynsym) - -.dynstr - *(.dynstr) - -.gnu.version - *(.gnu.version) - -.gnu.version_d - *(.gnu.version_d) - -.gnu.version_r - *(.gnu.version_r) - -.rel.init - *(.rel.init) - -.rela.init - *(.rela.init) - -.rel.text - *(.rel.text) - *(.rel.text.*) - *(.rel.gnu.linkonce.t*) - -.rela.text - *(.rela.text) - *(.rela.text.*) - *(.rela.gnu.linkonce.t*) - -.rel.fini - *(.rel.fini) - -.rela.fini - *(.rela.fini) - -.rel.rodata - *(.rel.rodata) - *(.rel.rodata.*) - *(.rel.gnu.linkonce.r*) - -.rela.rodata - *(.rela.rodata) - *(.rela.rodata.*) - *(.rela.gnu.linkonce.r*) - -.rel.data - *(.rel.data) - *(.rel.data.*) - *(.rel.gnu.linkonce.d*) - -.rela.data - *(.rela.data) - *(.rela.data.*) - *(.rela.gnu.linkonce.d*) - -.rel.ctors - *(.rel.ctors) - -.rela.ctors - *(.rela.ctors) - -.rel.dtors - *(.rel.dtors) - -.rela.dtors - *(.rela.dtors) - -.rel.got - *(.rel.got) - -.rela.got - *(.rela.got) - -.rel.bss - *(.rel.bss) - -.rela.bss - *(.rela.bss) - -.rel.plt - *(.rel.plt) - -.rela.plt - *(.rela.plt) - -.text 0x0000000000000000 0x8c - *(.vectors) - .vectors 0x0000000000000000 0x1e /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - 0x0000000000000000 __vectors - 0x0000000000000000 __vector_default - *(.vectors) - *(.progmem.gcc*) - 0x000000000000001e . = ALIGN (0x2) - 0x000000000000001e __trampolines_start = . - *(.trampolines) - .trampolines 0x000000000000001e 0x0 linker stubs - *(.trampolines*) - 0x000000000000001e __trampolines_end = . - *(.progmem*) - 0x000000000000001e . = ALIGN (0x2) - *(.jumptables) - *(.jumptables*) - *(.lowtext) - *(.lowtext*) - 0x000000000000001e __ctors_start = . - *(.ctors) - 0x000000000000001e __ctors_end = . - 0x000000000000001e __dtors_start = . - *(.dtors) - 0x000000000000001e __dtors_end = . - SORT(*)(.ctors) - SORT(*)(.dtors) - *(.init0) - .init0 0x000000000000001e 0x0 /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - 0x000000000000001e __init - *(.init0) - *(.init1) - *(.init1) - *(.init2) - .init2 0x000000000000001e 0xc /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - *(.init2) - *(.init3) - *(.init3) - *(.init4) - *(.init4) - *(.init5) - *(.init5) - *(.init6) - *(.init6) - *(.init7) - *(.init7) - *(.init8) - *(.init8) - *(.init9) - .init9 0x000000000000002a 0x4 /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - *(.init9) - *(.text) - .text 0x000000000000002e 0x2 /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - 0x000000000000002e __vector_1 - 0x000000000000002e __vector_12 - 0x000000000000002e __bad_interrupt - 0x000000000000002e __vector_6 - 0x000000000000002e __vector_3 - 0x000000000000002e __vector_11 - 0x000000000000002e __vector_13 - 0x000000000000002e __vector_7 - 0x000000000000002e __vector_5 - 0x000000000000002e __vector_4 - 0x000000000000002e __vector_9 - 0x000000000000002e __vector_2 - 0x000000000000002e __vector_8 - 0x000000000000002e __vector_14 - 0x000000000000002e __vector_10 - .text 0x0000000000000030 0x30 /tmp/ccNW2tJG.o - 0x0000000000000030 delay_ms - .text 0x0000000000000060 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - 0x0000000000000060 . = ALIGN (0x2) - *(.text.*) - .text.startup 0x0000000000000060 0x28 /tmp/ccNW2tJG.o - 0x0000000000000060 main - .text.libgcc.mul - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc.div - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc.prologue - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc.builtins - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc.fmul - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - .text.libgcc.fixed - 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - 0x0000000000000088 . = ALIGN (0x2) - *(.fini9) - .fini9 0x0000000000000088 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - 0x0000000000000088 exit - 0x0000000000000088 _exit - *(.fini9) - *(.fini8) - *(.fini8) - *(.fini7) - *(.fini7) - *(.fini6) - *(.fini6) - *(.fini5) - *(.fini5) - *(.fini4) - *(.fini4) - *(.fini3) - *(.fini3) - *(.fini2) - *(.fini2) - *(.fini1) - *(.fini1) - *(.fini0) - .fini0 0x0000000000000088 0x4 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - *(.fini0) - 0x000000000000008c _etext = . - -.data 0x0000000000800060 0x0 load address 0x000000000000008c - 0x0000000000800060 PROVIDE (__data_start, .) - *(.data) - .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - .data 0x0000000000800060 0x0 /tmp/ccNW2tJG.o - .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - *(.data*) - *(.rodata) - *(.rodata*) - *(.gnu.linkonce.d*) - 0x0000000000800060 . = ALIGN (0x2) - 0x0000000000800060 _edata = . - 0x0000000000800060 PROVIDE (__data_end, .) - -.bss 0x0000000000800060 0x0 - 0x0000000000800060 PROVIDE (__bss_start, .) - *(.bss) - .bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - .bss 0x0000000000800060 0x0 /tmp/ccNW2tJG.o - .bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.9.2/avr25/libgcc.a(_exit.o) - *(.bss*) - *(COMMON) - 0x0000000000800060 PROVIDE (__bss_end, .) - 0x000000000000008c __data_load_start = LOADADDR (.data) - 0x000000000000008c __data_load_end = (__data_load_start + SIZEOF (.data)) - -.noinit 0x0000000000800060 0x0 - 0x0000000000800060 PROVIDE (__noinit_start, .) - *(.noinit*) - 0x0000000000800060 PROVIDE (__noinit_end, .) - 0x0000000000800060 _end = . - 0x0000000000800060 PROVIDE (__heap_start, .) - -.eeprom 0x0000000000810000 0x0 - *(.eeprom*) - 0x0000000000810000 __eeprom_end = . - -.fuse - *(.fuse) - *(.lfuse) - *(.hfuse) - *(.efuse) - -.lock - *(.lock*) - -.signature - *(.signature*) - -.user_signatures - *(.user_signatures*) - -.stab 0x0000000000000000 0x600 - *(.stab) - .stab 0x0000000000000000 0x600 /tmp/ccNW2tJG.o - -.stabstr 0x0000000000000000 0xc02 - *(.stabstr) - .stabstr 0x0000000000000000 0xc02 /tmp/ccNW2tJG.o - -.stab.excl - *(.stab.excl) - -.stab.exclstr - *(.stab.exclstr) - -.stab.index - *(.stab.index) - -.stab.indexstr - *(.stab.indexstr) - -.comment 0x0000000000000000 0x11 - *(.comment) - .comment 0x0000000000000000 0x11 /tmp/ccNW2tJG.o - 0x12 (size before relaxing) - -.note.gnu.avr.deviceinfo - 0x0000000000000000 0x3c - .note.gnu.avr.deviceinfo - 0x0000000000000000 0x3c /usr/lib/gcc/avr/4.9.2/../../../avr/lib/avr25/crtattiny85.o - -.note.gnu.build-id - *(.note.gnu.build-id) - -.debug - *(.debug) - -.line - *(.line) - -.debug_srcinfo - *(.debug_srcinfo) - -.debug_sfnames - *(.debug_sfnames) - -.debug_aranges - *(.debug_aranges) - -.debug_pubnames - *(.debug_pubnames) - -.debug_info - *(.debug_info .gnu.linkonce.wi.*) - -.debug_abbrev - *(.debug_abbrev) - -.debug_line - *(.debug_line .debug_line.* .debug_line_end) - -.debug_frame - *(.debug_frame) - -.debug_str - *(.debug_str) - -.debug_loc - *(.debug_loc) - -.debug_macinfo - *(.debug_macinfo) - -.debug_weaknames - *(.debug_weaknames) - -.debug_funcnames - *(.debug_funcnames) - -.debug_typenames - *(.debug_typenames) - -.debug_varnames - *(.debug_varnames) - -.debug_pubtypes - *(.debug_pubtypes) - -.debug_ranges - *(.debug_ranges) - -.debug_macro - *(.debug_macro) -OUTPUT(test.elf elf32-avr) -LOAD linker stubs diff --git a/tools/avr_codegen/test.o b/tools/avr_codegen/test.o deleted file mode 100644 index 7f4d025..0000000 Binary files a/tools/avr_codegen/test.o and /dev/null differ -- cgit v1.2.3