SEARCH
TOOLBOX
LANGUAGES
modified on 5 July 2017 at 14:47 ••• 54,121 views

Electrum-100 Manual/Getting Started

From Manuals

Revision as of 14:47, 5 July 2017 by Support (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This chapter covers the initial installation of the hardware and software for the Electrum 100.

Contents

Installation

To setup board parameters, a terminal or a PC running a terminal emulator should be connected to the first serial port (COM1) using a null modem cable. Connect a 5 VDC power supply and wait for a login prompt. Upon power up, an Electrum 100 with its default factory configuration will boot from Dataflash and load the kernel and filesystem from NAND. To perform the initial board setup, please login as root and enter "password" when prompted for a password. Change the password using the 'passwd' command. The date can be changed using 'date' or via NTP using 'ntpdate'.

Debian GNU/Linux 5.0 electrum100 ttyS0

electrum100 login: root
Password:
Last login: Wed Jun 30 09:00:23 UTC 2010 on ttyS0
Linux electrum100 2.6.33.5-at91 #1 Tue Jun 29 11:37:56 EST 2010 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last was Wed Jun 30 09:10:46 2010 on ttyS0.

electrum100:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

electrum100:~# date 063012222010
Wed Jun 30 12:22:00 UTC 2010

electrum100:~# hwclock --systohc

The board default Ethernet configuration uses DHCP to obtain a dynamic address. To change to a static address, edit the following lines in /etc/network/interfaces .

# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.221
netmask 255.255.255.0
gateway 192.168.1.253

Before powering down, please execute the "shutdown" command from the root account to insure a proper shutdown.

electrum100:/# shutdown -h now

Broadcast message from root@electrum100 (ttyS0) (Wed Jun 30 12:38:26 2010):
The system is going down for system halt NOW!
...
Will now halt.
Power down.

Files can be transferred from the PC to the Electrum 100 using an Ethernet network, a USB flash drive or the COM1 serial port. Ethernet uploads can be made via SCP, NFS, FTP (ftpget) or TFTP. Serial uploads can be made via zmodem (rz).

Toolchain installation

To develop software for the Electrum 100, the recommended environment is a PC running x86 Linux. The Linux kernel should be 2.6.26 or above and the GCC compiler 4.3.2 or above. Debian or derivatives (including Ubuntu) are the Linux distributions directly supported by Micromint. Board software is available for download from the Electrum Wiki.

http://wiki.micromint.com/index.php/Electrum_Documentation

The recommended toolchain is the Embedian ARM cross toolchain. To install this cross toolchain under Debian or Ubuntu distributions, follow these steps:

1. Add the native compiler, make and ncurses library if they are not already in your development system.

# apt-get install gcc g++ make libncurses5-dev

2 Add the following line to /etc/apt/sources.list

deb http://www.emdebian.org/debian/ squeeze main

and update the signatures

# apt-get install emdebian-archive-keyring
# apt-get update

3. Install the following packages

# apt-get install linux-libc-dev-armel-cross libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi \
  gcc-4.3-arm-linux-gnueabi g++-4.3-arm-linux-gnueabi gdb-arm-linux-gnueabi uboot-mkimage

# apt-get install apt-cross dpkg-cross

More information on the Embedian toolchain is available from these references:

http://wiki.debian.org/EmdebianToolchain
http://www.emdebian.org/crush/keys.html

Another alternative is the Sourcery G++ Lite for GNU/Linux from CodeSourcery. The current version of this toolchain can be can be retrieved from the URL below. Select the "IA32 GNU/Linux TAR" distribution when updating.

http://www.codesourcery.com/downloads/public/gnu_toolchain/arm-none-linux-gnueabi

The PATH change will be effective on your next login. To confirm that the toolchain is on your PATH and is working properly, try compiling a simple 'Hello' program.

$ arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (Debian 4.3.2-1.1) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ arm-linux-gnueabi-gcc -g -march=armv5te -Os -Wall hello.c -o hello

$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26,
 not stripped

To set the toolchain prefix when compiling user space applications with Sourcery G++ Lite for GNU/Linux use

$ export CROSS_COMPILE=arm-linux-gnueabi-

Some applications may also require changing other Makefile variables to use the toolchain prefix. To test your applications in the Electrum 100, you can export one of your directories via NFS and mount it from the board. Once the application is complete, you can copy the binaries to the flash filesystem. Other alternatives to copy applications to the board include SCP, FTP, TFTP or zmodem.

Other toolchains can be used with the Electrum 100 to fulfill specific application requirements. Purposes of alternate toolchains include (but are not limited to) using GPL2 licensing (gcc 4.2.1 or lower) or using uClibc as the system 'C' library. Note that using an alternate toolchain to regenerate a kernel and its operating system utilities requires significant expertise with embedded Linux.

Although x86 Linux is the preferred development environment, it is feasible to develop user space applications on Windows PCs. The recommended toolchain would be the "IA32 Windows Installer" of Sourcery G++ Lite for GNU/Linux. Installation of the Cygwin shell and utilities is also advisable if you intend to use 'make' and other tools normally available under Linux. This will allow you to compile Linux user space executables to use on the Electrum 100. One important limitation when using a Windows PC for development is that many Makefiles for Linux applications assume packages or characteristics of a Linux installation that may not be implemented in Cygwin under Windows. For example, it could be very time consuming to rebuild the Linux kernel or the board bootloader under Windows. If you are restricted to using a Windows PC for development, you may consider VMWare or other virtualization software that allows you to run Linux from Windows.

Using Remote NFS Filesystems

The kernel in the Electrum 100 can mount its root filesystem via NFS. This allows setup of a directory in a development workstation or server to act as a repository for the target files, saving time during development since files are instantly accessible from the board without a transfer process. Once the development is released, the directory can be converted to a JFFS2 filesystem using 'mkfs.jffs2'. These are the main steps to use an NFS root filesystem with the Electrum 100: 1. Install the NFS service in your development workstation, if it is not installed already.

$ apt-get install nfs-kernel-server nfs-common portmap

2. Add the ARM root filesystem directory to your /etc/exports file and allow access to your local subnet.

/home/electrum100/rootfs 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)

