Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Ignore whitespace Rev 494 → Rev 495

/programy/C/avr/tests/ATmega128/Makefile
0,0 → 1,61
# makefile, written by guido socher
MCU=atmega128
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/ATmega128/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 8000000UL // 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(100);
+ /* set output to 5V, LED off */
+ PORTC &= ~(1<<LED);
+ cekej(1000);
+ }
+ return(0);
+}
/programy/C/avr/tests/ATmega128/blik.hex
0,0 → 1,18
:100000000C9446000C9465000C9465000C946500FB
:100010000C9465000C9465000C9465000C946500CC
:100020000C9465000C9465000C9465000C946500BC
:100030000C9465000C9465000C9465000C946500AC
:100040000C9465000C9465000C9465000C9465009C
:100050000C9465000C9465000C9465000C9465008C
:100060000C9465000C9465000C9465000C9465007C
:100070000C9465000C9465000C9465000C9465006C
:100080000C9465000C9465000C94650011241FBE4F
:10009000CFEFD0E1DEBFCDBF11E0A0E0B1E0E8E0FE
:1000A000F1E000E00BBF02C007900D92A030B10755
:1000B000D9F711E0A0E0B1E001C01D92A030B10776
:1000C000E1F70E9473000C9483000C9400009C01E3
:1000D00006C080E897E00197F1F7215030402115E4
:1000E0003105B9F70895CFEFD0E1DEBFCDBFA59AB6
:1000F000AD9A84E690E00E946700AD9888EE93E0A8
:080100000E946700F5CFFFCF5C
:00000001FF
/programy/C/avr/tests/ATmega128/blik.map
0,0 → 1,361
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/crtm128.o (exit)
/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/crtm128.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 0x108
*(.vectors)
.vectors 0x00000000 0x8c /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
0x00000000 __vectors
0x00000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
*(.progmem*)
0x0000008c . = ALIGN (0x2)
0x0000008c __trampolines_start = .
*(.trampolines)
.trampolines 0x0000008c 0x0 linker stubs
*(.trampolines*)
0x0000008c __trampolines_end = .
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000008c __ctors_start = .
*(.ctors)
0x0000008c __ctors_end = .
0x0000008c __dtors_start = .
*(.dtors)
0x0000008c __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000008c 0x0 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
0x0000008c __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000008c 0xc /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000098 0x1a /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
0x00000098 __do_copy_data
.init4 0x000000b2 0x10 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x000000b2 __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x000000c2 0x8 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
*(.init9)
*(.text)
.text 0x000000ca 0x4 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
0x000000ca __vector_22
0x000000ca __vector_28
0x000000ca __vector_1
0x000000ca __vector_32
0x000000ca __vector_34
0x000000ca __vector_24
0x000000ca __vector_12
0x000000ca __bad_interrupt
0x000000ca __vector_6
0x000000ca __vector_31
0x000000ca __vector_3
0x000000ca __vector_23
0x000000ca __vector_30
0x000000ca __vector_25
0x000000ca __vector_11
0x000000ca __vector_13
0x000000ca __vector_17
0x000000ca __vector_19
0x000000ca __vector_7
0x000000ca __vector_27
0x000000ca __vector_5
0x000000ca __vector_33
0x000000ca __vector_4
0x000000ca __vector_9
0x000000ca __vector_2
0x000000ca __vector_21
0x000000ca __vector_15
0x000000ca __vector_29
0x000000ca __vector_8
0x000000ca __vector_26
0x000000ca __vector_14
0x000000ca __vector_10
0x000000ca __vector_16
0x000000ca __vector_18
0x000000ca __vector_20
.text 0x000000ce 0x38 blik.o
0x000000e6 main
0x000000ce cekej
.text 0x00000106 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.text 0x00000106 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x00000106 . = ALIGN (0x2)
*(.text.*)
.text.libgcc 0x00000106 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
.text.libgcc 0x00000106 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_clear_bss.o)
0x00000106 . = ALIGN (0x2)
*(.fini9)
.fini9 0x00000106 0x0 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
0x00000106 exit
0x00000106 _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x00000106 0x2 /usr/lib/gcc/avr/4.2.2/avr5/libgcc.a(_exit.o)
*(.fini0)
0x00000108 _etext = .
 
.data 0x00800100 0x0 load address 0x00000108
0x00800100 PROVIDE (__data_start, .)
*(.data)
.data 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.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(_clear_bss.o)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x00800100 . = ALIGN (0x2)
0x00800100 _edata = .
0x00800100 PROVIDE (__data_end, .)
 
.bss 0x00800100 0x0 load address 0x00000108
0x00800100 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x00800100 0x0 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.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(_clear_bss.o)
*(.bss*)
*(COMMON)
0x00800100 PROVIDE (__bss_end, .)
0x00000108 __data_load_start = LOADADDR (.data)
0x00000108 __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 0x804
*(.stab)
.stab 0x00000000 0x414 /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.o
.stab 0x00000414 0x3f0 blik.o
0x3fc (size before relaxing)
 
.stabstr 0x00000000 0x7ef
*(.stabstr)
.stabstr 0x00000000 0x7ef /usr/lib/gcc/avr/4.2.2/../../../../avr/lib/avr5/crtm128.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/ATmega128/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