Herramientas de usuario

Herramientas del sitio


desarrollo:linux:linux_en_ciaa-nxp

Linux corriendo en CIAA-NXP

Cómo cargar Linux en la CIAA-NXP

Prerequisitos

Builroot requiere tener instalados los siguientes tools:

which
sed
make (version 3.81 or any later)
binutils
build-essential (only for Debian based systems)
gcc (version 2.95 or any later)
g++ (version 2.95 or any later)
bash
patch
gzip
bzip2
perl (version 5.8.7 or any later)
tar
cpio
python (version 2.6 or 2.7)
unzip
rsync
wget
ncurses-dev
git
bc

En debian/​ubuntu(14.04) ejecutar:

sudo apt-get install sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync wget libncurses5-dev git bc

Componentes

  • U-Boot Emcraft-based 2010.03
  • Linux Kernel v3.18-rc4 + port para LPC18xx/LPC43xx
  • Buildroot 2014.11-git + config para CIAA LPC4337
  • Busybox altamente customizado
  • i2c-tools
  • memtester
  • mii-diag
  • strace

Pasos a seguir

1. Clonar el Buildroot

$ git clone https://github.com/ciaa/buildroot.git
$ cd buildroot/

2. Configurar Buildroot

$ pwd
/home/user/buildroot

$ make ciaa_lpc4337_defconfig

3. Compilar

$ make

(prepararse unos mates mientras termina)

4. Grabar la CIAA

Buildroot produce varias imágenes:

$ ls output/images/
lpc4337-ciaa.dtb  rootfs.cpio  u-boot.bin  uImage

Solamente necesitamos u-boot.bin y uImage. El u-boot.bin se debe grabar en la flash interna (0x1a000000) y el uImage en SPIFI (0x14000000). Esto no es tan simple, debido a que la configuración de openocd actual no soporta el acceso a SPIFI (falta verificar).

De todos modos, la grabación no es tan trillada. Se puede proceder de la siguiente forma. Se usa openocd y gdb con la configuración CIAA para acceder a la flash interna en 0x1a000000 y grabar u-boot.bin. Los comandos de gdb serían más o menos:

target remote :3333
monitor halt
monitor flash erase_sector 0 0 last
monitor flash write_image erase unlock /home/user/buildroot/output/images/u-boot.bin 0x1A000000 bin

Una vez hecho esto se puede bootear la CIAA, y usar minicom/microcom para levantar la consola USART2 (la que viene con el USB) a 115200-8-N-1.

Una vez en la consola U-Boot, grabar la imagen Linux (uImage) es muy simple, usando un comando “run update”:

ciaa > run update
Auto-negotiation...completed.
LPC18XX_MAC: link UP (100/Full)
Using LPC18XX_MAC device
TFTP from server 192.168.0.45; our IP address is 192.168.0.103
Filename 'uImage-ciaa-nxp'.
Load address: 0x28000000
Loading: T #################################################################
       ###################
done
Bytes transferred = 1227114 (12b96a hex)

Cómo se puede ver, el comando transfiere de un servidor TFTP el archivo 'uImage-ciaa-nxp'. Lo único que tenemos que hacer es configurar la dirección IP del servidor TFTP (192.168.0.45 por default) y copiar el archivo uImage al servidor:

$ cp output/images/uImage /srv/tftp/uImage-ciaa-nxp

Se encontrará una guía detallada paso por paso aquí

5. FAQ

?? Q: ¿Cómo se instala un servidor TFTP? ?? A: ¡Es muy fácil! Sólo tienes que… http://bit.ly/1pZ5rzo. Usuarios de Debian/​Ubuntu pueden ver este tutorial. Recordar que si conectan la CIAA-NXP directo a la PC donde funcionará el servidor TFTP, deberán configurar la conexión Ethernet con IP fija 192.168.0.45.

Algunos detalles técnicos de Linux corriendo en la CIAA-NXP

