Electrum-200 Manual/Getting Started
From Manuals
This chapter covers the board and software installation for the Electrum 200.
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 200 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 press ENTER when prompted for a password. Change the password using the ‘passwd’ command.
Welcome to Micromint Linux 2.6.28.8 ttyS1 electrum200 login: root Password: login[387]: root login on 'ttyS1' BusyBox v1.13.2 (2009-02-27 17:02:28 EDT) built-in shell (ash) Enter 'help' for a list of built-in commands. # passwd root Changing password for root New password: Retype password: Password for root changed by root
The board default Ethernet configuration uses a static address. To change the address or to use DHCP, edit the following lines in /etc/init.d/rcS.
# Static IP address ifconfig eth0 192.168.1.221 netmask 255.255.255.0 route add default gw 192.168.1.253 # Dynamic IP address (DHCP) #udhcpc -i eth0
To enable remote access, generate the SSH keys and remove the comment (#) from the last line in the rcS file.
# dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key Will output 1024 bit rsa secret key to '/etc/dropbear/dropbear_rsa_host_key' Generating key, this may take a while... ... Fingerprint: md5 a1:7f:e9:62:a7:e8:27:fa:ab:db:86:66:b2:93:6f:cb # dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key Will output 1024 bit dss secret key to '/etc/dropbear/dropbear_dss_host_key' Generating key, this may take a while... ... Fingerprint: md5 01:4f:6f:f5:37:41:c5:f4:ea:6b:a6:97:6c:03:10:f7
Before powering down, please execute the “halt” command from the root account to insure a proper shutdown.
# halt The system is going down NOW! Sending SIGTERM to all processes Requesting system halt System halted.
Files can be transferred from the PC to the Electrum 200 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 200, the recommended environment is a PC running x86 Linux. The Linux kernel should be 2.6.8 or above and the GCC compiler 4.1.1 or above. Debian or derivatives (including Ubuntu) and RedHat or derivatives (including CentOS and Fedora) are the Linux distributions supported by Micromint. A Tools CD is included with the board that contains the following directories:
| Directory | Description |
|---|---|
| /boot | bootloader, kernel and filesystem files. These can be used to restore the board to its factory installation state. |
| /docs | Documentation in PDF format. |
| /drivers | USB drivers. |
| /licenses | Licenses applicable to software included on the CD. |
| /src | Board support package (BSP) and kernel source code |
| /tools | Compiler toolchains and other tools |
| /utils | General purpose utilities. |
The recommended toolchain is the Sourcery G++ Lite for GNU/Linux from CodeSourcery. A snapshot of this toolchain can be found on the tools directory. 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
These are representative commands to mount the CD, install the software on your home directory and add the directory to your PATH. Use the directories, username (myuser) and group (mygroup) applicable to your system.
$ mount /dev/cdrom /mnt/cdrom $ cd ~ $ tar xfj /mnt/cdrom/tools/arm-2008q3-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 $ tar xfj /mnt/cdrom/tools/devkitARM_r25b-i686-linux.tar.bz2 $ tar xfj /mnt/cdrom/tools/electrum200-bsp-2009-03.tar.bz2 $ cd electrum200 $ tar xfj /mnt/cdrom/tools/linux-2.6.28.8-at91.tar.bz2 $ sudo tar xfj /mnt/cdrom/tools/rootfs.arm.tar.bz2 $ sudo chown –R myuser:mygroup rootfs $ echo "export PATH=$PATH:~/arm-2008q3/bin;~devkitARM" >> ~/.bashrc $ unmount /mnt/cdrom
To 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-none-linux-gnueabi-gcc –version arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-41) 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-none-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.14, not stripped
To set the toolchain prefix when compiling user space applications with Sourcery G++ Lite for GNU/Linux use
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
Some applications may also require changing other Makefile variables to use the toolchain prefix. To test your applications in the Electrum 200, 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 200 to fulfill specific application requirements. They are listed on the README file included in the /tools directory of the CD as alternate toolchains. 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 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 200. 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 200 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 200:
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/electrum200/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.
Electrum200> setenv bootargs console=ttyS1,115200 root=/dev/nfs nfsroot=192.168.1.249:/home/electrum200/rootfs ip=192.168.1.221:192.168.1.249::255.255.255.0::eth0: Electrum200> saveenv Electrum200> reset
The parameters are as follows:
nfsroot=<server_ip>:<mount_directory> ip = <board_ip>:<server_ip>:<gateway_ip>:<netmask>:<hostname>:<device>:<proto>
Note that 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 Kernel and Root Filesystem
Released versions of the the Electrum 200 Linux kernel and filesystem are included in Released versions of the the Electrum 200 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 ~/electrum200 $ make kernel $ make filesystem
The resulting kernel and filesystem will be in the “boot” subdirectory. These files can be uploaded to the Electrum 200 NAND flash using the U-Boot bootloader. Updating the NAND will require the addresses of the NAND flash partitions shown in Table 2-1.
| 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 | 0x002FFFFF | Linux kernel | 2 MB | /dev/mtdblock5 |
| 0x00400000 | 0x3FFFFFFF | Root filesystem | 1,020 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, TFTP, NFS or a serial upload. The following would be representative commands to use a USB flash drive for NAND updates.
Electrum200> nand erase
NAND erase: device 0 whole chip
Skipping bad block at 0x02dc0000
Skipping bad block at 0x33b80000
Erasing at 0x3ffc0000 -- 100% complete.
OK
Electrum200> 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
Electrum200> fatload usb 0 0x22000000 uimage-2.6.28.8
reading uimage-2.6.28.8
...
1400704 bytes read
Electrum200> nand write 0x22000000 0x200000 0x200000
NAND write: device 0 offset 0x200000, size 0x200000
2097152 bytes written: OK
Electrum200> fatload usb 0 0x22000000 rootfs.arm.jffs2
reading rootfs.arm.jffs2
...
6029312 bytes read
Electrum200> nand write.jffs2 0x22000000 0x400000 0x5c0000
NAND write: device 0 offset 0x400000, size 0x5c0000
6029312 bytes written: OK
Electrum200> usb stop
stopping USB..
Electrum200> 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.
Electrum200> printenv bootcmd= console=ttyS1,115200 root=/dev/mtdblock5 mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env)ro, 1536k(user),2M(linux),-(root) rw rootfstype=jffs2 bootdelay=1 baudrate=115200 ethact=macb0 ethaddr=00:21:a3:00:00:00 ipaddr=192.168.1.221 netmask=255.255.255.0 serverip= bootargs=console=ttyS1,115200 stdin=serial stdout=serial stderr=serial Electrum200> setenv ethaddr 00:21:a3:00:00:00 Electrum200> setenv ipaddr 192.168.1.221 Electrum200> setenv netmask 255.255.255.0 Electrum200> setenv serverip 192.168.1.249 Electrum200> 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.
Electrum200> nand erase
NAND erase: device 0 whole chip
Skipping bad block at 0x02dc0000
Skipping bad block at 0x33b80000
Erasing at 0x3ffc0000 -- 100% complete.
OK
Electrum200> 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
Electrum200> tftp 0x22000000 uImage-2.6.28.8
...
Electrum200> nand write 0x22000000 0x200000 0x200000
NAND write: device 0 offset 0x200000, size 0x200000
2097152 bytes written: OK
Electrum200> tftp 0x22000000 rootfs.arm.jffs2
...
Electrum200> nand write.jffs2 0x22000000 0x400000 0x5c0000
NAND write: device 0 offset 0x400000, size 0x5c0000
6029312 bytes written: OK
Electrum200> usb stop
stopping USB..
Electrum200> 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 200 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 ~/electrum200 $ make bootstrap $ make bootloader
The resulting kernel and filesystem will be in the “boot” subdirectory. These files can be uploaded to the Electrum 200 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-2.
| Start | End | Description | Max Size |
|---|---|---|---|
| 0x00000000 | 0x0000107F | Bootstrap | 4,224 >4K |
| 0x00001080 | 0x000041FFF | U-Boot environment | 12,672 >12 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 JP4 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.
For serial port uploads, after the connect process please replace jumper JP4 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.
To perform the upload follow these steps:
1. Select “Enable Dataflash (SPIO CS1)” from the scripts listbox and click on “Execute”.
2. 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.
3. Select the location and filename of the bootloader file u-boot-df-2009.01.bin . Enter 0x4200 on the Address field and click on “Send File”.
4. 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-3 and 2-4 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.
| 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 |
| 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 |



