lpcware

Thoughts on the LPC1788 uCLinux port on the Embedded Artists board

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by wellsk on Thu Dec 22 16:46:22 MST 2011

EmCraft did a  pretty gooduCLinux port to the LPC1788 devices and has added support for the Embedded Artists board. I had a chance to try this out last week and will give some (quick) thoughts on it here. I hope this doesn't sound like a review.


The version tested was 1.3.0 (emCrafts packaged release version). This version covers the core features of the LPC17xx devices and includes patches and build procedures for u-boot, the kernel, and some applications. The build is based on the Code Sourcery Lite tools, which you'll have to download separately from <a href="http://www.mentor.com/embedded-software/codesourcery" target="_blank">Mentor Graphics</a> site. I tested the build on a dedicated Linux machine running Ubuntu 10.04, although other versions or even a VM should work fine. The EmCraft LPC1788 port is <a href="http://www.emcraft.com/index.php/products/88">here</a>.


<h1>Supported peripherals in v1.3.0</h1>

Most of the core CPU devices are supported in the v1.3.0 release - this includes the NVIC, MPU, system tick, and other CPU specific. Other devices supported incude the serial ports and ethernet MAC controller. Board specific functions include NOR FLASH via the MTD layer and the ethernet PHY.


Some of the devices - USB, SD, LCD controller - aren't there yet, but we'll probably see these devices available soon.


<h1>Documentation and build process</h1>

The documentation consists of a BSP guide specific to the Embedded Artists LPC1788 board, a Linux Cortex-M User's manual, and the release notes. The User's manual explains the process of installation, where to get and install the Code Sourcery tools, and how to build and deploy the images to the board. The build process requres first running a script to setup smoe basic environment variables and then typing make in the one of the project folders. One of the projects - networking - builds an uncompressed kernel image (uImage) with the busybox application (and root filesystenm as a single image) using initramfs.


<h1>u-boot</h1>

u-boot is based on the 2010.06 source code and the default image runs out of internal FLASH and uses internal RAM for primary memory storage. It initializes DRAM, which is used for loading of larger applications (ie, the kernel or ramdisk images). As of this release, u-boot supports the network interface, NOR FLASH, and DRAM. <em>As of this release, NAND FLASH and internal FLASH were not supported, but should be easy to add. Optionally, the <a href="http://www.lpcware.com/content/project/lpc177x8x-u-boot-port" target="_blank">2011.06 u-boot port</a> may be used which runs in DRAM and supports internal FLASH, ethernet, and NAND FLASH, but not NOR FLASH.</em>


Programming u-boot into the board was a breeze, requiring only the FLASH Magic utility with the generated hex file. Console output was via the UART on the serial USB interface. Environment variables are saved in NOR FLASH.


<pre>U-Boot 2010.03-linux-cortexm-1.3.0 (Dec 12 2011 - 16:16:09)
CPU  : LPC178x/7x series (Cortex-M3)
Freqs: SYSTICK=108MHz,EMCCLK=54MHz,PCLK=54MHz
Board: EA-LPC1788 rev 1
DRAM:  32 MB
Flash:  4 MB
In:    serial
Out:   serial
Err:   serial
Net:   LPC178X_MAC
Hit any key to stop autoboot:  0
EA-LPC1788&gt;</pre>

u-boot came right up after prograaming in internal FLASH and resetting the board. Bootup time was very fast. The first time you run u-boot, you'll get a message about using the default environment (the output from the boot cycle above doesn't show this). You can do a 'saveenv' command to save the default u-boot parameters in NOR FLASH.


Overall, u-boot was stable and functional. Some of the convience capabilities of u-boot such as command line history, command shortcuts, and the ping command are not part of the default configuration, but can be added to u-boot by placing the CONFIG_ options in the board's u-boot config file and re-building the image.


<h1>uCLinux kernel</h1>

The 2.6.33 kernel source with a set of patches is used to kernel image. A pre-built kernel configuration is used to build the LPC1788 specific kernel image (this is actually a multi-board image, with a kernel boot line argument selecting which board configuration to use at run-time). The default kernel configuration and image supported networking and seemed to work fine. Response was faster than uCLinux running on the LPC2000 and the kernel was very stable - no crashes or problems were noted during use - this is good! Once the kernel was started, the boot time was very fast (about 1 second from the first kernel message to the busybox prompt!).


Here is a boot sequence of the default build from the start of the bootm command in u-boot to to the busybox prompt. Note the kernel image size (2MB) is an uncompressed size and includes the initramfs image.


<pre>EA-LPC1788&gt; bootm
## Booting kernel from Legacy Image at a0000000 ...
   Image Name:   Linux-2.6.33-arm1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2089536 Bytes =  2 MB
   Load Address: a0008000
   Entry Point:  a0008001
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
 
Starting kernel ...
 
ÿLinux version 2.6.33-arm1 (usb10132@usb10132-desktop) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188) ) #18 Tue Dec 13 14:04:12 PST 2011
CPU: ARMv7-M Processor [412fc230] revision 0 (ARMv7M)
CPU: NO data cache, NO instruction cache
Machine: NXP LPC178x/7x
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 4064
Kernel command line: lpc178x_platform=ea-lpc1788 console=ttyS0,115200 panic=10 ip=10.1.10.214:::ea-lpc1788:eth0:off mem=16M ethaddr=C0:B1:3C:88:88:88
PID hash table entries: 64 (order: -4, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 16MB = 16MB total
Memory: 14140k/14140k available, 2244k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0xa0000000 - 0xa1000000   (  16 MB)
    modules : 0xa0000000 - 0x01000000   (1552 MB)
      .init : 0xa0008000 - 0xa00f1000   ( 932 kB)
      .text : 0xa00f1000 - 0xa01f7000   (1048 kB)
      .data : 0xa01f8000 - 0xa0206240   (  57 kB)
Hierarchical RCU implementation.
NR_IRQS:41
Calibrating delay loop... 30.92 BogoMIPS (lpj=154624)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
platform_device_registered
bio: create slab &lt;bio-0&gt; at 0
Switching to clocksource lpc178x-timer1
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP reno registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x4000c000 (irq = 5) is a 16550A
console [ttyS0] enabled
serial8250.2: ttyS1 at MMIO 0x40098000 (irq = 7) is a 16550A
physmap platform flash device: 00400000 at 80000000
physmap-flash: Found 1 x16 devices at 0x0 in 16-bit bank
Support for command set 0701 not present
gen_probe: No supported Vendor Command Set found
Found: SST 39VF3201
physmap-flash: Found 1 x16 devices at 0x0 in 16-bit bank
number of JEDEC chips: 1
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash":
0x000000000000-0x000000020000 : "flash_uboot_env"
0x000000020000-0x000000300000 : "flash_linux_image"
0x000000300000-0x000000400000 : "flash_jffs2"
lpc_mii_bus: probed
eth0: using RMII interface
eth0: LPC mac at 0x20084000 irq 28
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
TCP cubic registered
NET: Registered protocol family 17
IP-Config: Device `off' not found.
Freeing init memory: 932K
init started: BusyBox v1.17.0 (2011-12-13 14:01:47 PST)
~ #</pre>


I said this was going to be quick, so I'm going to stop here for now. My general impression is that what's there now is pretty good. The performance is surprising for a smaller part (and lots of experience with MMU/cache based devices). I hope to see some of the other peripheral support available soon!

Outcomes