Version 3 (modified by Chris Johns, on 02/27/18 at 07:25:24) (diff) |
---|
Beagle Board Support
Table of Contents
The page details how to run RTEMS on a Beagle Board family of boards. The Beagle Boards are supported by U-Boot and U-Boot can boot RTEMS. Please refer to the U-Boot documentation and the internet for documentation and example on using U-Boot.
This page provide details on updating a Beaglebone Black board. Please update and support for other Beagle Boards.
Consoles
RTEMS uses the console for a booting and as the primary interface. These are UARTs on the Beagle Boards. We recommend you have a working console and the default Linux images from the Beagle Board project use the UART consoles when booting and initialising.
Beagleboard-MX Console
The Beagleboard-MX has a standard female DB9 RS-232 connector. You will need an RS-232 to USB converter.
Beagle Bone Console
The Beaglebone Black supports the standard 6pin inline UART TTL connector. You can purchase a TTL to USB cable that plugs onto this header. Please refer to the board's user manual for the details of the cable and how to connect it.
Boot Loader
U-Boot is the boot loader for the Beagle Board family. The following is for each board in the family.
Beaglebone Black
The Beaglebone Black has a TI Sitara AM3358BZCZ100 processor and it configured to boot from eMMC memory. The factory ships the board with U-Boot, Linux kernel, and a full file system in the eMMC memory. You need to update the eMMC image to latest for the best results.
To control the boot we need a recent U-Boot and a suitable uEnv.txt
file on the SD card. The following procedure will create a suitable SD card image with a current U-Boot and uEnv.txt
file.
To boot using TFTP the uEnv.txt
contents is:
bootfile=bbb/rtems.img loadaddr=0x82000000 uenvcmd=echo Booting RTEMS BBB from net; set autoload no; dhcp; set serverip 10.10.5.2; tftpboot bbb/rtems.img; bootm; reset;
The server IP address is the host machine running the rtems-test
command.
Updating the eMMC
We recommend you upgrade this software to the latest found at https://rcn-ee.net/rootfs/bb.org/testing/2017-09-24/stretch-lxqt-2gb/. At the time of writing this the latest 2G image is 2G Beaglebone Black Debian 9.1 2017-09-24. Make sure you get a 2G image as this is the size of the eMMC on the a RevB Beaglebone Black. You need to use a 2G or great SD card.
$ xz -d bone-debian-9.1-lxqt-2gb-armhf-2017-09-24-2gb.img.xz $ dd if=bone-debian-9.1-lxqt-2gb-armhf-2017-09-24-2gb.img of=/dev/da0 bs=1m 1700+0 records in 1700+0 records out 1782579200 bytes transferred in 180.028664 secs (9901641 bytes/sec)
Place the SD card into the Beaglebone Black board and hold the Boot switch and turn the power on. The Boot switch is S2
and is located at the same end of the board as the SD card, HDMI and USB master connectors. Hold the Boot button on until the leds all turn on. This takes a few seconds. If booting from the SD card the console will start showing something like:
U-Boot SPL 2017.09-00003-g11d92ba68a (Sep 21 2017 - 10:40:17) Trying to boot from MMC1 U-Boot 2017.09-00003-g11d92ba68a (Sep 21 2017 - 10:40:17 -0500), Build: jenkins-github_Bootloader-Builder-602 CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB No match for driver 'omap_hsmmc' No match for driver 'omap_hsmmc' Some drivers were not found Reset Source: Power-on reset has occurred. MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 Using default environment Board: BeagleBone Black
Once the system has booted you will have a Beagebone Black login:
Debian GNU/Linux 9 beaglebone ttyS0 BeagleBoard.org Debian Image 2017-09-24 Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian default username:password is [debian:temppwd] beaglebone login:
Login as the default user using the provided password and then change to the /boot
directory and open as root using sudo
the u-Boot's user environment file (uEnv.txt
) to edit, in this case using vi
:
debian@beaglebone:~$ cd /boot debian@beaglebone:/boot$ sudo vi uEnv.txt
At the end of the file is the Generic eMMC Flasher support. Uncomment the line to have:
##enable Generic eMMC Flasher: ##make sure, these tools are installed: dosfstools rsync cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Save the file and shutdown:
debian@beaglebone:/boot$ sudo shutdown -h now [ 529.915200] reboot: Power down
Remove the power from the board and again apply power while pressing the Boot switch as you did before. This time the console will show the eMMC flasher procedure:
************************************************************ ==> Loaded ---------------------------------------- ================================================================================ Writing bootloader to [/dev/mmcblk1] ---------------------------------------- ==> Figuring out options for SPL U-Boot copy ... ===> Will use : count=1 seek=1 conv=notrunc bs=128k ==> Figuring out options for U-Boot copy ... ===> Will use : count=2 seek=1 conv=notrunc bs=384k ==> Copying SPL U-Boot with dd if=/opt/backup/uboot/MLO of=/dev/mmcblk1 count=1 seek=1 conv=notrunc bs=128k ------------------------------------------------------------ 0+1 records in 0+1 records out 75080 bytes (75 kB, 73 KiB) copied, 0.0239506 s, 3.1 MB/s ------------------------------------------------------------ ==> Copying U-Boot with dd if=/opt/backup/uboot/u-boot.img of=/dev/mmcblk1 count=2 seek=1 conv=notrunc bs=384k ------------------------------------------------------------ 1+1 records in 1+1 records out 397640 bytes (398 kB, 388 KiB) copied, 0.188179 s, 2.1 MB/s ------------------------------------------------------------ Writing bootloader completed ================================================================================ ================================================================================ Partitionning /dev/mmcblk1 ---------------------------------------- sfdisk: [2.26.x or greater] ==> sfdisk parameters: sfdisk: [sfdisk from util-linux 2.29.2] sfdisk: [sfdisk --force /dev/mmcblk1] sfdisk: [4M,,L,*] ==> Partitionning ------------------------------------------------------------ Checking that no-one is using this disk right now ... OK Disk /dev/mmcblk1: 1.8 GiB, 1920991232 bytes, 3751936 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes >>> Created a new DOS disklabel with disk identifier 0xb759f922. /dev/mmcblk1p1: Created a new partition 1 of type 'Linux' and of size 1.8 GiB. /dev/mmcblk1p2: Done. New situation: Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 * 8192 3751935 3743744 1.8G 8[ 63.419843] mmcblk1: p1 3 Linux The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. ------------------------------------------------------------ ==> Partitionning Completed ==> Generated Partitions: ------------------------------------------------------------ Disk /dev/mmcblk1: 1.8 GiB, 1920991232 bytes, 3751936 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xb759f922 Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 * 8192 3751935 3743744 1.8G 83 Linux ------------------------------------------------------------ ================================================================================ ================================================================================ Preparing future rootfs to receive files ---------------------------------------- ==> Formatting rootfs with mkfs.ext4 -O ^metadata_csum,^64bit /dev/mmcblk1p1 -L rootfs -------------------------------------------------------------------------------- mke2fs 1.43.4 (31-Jan-2017) Discarding device blocks: done Creating filesystem with 467968 4k blocks and 117120 inodes Filesystem UUID: 1aa2f1b9-7a7c-4dbc-9d36-c7e01ce19540 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done -------------------------------------------------------------------------------- ==> Formatting rootfs: /dev/mmcblk1p1 complete ==> Creating temporary rootfs directory (/tmp/rootfs) ==> Mounting /dev/mmcblk1p1 to /tmp/rootfs [ 77.717437] EXT4-fs (mmcblk1p1): mounted filesystem with ordered data mode. Opts: (null) ================================================================================ ================================================================================ Copying: Current rootfs to /dev/mmcblk1p1 ---------------------------------------- ==> rsync: / -> /tmp/rootfs ----------------------------------------
The leds show activity. Once the procedure has finished remove the power and remove the SD card:
[ 513.490441] reboot: Power down [ 513.493962] System will go to power_off state in approx. 1 second
Apply power and watch the board boot from the updated eMMC memory.
JTAG Debugging
This section cover JTAG debugging on the various Beagle boards.
Beaglebone Black JTAG
The following details debugging on a Beaglebone Black with a Flyswatter2 and the ARM 20-pin to cTI 20-pin JTAG Adapter Board. You need to solder the adapter board to the Beaglebone Black board.
OpenOCD
You will also need to build a recent OpenOCD from GIT. The following is a quick example on how to do this. Please refer to the OpenOCD documentation for any further detail and specific help.
$ git clone git://repo.or.cz/openocd.git openocd.git $ cd openocd.git $ ./bootstrap $ cd .. $ mkdir build $ cd build $ ../openocd.git/configure --enable-maintainer-mode --enable-ftdi --disable-werror --prefix=/opt/work/openocd $ gmake -j 8 $ gmake install
Notes:
- On FreeBSD the
--disable-werror
option needs to be used to disable warnings being treated as errors. - You need
--enable-ftdi
option is need to support the Flyswatter2 pod.
Download Tinncan Tool's OpenOCD configuration file for the Beaglebone Black.
With an editor create a Beaglebone Black configuration similar to:
$ cat bbb-fs.cfg source [find interface/ftdi/flyswatter2.cfg] source [find ti_beaglebone_with_fs2.cfg] telnet_port 4444 tcl_port 6666 gdb_port 3334
It is useful to have a file like this if you need to add special configurations, for example when using more than one Flyswatter2.
OpenOCD can be started with:
sudo /opt/work/openocd/bin/openocd -f bbb-fs.cfg -c "reset halt"
The target will reset and after 6 seconds it will reset again and perform a normal start up.
U-Boot and SPL
ADD U-Boot building
GDB
The remainder of the set up can be handled using GDB scripts. The part of the GDB scripts handles connecting to the target, which is OpenOCD in our case and restarting the Beaglebone Black.
This first script fragment handle connecting to the target:
def target-connect-bbb target remote :3333 end
This next fragment resets the target and initialises the memory so the RTEMS application can be downloaded:
def bbb-restart mon echo "] Reset..." mon reset halt mon bp 0x402f0400 4 hw mon reset run mon sleep 1000 mon rbp 0x402f0400 mon echo "] Loading MLO" mon load_image /somewhere/beagle/black/u-boot-spl-nodtb.bin 0x402f0400 bin mon bp 0x402f1424 4 hw mon echo "] Resume 0x402f0400" mon resume 0x402f0400 mon sleep 1000 mon rbp 0x402f1424 mon echo "] Done ..." end end