Building environment
In order to simplify our build environment, we decided to create our own environment based on make tools. Our build environment should answer the following problematics :
- Multi-platform (windows / linux / mac),
- Fully integrated in eclipse IDE, but it should also work outside this IDE,
- Allow compilation of same files for more than one target (dspic802, dspic804, simulation, unit test, ...), with no file duplication.
Architecture
Our build environment is based on gnu make tools. Therefore, all is based on a root Makefile that will include several target configuration files, several project configuration files and one user configuration file.
Requirements
First of all, a cross compiling tool chain for dspic should be usable.
On windows platform, a make tool should be installed and in the path. I recommend using msys and mingw. Do not forget to add msys and mingw at the start of your path definition, otherwise, several windows tools (like find) will be used instead of the msys tools. To check your path, siimply type "echo %path%" in a shell and check the order in which msys and mingw appears. When installing msys and mingw, check taht C and Cpp build chains are installed.
User configuration file
This file, named make.perso is used to define user configuration, such as the name of the tools used to build application, or some path used to specify includes or libraries path. Following is an example to illustrate this file content :
# Common definitions RM=rm -f # dsPic definitions C30_BASEDIR:=/c/PROGRA~1/Microchip/MPLABC~1/bin/ NON_FREE_PATH:=/c/PROGRA~1/Microchip/MPLABC~1/ AS_PIC=$(C30_BASEDIR)/pic30-coff-gcc CC_PIC=$(C30_BASEDIR)/pic30-coff-gcc CPP_PIC=$(C30_BASEDIR)/pic30-coff-gcc AR_PIC=$(C30_BASEDIR)/pic30-coff-ar LD_PIC=$(C30_BASEDIR)/pic30-coff-gcc BIN2HEX_PIC=$(C30_BASEDIR)/pic30-coff-bin2hex # Linux definitions AS_NUX=... CC_NUX=... CPP_NUX=... AR_NUX=... LD_NUX=...
As this file is user defined, it should not be managed under our configuration manager (subversion). All the definition contained in this file depends on the user platform.
Project configuration file
Target configuration files
Makefile
Tips
Make options
- To help you debug a project configuration, the environment allow you to trace all what is executed. This is done with the use of the TRACE=1 option.
- When you want to generate a binary used to debug your project, you could use the DEBUG=1 option. When this option will be used, the _DEBUG define is set.
> make all TRACE=1 *** [dspic-804:ucostest] compile bios/utils/utils_checksum.c to obj/dspic-804/ucostest/bios/utils/utils_checksum.o *** ++ dirname obj/dspic-804/ucostest/bios/utils/utils_checksum.o + mkdir -p obj/dspic-804/ucostest/bios/utils + /c/PROGRA~1/Microchip/MPLABC~1/bin/bin//pic30-coff-gcc -mcpu=33FJ128MC804 -Wall -W -Wunreachable-code -Wextra -Wcast-align -Waggregate-return -mlarge-data -mconst-in-code -mresource=/c/PROGRA~1/Microchip/MPLABC~1/bin/bin//c30_device.info -x c -O2 -Wa,-ahmcnlsdi=obj/dspic-804/ucostest/bios/utils/utils_checksum.o.lst -c bios/utils/utils_checksum.c -o obj/dspic-804/ucostest/bios/utils/utils_checksum.o -I. -I.//ucos_test -I.//bios/inc -I.//ucos/src -I.//ucos/port/dsPic33F -D_NDEBUG -D_NSIMULATION + set -e + /c/PROGRA~1/Microchip/MPLABC~1/bin/bin//pic30-coff-gcc -MM -mcpu=33FJ128MC804 -Wall -W -Wunreachable-code -Wextra -Wcast-align -Waggregate-return -mlarge-data -mconst-in-code -mresource=/c/PROGRA~1/Microchip/MPLABC~1/bin/bin//c30_device.info -x c -O2 -I. -I.//ucos_test -I.//bios/inc -I.//ucos/src -I.//ucos/port/dsPic33F -D_NDEBUG -D_NSIMULATION bios/utils/utils_checksum.c + sed 's#bios/utils/utils_checksum\.o[ :]*#obj/dspic-804/ucostest/bios/utils/utils_checksum.o : #' ...
Attachments
-
buils-arch.PNG
(6.9 KB) -
added by baronju 16 months ago.
