-
Notifications
You must be signed in to change notification settings - Fork 221
Porting the build to another compiler IDE
As explained in Build process explained it is possible to use your compiler from our Makefile, as long as it is mostly compatible with the GNU tools' syntax. E.g. clang works just fine. However, if this is not an option, you can easily create your own picoTCP build. But you need to pay attention a few important details. See the next paragraph.
Bear in mind that some compilers have GNU compatibility modes:
- ARM DS-5
- ARMCC
- Keil MDK-ARM
All have the --gnu
option (more info: ARM Information Center)
If you can't, or don't want to use picoTCP's original Makefile, you can easily integrate it into you current build system or IDE. There are a few details to pay attention to:
- Generating pico_defines.h
- Files to include
- Compiler options
This file is normally auto-generated, and contains all the options that picoTCP was configured with. It is important when compiling picoTCP objects/modules, but also when using the library in your applications. E.g. the size of structs can change, depending on which modules are enabled.
If you are not using our Makefile, you should generate a pico_defines.h
file manually.
A minimal version could look like this:
/* PicoTCP - Definition file */
#ifndef PICO_DEFINES_H
#define PICO_DEFINES_H
#define PICO_SUPPORT_ETH
#define PICO_SUPPORT_IPV4
#define PICO_SUPPORT_UDP
#endif
A bunch of files are mandatory for the picoTCP core. These are located in stack/*
.
From our Makefile, you can find these are the files:
CORE_OBJ= stack/pico_stack.o \
stack/pico_frame.o \
stack/pico_device.o \
stack/pico_protocol.o \
stack/pico_socket.o \
stack/pico_socket_multicast.o \
stack/pico_tree.o \
stack/pico_md5.o
Again, depending on which modules you will be using, and you have enabled, certain files must or must not be included in the build. Some files have portions under IFDEF, to account for options that are enabled/disabled.
Normally, there is a logical link between the name of the module, and the name of the files to be included.
If you are not sure, you can check the Makefile or the makefiles in rules/
to see which files are conditionally included.
An example for UDP (rules/udp.mk
):
OPTIONS+=-DPICO_SUPPORT_UDP
MOD_OBJ+=$(LIBBASE)modules/pico_udp.o
MOD_OBJ+=$(LIBBASE)modules/pico_socket_udp.o
Or directly from the Makefile (TFTP):
ifeq ($(TFTP),1)
MOD_OBJ+=$(LIBBASE)modules/pico_strings.o $(LIBBASE)modules/pico_tftp.o
OPTIONS+=-DPICO_SUPPORT_TFTP
endif
When using a compiler that does not understand the GCC syntax, you will need to adapt the options used for our build, to you compiler.
These are the CFLAGS
we use by default:
CFLAGS:= -I$(PREFIX)/include -Iinclude -Imodules
CFLAGS+= -Wall -Wdeclaration-after-statement -W -Wextra -Wshadow -Wcast-qual
CFLAGS+= -Wwrite-strings -Wunused-variable -Wundef -Wunused-function
CFLAGS+= -Wconversion Wcast-align -Wmissing-prototypes -Wno-missing-field-initializers
The first are the include paths used for building the picoTCP library; these should be easy to include in your own compiler/IDE. The other flags are mostly to have strict warnings when things are going wrong. We strongly advice to translate these to the equivalent for your compiler.
Platform specific flags
And then of course there are platform specific CFLAGS
, depending on the selected ARCH
.
For example, the PIC24 needs these options:
ifeq ($(ARCH),pic24)
CFLAGS+=-DPIC24 -c -mcpu=24FJ256GA106 -MMD -MF -g -omf=elf \
-mlarge-code -mlarge-data -msmart-io=1 -msfr-warn=off
endif
Questions or remarks? Please contact us!
[email protected] | picotcp.altran.be | Twitter | Facebook
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