first commit

This commit is contained in:
Christoffer Martinsson 2014-11-22 16:31:17 +01:00
commit e6e5b45e7c
10 changed files with 1521 additions and 0 deletions

1
.ajxp_meta Executable file
View File

@ -0,0 +1 @@
a:9:{s:11:"BOSCH_SCU.c";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"8650026666250d36b521231f5781a381";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.eep";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"aef2bc6462dabb81b069a9ba4ded0143";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.elf";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"fb5f31f92137a8976e9177dc6e723bfe";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.hex";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"1bc4e99534c29c2547139b23b72eb828";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.lss";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"54c0573b706c3eb148f6ff570ca723b8";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.lst";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"9a861e3d3b399f0bebeaae676448816d";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.map";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"2f5d8066277b09730e28dc11e78542a7";s:9:"md5_mtime";i:1311459940;}}}s:13:"BOSCH_SCU.sym";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"9406b2c07ff523d6ffb24ff85a411368";s:9:"md5_mtime";i:1311459940;}}}s:8:"makefile";a:1:{s:24:"AJXP_METADATA_SHAREDUSER";a:1:{s:11:"file_hahser";a:2:{s:3:"md5";s:32:"1e09920c492ce1626a51557031fa73fb";s:9:"md5_mtime";i:1311459940;}}}}

119
BOSCH_SCU.c Executable file
View File

@ -0,0 +1,119 @@
/*================================================================================================
CMtec BOSCH_SpeedControlUnit copyright 2008 v1.0 (2008-08-07)
Name: Christoffer Martinsson
E-mail: cm@cmtec.se
Uses:
PB1 = PWM output
PB2 = Sensor input
================================================================================================*/
#include <avr/delay.h>
#include <string.h>
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/eeprom.h>
/*================================================================================================
Functions
================================================================================================*/
/*------------------------------------------------------------------------------------------------
initIO
Description: Initialise I/O
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
void initIO (void){
/* Start PLL */
PLLCSR = (1<<PLLE);
loop_until_bit_is_set(PLLCSR, PLOCK);
PLLCSR |= (1<<PCKE);
/* Direction settings for port B */
DDRB = (1<<PB1);
/* Timer/PWM settings */
OCR1A = 0; // PWM value = 0
OCR1C = 255; // ~62kHz
TCCR1 = (1<<PWM1A)|(1<<COM1A0)|(1<<COM1A1)|(1<<CS11)|(1<<CS10);
/* ADC settings */
DIDR0 = (1<<ADC1D);
ADMUX = (1<<ADLAR)|(1<<MUX0);
ADCSRA = (1<<ADEN);
}
/*------------------------------------------------------------------------------------------------
readSensor
Description: Reading value from distance-sensor
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
unsigned char readSensor (void){
ADCSRA |= (1<<ADSC);
loop_until_bit_is_clear(ADCSRA,ADSC);
return ADCH;
}
/*------------------------------------------------------------------------------------------------
setPWM
Description: Set PMW output
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
void setPWM (unsigned char pwmValue){
if(pwmValue < 255 && pwmValue > 70)
{
pwmValue = pwmValue - 70;
OCR1A = pwmValue;
}
else if(pwmValue <= 70)
{
OCR1A = 0;
}
else
{
OCR1A = pwmValue;
}
}
/*================================================================================================
Main
================================================================================================*/
int main (void){
unsigned char tmp = 0;
cli(); // Disable global interrupt
initIO();
sei(); // Enable global interrupt
while(1){
setPWM(readSensor());
}
return (0);
}
/*================================================================================================
End
================================================================================================*/

1
BOSCH_SCU.eep Executable file
View File

@ -0,0 +1 @@
:00000001FF

BIN
BOSCH_SCU.elf Executable file

Binary file not shown.

14
BOSCH_SCU.hex Executable file
View File