After changing the exports file, perform an update by executing ‘exportfs –a’.

3. Allow access in /etc/hosts.allow to portmap and NFS daemons to your local subnet.

# Allow NFS mounts from local network
portmap: 127.0.0.1 192.168.1.0/255.255.255.0
mountd: 127.0.0.1 192.168.1.0/255.255.255.0
lockd: 127.0.0.1 192.168.1.0/255.255.255.0
rquotad: 127.0.0.1 192.168.1.0/255.255.255.0
statd: 127.0.0.1 192.168.1.0/255.255.255.0

4. Change the boot arguments on the board to use NFS. When booting, press any key to go to the U-Boot prompt. These are the arguments to boot the board with 192.168.1.221/24 and mount the root filesystem via NFS from 192.168.1.249.

Electrum> setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.249:/home/electrum100/rootfs
ip=192.168.1.221:192.168.1.249::255.255.255.0::eth0:
Electrum> saveenv
Electrum> reset

The parameters are as follows:

nfsroot=<server_ip>:<mount_directory>
ip = <board_ip>:<server_ip>:<gateway_ip>:<netmask>:<hostname>:<device>:<proto>

The IP on the boot arguments is used until the Linux TCP/IP service is started. If the IP configuration in your bootstring and the /etc/network/interfaces on your root filesystem are not consistent, your connection will be terminated when TCP/IP starts and you will see a message of the form "nfs: server x.x.x.x not responding". To avoid this, modify /etc/network/interfaces on your root filesystem consistent with the IP config on the boot arguments.

You can export multiple directories for different purposes, e.g. a development filesystem, a production filesystem, an application-specific filesystem, etc. This can save time during the development process.

For more details on configuring NFS, please visit the following URL or contact Micromint support at support@micromint.com .

http://tldp.org/HOWTO/NFS-HOWTO/server.html

Updating the Linux kernel and root filesystem

Released versions of the the Electrum 100 Linux kernel and filesystem are included in Released versions of the the Electrum 100 Linux kernel and filesystem are included in the "boot" directory of the Tools CD. Full sources are included in the board support package (BSP) to allow development of customized kernels and/or filesystems. They can be rebuilt with the Makefile provided.

$ cd ~/electrum100
$ make kernel
$ make filesystem

The resulting kernel and filesystem will be in the "boot" subdirectory. These files can be uploaded to the Electrum 100 NAND flash using the U-Boot bootloader. Updating the NAND will require the addresses of the NAND flash partitions shown in Table 2-1.

