Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Ignore whitespace Rev 494 → Rev 495

/programy/C/avr/tests/ATmega168/Makefile
0,0 → 1,61
# makefile, written by guido socher
MCU=atmega168
CC=avr-gcc
OBJCOPY=avr-objcopy
# optimize for size:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
#-------------------
all: blik.hex
#-------------------
help:
@echo "Usage: make all|load|load_pre|rdfuses|wrfuse1mhz|wrfuse4mhz|wrfusecrystal"
@echo "Warning: you will not be able to undo wrfusecrystal unless you connect an"
@echo " external crystal! uC is dead after wrfusecrystal if you do not"
@echo " have an external crystal."
#-------------------
blik.hex : blik.out
$(OBJCOPY) -R .eeprom -O ihex blik.out blik.hex
blik.out : blik.o
$(CC) $(CFLAGS) -o blik.out -Wl,-Map,blik.map blik.o
blik.o : blik.c
$(CC) $(CFLAGS) -Os -c blik.c
#------------------
load: $(FILE).hex
./prg_load_uc $(FILE).hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_pre: $(FILE).hex
./prg_load_uc $(FILE)_pre.hex
#
loaduisp: $(FILE).hex
./prg_load_uc -u $(FILE).hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_preuisp: $(FILE)_pre.hex
./prg_load_uc -u avrm8ledtest.hex
#-------------------
# fuse byte settings:
# Atmel AVR ATmega8
# Fuse Low Byte = 0xe1 (1MHz internal), 0xe3 (4MHz internal), 0xe4 (8MHz internal)
# Fuse High Byte = 0xd9
# Factory default is 0xe1 for low byte and 0xd9 for high byte
# Check this with make rdfuses
rdfuses:
./prg_fusebit_uc -r
# use internal RC oscillator 1 Mhz
wrfuse1mhz:
./prg_fusebit_uc -w 1
# use internal RC oscillator 4 Mhz
wrfuse4mhz:
./prg_fusebit_uc -w 4
# use external 3-8 Mhz crystal
# Warning: you can not reset this to intenal unless you connect a crystal!!
wrfusecrystal:
@echo "Warning: The external crystal setting can not be changed back without a working crystal"
@echo " You have 3 seconds to abort this with crtl-c"
@sleep 3
./prg_fusebit_uc -w 0
#-------------------
clean:
rm -f *.o *.map *.out *.hex
#-------------------
/programy/C/avr/tests/ATmega168/blik.c
0,0 → 1,48
/*********************************************
* vim: set sw=8 ts=8 si :
* Author: Guido Socher, Copyright: GPL
* This program is to test the led connected to
* PC5.
* See http://linuxfocus.org/English/November2004/
* for details.
* Chip type : ATMEGA644
* Clock frequency : Internal clock 1 Mhz (factory default)
*********************************************/
#include <avr/io.h>
#include <inttypes.h>
#define F_CPU 16000000UL // 8 MHz
#include <util/delay.h>
 
+
+void cekej(int ms)
+{
+
+ // 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--;
+ }
+}
+
+int main(void)
+{
+ /* INITIALIZE */
+ /* enable PC5 as output */
+ DDRC|= (1<<LED);
+
+ /* 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<<LED);
+ cekej(1000);
+ /* set output to 5V, LED off */
+ PORTC &= ~(1<<LED);
+ cekej(100);
+ }
+ return(0);
+}
/programy/C/avr/tests/ATmega168/blik.hex
0,0 → 1,15
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD4E02A
:10007000DEBFCDBF11E0A0E0B1E0E0EEF0E002C0F5
:1000800005900D92A030B107D9F711E0A0E0B1E0E2
:1000900001C01D92A030B107E1F70E945F000C94EF
:1000A0006F000C9400009C0106C080E09FE0019767
:1000B000F1F72150304021153105B9F70895CFEF00
:1000C000D4E0DEBFCDBF3D9A459A88EE93E00E9412
:1000D0005300459884E690E00E945300F5CFFFCF8F
:00000001FF
/programy/C/avr/tests/ATmega168/blik.map
0,0 → 1,358
Archive member included because of file (symbol)
 
/usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
/usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o (exit)
/usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
blik.o (__do_copy_data)
/usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
blik.o (__do_clear_bss)
 
Memory Configuration
 
Name Origin Length Attributes
text 0x00000000 0x00020000 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
 
Address of section .data set to 0x800100
LOAD /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
LOAD blik.o
LOAD /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a
LOAD /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/libc.a
LOAD /usr/lib/gcc/avr/4.2.2/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 0xe0
*(.vectors)
.vectors 0x00000000 0x68 /usr/lib/gcc/avr/4.2.2/../../../../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 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
0x00000068 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x00000068 0xc /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000074 0x16 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
0x00000074 __do_copy_data
.init4 0x0000008a 0x10 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x0000008a __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000009a 0x8 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
*(.init9)
*(.text)
.text 0x000000a2 0x4 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
0x000000a2 __vector_22
0x000000a2 __vector_1
0x000000a2 __vector_24
0x000000a2 __vector_12
0x000000a2 __bad_interrupt
0x000000a2 __vector_6
0x000000a2 __vector_3
0x000000a2 __vector_23
0x000000a2 __vector_25
0x000000a2 __vector_11
0x000000a2 __vector_13
0x000000a2 __vector_17
0x000000a2 __vector_19
0x000000a2 __vector_7
0x000000a2 __vector_5
0x000000a2 __vector_4
0x000000a2 __vector_9
0x000000a2 __vector_2
0x000000a2 __vector_21
0x000000a2 __vector_15
0x000000a2 __vector_8
0x000000a2 __vector_14
0x000000a2 __vector_10
0x000000a2 __vector_16
0x000000a2 __vector_18
0x000000a2 __vector_20
.text 0x000000a6 0x38 blik.o
0x000000be main
0x000000a6 cekej
.text 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.text 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
.text 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x000000de . = ALIGN (0x2)
*(.text.*)
.text.libgcc 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.text.libgcc 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
.text.libgcc 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x000000de . = ALIGN (0x2)
*(.fini9)
.fini9 0x000000de 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
0x000000de exit
0x000000de _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x000000de 0x2 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
*(.fini0)
0x000000e0 _etext = .
 
.data 0x00800100 0x0 load address 0x000000e0
0x00800100 PROVIDE (__data_start, .)
*(.data)
.data 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
.data 0x00800100 0x0 blik.o
.data 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.data 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
.data 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x00800100 . = ALIGN (0x2)
0x00800100 _edata = .
0x00800100 PROVIDE (__data_end, .)
 
.bss 0x00800100 0x0 load address 0x000000e0
0x00800100 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
.bss 0x00800100 0x0 blik.o
.bss 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.bss 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_copy_data.o)
.bss 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
*(.bss*)
*(COMMON)
0x00800100 PROVIDE (__bss_end, .)
0x000000e0 __data_load_start = LOADADDR (.data)
0x000000e0 __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 = .
 
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
 
.lock
*(.lock*)
 
.signature
*(.signature*)
 
.stab 0x00000000 0x744
*(.stab)
.stab 0x00000000 0x378 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm168.o
.stab 0x00000378 0x3cc blik.o
0x3d8 (size before relaxing)
 
.stabstr 0x00000000 0x767
*(.stabstr)
.stabstr 0x00000000 0x767 /usr/lib/gcc/avr/4.2.2/../../../../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
*(.debug_aranges)
 
.debug_pubnames
*(.debug_pubnames)
 
.debug_info
*(.debug_info)
*(.gnu.linkonce.wi.*)
 
.debug_abbrev
*(.debug_abbrev)
 
.debug_line
*(.debug_line)
 
.debug_frame
*(.debug_frame)
 
.debug_str
*(.debug_str)
 
.debug_loc
*(.debug_loc)
 
.debug_macinfo
*(.debug_macinfo)
OUTPUT(blik.out elf32-avr)
LOAD linker stubs
/programy/C/avr/tests/ATmega168/blik.out
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property