GNU build instructions

Document created by jorge_plascencia Employee on Apr 26, 2016Last modified by jorge_plascencia Employee on Apr 27, 2016
Version 3Show Document
  • View in full screen mode

These instructions explain how to use the CodeSourcery GNU tools to build a LWIP project and variant. GNU builds are based on the free CodeSourcery Codebench Lite version.

Download the CodeSourcery Lite GNU tools

Prior to building the code, you'll need to CodeSourcery GNU tools. These can be download from Mentor Graphics.

There are multiple versions of the tools that can be download. Make sure you download the EABI version of the tools with CodeBench. These will be identified similar to "Sourcery CodeBench Lite 2011.09-69 for ARM EABI". The IA32 Windows Installer version was used to generate the projects included in the LWIP packages.

After the tools are downloaded, install the tools onto your build machine.

Build system and source code modifications

Before you can build the projects, a few manual modifications of the source code and a few make related files are needed.

lpc177x_8x_emac.c

Locate the lpc177x_8x_emac.c and open it for editing. Wrap "#if 0/#endif" clauses around the ENET_IRQHandler function. This will prevent build problems when using the interrupt handler of the same name as part of the LWIP driver.

makeconfig

Locate the makeconfig file in the makesection folder.If needed, change the path and version number to what's been installed for your host machine.

#GNU_INSTALL_ROOT    =C:/Program Files (x86)/CodeSourcery/Sourcery G++ Lite
GNU_INSTALL_ROOT    =C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI
GNU_VERSION               =4.3.3

make.LPC177x_8x.gnu

Locate the make.LPC177x_8x.gnu file in the makesection/LPC177x_8x folder. Make changes as needed to this file for your build. For example, only the changes below were needed.

OPTIM            = s
CC                 = $(GNUTOOLS)/arm-none-eabi-gcc
#CC               = $(GNUTOOLS)/arm-none-eabi-gcc-$(GNU_VERSION)

Build procedure

Add make tools to system environment path

Once the changes have been made, open up a CMD (cmd.exe) shell for your Windows host machine. In the shell, switch to the directory with the example project (ie, ea1788_tcpecho_sa) and then into the gnu subfolder in that project. Run theaddtoolpath.bat script to add the tools path to your shell's environment.

C:\dev\git\lwip_work\updated\lpc177x_8x\lwip_lpc\nxpcommon\examples\ea1788\ea1788_tcpecho_sa\gnu>set PATH=..\..\..\..\..\..\makesection\tools;..\..\..\..\..\..\makesection\tools;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Keil421\ARM\BIN40;C:\Program Files (x86)\doxygen\bin;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin;C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Keil421\ARM\BIN40

C:\dev\git\lwip_work\updated\lpc177x_8x\lwip_lpc\nxpcommon\examples\ea1788\ea1788_tcpecho_sa\gnu>

Make the image

Then type make to build the project. If your project builds without errors, you should get a hex file that can be programmed into the board usng the Flash Magic tool.

port/sdram_k4s561632j.o C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../BoardSupport/sdram_mt48lc8m32lfb5.o C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../BoardSupport/sensor_smb380.o C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../BoardSupport/transceiver_sn74lvc16245.o C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../BoardSupport/uda1380.o   lpc_emac.o lpc_emac_zcbuffs.o lpc_phy.o lpc_debug.o sys_arch.o Serial.o lpc177x_8x_systick_arch.o retarget.o ea1788_board.o tcpecho_sa_app.o def.o dhcp.o dns.o init.o mem.o memp.o netif.o pbuf.o raw.o stats.o sys.o tcp.o tcp_in.o tcp_out.o timers.o udp.o autoip.o icmp.o igmp.o inet.o inet_chksum.o ip.o ip_addr.o ip_frag.o etharp.o echo.o  -static -mcpu=cortex-m3 -mthumb -mthumb-interwork -Wl,--start-group  -L'C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/arm-none-eabi/4.3.3/thumb2' -L'C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/arm-none-eabi/lib/thumb2' -lc -lg -lstdc++ -lsupc++  -lgcc -lm  -Wl,--end-group   -Xlinker -Map -Xlinker \ea1788_tcpecho_sa.map -Xlinker -T   linker/ldscript_dram_zc_gnu.ld -o ea1788_tcpecho_sa.elf
'C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin'/arm-none-eabi-objcopy -O ihex  ea1788_tcpecho_sa.elf ea1788_tcpecho_sa.hex
'C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin'/arm-none-eabi-objcopy -O srec  ea1788_tcpecho_sa.elf ea1788_tcpecho_sa.srec
C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../makesection/tools/mkdir -p GCC\Flash
C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../makesection/tools/mv -f ea1788_tcpecho_sa.map GCC\Flash\ea1788_tcpecho_sa.map
C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../makesection/tools/mv -f ea1788_tcpecho_sa.elf GCC\Flash\ea1788_tcpecho_sa.elf
C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../makesection/tools/mv -f ea1788_tcpecho_sa.hex GCC\Flash\ea1788_tcpecho_sa.hex
C:/dev/git/lwip_work/u2/lpc177x_8x/lwip_lpc/nxpcommon/examples/ea1788_tcpecho_sa/gnu/../../../../../makesection/tools/mv -f ea1788_tcpecho_sa.srec GCC\Flash\ea1788_tcpecho_sa.srec
'C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin'/arm-none-eabi-size GCC\Flash\ea1788_tcpecho_sa.elf
   text    data     bss     dec     hex filename
  70376     216 4611064 4681656  476fb8 GCC\Flash\ea1788_tcpecho_sa.elf


Once the image has been built, you can use Flash Magic to program the image into internal FLASH using the generated HEX file.

ea1788_gnu_use1.png

Attachments

    Outcomes