Topics / Index / englisch

WINAVR

Content (automatic)

Warnung

AVRStudio Version 4.12 Service Pack 4 Build 498 neigt häufig zu Abstürzen. Deswegen alle Minute das Projekt sichern.

Meine Programme

Ich habe meine WINAVR - Programme in meiner C++-Sammlung C:\home\cc\...

Herunterladen vom Internet und Installieren

Herunterladen von http://winavr.sourceforge.net
Alle Vorschläge annehmen.
Die Hilfe wird nach c:\WinAVR/WinAVR-user-manual.html  installiert  (*)
Im der Pfad-Angabe PATH muss auch C:\WinAVR\bin;C:\WinAVR\utils\bin; sein [Start] [Einstellungen] [Systemsteuerung] [System] [Tab:Erweitert] [Umgebungsvariablen]

Benutzung

[Start] [Programs] [WinAvr] [Programmers Notepad (WinAvr)]
Durch Make [] [] werden die folgenden Dateien aus name.cpp erzeugt
Hinweis: Make aus dem PN nur aufrufen, wenn eine Datai aus dem Verzeichnis offen ist, wo auch die Datei makefile drin ist. Also währen das PN-Fenster "makefile" offen ist.

name.bin

name.elf
Wird mit AVR Insight benutzt
name.hex
Wird mit Ponyprog zum Gerät geschickt.
name.lst

name.map

name.o

name.srec
Motorola S-Records
name_eeprom.bin

name_eeprom.hex
name_eeprom.srec

Um eines meiner Programme zu übersetzen, für die es schon ein .pnproj - Datei gibt:
Starte Programmers Notepad
Öffne ein Projekt, z.B.  /home/cc/qq/avr/qqmain/qqmain.pnproj

Wenn ein anderes CPP-Hauptprogramm für einen tmel AVR-Prozessor übersetzt werden soll, dann:
Erzeuge ein Unterverzeichnis z.B: /home/cc/????/avr/??????
Kopiere da ein schon existierendes Makefile hinein. z.B: von /home/cc/qq/avr/qqmain/makefile

The Compiler switches

D:\WinAVR\bin>avr-gcc --help
Usage: avr-gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  (Use '-v --help' to display command line options of sub-processes)
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path

  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -save-temps              Do not delete intermediate files
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=<file>            Override built-in specs with the contents of <file>
  -std=<standard>          Assume that the input sources are for <standard>
  -B <directory>           Add <directory> to the compiler's search paths
  -b <machine>             Run gcc for target <machine>, if installed
  -V <version>             Run gcc version number <version>, if installed
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by avr-gcc.  In order to pass
 other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:
<URL:http://gcc.gnu.org/bugs.html>.

D:\WinAVR\bin>

See also : ../cc/english/oskgcc.htm  /

Vordefinierte Preprozessor-Variable

__GNUC__ 3
__VERSION__

Ich definiere noch "AVR" in der Datei makefile

Auswählen eines Zielprozessors:
Die Auswahl des Zielprozessors und der Taktrate erfolgt in der Datei "makefile"
Die möglichen Prozessoren und deren Namen sind aufgelistet in
C:\WinAVR\avr\include\avr\io.h
z.B.: #elif defined(__AVR_ATmega8535__)

avr-ar : Die Libraries bearbeiten

Anzeigen von Libraries mit t

Beispiel:

D:\HOME\CC\LQ\AVR>dir
...
2005-06-28  07:48p              12,116 liblq.a
...
D:\HOME\CC\LQ\AVR>avr-ar t liblq.a
vt.o

D:\HOME\CC\LQ\AVR>avr-ar tv liblq.a
rw-rw-rw- 0/0  11340 Jun 28 19:43 2005 vt.o

D:\HOME\CC\LQ\AVR>

Damit ist angezeigt, dass das Modul (Datei) vt.o in der Library ist.

Herausziehen eines einzelnen Object-Files aus einer Library mit x:

Das Herausziehen geht mit avr-ar x library.a file.o
Beispiel :
avr-ar x liblq.a vt.o

Anzeigen von definierten und verlangen Symbolen

D:\HOME\CC\LQ\AVR>avr-objdump -t liblq.a
In archive liblq.a:

