Difference between revisions of "AVR"
m (→Implementation details: Fixed typos) |
m (→Resources: Added link to English version) |
||
Line 45: | Line 45: | ||
* [[AVR Programming]] | * [[AVR Programming]] | ||
* [[Arduino]] | * [[Arduino]] | ||
+ | * [[AVR Embedded Tutorial|AVR Embedded Tutorial]], Tutorial with code examples (English) | ||
* [[AVR Embedded Tutorial/de|AVR Embedded Tutorial]], Tutorial with code examples (German) | * [[AVR Embedded Tutorial/de|AVR Embedded Tutorial]], Tutorial with code examples (German) |
Revision as of 01:52, 6 March 2020
│
English (en) │
Warning: The FPC-AVR port is experimental and might be broken from time to time. If this is the case, please fill a bug report
FPC-AVR is the Free Pascal Compiler port for the Atmel-AVR processor. It uses the GCC AVR tool chain and will be compatible with GCC regarding calling conventions etc.
For instructions on how to program AVR's with FreePascal see the article AVR Programming.
Implementation details
FPC considers AVR to be a 16 bit CPU. So the type TRegister actually describes a register pair with the second register implicitly named.
Building cross-compiler
There are some requirements, you should know about
- You should use the latest Free Pascal sources as there is the most recent support for more controllers.
- Binutils for avr target
- Atmel provides bintuils binaries for Linux, Mac OS X and Windows.
atmel.no (registration required) follow the appropriate link for your operating system - On Linux host, you may either install bintuils for avr target from your distribution or use also the binaries provided by Atmel.
- You may also use the bintuils distributed with the Arduino IDE; on Windows they are installed to e.g. C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\bin
- Keep in mind, the Free Pacal Compiler will search for e.g. avr-embedded-as. So you must either rename the binary files, create symlinks (on Linux only) or adjust command line switch -XP<prefix> for FPC.
- You may need to set FPC's command line switch -FD<directory with binutils>
- Atmel provides bintuils binaries for Linux, Mac OS X and Windows.
- Latest stable Free Pascal Compiler
Then you can build your cross compiler. Please choose SUBARCH according to your Arduino board / AVR microprocessor.
make buildbase installbase CPU_TARGET=avr OS_TARGET=embedded SUBARCH=avr5 CROSSINSTALL=1 INSTALL_PREFIX=~/fpc NOGDB=1 PP=/usr/bin/fpc CROSSBINDIR=/usr/avr/bin
You may also set the bintuils prefix for this (equivialent to -XP switch)
make buildbase installbase CPU_TARGET=avr OS_TARGET=embedded SUBARCH=avr5 CROSSINSTALL=1 INSTALL_PREFIX=~/fpc NOGDB=1 PP=/usr/bin/fpc CROSSBINDIR=/usr/avr/bin BINUTILSPREFIX=avr-
Subarchitecture
The operating system target embedded requires you to specify a aubarchicture when building a cross compiler. The subarchitectures are compatible to the ones used by gcc.
Resources
- General information about Atmel AVR in wikipedia
- Atmel site
- Calling conventions
- list of subarchitectures
- Discussion on lazarusforum.de (German)
- AVR Programming
- Arduino
- AVR Embedded Tutorial, Tutorial with code examples (English)
- AVR Embedded Tutorial, Tutorial with code examples (German)