INICIO   Otros temas


GNU Toolchain Stellaris LM4F120 LaunchPad Evaluacion Kit - "EK-LM4F120XL"

Autor: Fernando Rafael Filipuzzi

E-mail: fernando_6867@yahoo.com.ar



  1. Datos de instalación:

    Esta es una breve guía de instalación de la cadena de desarrollo para el kid de Evaluación Stellaris LM4F120 LaunchPad - "EK-LM4F120XL" que se basa y resume desde el tutorial "The complete tutorial for Stellaris LaunchPad development with GNU/Linux (I)". También agrego la solución de algunos problemas que surgieron en la instalación del mismo.

    Este kit de evaluación usa el microcontrolador LM4F120H5QR.

    Lo que he instalado es lo mismo que use en "La cadena de desarrollo para HC11/HC12" en donde los armo en un entorno separado con debootstrap.

    	usuario@host:~$ mkdir ch
    	usuario@host:~$ dd if=/dev/zero of=./ch/wheezy-ch bs=1M count=10240				
    	usuario@host:~$ su
    	host:/home/usuario# mkfs.ext3 -v ./ch/wheezy-ch
    	...
    	¿Continuar de todas formas? (s,n) s
    	...
    	host:/home/usuario# mkdir /mnt/wheezy-ch
    	host:/home/usuario# mount -t ext3 -o loop ./ch/wheezy-ch /mnt/wheezy-ch
    	host:/home/usuario# aptitude install debootstrap
    	host:/home/usuario# debootstrap wheezy /mnt/wheezy-ch
    	host:/home/usuario# chroot /mnt/wheezy-ch
    	host:/home/usuario# uname -r
    	host:/home/usuario# chroot /mnt/wheezy-ch
    	host:/# uname -a
    	Linux wheezy-ch 3.8.2-wheezy-ch1 #1 SMP Sun Mar 10 22:10:45 ART 2013 x86_64 GNU/Linux
    	host:/# cat /etc/debian_version 
    	7.0
    	host:/# aptitude install locales locales-all
    	host:/# dpkg-reconfigure locales
    


  2. Construyendo el toolchain.

    Instalando las dependencias:

    	host:# apt-get install flex bison libgmp3-dev \
    	> libmpfr-dev libncurses5-dev libmpc-dev \
    	> autoconf texinfo build-essential \
    	> libftdi-dev git
    

    Además yo instalé lo siguiente:

    	host:# apt-get install zlib1g-dev python-yaml
    

    Para mas detalle ver Problemas resueltos.

    Luego seguimos con:

    	host:# mkdir -p /usr/src/toolchain_stellaris
    	host:# cd /usr/src/toolchain_stellaris
    	host:/usr/src/toolchain_stellaris# git clone https://github.com/esden/summon-arm-toolchain
    	host:/usr/src/toolchain_stellaris# cd summon-arm-toolchain
    	host:/usr/src/toolchain_stellaris/summon-arm-toolchain#	./summon-arm-toolchain
    	host:/usr/src/toolchain_stellaris/summon-arm-toolchain#	cd ..
    	host:/usr/src/toolchain_stellaris/#
    

    La última línea es la ejecución de un script que baja e instala en el directorio ~/sat el toolchain.

    	Baja binutils-2.23.1.tar.bz2 desde http://ftp.gnu.org/gnu/binutils/binutils-2.23.1.tar.bz2 e instalarlo.
    	Baja gcc-linaro-4.7-2013.01.tar.bz2 desde https://launchpadlibrarian.net/128703495/gcc-linaro-4.7-2013.01.tar.bz2
    	Baja newlib-2.0.0.tar.gz desde ftp://sourceware.org/pub/newlib/newlib-2.0.0.tar.gz
    
    	continua...
    

    Con lo siguiente fijamos que la variable de entorno PATH apunte al toolchain instalado:

    	export PATH=$PATH:$HOME/sat/bin
    

    Esto habría que repetirlo cada vez que iniciamos el interprete de comandos, para hacerlo de forma permanente hay que agregar esa línea en el archivo /etc/profile, esto último tendrá efecto después de reiniciar el sistema.


  3. Construyendo las librerias y ejemplos "StellarisWare library"

    Contiene software para simplificar y acelerar el desarrollo de aplicaciones, el enlace del sitio oficial de Texas Instruments requiere registrarse para iniciar la descarga del Stellaris® LM4F120 LaunchPad Evaluation Board Software. Al momento de realizar esta guía el fichero disponible se llamaba "SW-EK-LM4F120XL-9453.exe".

    También dejo un enlace local, pero puede que esté desactualizado.

    	root@host:/usr/src/toolchain_stellaris# wget http://hdcm.sytes.net/documentos/programacion/sistemasembedded/ficheros_gnu_toolchain_ek-lm4f120xl/lib/SW-EK-LM4F120XL-9453.exe.tar.bz2
    	root@host:/usr/src/toolchain_stellaris# tar jxvf SW-EK-LM4F120XL-9453.exe.tar.bz2
    

    Una vez que contamos con el fichero, lo descomprimimo y construimos los fuentes:

    	host:/usr/src/toolchain_stellaris# apt-get install unzip
    	host:/usr/src/toolchain_stellaris# mkdir -p stellarisware
    	host:/usr/src/toolchain_stellaris# cd stellarisware
    	host:/usr/src/toolchain_stellaris/stellarisware# unzip ../SW-EK-LM4F120XL-9453.exe
    	host:/usr/src/toolchain_stellaris/stellarisware# make
    	
    

    Veremos que cuenta con ejemplos como blinky, hello, etc.

    	host:/usr/src/toolchain_stellaris/stellarisware# cd ..
    	host:/usr/src/toolchain_stellaris/stellarisware# ls ./boards/ek-lm4f120xl	
    	.
    	bitband
    	blinky
    	drivers
    	ek-lm4f120xl.eww
    	ek-lm4f120xl.sgxw
    	ek-lm4f120xl.uvmpw
    	freertos_demo
    	gpio_jtag
    	hello
    	interrupts
    	Makefile
    	mpu_fault
    	project0
    	qs-rgb
    	timers
    	uart_echo
    	udma_demo
    	usb_dev_bulk
    	usb_dev_serial
    	host:/usr/src/toolchain_stellaris/stellarisware# cd ..
    

  4. Contruyendo el lm4flash

    lm4tools su descripción en https://github.com/utzig/lm4tools/blob/master/README.md. Este permite el desarrollo multiplataforma en el "TI Stellaris Launchpad boards".

    	host:/usr/src/toolchain_stellaris# git clone https://github.com/utzig/lm4tools.git
    

    Agrego también la instalación de libusb-1.0

    	host:/usr/src/toolchain_stellaris# aptitude install libusb-1.0-0 libusb-1.0-0-dev
    	host:/usr/src/toolchain_stellaris# aptitude install pkg-config
    
    	host:/usr/src/toolchain_stellaris# cd lm4tools/lm4flash
    	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# make
    	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# mv lm4flash ~/sat/bin/
    	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | tee /etc/udev/rules.d/99-stellaris-launchpad.rulesATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"
    	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# usermod -aG users root
    

  5. Problemas Resueltos:

    1. Problema 1: Al correr el makefile:
      	...
      	qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I../../gcc-linaro-4.7-2013.01/gcc -I../../gcc-linaro-4.7-2013.01/gcc/. -I../../gcc-linaro-4.7-2013.01/gcc/../include -I../../gcc-linaro-4.7-2013.01/gcc/../libcpp/include  -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc-linaro-4.7-2013.01/gcc/lto-opts.c -o lto-opts.o
      	gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I../../gcc-linaro-4.7-2013.01/gcc -I../../gcc-linaro-4.7-2013.01/gcc/. -I../../gcc-linaro-4.7-2013.01/gcc/../include -I../../gcc-linaro-4.7-2013.01/gcc/../libcpp/include  -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc-linaro-4.7-2013.01/gcc/lto-compress.c -o lto-compress.o
      	../../gcc-linaro-4.7-2013.01/gcc/lto-compress.c:28:18: fatal error: zlib.h: No existe el fichero o el directorio
      	compilation terminated.
      	gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I../../gcc-linaro-4.7-2013.01/gcc -I../../gcc-linaro-4.7-2013.01/gcc/. -I../../gcc-linaro-4.7-2013.01/gcc/../include -I../../gcc-linaro-4.7-2013.01/gcc/../libcpp/include  -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber -I../../gcc-linaro-4.7-2013.01/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc-linaro-4.7-2013.01/gcc/matrix-reorg.c -o matrix-reorg.o
      	make[2]: *** [lto-compress.o] Error 1
      	make[2]: *** Se espera a que terminen otras tareas....
      	rm gcc.pod
      	make[2]: se sale del directorio `/usr/src/toolchain_stellaris/summon-arm-toolchain/build/gcc'
      	make[1]: *** [all-gcc] Error 2
      	make[1]: se sale del directorio `/usr/src/toolchain_stellaris/summon-arm-toolchain/build'
      	make: *** [all] Error 2
      

      Solución:

      	host:/usr/src/toolchain_stellaris# apt-get install zlib1g-dev
      
    2. Problema 2:
      	libopencm3-4ad30d56b4b37e9c39d6623c61ea656c67441623/doc/lm3s/Doxyfile_latex
      	******************************************************************
      	* Building libopencm3-4ad30d56b4b37e9c39d6623c61ea656c67441623
      	******************************************************************
      	  UPDATING HEADERS
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	/usr/bin/env: python: No existe el fichero o el directorio
      	make: *** [generatedheaders] Error 127
      	root@hdcmvm:/usr/src/toolchain_stellaris/summon-arm-toolchain# 
      

      Solución:

      	host:/usr/src/toolchain_stellaris# aptitude install python-yaml
      
    3. Problema 3:
      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# make
      	make: pkg-config: No se encontró el programa
      	make: pkg-config: No se encontró el programa
      	gcc -Wall -g -O2  lm4flash.c  -o lm4flash
      	lm4flash.c:30:20: fatal error: libusb.h: No existe el fichero o el directorio
      	compilation terminated.
      	make: *** [lm4flash] Error 1
      

      Solución

      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# aptitude install pkg-config
      
    4. Problema 4: al correr el makefile
      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# make
      	make: pkg-config: No se encontró el programa
      	make: pkg-config: No se encontró el programa
      	gcc -Wall -g -O2  lm4flash.c  -o lm4flash
      	lm4flash.c:153:25: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:171:26: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:206:30: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:241:24: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:259:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:277:21: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:286:25: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:297:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:302:26: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:314:29: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:319:29: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c: In function ‘decode_buffer’:
      	lm4flash.c:360:13: error: ‘LIBUSB_ERROR_NO_MEM’ undeclared (first use in this function)
      	lm4flash.c:360:13: note: each undeclared identifier is reported only once for each function it appears in
      	lm4flash.c: At top level:
      	lm4flash.c:369:30: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:395:31: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:470:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:570:2: error: unknown type name ‘libusb_context’
      	lm4flash.c:571:2: error: unknown type name ‘libusb_device’
      	lm4flash.c: In function ‘flasher_flash’:
      	lm4flash.c:696:2: error: unknown type name ‘libusb_context’
      	lm4flash.c:697:2: error: unknown type name ‘libusb_device’
      	lm4flash.c:698:2: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:702:2: warning: implicit declaration of function ‘libusb_init’ [-Wimplicit-function-declaration]
      	lm4flash.c:706:11: warning: implicit declaration of function ‘libusb_error_name’ [-Wimplicit-function-declaration]
      	lm4flash.c:706:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:710:2: warning: implicit declaration of function ‘flasher_find_matching_device’ [-Wimplicit-function-declaration]
      	lm4flash.c:716:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:729:2: warning: implicit declaration of function ‘libusb_open’ [-Wimplicit-function-declaration]
      	lm4flash.c:732:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:736:2: warning: implicit declaration of function ‘libusb_claim_interface’ [-Wimplicit-function-declaration]
      	lm4flash.c:739:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:750:2: warning: implicit declaration of function ‘write_firmware’ [-Wimplicit-function-declaration]
      	lm4flash.c:756:3: warning: implicit declaration of function ‘libusb_close’ [-Wimplicit-function-declaration]
      	lm4flash.c:758:3: warning: implicit declaration of function ‘libusb_unref_device’ [-Wimplicit-function-declaration]
      	lm4flash.c:760:3: warning: implicit declaration of function ‘libusb_exit’ [-Wimplicit-function-declaration]
      	lm4flash.c: At top level:
      	lm4flash.c:84:16: warning: ‘flash_block’ defined but not used [-Wunused-variable]
      	lm4flash.c:89:3: warning: ‘buf’ defined but not used [-Wunused-variable]
      	lm4flash.c:103:17: warning: ‘le32_to_cpu’ defined but not used [-Wunused-function]
      	lm4flash.c:348:12: warning: ‘decode_buffer’ defined but not used [-Wunused-function]
      	make: *** [lm4flash] Error 1
      	root@hdcmvm:/usr/src/toolchain_stellaris/lm4tools/lm4flash# 
      

      Solución

      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# aptitude install libusb-1.0-0 libusb-1.0-0-dev
      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# aptitude install pkg-config
      
    5. Problema 5: al correr el makefile
      	root@hdcmvm:/usr/src/toolchain_stellaris/lm4tools/lm4flash# make
      	Package libusb-1.0 was not found in the pkg-config search path.
      	Perhaps you should add the directory containing `libusb-1.0.pc'
      	to the PKG_CONFIG_PATH environment variable
      	No package 'libusb-1.0' found
      	Package libusb-1.0 was not found in the pkg-config search path.
      	Perhaps you should add the directory containing `libusb-1.0.pc'
      	to the PKG_CONFIG_PATH environment variable
      	No package 'libusb-1.0' found
      	gcc -Wall -g -O2  lm4flash.c  -o lm4flash
      	lm4flash.c:153:25: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:171:26: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:206:30: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:241:24: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:259:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:277:21: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:286:25: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:297:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:302:26: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:314:29: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:319:29: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c: In function ‘decode_buffer’:
      	lm4flash.c:360:13: error: ‘LIBUSB_ERROR_NO_MEM’ undeclared (first use in this function)
      	lm4flash.c:360:13: note: each undeclared identifier is reported only once for each function it appears in
      	lm4flash.c: At top level:
      	lm4flash.c:369:30: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:395:31: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:470:27: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:570:2: error: unknown type name ‘libusb_context’
      	lm4flash.c:571:2: error: unknown type name ‘libusb_device’
      	lm4flash.c: In function ‘flasher_flash’:
      	lm4flash.c:696:2: error: unknown type name ‘libusb_context’
      	lm4flash.c:697:2: error: unknown type name ‘libusb_device’
      	lm4flash.c:698:2: error: unknown type name ‘libusb_device_handle’
      	lm4flash.c:702:2: warning: implicit declaration of function ‘libusb_init’ [-Wimplicit-function-declaration]
      	lm4flash.c:706:11: warning: implicit declaration of function ‘libusb_error_name’ [-Wimplicit-function-declaration]
      	lm4flash.c:706:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:710:2: warning: implicit declaration of function ‘flasher_find_matching_device’ [-Wimplicit-function-declaration]
      	lm4flash.c:716:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:729:2: warning: implicit declaration of function ‘libusb_open’ [-Wimplicit-function-declaration]
      	lm4flash.c:732:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:736:2: warning: implicit declaration of function ‘libusb_claim_interface’ [-Wimplicit-function-declaration]
      	lm4flash.c:739:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat]
      	lm4flash.c:750:2: warning: implicit declaration of function ‘write_firmware’ [-Wimplicit-function-declaration]
      	lm4flash.c:756:3: warning: implicit declaration of function ‘libusb_close’ [-Wimplicit-function-declaration]
      	lm4flash.c:758:3: warning: implicit declaration of function ‘libusb_unref_device’ [-Wimplicit-function-declaration]
      	lm4flash.c:760:3: warning: implicit declaration of function ‘libusb_exit’ [-Wimplicit-function-declaration]
      	lm4flash.c: At top level:
      	lm4flash.c:84:16: warning: ‘flash_block’ defined but not used [-Wunused-variable]
      	lm4flash.c:89:3: warning: ‘buf’ defined but not used [-Wunused-variable]
      	lm4flash.c:103:17: warning: ‘le32_to_cpu’ defined but not used [-Wunused-function]
      	lm4flash.c:348:12: warning: ‘decode_buffer’ defined but not used [-Wunused-function]
      	make: *** [lm4flash] Error 1
      

      Solución

      	host:/usr/src/toolchain_stellaris/lm4tools/lm4flash# aptitude install libusb-1.0-0 libusb-1.0-0-dev
      
    6. Problema 6: Al querer bajar los fuentes con git desde debian lenny
      	host:/usr/src/toolchain_stellaris/summon-arm-toolchain# git clone https://github.com/esden/summon-arm-toolchain
      
      	Initialized empty Git repository in /usr/src/toolchain_stellaris/summon-arm-toolchain/summon-arm-toolchain/.git/
      	error: The requested URL returned error: 403
      	warning: remote HEAD refers to nonexistent ref, unable to checkout.
      
      	host:/usr/src/toolchain_stellaris/summon-arm-toolchain# 
      

      Solución: referencia https://github.com/everzet/capifony/issues/72 Hay que cambiar https por git en la url, quedando así

      	host:/usr/src/toolchain_stellaris/summon-arm-toolchain# git clone git://github.com/esden/summon-arm-toolchain
      

  6. Enlaces y referencias:

    1. Stellaris® LM4F120 LaunchPad Evaluation:
      1. Stellaris® LM4F120 LaunchPad Evaluation Kit
      2. Stellaris® LM4F120 LaunchPad Evaluation Board Software
    2. Kernel Hacks site
      1. The complete tutorial for Stellaris LaunchPad development with GNU/Linux (I)(enlace local en pdf)
      2. The complete tutorial for Stellaris Launchpad development with GNU/Linux (II)(enlace local en pdf)
      3. The complete tutorial for Stellaris LaunchPad development with GNU/Linux (III)(enlace local en pdf)
    3. Is there an open source debugger for Stellaris?
      1. Stellaris Toolchain by Matthew Kendall (enlace local en pdf)
      2. Recursive Labs Blog
      3. Debugging the Stellaris with OpenOCD
    4. GNU Tools for ARM Embedded Processors
    5. Enlaces locales



INICIO   Otros temas