@ -0,0 +1,14 @@
:100000000EC026C025C024C023C022C021C020C0ED
:100010001FC01EC01DC01CC01BC01AC019C01124A7
:100020001FBECFEDCDBF10E0A0E6B0E0EAECF0E0FF
:1000300002C005900D92A036B107D9F710E0A0E6F6
:10004000B0E001C01D92A036B107E1F729D03BC056
:10005000D7CF82E087BD07B400FEFDCF87B58460AF
:1000600087BD82E087BB1EBC8FEF8DBD83E780BF5D
:1000700084E084BB81E287B980E886B90895369A26
:100080003699FECF85B10895982F8754883B10F498
:10009000965404C0973410F41EBC08959EBD089574
:1000A000F894D7DF7894369A3699FECF95B1892F98
:1000B0008754883B10F4965404C0973410F41EBC47
:0A00C000F2CF9EBDF0CFF894FFCF01
:00000001FF

251
BOSCH_SCU.lss Executable file
View File

@ -0,0 +1,251 @@
BOSCH_SCU.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000000ca 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .debug_aranges 00000020 00000000 00000000 0000011e 2**0
CONTENTS, READONLY, DEBUGGING
2 .debug_pubnames 00000040 00000000 00000000 0000013e 2**0
CONTENTS, READONLY, DEBUGGING
3 .debug_info 00000110 00000000 00000000 0000017e 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 000000e0 00000000 00000000 0000028e 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_line 0000016a 00000000 00000000 0000036e 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_frame 00000050 00000000 00000000 000004d8 2**2
CONTENTS, READONLY, DEBUGGING
7 .debug_str 00000088 00000000 00000000 00000528 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_loc 0000001e 00000000 00000000 000005b0 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0e c0 rjmp .+28 ; 0x1e <__ctors_end>
2: 26 c0 rjmp .+76 ; 0x50 <__bad_interrupt>
4: 25 c0 rjmp .+74 ; 0x50 <__bad_interrupt>
6: 24 c0 rjmp .+72 ; 0x50 <__bad_interrupt>
8: 23 c0 rjmp .+70 ; 0x50 <__bad_interrupt>
a: 22 c0 rjmp .+68 ; 0x50 <__bad_interrupt>
c: 21 c0 rjmp .+66 ; 0x50 <__bad_interrupt>
e: 20 c0 rjmp .+64 ; 0x50 <__bad_interrupt>
10: 1f c0 rjmp .+62 ; 0x50 <__bad_interrupt>
12: 1e c0 rjmp .+60 ; 0x50 <__bad_interrupt>
14: 1d c0 rjmp .+58 ; 0x50 <__bad_interrupt>
16: 1c c0 rjmp .+56 ; 0x50 <__bad_interrupt>
18: 1b c0 rjmp .+54 ; 0x50 <__bad_interrupt>
1a: 1a c0 rjmp .+52 ; 0x50 <__bad_interrupt>
1c: 19 c0 rjmp .+50 ; 0x50 <__bad_interrupt>
0000001e <__ctors_end>:
1e: 11 24 eor r1, r1
20: 1f be out 0x3f, r1 ; 63
22: cf ed ldi r28, 0xDF ; 223
24: cd bf out 0x3d, r28 ; 61
00000026 <__do_copy_data>:
26: 10 e0 ldi r17, 0x00 ; 0
28: a0 e6 ldi r26, 0x60 ; 96
2a: b0 e0 ldi r27, 0x00 ; 0
2c: ea ec ldi r30, 0xCA ; 202
2e: f0 e0 ldi r31, 0x00 ; 0
30: 02 c0 rjmp .+4 ; 0x36 <.do_copy_data_start>
00000032 <.do_copy_data_loop>:
32: 05 90 lpm r0, Z+
34: 0d 92 st X+, r0
00000036 <.do_copy_data_start>:
36: a0 36 cpi r26, 0x60 ; 96
38: b1 07 cpc r27, r17
3a: d9 f7 brne .-10 ; 0x32 <.do_copy_data_loop>
0000003c <__do_clear_bss>:
3c: 10 e0 ldi r17, 0x00 ; 0
3e: a0 e6 ldi r26, 0x60 ; 96
40: b0 e0 ldi r27, 0x00 ; 0
42: 01 c0 rjmp .+2 ; 0x46 <.do_clear_bss_start>
00000044 <.do_clear_bss_loop>:
44: 1d 92 st X+, r1
00000046 <.do_clear_bss_start>:
46: a0 36 cpi r26, 0x60 ; 96
48: b1 07 cpc r27, r17
4a: e1 f7 brne .-8 ; 0x44 <.do_clear_bss_loop>
4c: 29 d0 rcall .+82 ; 0xa0 <main>
4e: 3b c0 rjmp .+118 ; 0xc6 <_exit>
00000050 <__bad_interrupt>:
50: d7 cf rjmp .-82 ; 0x0 <__vectors>
00000052 <initIO>:
Description: Initialise I/O
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
void initIO (void){
52: 82 e0 ldi r24, 0x02 ; 2
54: 87 bd out 0x27, r24 ; 39
/* Start PLL */
PLLCSR = (1<<PLLE);
loop_until_bit_is_set(PLLCSR, PLOCK);
56: 07 b4 in r0, 0x27 ; 39
58: 00 fe sbrs r0, 0
5a: fd cf rjmp .-6 ; 0x56 <initIO+0x4>
PLLCSR |= (1<<PCKE);
5c: 87 b5 in r24, 0x27 ; 39
5e: 84 60 ori r24, 0x04 ; 4
60: 87 bd out 0x27, r24 ; 39
/* Direction settings for port B */
DDRB = (1<<PB1);
62: 82 e0 ldi r24, 0x02 ; 2
64: 87 bb out 0x17, r24 ; 23
/* Timer/PWM settings */
OCR1A = 0; // PWM value = 0
66: 1e bc out 0x2e, r1 ; 46
OCR1C = 255; // ~62kHz
68: 8f ef ldi r24, 0xFF ; 255
6a: 8d bd out 0x2d, r24 ; 45
TCCR1 = (1<<PWM1A)|(1<<COM1A0)|(1<<COM1A1)|(1<<CS11)|(1<<CS10);
6c: 83 e7 ldi r24, 0x73 ; 115
6e: 80 bf out 0x30, r24 ; 48
/* ADC settings */
DIDR0 = (1<<ADC1D);
70: 84 e0 ldi r24, 0x04 ; 4
72: 84 bb out 0x14, r24 ; 20
ADMUX = (1<<ADLAR)|(1<<MUX0);
74: 81 e2 ldi r24, 0x21 ; 33
76: 87 b9 out 0x07, r24 ; 7
ADCSRA = (1<<ADEN);
78: 80 e8 ldi r24, 0x80 ; 128
7a: 86 b9 out 0x06, r24 ; 6
}
7c: 08 95 ret
0000007e <readSensor>:
Description: Reading value from distance-sensor
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
unsigned char readSensor (void){
7e: 36 9a sbi 0x06, 6 ; 6
ADCSRA |= (1<<ADSC);
loop_until_bit_is_clear(ADCSRA,ADSC);
80: 36 99 sbic 0x06, 6 ; 6
82: fe cf rjmp .-4 ; 0x80 <readSensor+0x2>
return ADCH;
84: 85 b1 in r24, 0x05 ; 5
}
86: 08 95 ret
00000088 <setPWM>:
Description: Set PMW output
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
void setPWM (unsigned char pwmValue){
88: 98 2f mov r25, r24
if(pwmValue < 255 && pwmValue > 70)
8a: 87 54 subi r24, 0x47 ; 71
8c: 88 3b cpi r24, 0xB8 ; 184
8e: 10 f4 brcc .+4 ; 0x94 <setPWM+0xc>
{
pwmValue = pwmValue - 70;
90: 96 54 subi r25, 0x46 ; 70
92: 04 c0 rjmp .+8 ; 0x9c <setPWM+0x14>
OCR1A = pwmValue;
}
else if(pwmValue <= 70)
94: 97 34 cpi r25, 0x47 ; 71
96: 10 f4 brcc .+4 ; 0x9c <setPWM+0x14>
{
OCR1A = 0;
98: 1e bc out 0x2e, r1 ; 46
9a: 08 95 ret
}
else
{
OCR1A = pwmValue;
9c: 9e bd out 0x2e, r25 ; 46
9e: 08 95 ret
000000a0 <main>:
}
/*================================================================================================
Main
================================================================================================*/
int main (void){
a0: f8 94 cli
unsigned char tmp = 0;
cli(); // Disable global interrupt
initIO();
a2: d7 df rcall .-82 ; 0x52 <initIO>
sei(); // Enable global interrupt
a4: 78 94 sei
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
unsigned char readSensor (void){
ADCSRA |= (1<<ADSC);
a6: 36 9a sbi 0x06, 6 ; 6
loop_until_bit_is_clear(ADCSRA,ADSC);
a8: 36 99 sbic 0x06, 6 ; 6
aa: fe cf rjmp .-4 ; 0xa8 <main+0x8>
return ADCH;
ac: 95 b1 in r25, 0x05 ; 5
Input: -
Output: -
------------------------------------------------------------------------------------------------*/
void setPWM (unsigned char pwmValue){
if(pwmValue < 255 && pwmValue > 70)
ae: 89 2f mov r24, r25
b0: 87 54 subi r24, 0x47 ; 71
b2: 88 3b cpi r24, 0xB8 ; 184
b4: 10 f4 brcc .+4 ; 0xba <main+0x1a>
{
pwmValue = pwmValue - 70;
b6: 96 54 subi r25, 0x46 ; 70
b8: 04 c0 rjmp .+8 ; 0xc2 <main+0x22>
OCR1A = pwmValue;
}
else if(pwmValue <= 70)
ba: 97 34 cpi r25, 0x47 ; 71
bc: 10 f4 brcc .+4 ; 0xc2 <main+0x22>
{
OCR1A = 0;
be: 1e bc out 0x2e, r1 ; 46
c0: f2 cf rjmp .-28 ; 0xa6 <main+0x6>
}
else
{
OCR1A = pwmValue;
c2: 9e bd out 0x2e, r25 ; 46
c4: f0 cf rjmp .-32 ; 0xa6 <main+0x6>
000000c6 <_exit>:
c6: f8 94 cli
000000c8 <__stop_program>:
c8: ff cf rjmp .-2 ; 0xc8 <__stop_program>

172
BOSCH_SCU.lst Executable file
View File

@ -0,0 +1,172 @@
1 .file "BOSCH_SCU.c"
2 __SREG__ = 0x3f
3 __SP_H__ = 0x3e
4 __SP_L__ = 0x3d
5 __CCP__ = 0x34
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
17 .Ltext0:
18 .global initIO
20 initIO:
21 .LFB14:
22 .LM1:
23 /* prologue: function */
24 /* frame size = 0 */
25 .LM2:
26 0000 82E0 ldi r24,lo8(2)
27 0002 87BD out 71-32,r24
28 .L2:
29 .LM3:
30 0004 07B4 in __tmp_reg__,71-32
31 0006 00FE sbrs __tmp_reg__,0
32 0008 00C0 rjmp .L2
33 .LM4:
34 000a 87B5 in r24,71-32
35 000c 8460 ori r24,lo8(4)
36 000e 87BD out 71-32,r24
37 .LM5:
38 0010 82E0 ldi r24,lo8(2)
39 0012 87BB out 55-32,r24
40 .LM6:
41 0014 1EBC out 78-32,__zero_reg__
42 .LM7:
43 0016 8FEF ldi r24,lo8(-1)
44 0018 8DBD out 77-32,r24
45 .LM8:
46 001a 83E7 ldi r24,lo8(115)
47 001c 80BF out 80-32,r24
48 .LM9:
49 001e 84E0 ldi r24,lo8(4)
50 0020 84BB out 52-32,r24
51 .LM10:
52 0022 81E2 ldi r24,lo8(33)
53 0024 87B9 out 39-32,r24
54 .LM11:
55 0026 80E8 ldi r24,lo8(-128)
56 0028 86B9 out 38-32,r24
57 /* epilogue start */
58 .LM12:
59 002a 0895 ret
60 .LFE14:
62 .global readSensor
64 readSensor:
65 .LFB15:
66 .LM13:
67 /* prologue: function */
68 /* frame size = 0 */
69 .LM14:
70 002c 369A sbi 38-32,6
71 .L6:
72 .LM15:
73 002e 3699 sbic 38-32,6
74 0030 00C0 rjmp .L6
75 .LM16:
76 0032 85B1 in r24,37-32
77 /* epilogue start */
78 .LM17:
79 0034 0895 ret
80 .LFE15:
82 .global setPWM
84 setPWM:
85 .LFB16:
86 .LM18:
87 .LVL0:
88 /* prologue: function */
89 /* frame size = 0 */
90 0036 982F mov r25,r24
91 .LM19:
92 0038 8754 subi r24,lo8(-(-71))
93 .LVL1:
94 003a 883B cpi r24,lo8(-72)
95 003c 00F4 brsh .L10
96 .LM20:
97 003e 9654 subi r25,lo8(-(-70))
98 0040 00C0 rjmp .L12
99 .L10:
100 .LM21:
101 0042 9734 cpi r25,lo8(71)
102 0044 00F4 brsh .L12
103 .LM22:
104 0046 1EBC out 78-32,__zero_reg__
105 0048 0895 ret
106 .L12:
107 .LM23:
108 004a 9EBD out 78-32,r25
109 004c 0895 ret
110 .LFE16:
112 .global main
114 main:
115 .LFB17:
116 .LM24:
117 /* prologue: function */
118 /* frame size = 0 */
119 .LM25:
120 /* #APP */
121 ; 102 "BOSCH_SCU.c" 1
122 004e F894 cli
123 ; 0 "" 2
124 .LM26:
125 /* #NOAPP */
126 0050 00D0 rcall initIO
127 .LM27:
128 /* #APP */
129 ; 106 "BOSCH_SCU.c" 1
130 0052 7894 sei
131 ; 0 "" 2
132 /* #NOAPP */
133 .L21:
134 .LBB6:
135 .LBB7:
136 .LM28:
137 0054 369A sbi 38-32,6
138 .L15:
139 .LM29:
140 0056 3699 sbic 38-32,6
141 0058 00C0 rjmp .L15
142 .LM30:
143 005a 95B1 in r25,37-32
144 .LBE7:
145 .LBE6:
146 .LBB8:
147 .LBB9:
148 .LM31:
149 005c 892F mov r24,r25
150 005e 8754 subi r24,lo8(-(-71))
151 0060 883B cpi r24,lo8(-72)
152 0062 00F4 brsh .L16
153 .LM32:
154 0064 9654 subi r25,lo8(-(-70))
155 0066 00C0 rjmp .L18
156 .L16:
157 .LM33:
158 0068 9734 cpi r25,lo8(71)
159 006a 00F4 brsh .L18
160 .LM34:
161 006c 1EBC out 78-32,__zero_reg__
162 006e 00C0 rjmp .L21
163 .L18:
164 .LM35:
165 0070 9EBD out 78-32,r25
166 0072 00C0 rjmp .L21
167 .LBE9:
168 .LBE8:
169 .LFE17:
219 .Letext0:
DEFINED SYMBOLS
*ABS*:00000000 BOSCH_SCU.c
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:2 *ABS*:0000003f __SREG__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:3 *ABS*:0000003e __SP_H__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:4 *ABS*:0000003d __SP_L__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:5 *ABS*:00000034 __CCP__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:6 *ABS*:00000000 __tmp_reg__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:7 *ABS*:00000001 __zero_reg__
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:20 .text:00000000 initIO
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:64 .text:0000002c readSensor
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:84 .text:00000036 setPWM
C:\DOCUME~1\cm\LOKALA~1\Temp/ccPy3Fwx.s:114 .text:0000004e main
UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss

398
BOSCH_SCU.map Executable file
View File

@ -0,0 +1,398 @@
Archive member included because of file (symbol)
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o (exit)
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
BOSCH_SCU.o (__do_copy_data)
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
BOSCH_SCU.o (__do_clear_bss)
Memory Configuration
Name Origin Length Attributes
text 0x00000000 0x00002000 xr
data 0x00800060 0x0000ffa0 rw !x
eeprom 0x00810000 0x00010000 rw !x
fuse 0x00820000 0x00000400 rw !x
lock 0x00830000 0x00000400 rw !x
signature 0x00840000 0x00000400 rw !x
*default* 0x00000000 0xffffffff
Linker script and memory map
LOAD c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
LOAD BOSCH_SCU.o
LOAD c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25\libm.a
LOAD c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a
LOAD c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25\libc.a
LOAD c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a
.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 0x00000000 0xca
*(.vectors)
.vectors 0x00000000 0x1e c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
0x00000000 __vectors
0x00000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
*(.progmem*)
0x0000001e . = ALIGN (0x2)
0x0000001e __trampolines_start = .
*(.trampolines)
.trampolines 0x0000001e 0x0 linker stubs
*(.trampolines*)
0x0000001e __trampolines_end = .
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000001e __ctors_start = .
*(.ctors)
0x0000001e __ctors_end = .
0x0000001e __dtors_start = .
*(.dtors)
0x0000001e __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000001e 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
0x0000001e __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000001e 0x8 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000026 0x16 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
0x00000026 __do_copy_data
.init4 0x0000003c 0x10 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
0x0000003c __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000004c 0x4 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
*(.init9)
*(.text)
.text 0x00000050 0x2 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
0x00000050 __vector_1
0x00000050 __vector_12
0x00000050 __bad_interrupt
0x00000050 __vector_6
0x00000050 __vector_3
0x00000050 __vector_11
0x00000050 __vector_13
0x00000050 __vector_7
0x00000050 __vector_5
0x00000050 __vector_4
0x00000050 __vector_9
0x00000050 __vector_2
0x00000050 __vector_8
0x00000050 __vector_14
0x00000050 __vector_10
.text 0x00000052 0x74 BOSCH_SCU.o
0x0000007e readSensor
0x000000a0 main
0x00000088 setPWM
0x00000052 initIO
.text 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
.text 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
.text 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
0x000000c6 . = ALIGN (0x2)
*(.text.*)
.text.libgcc 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
.text.libgcc 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
.text.libgcc 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
0x000000c6 . = ALIGN (0x2)
*(.fini9)
.fini9 0x000000c6 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
0x000000c6 exit
0x000000c6 _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x000000c6 0x4 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
*(.fini0)
0x000000ca _etext = .
.data 0x00800060 0x0 load address 0x000000ca
0x00800060 PROVIDE (__data_start, .)
*(.data)
.data 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
.data 0x00800060 0x0 BOSCH_SCU.o
.data 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
.data 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
.data 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x00800060 . = ALIGN (0x2)
0x00800060 _edata = .
0x00800060 PROVIDE (__data_end, .)
.bss 0x00800060 0x0 load address 0x000000ca
0x00800060 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
.bss 0x00800060 0x0 BOSCH_SCU.o
.bss 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
.bss 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
.bss 0x00800060 0x0 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
*(.bss*)
*(COMMON)
0x00800060 PROVIDE (__bss_end, .)
0x000000ca __data_load_start = LOADADDR (.data)
0x000000ca __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800060 0x0
0x00800060 PROVIDE (__noinit_start, .)
*(.noinit*)
0x00800060 PROVIDE (__noinit_end, .)
0x00800060 _end = .
0x00800060 PROVIDE (__heap_start, .)
.eeprom 0x00810000 0x0
*(.eeprom*)
0x00810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment
*(.comment)
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x20
*(.debug_aranges)
.debug_aranges
0x00000000 0x20 BOSCH_SCU.o
.debug_pubnames
0x00000000 0x40
*(.debug_pubnames)
.debug_pubnames
0x00000000 0x40 BOSCH_SCU.o
.debug_info 0x00000000 0x110
*(.debug_info)
.debug_info 0x00000000 0x110 BOSCH_SCU.o
*(.gnu.linkonce.wi.*)
.debug_abbrev 0x00000000 0xe0
*(.debug_abbrev)
.debug_abbrev 0x00000000 0xe0 BOSCH_SCU.o
.debug_line 0x00000000 0x16a
*(.debug_line)
.debug_line 0x00000000 0x16a BOSCH_SCU.o
.debug_frame 0x00000000 0x50
*(.debug_frame)
.debug_frame 0x00000000 0x50 BOSCH_SCU.o
.debug_str 0x00000000 0x88
*(.debug_str)
.debug_str 0x00000000 0x88 BOSCH_SCU.o
0xbc (size before relaxing)
.debug_loc 0x00000000 0x1e
*(.debug_loc)
.debug_loc 0x00000000 0x1e BOSCH_SCU.o
.debug_macinfo
*(.debug_macinfo)
OUTPUT(BOSCH_SCU.elf elf32-avr)
LOAD linker stubs
Cross Reference Table
Symbol File
__bad_interrupt c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__bss_end c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
__bss_start c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
__data_end c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
__data_load_start c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
__data_start c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
__do_clear_bss c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_clear_bss.o)
BOSCH_SCU.o
__do_copy_data c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_copy_data.o)
BOSCH_SCU.o
__heap_end c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__init c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__stack c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_1 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_10 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_11 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_12 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_13 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_14 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_2 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_3 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_4 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_5 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_6 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_7 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_8 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_9 c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vector_default c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
__vectors c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
_exit c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
exit c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/avr25\libgcc.a(_exit.o)
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
initIO BOSCH_SCU.o
main BOSCH_SCU.o
c:/winavr-20080610/bin/../lib/gcc/avr/4.3.0/../../../../avr/lib/avr25/crttn25.o
readSensor BOSCH_SCU.o
setPWM BOSCH_SCU.o

55
BOSCH_SCU.sym Executable file
View File

@ -0,0 +1,55 @@
00000000 W __heap_end
00000000 a __tmp_reg__
00000000 W __vector_default
00000000 T __vectors
00000001 a __zero_reg__
0000001e T __ctors_end
0000001e T __ctors_start
0000001e T __dtors_end
0000001e T __dtors_start
0000001e W __init
0000001e T __trampolines_end
0000001e T __trampolines_start
00000026 T __do_copy_data
00000032 t .do_copy_data_loop
00000034 a __CCP__
00000036 t .do_copy_data_start
0000003c T __do_clear_bss
0000003d a __SP_L__
0000003e a __SP_H__
0000003f a __SREG__
00000044 t .do_clear_bss_loop
00000046 t .do_clear_bss_start
00000050 T __bad_interrupt
00000050 W __vector_1
00000050 W __vector_10
00000050 W __vector_11
00000050 W __vector_12
00000050 W __vector_13
00000050 W __vector_14
00000050 W __vector_2
00000050 W __vector_3
00000050 W __vector_4
00000050 W __vector_5
00000050 W __vector_6
00000050 W __vector_7
00000050 W __vector_8
00000050 W __vector_9
00000052 T initIO
0000007e T readSensor
00000088 T setPWM
000000a0 T main
000000c6 T _exit
000000c6 W exit
000000c8 t __stop_program
000000ca A __data_load_end
000000ca A __data_load_start
000000ca T _etext
000000df W __stack
00800060 T __bss_end
00800060 T __bss_start
00800060 T __data_end
00800060 T __data_start
00800060 T _edata
00800060 N _end
00810000 N __eeprom_end

510
makefile Executable file
View File

@ -0,0 +1,510 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = attiny25
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 8000000
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = BOSCH_SCU
# List C source files here. (C dependencies are automatically generated.)
SRC = BOSCH_SCU.c
#$(TARGET).c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL
# Place -I options here
CINCS =
#---------------- Compiler Options ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = dragon_isp
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = com1 # programmer connected to serial device
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
build: elf hex eep lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) --format=avr --mcu=$(MCU) $(TARGET).elf
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags .eeprom=alloc,load \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i)
$(REMOVE) .dep/*
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff \
clean clean_list program debug gdb-config