Table 2-1: NAND Flash Memory Map – 512 MB (Base = 0x40000000)
Start End Description Max Size Device
0x00000000 0x0003FFFF Bootstrap 256 KB /dev/mtdblock0
0x00040000 0x0007FFFF U-Boot executable 256 KB /dev/mtdblock1
0x00080000 0x000BFFFF U-Boot environment 256 KB /dev/mtdblock2
0x000c0000 0x000FFFFF U-Boot redundant 256 KB /dev/mtdblock3
0x00100000 0x001FFFFF User area 1 MB /dev/mtdblock4
0x00200000 0x003FFFFF Linux kernel 2 MB /dev/mtdblock5
0x00400000 0x1FFFFFFF Root filesystem 508 MB /dev/mtdblock6

NOTE: Only the kernel and filesystem partitions are used when booting from Dataflash

To access the bootloader console, connect a terminal or a PC running a terminal emulator should be connected to the first serial port (COM1) using a null modem cable. Upon power up, press any key to prevent the boot process from loading the kernel. Files can be uploaded using a USB flash drive, MMC/SD card, TFTP, NFS or a serial upload. The following would be representative commands to use a USB flash drive for NAND updates.

Table 2-2: Byte Counts for Kernel and File Systems
Byte Count
Linux 2.6.33.20-1 Kernel 0x1E0000
Debian 5.0.9 0x3720000
Debian 6.0.4 0x3D40000

NOTE: Byte counts below correspond to the 2.6.33.20-1 kernel and 6.0.4 filesystem on the Wiki. If you use others you will need to adjust the byte counts.

Electrum> nand erase

NAND erase: device 0 whole chip
Skipping bad block at  0x280000000000000                                        
Erasing at 0x1ffe000000000000 --   0% complete.
OK

Electrum> usb start
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found

Electrum> fatload usb 0 0x20100000 uImage-2.6.33.20-1-at91
reading uimage-2.6.33.20-1-at91

1939092 bytes read

Electrum> nand write 0x20100000 0x200000 0x1E0000

NAND write: device 0 offset 0x200000, size 0x1e0000
1966080 bytes written: OK

Electrum> fatload usb 0 0x20100000 rootfs.armel.jffs2
reading rootfs.armel.jffs2

64225280 bytes read

Electrum> nand write.jffs2 0x20100000 0x400000 0x3D40000

NAND write: device 0 offset 0x400000, size 0x3d40000
 64225280 bytes written: OK

Electrum> usb stop
stopping USB..

Electrum> reset

The NAND flash erase procedure can report some bad blocks. That is normal. They are mapped during the process and not used for storage. Note that the filesystem size (last parameter in the 'nand write' command) should match the size of the file you generated to insure the filesystem is created properly.

To copy the files from an FTP server, check that the following parameters are setup in the bootloader environment.

Electrum> printenv
bootargs=console=ttyS0,115200 root=/dev/mtdblock6 mtdparts=atmel_nand:256k(bootstrap)ro,256k(uboot)ro,256k(env1),
256k(env2),1024k(user),2M(linux),-(root) rw rootfstype=jffs2
bootcmd=nand read 0x22000000 0x200000 0x200000; bootm
bootdelay=1
baudrate=115200
ethact=macb0
ethaddr=00:21:a3:00:00:12
ipaddr=192.168.1.221
netmask=255.255.255.0
serverip= 
bootargs=console=ttyS0,115200
stdin=serial
stdout=serial
stderr=serial

Electrum> setenv ethaddr 00:21:a3:00:00:00
Electrum> setenv ipaddr 192.168.1.221
Electrum> setenv netmask 255.255.255.0
Electrum> setenv serverip 192.168.1.249
Electrum> saveenv

The ethaddr should match the board serial number of the board and the serverip should be the TFTP server address. With this setup, the NAND flash can be updated via TFTP using the following commands.

Electrum> nand erase

NAND erase: device 0 whole chip
Skipping bad block at  0x02dc0000
Skipping bad block at  0x33b80000
Erasing at 0x3ffc0000 -- 100% complete.
OK

Electrum> tftp 0x20100000 uImage-2.6.33.20-1-at91
...

Electrum> nand write 0x20100000 0x200000 0x1E0000

NAND write: device 0 offset 0x200000, size 0x1e0000
1966080 bytes written: OK

Electrum> tftp 0x20100000 rootfs.armel.jffs2
...
Electrum> nand write.jffs2 0x20100000 0x400000 0x3720000

NAND write: device 0 offset 0x400000, size 0x3720000
57802752 bytes written: OK

Electrum> reset

