SEARCH
TOOLBOX
LANGUAGES
modified on 11 April 2012 at 16:33 ••• 273,037 views

Electrum FAQ

From Manuals

(Difference between revisions)
Jump to: navigation, search
(How can a rootfs directory be populated for NFS mounts?)
(How can a rootfs directory be populated for NFS mounts?)
Line 58: Line 58:
  losetup -d /dev/loop0
  losetup -d /dev/loop0
-
To generate a JFFS2 image from the exported directory you can use the mkfs.jffs2 command from the mtd-utils package. The directory should not be mounted when building the image.
+
To generate a JFFS2 image from the exported directory you can use the mkfs.jffs2 command from the mtd-utils package. This assumes an erase block size of 128KB and a page size of 2KB. The directory should not be mounted when building the image.
-
  mkfs.jffs2 -l -n -p -q -e 0x20000 -s 0x800 -d /home/electrum100/rootfs -o $/home/electrum100/rootfs.armel.jffs2
+
  mkfs.jffs2 -l -n -p -q -e 0x20000 -s 0x800 -d /home/electrum100/rootfs -o /home/electrum100/rootfs.armel.jffs2
==How can I compile applications on the board?==
==How can I compile applications on the board?==

Revision as of 20:26, 15 December 2010

Contents

Frequently Asked Questions - Hardware

How much current is required by the Electrum controllers?

On typical operating conditions, the current requirements are as follows. Note that I/O devices may increase total current requirements so the complete system should be considered when sizing power requirements.

Electrum 100: +5V@300mA
Electrum 200: +5V@400mA

Are digital inputs compatible with 5V logic?

No. PIOs on AT91SAM9 microcontrollers support 3.3V logic. Level shifters should be used to interface to 5V logic.

How can I set the real time clock (RTC)?

From a Linux command line you can use the 'date' command to set the system date and then 'hwclock' to copy the system date to the hardware clock. The RTC battery option is required to keep time after power off.

# date 063011222010
Wed Jun 30 11:22:00 UTC 2010
# hwclock --systohc

To set the timezone use 'tzselect' and edit the UTC value on /etc/default/rcS. To sync time with NTP servers install 'ntpdate' using 'apt'.

How can I change the MAC address of the board?

The Micromint Electrum is assigned a MAC address during production from the Micromint block 00:21:a3:xx:yy:zz. This address is stored on the U-Boot configuration as the 'ethaddr' environment variable. To prevent accidental changes to the MAC address, the bootloader console does not allow changing the MAC address once it is set. If you need to substitute the assigned MAC address you can clear the bootloader environment by executing the commands below from the bootloader console. After rebooting, you will be able to change the 'ethaddr' variable. Note that you will need to apply any other changes you made to the bootloader configuration.

Electrum> mw.b 0x20100000 0 4
Electrum> cp.b 0x20100000 0xD0002100 4
Copy to DataFlash... done
Electrum> reset

Frequently Asked Questions - Software

How can 'apt' be used to install new packages on the NAND filesystem?

'apt' requires umap/mmap to write to the cache. This is not supported by the JFFS2 filesystem in NAND. A common workwaround is to use a 'tmpfs' filesystem in RAM for the 'apt' cache. We provide the 'apt-setup' and 'apt-purge' scripts to simplify this process. Run 'apt-setup' before installing your packages and 'apt-purge' afterwards. You can ignore any 'fopen' warnings from 'apt-get'. If the cache required by your updates exceeds the available RAM you will need to divide the updates in parts and execute 'apt-setup' and 'apt-purge' before/after each part. Note that this workaround is only required when using a JFFS2 filesystem in NAND as your root filesystem. It is not required if you are using a microSD card as your root filesystem.

What driver is required to use the AT91 USB device port with the Atmel SAM-BA utility?

Current versions of the SAM-BA utility for Windows or Linux handle the USB device port as a serial device with the USB CDC driver. If you are using the older atm6124.sys driver for Windows, it should be removed and replaced with the AT91 USB CDC driver for Windows.

Can the Atmel SAM-BA utility be used to update the NAND filesystem?

No. The NAND geometry assumed by SAM-BA is different than the one used by the NAND on the Electrum controllers. You can update the NAND filesystem using U-Boot as explained in the manual. Windows and Linux versions of SAM-BA can be used to update the Dataflash.

How can a rootfs directory be populated for NFS mounts?

The JFFS2 image can be mounted on a Linux system and copied to the directory exported via NFS. Below are the typical commands used, The image is assumed to be at /home/electrum100 and the exported directory at /home/electrum100/rootfs so you should modify it when using other locations.

[ -b /dev/mtdblock0 ] || mknod /dev/mtdblock0 b 31 0
[ -d /media/jffs2 ] || mkdir -p /media/jffs2
[ -d /home/electrum100/rootfs ] || mkdir -p /home/electrum100/rootfs
modprobe loop
losetup /dev/loop0 /home/electrum100/rootfs.armel.jffs2
modprobe mtdblock
modprobe block2mtd
echo "/dev/loop0,128KiB" > /sys/module/block2mtd/parameters/block2mtd
modprobe jffs2
mount -t jffs2 /dev/mtdblock0 /media/jffs2

cp -pr /media/jffs2/* /home/electrum100/rootfs

umount /media/jffs2
modprobe -r jffs2
modprobe -r block2mtd
modprobe -r mtdblock
losetup -d /dev/loop0

To generate a JFFS2 image from the exported directory you can use the mkfs.jffs2 command from the mtd-utils package. This assumes an erase block size of 128KB and a page size of 2KB. The directory should not be mounted when building the image.

mkfs.jffs2 -l -n -p -q -e 0x20000 -s 0x800 -d /home/electrum100/rootfs -o /home/electrum100/rootfs.armel.jffs2

How can I compile applications on the board?

You can use 'apt-get install' to install gcc, gdb and any other packages you need for your projects. This allows you to do all your software development on the board. The board should have Internet access so 'apt' is able to download and install packages from the Debian armel repositories. The command below installs a base development system. You should execute 'apt-setup' and 'apt-purge' before/after installing packages if your root filesystem is in NAND.

# apt-get install --no-install-recommends binutils cpp cpp-4.3 gcc gcc-4.3 gdb libc6-dev

Test the installation by compiling a simple "Hello, world" program.

/* hello.c */
#include <stdio.h>

int main(void)
{
    printf("Hello, World!\n");
}
# gcc hello.c -o hello
# ./hello
Hello, World!

Note that cross-compiling on a multi-core PC with Debian or Ubuntu Linux is significantly faster. The manual explains how to set up an ARM cross-toolchain. If your project build times are significant, that would be a more productive route. To avoid file transfers during development you can share a filesystem between the PC and the board using NFS.