-
Notifications
You must be signed in to change notification settings - Fork 15
Build process explained
The official build process for picoTCP is a Makefile. This section will explain how this works, how modules are enabled or disabled, how a specific compiler or architecture is chosen.
make
This is the default build process. A static picoTCP library will be built, using the default configuration. It makes use of configurable variables, which will be explained later.
What will happen is this:
- Compile selected picoTCP modules (
mod
target in Makefile) - Compile picoTCP core (
core
target in Makefile) - Archive all objects into a static library (
lib
target in Makefile)
The build process will make use of the GNU compiler tools (gcc, ranlib ...).
This will result in a library, found in $(PREFIX)/lib/
, called $(LIBNAME)
-
PREFIX
is 'build' by default -
LIBNAME
is libpicotcp.a by default
The generated library can be statically linked together with your picoTCP application, on your host machine (be that 32 or 64bit Linux, OSX or Windows). You application should use the include files generated and copied to the PREFIX directory.
The most useful build options are set using Makefile variables, which can also be edited using environment variables.
E.g. if you want to change the PREFIX
, previously mentioned, you can invoke make like this:
PREFIX=myprefix make
Other build options are explained below.
CROSS_COMPILE is a variable that will be prepended to all the GNU compiler tools (gcc, as, ld, ranlib ...)
Running make like this:
CROSS_COMPILE=arm-none-eabi make
Will therefor call:
- arm-none-eabi-gcc
- arm-none-eabi-ranlib
- etc ...
CROSS_COMPILE=arm-none-eabi ARCH=cortexm3 make
To select a different architecture, the ARCH variable has to be set. ARCH has to be defined in:
- the
Makefile
, if there are any special compiler flags needed for this architecture -
include/pico_config.h
, to include the right port header files (include/arch/*
).
Porting to a new architecture or target is easy, and is explained in [Porting picoTCP to your favorite embedded target] (Porting-picoTCP-HW)
Modules can be configured by setting variables to 0 or 1.
E.g.:
IPV4=1 IPV6=1 TCP=1 UDP=1 IPFILTER=0 DHCP_SERVER=0 make
Be aware that there might be dependencies between modules; e.g. you cannot use IPV4FRAG without enabling IPV4. For a complete list of modules, please see [Configuring and compiling] (Configuring-and-compiling)
If you just want to swap GCC for another compiler, accepting the same format of arguments, you can do that by replacing the CC variable defined in the Makefile, by your own compiler.
E.g. to replace GCC with Clang:
...
CC:=$(CROSS_COMPILE)clang
...
However, if your compiler is not compatible with GCC syntax, you can do two things:
- Adapt the Makefile to suit your compiler
- Adapt or create your own build process (See Porting the build to another compiler IDE)
Getting Started
- Setting up the environment
- Testing
- Configuring and compiling
- Running picoTCP on Linux - Deprecated (see setting up)
- Running picoTCP on Windows
Porting
- Build process explained
- Porting the build to another compiler or IDE
- Porting picoTCP to your favorite embedded target
- Porting picoTCP to your favorite Operating System
- Example device driver
Development