/programy/C/avr/tests/ATmega168/blik.aps |
---|
0,0 → 1,0 |
<AVRStudio><MANAGEMENT><ProjectName>blik</ProjectName><Created>27-Apr-2008 12:47:54</Created><LastEdit>27-Apr-2008 12:57:13</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>27-Apr-2008 12:47:54</Created><Version>4</Version><Build>4, 14, 0, 589</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\blik.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\KAKLIK\projekty\programy\C\avr\tests\ATmega168\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>ICE50</CURRENT_TARGET><CURRENT_PART>ATmega168.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>blik.c</SOURCEFILE><OTHERFILE>default\blik.lss</OTHERFILE><OTHERFILE>default\blik.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega168</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>blik.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\WinAVR\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>blik.c</FileName><Status>1</Status></File00000></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> |
/programy/C/avr/tests/ATmega168/blik.aws |
---|
0,0 → 1,0 |
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA168"/><Files><File00000 Name="D:\KAKLIK\projekty\programy\C\avr\tests\ATmega168\blik.c" Position="216 71 1051 588" LineCol="3 0" State="Maximized"/></Files></AVRWorkspace> |
/programy/C/avr/tests/ATmega168/default/Makefile |
---|
0,0 → 1,75 |
############################################################################### |
# Makefile for the project blik |
############################################################################### |
## General Flags |
PROJECT = blik |
MCU = atmega168 |
TARGET = blik.elf |
CC = avr-gcc.exe |
## Options common to compile, link and assembly rules |
COMMON = -mmcu=$(MCU) |
## Compile options common for all C compilation units. |
CFLAGS = $(COMMON) |
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d |
## Assembly specific flags |
ASMFLAGS = $(COMMON) |
ASMFLAGS += $(CFLAGS) |
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 |
## Linker flags |
LDFLAGS = $(COMMON) |
LDFLAGS += -Wl,-Map=blik.map |
## Intel Hex file production flags |
HEX_FLASH_FLAGS = -R .eeprom |
HEX_EEPROM_FLAGS = -j .eeprom |
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" |
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings |
## Objects that must be built in order to link |
OBJECTS = blik.o |
## Objects explicitly added by the user |
LINKONLYOBJECTS = |
## Build |
all: $(TARGET) blik.hex blik.eep blik.lss size |
## Compile |
blik.o: ../blik.c |
$(CC) $(INCLUDES) $(CFLAGS) -c $< |
##Link |
$(TARGET): $(OBJECTS) |
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) |
%.hex: $(TARGET) |
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ |
%.eep: $(TARGET) |
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 |
%.lss: $(TARGET) |
avr-objdump -h -S $< > $@ |
size: ${TARGET} |
@echo |
@avr-size -C --mcu=${MCU} ${TARGET} |
## Clean target |
.PHONY: clean |
clean: |
-rm -rf $(OBJECTS) blik.elf dep/* blik.hex blik.eep blik.lss blik.map |
## Other dependencies |
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) |
/programy/C/avr/tests/ATmega168/default/blik.elf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/C/avr/tests/ATmega168/default/blik.hex |
---|
0,0 → 1,15 |
:100000000C9434000C944F000C944F000C944F004F |
:100010000C944F000C944F000C944F000C944F0024 |
:100020000C944F000C944F000C944F000C944F0014 |
:100030000C944F000C944F000C944F000C944F0004 |
:100040000C944F000C944F000C944F000C944F00F4 |
:100050000C944F000C944F000C944F000C944F00E4 |
:100060000C944F000C944F0011241FBECFEFD4E02E |
:10007000DEBFCDBF11E0A0E0B1E0E4EDF0E002C0F2 |
:1000800005900D92A030B107D9F711E0A0E0B1E0E2 |
:1000900001C01D92A030B107E1F70C945E000C94F2 |
:1000A00000009C01E0E8F7E005C0CF010197F1F7FF |
:1000B0002150304021153105C1F708953D9A4598EA |
:1000C00082E390E00E945100459A82E390E00E9412 |
:0400D0005100F5CF17 |
:00000001FF |
/programy/C/avr/tests/ATmega168/default/blik.lss |
---|
0,0 → 1,162 |
blik.elf: file format elf32-avr |
Sections: |
Idx Name Size VMA LMA File off Algn |
0 .text 000000d4 00000000 00000000 00000054 2**1 |
CONTENTS, ALLOC, LOAD, READONLY, CODE |
1 .stab 0000036c 00000000 00000000 00000128 2**2 |
CONTENTS, READONLY, DEBUGGING |
2 .stabstr 00000084 00000000 00000000 00000494 2**0 |
CONTENTS, READONLY, DEBUGGING |
3 .debug_aranges 00000020 00000000 00000000 00000518 2**0 |
CONTENTS, READONLY, DEBUGGING |
4 .debug_pubnames 00000028 00000000 00000000 00000538 2**0 |
CONTENTS, READONLY, DEBUGGING |
5 .debug_info 0000013d 00000000 00000000 00000560 2**0 |
CONTENTS, READONLY, DEBUGGING |
6 .debug_abbrev 000000d3 00000000 00000000 0000069d 2**0 |
CONTENTS, READONLY, DEBUGGING |
7 .debug_line 000000fc 00000000 00000000 00000770 2**0 |
CONTENTS, READONLY, DEBUGGING |
8 .debug_frame 00000030 00000000 00000000 0000086c 2**0 |
CONTENTS, READONLY, DEBUGGING |
9 .debug_str 000000dd 00000000 00000000 0000089c 2**0 |
CONTENTS, READONLY, DEBUGGING |
10 .debug_loc 00000028 00000000 00000000 00000979 2**0 |
CONTENTS, READONLY, DEBUGGING |
Disassembly of section .text: |
00000000 <__vectors>: |
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end> |
4: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
8: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
10: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
14: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
18: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
1c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
20: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
24: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
28: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
2c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
30: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
34: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
38: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
3c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
40: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
44: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
48: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
4c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
50: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
54: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
58: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
5c: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
60: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
64: 0c 94 4f 00 jmp 0x9e ; 0x9e <__bad_interrupt> |
00000068 <__ctors_end>: |
68: 11 24 eor r1, r1 |
6a: 1f be out 0x3f, r1 ; 63 |
6c: cf ef ldi r28, 0xFF ; 255 |
6e: d4 e0 ldi r29, 0x04 ; 4 |
70: de bf out 0x3e, r29 ; 62 |
72: cd bf out 0x3d, r28 ; 61 |
00000074 <__do_copy_data>: |
74: 11 e0 ldi r17, 0x01 ; 1 |
76: a0 e0 ldi r26, 0x00 ; 0 |
78: b1 e0 ldi r27, 0x01 ; 1 |
7a: e4 ed ldi r30, 0xD4 ; 212 |
7c: f0 e0 ldi r31, 0x00 ; 0 |
7e: 02 c0 rjmp .+4 ; 0x84 <.do_copy_data_start> |
00000080 <.do_copy_data_loop>: |
80: 05 90 lpm r0, Z+ |
82: 0d 92 st X+, r0 |
00000084 <.do_copy_data_start>: |
84: a0 30 cpi r26, 0x00 ; 0 |
86: b1 07 cpc r27, r17 |
88: d9 f7 brne .-10 ; 0x80 <.do_copy_data_loop> |
0000008a <__do_clear_bss>: |
8a: 11 e0 ldi r17, 0x01 ; 1 |
8c: a0 e0 ldi r26, 0x00 ; 0 |
8e: b1 e0 ldi r27, 0x01 ; 1 |
90: 01 c0 rjmp .+2 ; 0x94 <.do_clear_bss_start> |
00000092 <.do_clear_bss_loop>: |
92: 1d 92 st X+, r1 |
00000094 <.do_clear_bss_start>: |
94: a0 30 cpi r26, 0x00 ; 0 |
96: b1 07 cpc r27, r17 |
98: e1 f7 brne .-8 ; 0x92 <.do_clear_bss_loop> |
9a: 0c 94 5e 00 jmp 0xbc ; 0xbc <main> |
0000009e <__bad_interrupt>: |
9e: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> |
000000a2 <delay_ms>: |
void delay_ms(unsigned int ms) |
/* delay for a minimum of <ms> */ |
{ |
a2: 9c 01 movw r18, r24 |
a4: e0 e8 ldi r30, 0x80 ; 128 |
a6: f7 e0 ldi r31, 0x07 ; 7 |
a8: 05 c0 rjmp .+10 ; 0xb4 <delay_ms+0x12> |
*/ |
void |
_delay_loop_2(uint16_t __count) |
{ |
__asm__ volatile ( |
aa: cf 01 movw r24, r30 |
ac: 01 97 sbiw r24, 0x01 ; 1 |
ae: f1 f7 brne .-4 ; 0xac <delay_ms+0xa> |
// we use a calibrated macro. This is more |
// accurate and not so much compiler dependent |
// as self made code. |
while(ms){ |
_delay_ms(0.96); |
ms--; |
b0: 21 50 subi r18, 0x01 ; 1 |
b2: 30 40 sbci r19, 0x00 ; 0 |
b4: 21 15 cp r18, r1 |
b6: 31 05 cpc r19, r1 |
b8: c1 f7 brne .-16 ; 0xaa <delay_ms+0x8> |
ba: 08 95 ret |
000000bc <main>: |
} |
} |
/* new style */ |
int main(void) |
{ |
bc: 3d 9a sbi 0x07, 5 ; 7 |
/* INITIALIZE */ |
/* enable PC5 as output */ |
DDRC|= (1<<DDC5); |
/* PC5 is 5 (see file include/avr/iom8.h) and 1<<PC5 is 00100000 |
* This can also be written as _BV(PC5)*/ |
while (1) { |
/* led on, pin=0 */ |
PORTC &= ~(1<<PC5); |
be: 45 98 cbi 0x08, 5 ; 8 |
delay_ms(50); |
c0: 82 e3 ldi r24, 0x32 ; 50 |
c2: 90 e0 ldi r25, 0x00 ; 0 |
c4: 0e 94 51 00 call 0xa2 ; 0xa2 <delay_ms> |
/* set output to 5V, LED off */ |
PORTC|= (1<<PC5); |
c8: 45 9a sbi 0x08, 5 ; 8 |
delay_ms(50); |
ca: 82 e3 ldi r24, 0x32 ; 50 |
cc: 90 e0 ldi r25, 0x00 ; 0 |
ce: 0e 94 51 00 call 0xa2 ; 0xa2 <delay_ms> |
d2: f5 cf rjmp .-22 ; 0xbe <main+0x2> |
/programy/C/avr/tests/ATmega168/default/blik.map |
---|
0,0 → 1,347 |
Archive member included because of file (symbol) |
c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
blik.o (__do_copy_data) |
c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
blik.o (__do_clear_bss) |
Discarded input sections |
.stabstr 0x00000000 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
Memory Configuration |
Name Origin Length Attributes |
text 0x00000000 0x00020000 xr |
data 0x00800060 0x0000ffa0 rw !x |
eeprom 0x00810000 0x00010000 rw !x |
*default* 0x00000000 0xffffffff |
Linker script and memory map |
Address of section .data set to 0x800100 |
LOAD c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
LOAD blik.o |
LOAD c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a |
LOAD c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5\libc.a |
LOAD c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\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 0xd4 |
*(.vectors) |
.vectors 0x00000000 0x68 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
0x00000000 __vectors |
0x00000000 __vector_default |
*(.vectors) |
*(.progmem.gcc*) |
*(.progmem*) |
0x00000068 . = ALIGN (0x2) |
0x00000068 __trampolines_start = . |
*(.trampolines) |
.trampolines 0x00000068 0x0 linker stubs |
*(.trampolines*) |
0x00000068 __trampolines_end = . |
*(.jumptables) |
*(.jumptables*) |
*(.lowtext) |
*(.lowtext*) |
0x00000068 __ctors_start = . |
*(.ctors) |
0x00000068 __ctors_end = . |
0x00000068 __dtors_start = . |
*(.dtors) |
0x00000068 __dtors_end = . |
SORT(*)(.ctors) |
SORT(*)(.dtors) |
*(.init0) |
.init0 0x00000068 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
0x00000068 __init |
*(.init0) |
*(.init1) |
*(.init1) |
*(.init2) |
.init2 0x00000068 0xc c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
*(.init2) |
*(.init3) |
*(.init3) |
*(.init4) |
.init4 0x00000074 0x16 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
0x00000074 __do_copy_data |
.init4 0x0000008a 0x10 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
0x0000008a __do_clear_bss |
*(.init4) |
*(.init5) |
*(.init5) |
*(.init6) |
*(.init6) |
*(.init7) |
*(.init7) |
*(.init8) |
*(.init8) |
*(.init9) |
.init9 0x0000009a 0x4 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
*(.init9) |
*(.text) |
.text 0x0000009e 0x4 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
0x0000009e __vector_22 |
0x0000009e __vector_1 |
0x0000009e __vector_24 |
0x0000009e __vector_12 |
0x0000009e __bad_interrupt |
0x0000009e __vector_6 |
0x0000009e __vector_3 |
0x0000009e __vector_23 |
0x0000009e __vector_25 |
0x0000009e __vector_11 |
0x0000009e __vector_13 |
0x0000009e __vector_17 |
0x0000009e __vector_19 |
0x0000009e __vector_7 |
0x0000009e __vector_5 |
0x0000009e __vector_4 |
0x0000009e __vector_9 |
0x0000009e __vector_2 |
0x0000009e __vector_21 |
0x0000009e __vector_15 |
0x0000009e __vector_8 |
0x0000009e __vector_14 |
0x0000009e __vector_10 |
0x0000009e __vector_16 |
0x0000009e __vector_18 |
0x0000009e __vector_20 |
.text 0x000000a2 0x32 blik.o |
0x000000bc main |
0x000000a2 delay_ms |
.text 0x000000d4 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
.text 0x000000d4 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
0x000000d4 . = ALIGN (0x2) |
*(.text.*) |
.text.libgcc 0x000000d4 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
.text.libgcc 0x000000d4 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
0x000000d4 . = ALIGN (0x2) |
*(.fini9) |
*(.fini9) |
*(.fini8) |
*(.fini8) |
*(.fini7) |
*(.fini7) |
*(.fini6) |
*(.fini6) |
*(.fini5) |
*(.fini5) |
*(.fini4) |
*(.fini4) |
*(.fini3) |
*(.fini3) |
*(.fini2) |
*(.fini2) |
*(.fini1) |
*(.fini1) |
*(.fini0) |
*(.fini0) |
0x000000d4 _etext = . |
.data 0x00800100 0x0 load address 0x000000d4 |
0x00800100 PROVIDE (__data_start, .) |
*(.data) |
.data 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
.data 0x00800100 0x0 blik.o |
.data 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
.data 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
*(.data*) |
*(.rodata) |
*(.rodata*) |
*(.gnu.linkonce.d*) |
0x00800100 . = ALIGN (0x2) |
0x00800100 _edata = . |
0x00800100 PROVIDE (__data_end, .) |
.bss 0x00800100 0x0 |
0x00800100 PROVIDE (__bss_start, .) |
*(.bss) |
.bss 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
.bss 0x00800100 0x0 blik.o |
.bss 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_copy_data.o) |
.bss 0x00800100 0x0 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/avr5\libgcc.a(_clear_bss.o) |
*(.bss*) |
*(COMMON) |
0x00800100 PROVIDE (__bss_end, .) |
0x000000d4 __data_load_start = LOADADDR (.data) |
0x000000d4 __data_load_end = (__data_load_start + SIZEOF (.data)) |
.noinit 0x00800100 0x0 |
0x00800100 PROVIDE (__noinit_start, .) |
*(.noinit*) |
0x00800100 PROVIDE (__noinit_end, .) |
0x00800100 _end = . |
0x00800100 PROVIDE (__heap_start, .) |
.eeprom 0x00810000 0x0 |
*(.eeprom*) |
0x00810000 __eeprom_end = . |
.stab 0x00000000 0x36c |
*(.stab) |
.stab 0x00000000 0x36c c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
.stabstr 0x00000000 0x84 |
*(.stabstr) |
.stabstr 0x00000000 0x84 c:/program files/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm168.o |
.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 blik.o |
.debug_pubnames |
0x00000000 0x28 |
*(.debug_pubnames) |
.debug_pubnames |
0x00000000 0x28 blik.o |
.debug_info 0x00000000 0x13d |
*(.debug_info) |
.debug_info 0x00000000 0x13d blik.o |
*(.gnu.linkonce.wi.*) |
.debug_abbrev 0x00000000 0xd3 |
*(.debug_abbrev) |
.debug_abbrev 0x00000000 0xd3 blik.o |
.debug_line 0x00000000 0xfc |
*(.debug_line) |
.debug_line 0x00000000 0xfc blik.o |
.debug_frame 0x00000000 0x30 |
*(.debug_frame) |
.debug_frame 0x00000000 0x30 blik.o |
.debug_str 0x00000000 0xdd |
*(.debug_str) |
.debug_str 0x00000000 0xdd blik.o |
0x11a (size before relaxing) |
.debug_loc 0x00000000 0x28 |
*(.debug_loc) |
.debug_loc 0x00000000 0x28 blik.o |
.debug_macinfo |
*(.debug_macinfo) |
OUTPUT(blik.elf elf32-avr) |
LOAD linker stubs |
/programy/C/avr/tests/ATmega168/default/blik.o |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/C/avr/tests/ATmega168/default/dep/blik.o.d |
---|
0,0 → 1,27 |
blik.o: ../blik.c c:/program\ files/winavr/bin/../avr/include/avr/io.h \ |
c:/program\ files/winavr/bin/../avr/include/avr/sfr_defs.h \ |
c:/program\ files/winavr/bin/../avr/include/inttypes.h \ |
c:/program\ files/winavr/bin/../avr/include/stdint.h \ |
c:/program\ files/winavr/bin/../avr/include/avr/iom168.h \ |
c:/program\ files/winavr/bin/../avr/include/avr/iomx8.h \ |
c:/program\ files/winavr/bin/../avr/include/avr/portpins.h \ |
c:/program\ files/winavr/bin/../avr/include/avr/version.h \ |
c:/program\ files/winavr/bin/../avr/include/util/delay.h |
c:/program\ files/winavr/bin/../avr/include/avr/io.h: |
c:/program\ files/winavr/bin/../avr/include/avr/sfr_defs.h: |
c:/program\ files/winavr/bin/../avr/include/inttypes.h: |
c:/program\ files/winavr/bin/../avr/include/stdint.h: |
c:/program\ files/winavr/bin/../avr/include/avr/iom168.h: |
c:/program\ files/winavr/bin/../avr/include/avr/iomx8.h: |
c:/program\ files/winavr/bin/../avr/include/avr/portpins.h: |
c:/program\ files/winavr/bin/../avr/include/avr/version.h: |
c:/program\ files/winavr/bin/../avr/include/util/delay.h: |
/programy/C/avr/tests/ATmega168/uart/default/Makefile |
---|
0,0 → 1,78 |
############################################################################### |
# Makefile for the project main |
############################################################################### |
## General Flags |
PROJECT = main |
MCU = atmega168 |
TARGET = main.elf |
CC = avr-gcc.exe |
## Options common to compile, link and assembly rules |
COMMON = -mmcu=$(MCU) |
## Compile options common for all C compilation units. |
CFLAGS = $(COMMON) |
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=14318180UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d |
## Assembly specific flags |
ASMFLAGS = $(COMMON) |
ASMFLAGS += $(CFLAGS) |
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 |
## Linker flags |
LDFLAGS = $(COMMON) |
LDFLAGS += -Wl,-Map=main.map |
## Intel Hex file production flags |
HEX_FLASH_FLAGS = -R .eeprom |
HEX_EEPROM_FLAGS = -j .eeprom |
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" |
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings |
## Objects that must be built in order to link |
OBJECTS = main.o uart.o |
## Objects explicitly added by the user |
LINKONLYOBJECTS = |
## Build |
all: $(TARGET) main.hex main.eep main.lss size |
## Compile |
main.o: ../main.c |
$(CC) $(INCLUDES) $(CFLAGS) -c $< |
uart.o: ../uart.c |
$(CC) $(INCLUDES) $(CFLAGS) -c $< |
##Link |
$(TARGET): $(OBJECTS) |
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) |
%.hex: $(TARGET) |
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ |
%.eep: $(TARGET) |
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 |
%.lss: $(TARGET) |
avr-objdump -h -S $< > $@ |
size: ${TARGET} |
@echo |
@avr-size -C --mcu=${MCU} ${TARGET} |
## Clean target |
.PHONY: clean |
clean: |
-rm -rf $(OBJECTS) main.elf dep/* main.hex main.eep main.lss main.map |
## Other dependencies |
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) |
/programy/C/avr/tests/ATmega168/uart/default/main.elf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programy/C/avr/tests/ATmega168/uart/main.aps |
---|
0,0 → 1,0 |
<AVRStudio><MANAGEMENT><ProjectName>main</ProjectName><Created>27-Apr-2008 13:39:11</Created><LastEdit>27-Apr-2008 15:20:23</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>27-Apr-2008 13:39:11</Created><Version>4</Version><Build>4, 14, 0, 589</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\main.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\KAKLIK\projekty\programy\C\avr\tests\ATmega168\uart\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>ICE50</CURRENT_TARGET><CURRENT_PART>ATmega168.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>uart.c</SOURCEFILE><HEADERFILE>uart.h</HEADERFILE><OTHERFILE>default\main.lss</OTHERFILE><OTHERFILE>default\main.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega168</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>main.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=14318180UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\WinAVR\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>uart.c</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>uart.h</FileName><Status>1</Status></File00002></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> |
/programy/C/avr/tests/ATmega168/uart/main.aws |
---|
0,0 → 1,0 |
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA168"/><Files/></AVRWorkspace> |
/programy/C/avr/tests/ATmega168/uart/main.c |
---|
0,0 → 1,27 |
#include <string.h> |
#include <avr/pgmspace.h> |
#include <avr/sleep.h> |
#include "uart.h" |
int main() |
{ |
/* we will just use ordinary idle mode */ |
// set_sleep_mode(SLEEP_MODE_IDLE); |
/* setup uart */ |
uart_init(); |
/* setup sd card slot */ |
while(1) |
{ |
uart_puts_p(PSTR("test000000000000000")); |
} |
return 1; |
} |
/programy/C/avr/tests/ATmega168/uart/uart.c |
---|
0,0 → 1,198 |
/* |
* Copyright (c) 2006-2007 by Roland Riegel <feedback@roland-riegel.de> |
* |
* This file is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 2 as |
* published by the Free Software Foundation. |
*/ |
#include <stdio.h> |
#include <avr/interrupt.h> |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <avr/sfr_defs.h> |
#include <avr/sleep.h> |
#include "uart.h" |
/* some mcus have multiple uarts */ |
#ifdef UDR0 |
#define UBRRH UBRR0H |
#define UBRRL UBRR0L |
#define UDR UDR0 |
#define UCSRA UCSR0A |
#define UDRE UDRE0 |
#define RXC RXC0 |
#define UCSRB UCSR0B |
#define RXEN RXEN0 |
#define TXEN TXEN0 |
#define RXCIE RXCIE0 |
#define UCSRC UCSR0C |
#define URSEL |
#define UCSZ0 UCSZ00 |
#define UCSZ1 UCSZ01 |
#define UCSRC_SELECT 0 |
#else |
#define UCSRC_SELECT (1 << URSEL) |
#endif |
#ifndef USART_RXC_vect |
#if defined(UART0_RX_vect) |
#define USART_RXC_vect UART0_RX_vect |
#elif defined(UART_RX_vect) |
#define USART_RXC_vect UART_RX_vect |
#elif defined(USART0_RX_vect) |
#define USART_RXC_vect USART0_RX_vect |
#elif defined(USART_RX_vect) |
#define USART_RXC_vect USART_RX_vect |
#elif defined(USART0_RXC_vect) |
#define USART_RXC_vect USART0_RXC_vect |
#elif defined(USART_RXC_vect) |
#define USART_RXC_vect USART_RXC_vect |
#else |
#error "Uart receive complete interrupt not defined!" |
#endif |
#endif |
#define BAUD 9600UL |
#define UBRRVAL (F_CPU/(BAUD*16)-1) |
#define USE_SLEEP 1 |
void uart_init() |
{ |
/* set baud rate */ |
UBRRH = UBRRVAL >> 8; |
UBRRL = UBRRVAL & 0xff; |
/* set frame format: 8 bit, no parity, 1 bit */ |
UCSRC = UCSRC_SELECT | (1 << UCSZ1) | (1 << UCSZ0); |
/* enable serial receiver and transmitter */ |
#if !USE_SLEEP |
UCSRB = (1 << RXEN) | (1 << TXEN); |
#else |
UCSRB = (1 << RXEN) | (1 << TXEN) | (1 << RXCIE); |
#endif |
} |
void uart_putc(uint8_t c) |
{ |
if(c == '\n') |
uart_putc('\r'); |
/* wait until transmit buffer is empty */ |
while(!(UCSRA & (1 << UDRE))); |
/* send next byte */ |
UDR = c; |
} |
void uart_putc_hex(uint8_t b) |
{ |
/* upper nibble */ |
if((b >> 4) < 0x0a) |
uart_putc((b >> 4) + '0'); |
else |
uart_putc((b >> 4) - 0x0a + 'a'); |
/* lower nibble */ |
if((b & 0x0f) < 0x0a) |
uart_putc((b & 0x0f) + '0'); |
else |
uart_putc((b & 0x0f) - 0x0a + 'a'); |
} |
void uart_putw_hex(uint16_t w) |
{ |
uart_putc_hex((uint8_t) (w >> 8)); |
uart_putc_hex((uint8_t) (w & 0xff)); |
} |
void uart_putdw_hex(uint32_t dw) |
{ |
uart_putw_hex((uint16_t) (dw >> 16)); |
uart_putw_hex((uint16_t) (dw & 0xffff)); |
} |
void uart_putw_dec(uint16_t w) |
{ |
uint16_t num = 10000; |
uint8_t started = 0; |
while(num > 0) |
{ |
uint8_t b = w / num; |
if(b > 0 || started || num == 1) |
{ |
uart_putc('0' + b); |
started = 1; |
} |
w -= b * num; |
num /= 10; |
} |
} |
void uart_putdw_dec(uint32_t dw) |
{ |
uint32_t num = 1000000000; |
uint8_t started = 0; |
while(num > 0) |
{ |
uint8_t b = dw / num; |
if(b > 0 || started || num == 1) |
{ |
uart_putc('0' + b); |
started = 1; |
} |
dw -= b * num; |
num /= 10; |
} |
} |
void uart_puts(const char* str) |
{ |
while(*str) |
uart_putc(*str++); |
} |
void uart_puts_p(PGM_P str) |
{ |
while(1) |
{ |
uint8_t b = pgm_read_byte_near(str++); |
if(!b) |
break; |
uart_putc(b); |
} |
} |
uint8_t uart_getc() |
{ |
/* wait until receive buffer is full */ |
#if USE_SLEEP |
uint8_t sreg = SREG; |
sei(); |
while(!(UCSRA & (1 << RXC))) |
sleep_mode(); |
SREG = sreg; |
#else |
while(!(UCSRA & (1 << RXC))); |
#endif |
uint8_t b = UDR; |
if(b == '\r') |
b = '\n'; |
return b; |
} |
EMPTY_INTERRUPT(USART_RXC_vect) |
/programy/C/avr/tests/ATmega168/uart/uart.h |
---|
0,0 → 1,33 |
/* |
* Copyright (c) 2006-2007 by Roland Riegel <feedback@roland-riegel.de> |
* |
* This file is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 2 as |
* published by the Free Software Foundation. |
*/ |
#ifndef UART_H |
#define UART_H |
#include <stdint.h> |
#include <avr/pgmspace.h> |
void uart_init(); |
void uart_putc(uint8_t c); |
void uart_putc_hex(uint8_t b); |
void uart_putw_hex(uint16_t w); |
void uart_putdw_hex(uint32_t dw); |
void uart_putw_dec(uint16_t w); |
void uart_putdw_dec(uint32_t dw); |
void uart_puts(const char* str); |
void uart_puts_p(PGM_P str); |
uint8_t uart_getc(); |
#endif |