PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Asuro - Linux - Console - Flasher



Tekeli
09.08.2005, 11:51
Hallo,
für die unter Euch, die Linux benutzen und kein QT drauf haben, aber trotzdem den Asuro von einer Console aus flashen wollen.
Es gab schon diesbezüglich eine Anfrage hier im Forum:
https://www.roboternetz.de/phpBB2/viewtopic.php?t=9328

Vorgehensweise:

tar -xvzf Flasher.tar.gz
cd Flasher
make
./flasher -ttyS0 test.hex

Es wurden bloß die Originalsourcen von der ASURO-CD angepasst. QT und Windows Zeug wurde entfernt.

Best wishes

duhh
09.08.2005, 14:30
Sehr gut, da ich Gentoo 2005 auf Fluxbox laufen hab und dementsprechend auch kein qt hab
danke danke danke

izaseba
09.08.2005, 16:32
hallo,
und was ist mit asurocon , es steckt im Tools Ordner?
Es ist ein Konsolentool, das benutze ich von anfang an
:-k

Gruß Sebastian

Tekeli
09.08.2005, 16:55
Hallo izaseba,

wie gesagt, nicht alle wollen,können,müssen :) KDE benutzen
und asurocon verlangt ledier nach der qt-lib.


./asurocon
./asurocon: error while loading shared libraries: libqt-mt.so.3: cannot open shared object file: No such file or directory

Das stand auch hier https://www.roboternetz.de/phpBB2/zeigebeitrag.php?t=9328

@duhh ich benutze auch gentoo :)

Best wishes

izaseba
09.08.2005, 17:18
ups, das ist mir garnicht aufgefallen, weil ich die qt-lib sowieso drauf habe(aber nicht wegen KDE)

Dann hoffe ich, daß nir verziehen wird, daß ich den Mund zu voll genommen habe ](*,)

Gruß Sebastian

Tekeli
09.08.2005, 17:42
Kein Problem :)

@duhh. Hast Du schon avr-gcc bei Dir installiert? Wenn nicht vielleicht hilft Dir das:

als root:
1) PORTDIR_OVERLAY="/usr/local/portage"
kommt in /etc/make.conf
2) mkdir /usr/local/portage
3) crossdev --target avr
damit installierts Du avr-gcc
4) Den Flasher (s.o.) compilieren und, sagen wir mal, als asuroflash nach /usr/local/bin kopieren.
5) Für Projkete diese Makefile-Datei benutzen. (Anpassen!)


######### AVR Project Makefile Template #########
###### ######
###### Copyright (C) 2003-2005,Pat Deegan, ######
###### Psychogenic Inc ######
###### All Rights Reserved ######
###### ######
###### You are free to use this code as part ######
###### of your own applications provided ######
###### you keep this copyright notice intact ######
###### and acknowledge its authorship with ######
###### the words: ######
###### ######
###### "Contains software by Pat Deegan of ######
###### Psychogenic Inc (www.psychogenic.com)" ######
###### ######
###### If you use it as part of a web site ######
###### please include a link to our site, ######
###### http://electrons.psychogenic.com or ######
###### http://www.psychogenic.com ######
###### ######
################################################## ##


##### This Makefile will make compiling Atmel AVR
##### micro controller projects simple with Linux
##### or other Unix workstations and the AVR-GCC
##### tools.
#####
##### It supports C, C++ and Assembly source files.
#####
##### Customize the values as indicated below and :
##### make
##### make disasm
##### make stats
##### make hex
##### make writeflash
##### make gdbinit
##### or make clean
#####
##### See the http://electrons.psychogenic.com/
##### website for detailed instructions


################################################## ##
##### #####
##### Configuration #####
##### #####
##### Customize the values in this section for #####
##### your project. MCU, PROJECTNAME and #####
##### PRJSRC must be setup for all projects, #####
##### the remaining variables are only #####
##### relevant to those needing additional #####
##### include dirs or libraries and those #####
##### who wish to use the avrdude programmer #####
##### #####
##### See http://electrons.psychogenic.com/ #####
##### for further details. #####
##### #####
################################################## ##


##### Target Specific Details #####
##### Customize these for your project #####

# Name of target controller
# (e.g. 'at90s8515', see the available avr-gcc mmcu
# options for possible values)
MCU=atmega8