To use NFS or serial upload (loady) please consult the U-Boot documentation at the URL below or contact Micromint support (support@micromint.com) . http://www.denx.de/wiki/U-Boot

Updating the Bootstrap and Bootloader

Released versions of the the Electrum 100 botstrap and bootloader are included in the "boot" directory of the Tools CD. Full sources are included in the board support package (BSP) to allow development of customized boot features. They can be rebuilt with the Makefile provided.

$ cd ~/electrum100
$ make bootstrap
$ make bootloader

The resulting bootstrap and bootloader will be in the "boot" subdirectory. These files can be uploaded to the Electrum 100 Dataflash using the Atmel AT91 In-System Programmer (ISP) utility included in the "tools" directory on the CD. The AT91 ISP is currently only released for Windows PCs. A test version of the AT91 ISP for Linux is available on the Atmel web site. Please check the README file in the "tools" directory of the CD. Updating the Dataflash will require the addresses of the Dataflash partitions shown in Table 2-3.

Table 2-3": DataFlash Memory Map – 256 KB (CS1 Base = 0xD0000000)
Start End Description Max Size
0x00000000 0x000020FF Bootstrap 8,448 (>8 KB)
0x00002100 0x000041FF U-Boot environment 8,448 (>8 KB)
0x00004200 0x0003DDFF U-Boot executable 236,544 (231 KB)
0x0003DE00 0x00041FFF User area 16,896 (>16 KB)

The SAM-BA utility of the AT91 ISP can upload the boot files using a Segger J-Link (JTAG) or a serial port connected to COM2 (DBGU). When updating the Dataflash via the serial port, jumper JP2 must be removed prior to powering up the board. When the AT91 ISP is loaded, a window similar to that of Figure 2-1 will be displayed. Select the desired interface and click the "Connect" button.

Atmel ISP
Figure 2-1: Atmel AT91 ISP connection window

For serial port uploads, after the connect process please replace jumper JP2 to allow access to the Dataflash. Once the connection to the board is established, a window similar to that of Figure 2-2 will be displayed. Select the "Dataflash AT45 DB" tab.

Atmel ISP
Figure 2-2: Atmel AT91 ISP Dataflash utilities

To perform the upload follow these steps:

  1. Select "Enable Dataflash (SPIO CS1)" from the scripts listbox and click on "Execute".
  2. Select "Erase All" from the scripts listbox and click on "Execute".
  3. Select "Send boot file" from the scripts listbox and click on "Execute". Select the location and filename of the bootstrap file bootstrap-df-1.11.bin .
  4. Select the location and filename of the bootloader file u-boot-df-2010.09.bin . Enter 0x4200 on the Address field and click on "Send File".
  5. Exit SAM-BA and reset the board.

This procedure does not erase the bootloader data saved on the environment partition. That is erased only if you select to completely erase the Dataflash with the SAM-BA "Erase Dataflash" script. If the Dataflash is erased, after resetting the board, press a key when booting to enter a minimal bootloader environment as indicated in section 2.3 of this manual.

Memory Maps

The processor memory map and the Linux device names of internal peripherals are shown in Tables 2-4 and 2-5 and Figure 2-3. Majors and minors follow the Linux device name conventions listed on the devices-2.6+.txt file included in the "docs" directory of the Tools CD. IOCTLs available to user space applications vary according to the driver. Consult Linux device driver references for more details.


Table 2-4: Main Memory Map
Start End Description
0x00000000 0x0FFFFFFF Internal CPU memories
0x20000000 0x2FFFFFFF SDRAM (32 – 256 MB)
0x40000000 0x4FFFFFFF NAND (128 MB – 2 GB)
0xD0000000 0xDFFFFFFF DataFlash at CS1
0xF0000000 0xFFFFFFFF Internal CPU peripherals


Table 2-5: Internal Peripheral Memory Map
Start Description Device
0xFFFB0000 COM1 (UART0) /dev/ttyS0
0xFFFB4000 UART1
0xFFFB8000 UART2
0xFFFC4000 Ethernet MAC (EMAC) eth0
0xFFFC8000 SPI0
0xFFFCC000 SPI1
0xFFFFF200 COM2 (DBGU) /dev/ttyS1
0xFFFFF400 PIOA
0xFFFFF600 PIOB
0xFFFFF800 PIOC
Atmel ISP
Figure 2-3: AT91SAM9G20 Memory Map

NEXT: Hardware

PREVIOUS: Introduction