Difference between revisions of "Category:How to - Build helloworld"
(Created page with '==Overview== What follows is a description for building C programs on a workstation using the cross-build tools of OpenEmbedded directly but not using the bitbake/recipe framewo…') |
m (More detail about TMPDIR) |
||
Line 1: | Line 1: | ||
==Overview== | ==Overview== | ||
− | What follows is a description for building C programs on a workstation using the cross-build tools of OpenEmbedded | + | What follows is a description for building C programs on a workstation using the cross-build tools of [http://wiki.openembedded.net/index.php/Main_Page OpenEmbedded], but not using the bitbake/recipe framework. |
− | + | ||
==Setup== | ==Setup== | ||
Line 8: | Line 7: | ||
Follow the instructions for [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Setting-up-a-build-environment/111.html setting up a build environment] to get the cross-build tools correctly installed. | Follow the instructions for [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Setting-up-a-build-environment/111.html setting up a build environment] to get the cross-build tools correctly installed. | ||
+ | While you don't necessarily need to build a complete image to get the cross-tools for a C program, as a practical matter, successfully building an image is a good test that the cross-tools are correctly installed. | ||
+ | |||
+ | The tools are built under the TMPDIR directory declared in ${OVEROTOP}/build/conf/site.conf. | ||
+ | |||
+ | TMPDIR defaults to ${OVEROTOP}/tmp, but you can point it somewhere else. | ||
+ | |||
+ | For instance, putting TMPDIR on a faster disk can speed your build. | ||
==Makefile== | ==Makefile== | ||
Line 19: | Line 25: | ||
# OVEROTOP is normally ${HOME}/overo-oe | # OVEROTOP is normally ${HOME}/overo-oe | ||
# | # | ||
− | # OETMP is the same as | + | # OETMP is the same as TMPDIR as defined in ${OVEROTOP}/build/conf/site.conf |
# | # | ||
Line 51: | Line 57: | ||
clean: | clean: | ||
rm -f ${TARGET} ${OBJS} *~ | rm -f ${TARGET} ${OBJS} *~ | ||
− | |||
==Distribute== | ==Distribute== | ||
− | + | Copy the resulting target executable to the overo. | |
1. If you are using [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/111.html a microSD card], copy your executable to the rootfs before you unmount it in the final step. | 1. If you are using [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/111.html a microSD card], copy your executable to the rootfs before you unmount it in the final step. |
Revision as of 06:08, 1 January 2010
Contents
Overview
What follows is a description for building C programs on a workstation using the cross-build tools of OpenEmbedded, but not using the bitbake/recipe framework.
Setup
Follow the instructions for setting up a build environment to get the cross-build tools correctly installed.
While you don't necessarily need to build a complete image to get the cross-tools for a C program, as a practical matter, successfully building an image is a good test that the cross-tools are correctly installed.
The tools are built under the TMPDIR directory declared in ${OVEROTOP}/build/conf/site.conf.
TMPDIR defaults to ${OVEROTOP}/tmp, but you can point it somewhere else.
For instance, putting TMPDIR on a faster disk can speed your build.
Makefile
Create a makefile for your project pointing to the cross-build toolchain.
Here is a simple one for helloworld.
# Makefile for building with the OE cross tools # # OVEROTOP is normally ${HOME}/overo-oe # # OETMP is the same as TMPDIR as defined in ${OVEROTOP}/build/conf/site.conf # OETMP = ${OVEROTOP}/tmp TOOLDIR = ${OETMP}/cross/armv7a/bin STAGEDIR = ${OETMP}/staging/armv7a-angstrom-linux-gnueabi/usr CC = ${TOOLDIR}/arm-angstrom-linux-gnueabi-gcc CFLAGS = -Wall LIBDIR = ${STAGEDIR}/lib INCDIR = ${STAGEDIR}/include LIBS = -L ${LIBDIR} TARGET = helloworld OBJS = helloworld.o ${TARGET} : $(OBJS) ${CC} ${CFLAGS} ${OBJS} ${LIBS} -o ${TARGET} helloworld.o: helloworld.c ${CC} ${CFLAGS} -I ${INCDIR} -c helloworld.c clean: rm -f ${TARGET} ${OBJS} *~
Distribute
Copy the resulting target executable to the overo.
1. If you are using a microSD card, copy your executable to the rootfs before you unmount it in the final step.
2. If you have a network connection to the overo, use scp.
3. If you have a kermit console session, use the kermit SEND command.
This category currently contains no pages or media.