Building
From Arctic Core - the open source AUTOSAR embedded platform
This article briefs the steps necessary to build Arctic Core.
Contents |
Preparations
You will need:
- A cross compiler installed for the target archetecture you want to build (Support only for GCC up to 2.8.0. With 2.9.0 CodeWarrior support was added)
- Some tools: sed, awk, echo, ....
For convenience, Arctic Studio ships a customized msys distribution with all the tools necessary to build and maintain Arctic Core. The msys distribution is also available as a standalone product.
Arctic Core has been built on Mac OS X, Linux and Windows.
Build from terminal
Building is a 2 step process
- Set the environment variables
- Build the configuration
It's easy to start with an example that is done under msys:
Set the environment variables:
$ export CROSS_COMPILE=/c/devtools/ArcticStudio/msys/opt/powerpc-eabispe/bin/powerpc-eabispe-
Then build it:
$ make BOARDDIR=mpc551xsim BDIR=boards/mpc551xsim/examples/os_simple all
Build from within Eclipse
Core user
- Setting up a Arctic Studio project: Quick-start Tutorial
- More on Arctic Studio build settings: Arctic Studio build settings
There are two ways to build most examples. 1. Create a project according to Quick-start Tutorial and build it. 2. Build directly in the arc source tree.
Build in Arc source tree
You can directly under the board/<board>/examples/<example>. For example to build the simple for the mpc551xsim board:
- Bring up the "Make Target" window
- Go down to board/mpc551xsim/examples/simple
- Right click on simple, click "New"
- Type target name "all"
- Press "ok"
- Now press the new "all" target that appeared.
- Done!
- To clean that target, repeat steps 3 to 7
- Note
When you build directly under the examples under boards you may need to change COMPILE/CROSS_COMPILE/CW_COMPILE/etc. Most examples though have a default compiler that is one of the core builders that you install with Arctic Studio.
Core developer
As a core developer there are some unique features that you want
- Building it all to verify over multiple targets (if you touch common parts)
- Easy to build specific examples
- Easy to build specific tests.
To run specialized builds the easiest way is probably to create Eclipse make targets. This is done in the view "Make Targets" (Window -> Show View -> Make Targets)
For batch processing there are the ./scripts/build_xxx.sh scripts to make this easy. (assuming things about the tools paths)
Preferences:
- make targets added in "Make Targets" end up in the .cproject file:
- Things added to the environment in "c/c++ build" is addede to ".settings/org.eclipse.cdt.core.prefs"
Under Windows
There are a lot of options here cygwin, msys, colinux, etc. It is NOT wise to mix environments from cygwin and msys unless you know what you are doing. The preferred environment Arctic Core is cygwin.
Static Code Analysis
Note that the code for the moment is NOT tagged with any pclint or splint tags.
pc-lint
Adding pc-lint support. Add the environment variable PCLINT with the path to the pc-lint executable:
export PCLINT=/c/devtools/lint/lint-nt.exe
The pclint files are located under scripts/pclint
splint
Add support for splint. Add the environment variable PCLINT with the path to the pc-lint executable:
export SPLINT=/c/devtools/splint-3.1.1/bin/splint.exe
Environment
MSYS
It's possible to build using msys from version 10 of arc repo. To use MSYS instead of the default Cygwin install:
- Install msys. This [1] might work.
- Remove the cygwin path from your system. (Or just remove it from eclipse if it's there)
- Add path to MSYS.
- Done-
So why use msys instead of cygwin? The best reasons are:
- You get real windows paths. Some debuggers have can't deal with cygwin paths.
- Speed
Example install/build for MSYS and ARM
- Download MSYS from [2]
- Install
- Do you wish to continue with the post install? [yn ], Press y
- Do you have MinGW installed? [yn ] Press return
- Press return
- Download codesourcery for ARM.
- Install
- Press next a couple of times until you get to install foler:
C:\devtools\Codesourcery\arm-2009q1
- Press "Do not modify PATH"
- Press "Next" until installed.
- Open up msys. Press the MSYS icon on your desktop or press the msys.bat file in the installation dirtory.
- Clone the arc repository some way.
- $cd <your project path>/arc
- $ export CROSS_COMPILE=/c/devtools/Codesourcery/arm-2009q1/bin/arm-none-eabi-
- $ export BOARDDIR=et_stm32_stamp
- $ export BDIR=examples/tiny
- $ make all
- Done!!
Error "Broken pipe"
If you get an error "Broken pipe" when running make in msys, try running make in silent mode:
make -s
To set this in Arctic Studio go to Project Properties --> C/C++ Build, uncheck Use default build command, and enter the above in Build command.
Cygwin (NOT USED ANYMORE)
Cygwin is no longer the preferred environment since Eclipse is dropping support for it. The current version uses MYS instead. Text below are for legacy versions.
Recent Cygwin releases can be divided into the 1.7 series that does a lot more things right than pre 1.7. Although 1.7 is beta in time of writing this, that is preferred.
1.7 and later
$ export CROSS_COMPILE=/cygdrive/c/devtools/gcc/4.1.2/powerpc-eabispe/bin/power pc-eabispe-
Add the path to whatever unix emulation you are running. For example cygwin you will have to add
PATH c:\cygwin\bin
Pre 1.7 Uses the registry and that amounts to heap of problems. Don't use.
Bash
Add for example
export CROSS_COMPILE=/cygdrive/c/devtools/gcc/4.1.2/powerpc-eabispe/bin/powerpc-eabispe-
to the .bash_profile
Compilers
GCC
GCC is the default compiler for ArcCore.
For more information about our GCC article
CW
This is new for the 2.9.0 release.
To select the codewarrior compiler instead of GCC the following environment variables must be set.
- COMPILER
- set to "cw" to select CodeWarrior compiler
- CW_COMPILE
- The path to the root directory of the Codewarrior installation (the directory that holds PowerPC_EABI_Tools, etc. Do not use spaces in installation and use msys path. Example of a path "/c/devtools/cw_55xx"