# dmesg
Booting Linux on physical CPU 0x0
Linux version 3.18.0-rc4 (zeta@arch) (gcc version 4.8.2 (OSELAS.Toolchain-2013.12.2) ) #2 Thu Dec 4 17:39:12 ART 2014
CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=00000000
CPU: unknown data cache, unknown instruction cache
Machine model: CIAA NXP LPC4337
bootconsole [earlycon0] enabled
On node 0 totalpages: 2048
free_area_init_node: node 0, pgdat 281a0efc, node_mem_map 287f0000
  Normal zone: 16 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 2048 pages, LIFO batch:0
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0 
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 2032
Kernel command line: console=ttyS0,115200 earlyprintk ip=192.168.0.103:192.168.0.45:::ciaa-nxp:eth0:off ethaddr=C0:B1:3C:88:78:93
PID hash table entries: 32 (order: -5, 128 bytes)
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 6328K/8192K available (931K kernel code, 77K rwdata, 152K rodata, 476K init, 74K bss, 1864K reserved)
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0x28000000 - 0x28800000   (   8 MB)
      .text : 0x28008000 - 0x28116cf8   (1084 kB)
      .init : 0x28117000 - 0x2818e000   ( 476 kB)
      .data : 0x2818e000 - 0x281a1520   (  78 kB)
       .bss : 0x281a1520 - 0x281b3fed   (  75 kB)
NR_IRQS:16 nr_irqs:16 16
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836480000000ns
Calibrating delay loop... 15.87 BogoMIPS (lpj=79360)
pid_max: default: 4096 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Switched to clocksource lpc3250 timer
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console [ttyS0] disabled
of_serial 400c1000.serial: ttyS0 at MMIO 0x400c1000 (irq = 19, base_baud = 9000000) is a 16550A
console [ttyS0] enabled
bootconsole [earlycon0] disabled
of_serial 400c2000.serial: ttyS1 at MMIO 0x400c2000 (irq = 20, base_baud = 9000000) is a 16550A
stmmaceth 40010000.ethernet: no reset control found
stmmac - user ID: 0x11, Synopsys ID: 0x36
 Ring mode enabled
 DMA HW capability register supported
 Enhanced/Alternate descriptors
	Enabled extended descriptors
 RX Checksum Offload Engine supported (type 2)
 TX Checksum insertion supported
 Wake-Up On Lan supported
 Enable RX Mitigation via HW Watchdog Timer
libphy: stmmac: probed
eth0: PHY ID 0007c0f1 at 1 IRQ POLL (stmmac-0:01) active
i2c /dev entries driver
TCP: cubic registered
Freeing unused kernel memory: 476K (28117000 - 2818e000)
/ # free
             total         used         free       shared      buffers
Mem:          6804         2800         4004            0            0
-/+ buffers:               2800         4004
/ # memtester 800K 1
memtester version 4.3.0 (32-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 0MB (819200 bytes)
got  0MB (819200 bytes), trying mlock ...locked.
  Loop 1/1:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Done.

Roadmap

Si bien la CIAA NXP ya bootea y funciona de manera relativamente estable, existen varios interrogantes y tareas que están pendientes. Sin ningún orden particular:

  • Migrar a un kernel XIP Listo.
  • Migrar a un rootfs XIP Ezequiel hizo algunos avances usando ROMFS. No es realmente XIP, pero permite reducir el uso de RAM notablemente.
  • Habilitar y probar las entradas y salidas GPIOs Completado.
  • Habilitar y probar I2C Completado Ernesto pudo leer de la EEPROM.
  • Habilitar y probar SPI Completado. Funciona usando mainline.
  • Habilitar y probar USB (Faltaría configurar el árbol del USB0PLL)
  • Habilitar y probar RTC
  • Implementar driver para watchdog Completado.
  • Implementar un driver PWM usando el SCT Completado.
  • Implementar drivers IIO para ADC/DAC
  • Usar el timer systick implementado en mainline
  • Configurar y probar httpd y telnetd El driver stmmac en mainline no funciona para LPC43xx. Ezequiel porteó el driver stm32 de Emcraft para el IP core MAC, el cual funciona bien y pudo probar httpd.
  • Investigar la posibilidad de usar la SRAM para liberar SDRAM [3].
  • Si la memoria RAM escasea, es posible hacer un análisis detallado del footprint dinámico (usando ftrace) y estático (usando readelf). Esto puede ser interesante para identificar grandes sumideros de memoria y tratar de reducirlos [4].
  • Investigar la utilización del MPU
  • Investigar la utilización del companion CPU cortex-M0, para realizar multiprocesamiento asimétrico. Work-in-progress por Ariel D'alessandro. Más información.
  • Investigar por qué es necesario mantener el clock USB0 encendido Posiblemente no interese una vez que los clks USB estén inicializados.

Periféricos soportados en upstream

En esta wiki se puede consultar una tabla del estado de cada periférico respecto de su soporte en el kernel oficial o upstream.

Enlaces de interés

desarrollo/linux/linux_en_ciaa-nxp.txt · Última modificación: 2016/03/15 23:52 por egarcia

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki