Weiß keiner Rat?
Hier nochmal die Files (dürften jetzt etwas anders sein):
.c-File
MakeFile:Code:/********************************************* * 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 : ATMEGA8 * Clock frequency : Internal clock 1 Mhz (factory default) *********************************************/ #include <avr/io.h> #include <inttypes.h> //#define OLD 1 #ifdef OLD /* compatibilty macros for old style */ #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif #endif /*OLD*/ void delay_ms(unsigned short ms) /* delay for a minimum of <ms> */ /* with a 1Mhz clock, the resolution is 1 ms */ { uint8_t inner,inner1; while (ms) { inner = 100; while (inner) { inner--; inner1 = 70; while (inner1) { inner1--; } } ms--; } } #ifdef OLD // old style now depricated: void main(void) { // enable PC5 as output sbi(DDRC,PC5); while (1) { // led on, pin=0 cbi(PORTC,PC5); delay_ms(500); // set output to 5V, LED off sbi(PORTC,PC5); delay_ms(500); } } #else /* new style */ void main(void) { /* INITIALIZE */ /* enable PC5 as output */ DDRC|= _BV(PC5); /* BLINK, BLINK ... */ /* PC5 is 5 (see file include/avr/iom8.h) and _BV(PC5) is 00100000 */ while (1) { /* led on, pin=0 */ PORTC &= ~_BV(PC5); delay_ms(500); /* set output to 5V, LED off */ PORTC|= _BV(PC5); delay_ms(500); } } #endif /*OLD*/
prg_load_ucCode:# makefile, written by guido socher MCU=atmega32 CC=avr-gcc OBJCOPY=avr-objcopy # optimize for size: CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues #------------------- all: avrm8ledtest.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." #------------------- avrm8ledtest.hex : avrm8ledtest.out $(OBJCOPY) -R .eeprom -O ihex avrm8ledtest.out avrm8ledtest.hex avrm8ledtest.out : avrm8ledtest.o $(CC) $(CFLAGS) -o avrm8ledtest.out -Wl,-Map,avrm8ledtest.map avrm8ledtest.o avrm8ledtest.o : avrm8ledtest.c $(CC) $(CFLAGS) -Os -c avrm8ledtest.c #------------------ load: avrm8ledtest.hex ./prg_load_uc avrm8ledtest.hex # here is a pre-compiled version in case you have trouble with # your development environment load_pre: avrm8ledtest_pre.hex ./prg_load_uc avrm8ledtest.hex # loaduisp: avrm8ledtest.hex ./prg_load_uc -u avrm8ledtest.hex # here is a pre-compiled version in case you have trouble with # your development environment load_preuisp: avrm8ledtest_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 *t.hex #-------------------
Code:#!/bin/sh prg="adude" if [ "$1" = "-u" ]; then shift; prg="uisp" fi if [ -z "$1" -o "$1" = "-h" -o "$1" = "--help" ]; then echo "prg_load_uc -- load a .hex file into a atmega8 microcontroller" echo "" echo "Usage: prg_load_uc [-hu] File.hex" echo "" echo "OPTIONS: -h this help" echo " -u use uisp instead of avrdude" echo " avrdude can automatically detect dapa or avrusb500." echo " uisp can only be used with the parallel port dapa." echo "" echo "This script can be easily adapted to different Programmer types" exit 0 fi pfile="$1" if [ "$prg" = "uisp" ]; then set -x uisp -dlpt=/dev/parport0 --erase -dprog=dapa uisp -dlpt=/dev/parport0 --upload if="$pfile" -dprog=dapa -v=3 --hash=32 --verify set +x fi if [ "$prg" = "adude" ]; then if grep "Vendor=0403 ProdID=6001" /proc/bus/usb/devices > /dev/null ; then set -x avrdude -F -p m8 -c avrusb500 -e -U flash:w:"$pfile" set +x else set -x avrdude -F -p m8 -c dapa -e -U flash:w:"$pfile" set +x fi fi







Zitieren
Lesezeichen