# id to use with programmer
# default: PROGRAMMER_MCU=$(MCU)
# In case the programer used, e.g avrdude, doesn't
# accept the same MCU name as avr-gcc (for example
# for ATmega8s, avr-gcc expects 'atmega8' and
# avrdude requires 'm8')
#PROGRAMMER_MCU=m8

# Name of our project
# (use a single word, e.g. 'myproject')
PROJECTNAME=test

# Source files
# List C/C++/Assembly source files:
# (list all files to compile, e.g. 'a.c b.cpp as.S'):
# Use .cc, .cpp or .C suffix for C++ files, use .S
# (NOT .s !!!) for assembly source code files.
PRJSRC=main.S

# additional includes (e.g. -I/path/to/mydir)
INC=-I/usr/avr/include
# libraries to link in (e.g. -lmylib)
LIBS=

# Optimization level,
# use s (size opt), 1, 2, 3 or 0 (off)
OPTLEVEL=s


##### AVR Dude 'writeflash' options #####
##### If you are using the avrdude program
##### (http://www.bsdhome.com/avrdude/) to write
##### to the MCU, you can set the following config
##### options and use 'make writeflash' to program
##### the device.


# programmer id--check the avrdude for complete list
# of available opts. These should include stk500,
# avr910, avrisp, bsd, pony and more. Set this to
# one of the valid "-c PROGRAMMER-ID" values
# described in the avrdude info page.
#
#AVRDUDE_PROGRAMMERID=stk500

# port--serial or parallel port to which your
# hardware programmer is attached
#
#AVRDUDE_PORT=/dev/ttyS1

# port--serial which is used by asuroflash
#
ASURO_FLASHING_PORT=ttyS0



################################################## ##
##### Config Done #####
##### #####
##### You shouldn't need to edit anything #####
##### below to use the makefile but may wish #####
##### to override a few of the flags #####
##### nonetheless #####
##### #####
################################################## ##


##### Flags ####

# HEXFORMAT -- format for .hex file output
HEXFORMAT=ihex

# compiler
CFLAGS=-I. $(INC) -g -mmcu=$(MCU) -O$(OPTLEVEL) \
-fpack-struct -fshort-enums \
-funsigned-bitfields -funsigned-char \
-Wall -Wstrict-prototypes \
-Wa,-ahlms=$(firstword \
$(filter %.lst, $(<:.c=.lst)))

# c++ specific flags
CPPFLAGS=-fno-exceptions \
-Wa,-ahlms=$(firstword \
$(filter %.lst, $(<:.cpp=.lst))\
$(filter %.lst, $(<:.cc=.lst)) \
$(filter %.lst, $(<:.C=.lst)))

# assembler
ASMFLAGS =-I. $(INC) -mmcu=$(MCU) \
-x assembler-with-cpp \
-Wa,-gstabs,-ahlms=$(firstword \
$(<:.S=.lst) $(<.s=.lst))


# linker
LDFLAGS=-Wl,-Map,$(TRG).map -mmcu=$(MCU) \
-lm $(LIBS)

##### executables ####
CC=avr-gcc
OBJCOPY=avr-objcopy
OBJDUMP=avr-objdump
SIZE=avr-size
#AVRDUDE=avrdude
REMOVE=rm -f
ASURO_FLASH=asuroflash

##### automatic target names ####
TRG=$(PROJECTNAME).out
DUMPTRG=$(PROJECTNAME).s

HEXROMTRG=$(PROJECTNAME).hex
HEXTRG=$(HEXROMTRG) $(PROJECTNAME).ee.hex
GDBINITFILE=gdbinit-$(PROJECTNAME)

# Define all object files.

# Start by splitting source files by type
# C++
CPPFILES=$(filter %.cpp, $(PRJSRC))
CCFILES=$(filter %.cc, $(PRJSRC))
BIGCFILES=$(filter %.C, $(PRJSRC))
# C
CFILES=$(filter %.c, $(PRJSRC))
# Assembly
ASMFILES=$(filter %.S, $(PRJSRC))


# List all object files we need to create
OBJDEPS=$(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o)\
$(BIGCFILES:.C=.o) \
$(CCFILES:.cc=.o) \
$(ASMFILES:.S=.o)

# Define all lst files.
LST=$(filter %.lst, $(OBJDEPS:.o=.lst))

# All the possible generated assembly
# files (.s files)
GENASMFILES=$(filter %.s, $(OBJDEPS:.o=.s))


