Skip to content
gatk555 edited this page Dec 28, 2023 · 5 revisions

Retired from : https://github.com/buserror/simavr/blob/master/doc/manual/manual.pdf?raw=true

This section provides instructions on how to retrieve, compile and install simavr on the GNU/Linux operating system.

simavr

Getting the source code

The official home of simavr is https://github.com/buserror/simavr.
Stable releases are published as git repository tags (direct downloads are available at https://github.com/buserror/simavr/tags).
To clone a local copy of the repository, run

git clone git://github.com/buserror/simavr.git

Software Dependencies

elfutils is not a hard dependency but is highly recommended. The name of this package may differ from distro to distro. For example, in Ubuntu and other Debian derivatives the required package is called libelf-dev. Also libdwarf-dev (or equivalent) is recommended.

At compile-time, simavr additionally requires avr-libc to complete its builtin AVR core definitions. It is assumed that further standard utilities (git, gcc or clang, make, etc . . . ) are already present. simavr has been tested with the following software versions:

  • Arch Linux x86 64 and i686
  • elfutils 0.154
  • avr-libc 1.8.0
  • gcc 4.7.1
  • make 3.82

Furthermore, the board usb example depends on libusb_vhci and vhci_hcd. For further details, see examples/board usb/README.
Note however that these are not required for a fully working simavr build

Compilation and Installation

simavr ’s build system relies on standard makefiles. The simplest compilation boils down to the usual

make

As usual, there are several variables to allow configuration of the build procedure. The most important ones are described in the following section:

  • AVR_ROOT The path to the system’s avr-libc installation.
    While the default value should be correct for many systems, it may need to be set manually if the message ’WARNING . . . did not compile, check your avr-gcc toolchain’ appears during the build. For example, if iomxx0 1.h is located at /usr/avr/include/avr/iomxx0 1.h, AVR_ROOT must be set to /usr/avr.
  • CFLAGS The standard compiler flags variable.
    It may be useful to modify CFLAGS for easier debugging (in which case optimizations should be disabled and debugging information enabled: - O0 -g). Additionally adding -DCONFIG_SIMAVR_TRACE=1 enables extra verbose output and extended execution tracing.

These variables may be set either directly in Makefile.common, or alternatively can be passed to the make invocation (make AVR_ROOT=/usr/avr DESTDIR=/usr install).

Installation is managed through the usual

sudo make install

The DESTDIR variable can be used in association with the PREFIX variable to create a simavr package. DESTDIR=/dest/dir PREFIX=/usr installs to /dest/dir but keeps the package configured to the standard prefix (/usr).

For development, we built and installed simavr with the following procedure:

make clean
make AVR_ROOT=/usr/avr CFLAGS="-O0 -Wall -Wextra -g -fPIC \
-std=gnu99 -Wno-sign-compare -Wno-unused-parameter"
make DESTDIR="/usr" install