vt.o:     file format elf32-avr

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 vt.cpp
00000000 l    d  .text  00000000
00000000 l    d  .data  00000000
00000000 l    d  .bss   00000000
0000003f l       *ABS*  00000000 __SREG__
0000003e l       *ABS*  00000000 __SP_H__
0000003d l       *ABS*  00000000 __SP_L__
00000000 l       *ABS*  00000000 __tmp_reg__
00000001 l       *ABS*  00000000 __zero_reg__
00000005 l     O .data  00000004 attriblist
000000b2 l     O .bss   00000002 sOperatingsys
00000030 l     O .data  000000a2 _ZZ5vtkeyvE7pattern
000000d2 l     O .data  00000002 FSYSTEMCASESENSITIVE
000000d4 l     O .data  00000002 EPOCHTOTXT_BUFFER_SIZE
000000d6 l     O .data  00000004 DAYCOUNT_1970_1_1
00000000         *UND*  00000000 __do_copy_data
00000000         *UND*  00000000 __do_clear_bss
00000000 g     O .data  00000002 vt_xmax
00000002 g     O .data  00000002 vt_ymax
00000000 g     O .bss   00000001 vt_uses_screen
00000001 g     O .bss   00000050 screen
00000051 g     O .bss   00000050 act_screen
000000a1 g     O .bss   00000002 vt_curr_line
000000a3 g     O .bss   00000002 vt_curr_col
000000a5 g     O .bss   00000002 act_vt_curr_line
000000a7 g     O .bss   00000002 act_vt_curr_col
00000004 g     O .data  00000001 vt_current_attribute
000000a9 g     O .bss   00000002 vt_scrol_ymin
000000ab g     O .bss   00000002 vt_scrol_ymax
00000000 g     F .text  0000004a _Z8vtcolorshh
0000004a g     F .text  00000040 _Z6vtattrh
0000008a g     F .text  000000bc _Z5vtclsv
00000000         *UND*  00000000 strcmp
00000edc g     F .text  0000013a _Z8xxvtopenv
00000146 g     F .text  00000010 _Z8vtcurdisv
00000b4a g     F .text  00000344 _Z9vtrefreshv
00000156 g     F .text  00000050 _Z10vtsetscrolhh
000001a6 g     F .text  0000023a _Z6vtochac
00000000         *UND*  00000000 __mulhi3
00000890 g     F .text  0000020a _Z4vtnlv
00000000         *UND*  00000000 __iob
00000000         *UND*  00000000 fputc
000003e0 g     F .text  00000068 _Z6vtputsPKc
00000448 g     F .text  000000ae _Z8vtdeleolv
000004f6 g     F .text  00000074 _Z8vtdelbolv
0000056a g     F .text  00000178 _Z7vtcurdnv
000006e2 g     F .text  000001ae _Z7vtcurupv
00000a9a g     F .text  0000006e _Z8vtcurposjj
00000b08 g     F .text  00000042 _Z9vtgcurposPhS_
000000ad g     O .bss   00000005 vt_raw_sequence
00000000         *UND*  00000000 printf
00000e8e g     F .text  0000002c _Z7vtclosev
00000eba g     F .text  00000010 _Z14vtclose_forcedv
00000eca g     F .text  00000012 _Z6vtopenv
00001016 g     F .text  0000000e _Z7vtiskeyv
00001024 g     F .text  0000000e _Z11vtiskeyfastv
00001032 g     F .text  00000034 _Z13getrawkeycodev
00001066 g     F .text  000001d2 _Z5vtkeyv
00000000         *UND*  00000000 _Z7getmsecv
00000000         *UND*  00000000 _Z8diffmsecm
00000000         *UND*  00000000 _Z6iswordPKcS0_
00001238 g     F .text  00000098 _Z10xxvtcurposii

D:\HOME\CC\LQ\AVR>

Simulation


Siehe ../../../../WinAVR/doc/simulavr-0.1.2.1/html/index.html
Dort sind gute und verständliche Beispiele.

Simulation mit Benutzerführung

In die erste DOS-BOX eingeben:
C:\HOME\CC\QQ\AVR\QQMAIN>simulavr -d at90s8515 -g

Simulating a at90s8515 device.

MESSAGE: file ../../simulavr-0.1.2.1/src/decoder.c: line 3872: generating opcode
 lookup_table
MESSAGE: file ../../simulavr-0.1.2.1/src/main.c: line 413: Simulating clock freq
uency of 8000000 Hz
Waiting on port 1212 for gdb client to connect...
Connection opened by host 127.0.0.1, port 1358.
Waiting on port 1212 for gdb client to connect...


In eine zweite DOS-BOX eingeben: avr-insight
Dadurch wird ein Fenster geöffnet.

Austauschen der Library gegen eine neuere Version (von http://savannah.nongnu.org)

Sichern von C:\WinAVR
Herunterladen nach ~/www/download.savannah.gnu.org/avr-libc
Auspacken der Library mit Linux (der tar in WinAVR kennt gz2 nicht) und kopieren nach C:\WinAVR\avr-libc-1.4.5

In Windows :
c:
cd C:\WinAVR\avr-libc-1.4.5
sh
./configure --build=`./config.guess` --host=avrc
- geht nicht, vermutlich fehlen mir hier viele tools (sollte vielleicht cygwin herunterladen und installieren)

Siehe auch


WWW