Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— |
programming:cross_compile_ppc [2013/12/16 13:53] (aktuell) idefix angelegt |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== | ||
+ | First install eldk described [[IceCube# | ||
+ | |||
+ | ===== Automake and Autoconf | ||
+ | We use automake and autoconf, because cmake cannot cross compile yet. | ||
+ | At first we need some files for automake: | ||
+ | < | ||
+ | touch NEWS | ||
+ | touch README | ||
+ | touch AUTHORS | ||
+ | touch ChangeLog | ||
+ | </ | ||
+ | |||
+ | Create a autogen.sh: | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | rm -f config.cache | ||
+ | rm -f acconfig.h | ||
+ | |||
+ | autoreconf --force --install -I config -I m4 | ||
+ | #autoconf | ||
+ | #autoheader | ||
+ | #automake --add-missing | ||
+ | |||
+ | ./configure " | ||
+ | |||
+ | echo | ||
+ | echo "Now type ' | ||
+ | </ | ||
+ | |||
+ | We have the following directory structure: | ||
+ | < | ||
+ | / | ||
+ | -> i2c | ||
+ | </ | ||
+ | |||
+ | Now create a file called configure.ac: | ||
+ | < | ||
+ | AC_INIT(icecube, | ||
+ | AC_PREREQ(2.5) | ||
+ | AC_CONFIG_SRCDIR([i2c/ | ||
+ | AC_CONFIG_AUX_DIR(config) | ||
+ | |||
+ | AM_INIT_AUTOMAKE(1.8) | ||
+ | |||
+ | AC_PROG_CC | ||
+ | |||
+ | dnl Checks for header files. | ||
+ | AC_CONFIG_HEADER(config.h) | ||
+ | AC_HEADER_STDC | ||
+ | AC_CONFIG_FILES([Makefile i2c/ | ||
+ | AC_OUTPUT | ||
+ | </ | ||
+ | |||
+ | And a file Makefile.am: | ||
+ | < | ||
+ | EXTRA_DIST = autogen.sh configure | ||
+ | SUBDIRS = i2c | ||
+ | </ | ||
+ | |||
+ | In the directory i2c create a file Makefile.am: | ||
+ | < | ||
+ | INCLUDES = -I/ | ||
+ | |||
+ | bin_PROGRAMS = readMax6633 | ||
+ | readMax6633_SOURCES = readMax6633.c | ||
+ | </ | ||
+ | |||
+ | Now execute the script autogen.sh with: | ||
+ | < | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | To cross-compile now do the following: | ||
+ | < | ||
+ | export CROSS_COMPILE=ppc_6xx- | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | ===== cmake ===== | ||
+ | Create a file CMakeLists.txt: | ||
+ | < | ||
+ | project (ICECUBE) | ||
+ | |||
+ | SET(CMAKE_C_FLAGS " | ||
+ | add_subdirectory(i2c) | ||
+ | </ | ||
+ | |||
+ | And a file i2c/ | ||
+ | < | ||
+ | add_executable (readMax6633 readMax6633.c) | ||
+ | </ | ||
+ | |||
+ | Now execute: | ||
+ | < | ||
+ | CC=ppc_6xx-gcc cmake . | ||
+ | </ | ||
+ | |||