.SUFFIXES : .c .cc .cpp .C .o .out .s .S \
.hex .ee.hex .h .hh .hpp


.PHONY: writeflash clean stats gdbinit stats

# Make targets:
# all, disasm, stats, hex, writeflash/install, clean
all: $(TRG)

disasm: $(DUMPTRG) stats

stats: $(TRG)
$(OBJDUMP) -h $(TRG)
$(SIZE) $(TRG)

hex: $(HEXTRG)


#writeflash: hex
# $(AVRDUDE) -c $(AVRDUDE_PROGRAMMERID) \
# -p $(PROGRAMMER_MCU) -P $(AVRDUDE_PORT) -e \
# -U flash:w:$(HEXROMTRG)

writeflash: hex
$(ASURO_FLASH) -$(ASURO_FLASHING_PORT) $(HEXROMTRG)

install: writeflash

$(DUMPTRG): $(TRG)
$(OBJDUMP) -S $< > $@


$(TRG): $(OBJDEPS)
$(CC) $(LDFLAGS) -o $(TRG) $(OBJDEPS)


#### Generating assembly ####
# asm from C
%.s: %.c
$(CC) -S $(CFLAGS) $< -o $@

# asm from (hand coded) asm
%.s: %.S
$(CC) -S $(ASMFLAGS) $< > $@


# asm from C++
.cpp.s .cc.s .C.s :
$(CC) -S $(CFLAGS) $(CPPFLAGS) $< -o $@



#### Generating object files ####
# object from C
.c.o:
$(CC) $(CFLAGS) -c $< -o $@


# object from C++ (.cc, .cpp, .C files)
.cc.o .cpp.o .C.o :
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

# object from asm
.S.o :
$(CC) $(ASMFLAGS) -c $< -o $@


#### Generating hex files ####
# hex files from elf
##### Generating a gdb initialisation file #####
.out.hex:
$(OBJCOPY) -j .text \
-j .data \
-O $(HEXFORMAT) $< $@

.out.ee.hex:
$(OBJCOPY) -j .eeprom \
--change-section-lma .eeprom=0 \
-O $(HEXFORMAT) $< $@


##### Generating a gdb initialisation file #####
##### Use by launching simulavr and avr-gdb: #####
##### avr-gdb -x gdbinit-myproject #####
gdbinit: $(GDBINITFILE)

$(GDBINITFILE): $(TRG)
@echo "file $(TRG)" > $(GDBINITFILE)

@echo "target remote localhost:1212" \
>> $(GDBINITFILE)

@echo "load" >> $(GDBINITFILE)
@echo "break main" >> $(GDBINITFILE)
@echo "continue" >> $(GDBINITFILE)
@echo
@echo "Use 'avr-gdb -x $(GDBINITFILE)'"


#### Cleanup ####
clean:
$(REMOVE) $(TRG) $(TRG).map $(DUMPTRG)
$(REMOVE) $(OBJDEPS)
$(REMOVE) $(LST) $(GDBINITFILE)
$(REMOVE) $(GENASMFILES)
$(REMOVE) $(HEXTRG)



##### EOF #####

Ach ja, damit Du als normaler User flashen kannst, sollst Du der Gruppen uucp und tty angehören. :)

Best wishes

Tim Botz
11.10.2005, 04:33
Hallo Tekeli,

ich würde gerne das Programm mit USB (/dev/ttyUSB0) benutzen.
Wird es eine Version von asurocon geben USB unterstützt?

Viele Grüße,
Tim

Tim Botz
11.10.2005, 05:20
Hallo Tekel,

konnte selbst den Code i.d. Datei PosixSerial.cpp abändern damit es
mit USB funktioniert.



Zeile 42:
Vorher: sprintf(m_portName,"/dev/ttyS%d",port);
Nachher: sprintf(m_portName,"/dev/ttyUSB%d",port);



Mit dem Aufruf von
./flasher -0 /home/tim/code/test.hex
konnte ich dann von der Console aus flashen.

(-0 (null) ist für /dev/ttyUSB0, bei /dev/ttyUSB1 sollte man -1 als Parameter
übergeben).

Man kann sicherlich den Quellcode so abändern das man die Parameter
in der Form -ttySx oder -ttyUSBx eingeben kann.

Viele Grüße,

Tim

kaspar2
28.03.2011, 21:47
Danke für den Code oben, damit habe ich es auch mit einem 64bit ubuntu zum laufen bekommen :-)