970 likes | 1.41k Vues
Beagle Board 101. Gerald Coley and Jason Kridner September 22, 2009 Archived at: http://beagleboard.org/esc. Agenda. Overview of the Beagle Board Board features and community Booting the Beagle Board Some simple tests (learning Linux) Writing our own boot script
E N D
Beagle Board 101 Gerald Coley and Jason Kridner September 22, 2009 Archived at:http://beagleboard.org/esc
Agenda • Overview of the Beagle Board • Board features and community • Booting the Beagle Board • Some simple tests (learning Linux) • Writing our own boot script • Native, managed, and web-based UI code development • Collaboration tools and community participation • Resources for more information and support • Hardware presentation • Lessons from building Beagle
What’s in a name… Bring your own peripherals Entry-level cost ($149) ARM Cortex-A8 (superscalar) Graphics and DSP accelerated Linux and open source community Environment for innovators
Active & technical community Freedom to innovate Freesoftware Opportunity to tinker and learn Wikis, blogs, promotion of community activity Community development Personally affordable > 2,000 participants and growing $149 Addressing open source communityneeds Instant access to >10 million lines of code Open access to hardware documentation
Fast, low power, flexible expansion • OMAP3530 Processor • 600MHz Cortex-A8 • NEON+VFPv3 • 16KB/16KB L1$ • 256KB L2$ • 430MHz C64x+ DSP • 32K/32K L1$ • 48K L1D • 32K L2 • PowerVR SGX GPU • 64K on-chip RAM • POP Memory • 128MB* LPDDR RAM • 256MB NAND flash • Peripheral I/O • DVI-D video out • SD/MMC+ • S-Video out • USB 2.0 HS OTG • I2C, I2S, SPI,MMC/SD • JTAG • Stereo in/out • Alternate power • RS-232 serial 3” • USB Powered • 2W maximum consumption • OMAP is small % of that • Many adapter options • Car, wall, battery, solar, … * Revision C has 256MB LPDDR RAM
On-going collaboration at BeagleBoard.org • Live chat via IRC for 24/7 community support • Links to software projects to download And more… • Other Features • 4 LEDs • USR0 • USR1 • PMU_STAT • PWR • 2 buttons • USER • RESET • 4 boot sources • SD/MMC • NAND flash • USB • Serial 3” • Peripheral I/O • DVI-D video out • SD/MMC+ • S-Video out • USB HS on-the-go • I2C, I2S, SPI,MMC/SD • JTAG • Stereo in/out • Alternate power • RS-232 serial
New for Revision C 3” • Peripheral I/O • USB HS/host-only(in addition to existingUSB HS on-the-go) • LCD expansion 256MB LPDDR RAM (up from 128MB)
Desktop development DVI-D Power Stereo out SD Stereo in USB Note: Beagle Boardcan be powered fromthe alternate jack (as shown) or via USB
Development on-the-go Power + IP over USB Serial Port
Expand with custom hardware USRP Stereo out USB Power SD2GB Photo by Philip Balister 10
Typical peripherals • Available from Digi-Key • Serial cable (BBC01-ND) • Needed for serial console • HDMI-to-DVI-D cable (AE10260-ND) • Needed for connection to digital monitors • USB hub (DA-70227-ND) • Needed for adding USB peripherals • 5V power supply (T450-P5P-ND) • Frees USB OTG port • Hardware specifications and recommended peripherals • http://BeagleBoard.org/hardware • RSS feed of newly verified peripherals • http://feeds.feedburner.com/BeagleBoardPeripherals
Other design benefitshttp://beagleboard.org/hardware/design • Open source hardware design • Low power • No fan for silent operation • Use a USB cable to power the board (barrel connector power option) • USB 2.0 high-speed on-the-go (OTG) and host-only (EHCI) ports • Host an almost endless set of USB peripheral devices • On-the go port • Acts as ‘device’ when connected to a PC and ‘host’ when connected to a hub • OTG port requires a mini-A to standard-A adapter to act as a host http://BeagleBoard.org/hardware • Able to emulate a network connection to a PC • Provides power to board • Boot options • Boot from NAND, MMC/SD, serial, or USB using OMAP3530 ROM • User button • Boot default: NAND USB serial MMC/SD • Button pressed: USB serial MMC/SD NAND • Avoids “bricking” • Reusable in applications • Reset button (function may be altered with software)
Verifying the hardware • Code images, procedure, and sources are provided to verify the board functionality • Links to the diagnostics found at http://BeagleBoard.org/support • Includes bootloader, Linux kernel, and minimal file system for testing • These sources act as examples for software developers
Baseline tools and softwarehttp://beagleboard.org/resources • Hardware verification procedure (http://beagleboard.org.support) • Code images, procedure, and sources are provided to verify the board functionality • GPL ARM GNU compiler collection • Code Sourcery version 2007q3 is one known-good option • Runs on Linux/Windows and generates ARMv7/Thumb2 • Free C6000 compiler for non-commercial use • x86-Linux hosted • GPL x-load version 1.4.2 • GPL u-boot version 2009.01 • Interact over UART or USB and program flash • Boot kernel from UART, NAND, or MMC/SD (FAT32) • Test UART, DVI-D, S-Video, NAND, and MMC/SD • GPL Linux kernel version 2.6.28 for diagnostics • Test UART, DVI-D, S-Video, ALSA audio, NAND, MMC/SD, USB OTG, and USB Host • Free 3D graphics libraries (OpenGLES 2.0) • BSD/GPL DSP interface software • Free production audio/video codecs for the DSP
BeagleBoard.org • Facilitates community • Aggregates blogs • Provides community chat • “Of, by, and for” members • Promotes member actions • OMAP3530 collaboration • Focus “upstream” • Long-term presence • Broad set of problems • Aggregate “downstream” • Inform users of the broader world • Avoid information deluge • Four primary activities • Buy a board • Learn how to use existing projects • Learn how to join or start a project • Learn about the latest project news • Plans for site • Multi-lingual • Wiki-like editing-through-web • Keep website source open & leverage OpenID
Community projects and distroshttp://www.flickr.com/groups/beagleboard/pool/ and http://beagleboad.org/project Kernel Creativity Tools Browser Office Suite Windowing System • Ångström Linux Distribution • Firefox 3.0, Epiphany-WebKit, etc. • AbiWord, GIMP, etc. • 3D graphics and DSP codec integration • ARMv7+NEON gcc tool-chain • Maemo.org • FFmpeg • 720P-24 MPEG4 decode on ARM+NEON only • Beagle SDR (low-power software defined radio) • Windows Embedded for BeagleBoard • Handheld.org’s Mojo Ubuntu build for ARM • Android for Beagle • ARM Linux Internet Platform • Ubuntu, Debian, OpenOCD, Mamona, Ethernet, OKL4, robots, home automation, vision, e-ink displays, FreeBSD, QEMU, Fedora, … • Kernel, boot-loader, and boot utilities • Several more and growing…
Camera streaming application Audio processing Linux home fileserver A handful of the thousands… Fanless multimedia/internet terminal VLC VideoLAN Low-cost kiosk terminal Development platform for mobile VoIP phone Wearable computer CMUcam-style applications Low cost linux pc/gaming device Smart home Bluez and GUI using direct frame buffering I'm interested to buy 2 to 10 rev-B boards (10 preferred ;) congratulations for your project and its spirit ! Linux thin client LCD picture frame Port xnu Autonomous robot Port OpenWrt Port Google-Android Networked digital signage Processing images and pattern recognition Home monitoring No idea yet Small linux home fileserver I'm not interested in waiting for the platform to mature any longer. Let me know how to get hold of a beagleboard now. Port OpenMoko Mobile DTV tuner and receiver Port OKL4 Clutter & Qt development Powerful nas with media server and transcoding capabilities Autonomous vehicles Home security cameras and powered-curtains After discussing with my dev guys, I confirm I would like to order 20 beagleboards I'd like my students to design and build hardware and software to do for Linux what TimeCapsule does for MacOS Bachelor thesis Media centre SDR platform Speech recognition applications Vehicle telematics Project for masters degree Linux/Firefox web add-on for the TV in the house
Equipment at ESC Boston Powered USB hub USBPower DVI-DMonitor SD Desktop Computer Configuration • For you to keep • Beagle Board Rev. C3 • SD card • Content for each class • Serial cable • IDC10-to-DB9 adapter • Null modem cable • Hub: • Powered USB 2.0 HS • Cables: • USB to Beagle power • HDMI to DVI-D • USB A to mini-B • For you to use in the labs • DVI-D monitor • USB keyboard and mouse
First boot of “101” image #opkg install font-misc-misc xterm -fn 10x20 & • Connect everything and then apply power • Image boots up as root by default • ApplicationsSettingsLogin Setup • Don’t do the next step yet! • Start ‘root terminal’ and use ‘/switchboot’ to start other images • Use ‘halt’ to power down (optional?)
Default boot behavior RESET Is USER pressed? Poll USB, Serial, and SD before trying NAND Is u-boot.bin on SD card? Run u-boot.bin from SD card, possibly ignoring environment Is envvar set? Execute commands stored in ‘bootcmd’ environment var Execute default commands
The five (5) boot phases MLO: 0x000000 U-boot: 0x020000 Env: 0x260000 Kernel: 0x280000 File sys: 0x680000 ROM loads x-load (MLO) X-load loads u-boot U-boot reads commands Commands load kernel Kernel reads root file system
(1) ROM loads x-load (MLO)http://www.ti.com/litv/pdf/sprufd6a • ROM attempts to load boot image • Sequence of attempts depends if USER button pressed • Not-pressed: NANDUSBserialMMC/SD • Pressed: USBserialMMC/SDNAND • For MMC/SD boot • Must have 255 heads and 63 sectors/track • First partition is FAT and bootable • Must have “MLO” as first file and directory entry • “MLO” is x-load.bin.ift renamed • X-load image must be “signed” • signGP app is open source • There are utilities for USB and serial boot
(2) X-load loads u-boothttp://gitorious.org/projects/x-load-omap3 • X-load is a utility derived from u-boot • Small enough to fit in internal RAM • Configures external RAM • Only configured to read NAND or MMC/SD • X-load 1.4.2 looks first on MMC/SD • If it finds u-boot.bin, loads and runs it • Otherwise loads u-boot from the second NAND partition (mtd1)
(3) U-boot reads commandshttp://gitorious.org/projects/u-boot-omap3 • U-boot version allows interaction over the serial and USB ports • Serial cable provided in case you have a laptop • USB driver looks like a USB-to-serial converter device • Use gserial.inf to install a driver in Windows • U-boot environment variables read from flash • Stored in the third flash partition (mtd2) • ‘bootcmd’ variable stores the commands to execute • ‘bootdelay’ is number of seconds to allow interruption of the boot • Default ‘bootcmd’ reads ‘boot.scr’ auto-script
(4) Commands load kernel • U-boot loads kernel and passes it ‘bootargs’ • Default environment is used when variables haven’t been stored in flash • Rev C boards are shipped without variables stored in flash • Console can be used to interrupt the boot process and modify variables • The Rev B u-boot only supported the console over the serial port • The Rev C u-boot adds support for the console over the USB OTG port • Future modifications may support USB keyboard/mouse and DVI-D monitor • Fourth flash partition (mtd3) is reserved for the kernel • bootm <RAM addr> – executes kernel from RAM
Default bootcmd for Rev Chttp://gitorious.org/projects/beagleboard-default-u-boot/repos/jason-clone/blobs/for-khasim-rebase/include/configs/omap3_beagle.h bootcmd=if mmcinit; then if run loadbootscript; then run bootscript; else if run loaduimage; then if run loadramdisk; then run ramboot; else run mmcboot; fi; else run nandboot; fi; fi; else run nandboot; fi
U-boot command summaryhttp://www.denx.de/wiki/DULG/Manual • Basic commands • help – provide the list of commands (varies by build) • printenv – lists the contents of the current environment • saveenv – writes the current environment to the flash • setenv <variable> ‘string’ – sets environment variable • autoscr <RAM addr> – run script from RAM • MMC/SD • mmcinit – initializes the MMC/SD card • fatls mmc 0 – reads FAT directory on the first partition • fatload mmc 0 <RAM addr> <filename> – load a file into RAM • NAND • nand unlock – enables writing to the NAND • nandecc <sw|hw> – configures ECC mode (OMAP3 specific) • nand erase <start> <length> – erases portion of NAND flash • nand read <RAM addr> <start> <length> – reads into RAM • nand write <RAM addr> <start> <length> – writes from RAM • Serial • loadb <RAM addr> – reads into RAM via kermit file send
(5) Kernel reads root file system • Kernel mounts root file system based on ‘bootargs’ • NAND (JFFS2): root=/dev/mtdblock4 rw rootfstype=jffs2 • RAMDISK: root=/dev/ram0 rw ramdisk_size=32768 initrd=0x81600000,32M • MMC/SD: root=/dev/mmcblk0p2 rw rootwait • NFS: root=/dev/nfs rw nfsroot=192.168.123.1:/data/target ip=192.168.123.2::255.255.255.0 nolock,rsize=1024,wsize=1024 rootdelay=2
Configuring the displayhttp://groups.google.com/group/beagleboard/msg/4c64b2c614622053 video=omapfb vram=10M omap-dss.def_disp=lcd omapfb.vram=4M,3M,3M omapfb.video_mode=1024x768MR-16@60
Other bootargs • nohz=off • Power management • mem=88M • Reserve memory
Some simple tests Understanding the basics of Linux
Getting started with Linux • Starting references • http://free-electrons/training • http://kernelnewbies.org (/UpstreamMerge) • The Linux Documentation Project (http://www.tldp.org/) • Device Drivers Book (http://www.xml.com/ldd/chapter/book/index.html) • http://kerneltrap.org • “The” kernel GitWeb • http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git • Linux-omap kernel • http://linux.omap.com • http://source.mvista.com/git/ (Tony Lindgren) • Others that feed “the” kernel or linux-omap kernel • http://www.linux-arm.org/git?p=linux-2.6.git • http://www.arm.linux.org.uk/ • http://www.sakoman.net/cgi-bin/gitweb.cgi
Everything is a filehttp://free-electrons.com/doc/unix_linux_introduction.pdf • In Linux, you typically talk to devices using file I/O • GPIO example • ls /sys; ls /proc; cat /proc/cmdline • echo “none” > /sys/class/leds/beagleboard\:\:usr0/trigger • echo “1” > /sys/class/leds/beagleboard\:\:usr0/brightness • echo “0” > /sys/class/leds/beagleboard\:\:usr0/brightness • echo “heartbeat” > /sys/class/leds/beagleboard\:\:usr0/trigger
Read eventshttp://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/input/input.txt • cd ~/utils • gcc -o evtestevtest.c • ./evtest /dev/input/event0 • Press the “USER” button • ^C to exit • ./evtest /dev/input/event4 • Move the mouse • ^C to exit
Access monitor EDID cd /sys/bus; ls; cd cat /sys/bus/i2c/devices/3-0050/eeprom i2cdump -y 0x3 0x50 b decode-edid fbset
USB OTG and EHCI cd /sys/bus/usb/devices ls cat usb1/speed cat usb1/1-2/1-2.2/manufacturer cd lsusb
Networking • Copy linux.inf from SD card to host and connect Beagle • ifconfig • nano /etc/networking/interfaces • ifdown usb0; ifup usb0 • ifconfig • Configure your host using linux.inf • ping 192.168.123.1 • VNC • x11vnc & • Connect with your VNC viewer from your host • Synergy • Start Synergy server on your host • synergyc --daemon --restart 192.168.123.1
Build u-boot and mkimage cd ~/u-boot-omap3 make omap3_beagle_config make
Build my.scr • cd ~/u-boot-omap3 • cp /media/mmcblk0p1/menu/kridner.scriptmy.script • nanomy.script • ./tools/mkimage -A arm -T script -C none -d my.script my.scr • Be very careful before executing the next step • cp my.scr /media/mmcblk0p1/boot.scr • If unsure, run /switchboot now • boot
Edit environment in flash • make env • nano /etc/fw_env.config • /dev/mtd2 0 0x20000 0x20000 • ./tools/env/fw_printenv • ln -s tools/env/fw_printenv fw_setenv • ./fw_setenv usbtty ‘cdc_acm’ • ./fw_setenv stdout ‘serial,usbtty’ • ./fw_setenv stdin ‘serial,usbtty’ • ./fw_setenv stderr ‘serial,usbtty’ • ./tools/env/fw_printenv
Trying usbtty • cp ~/gserial.inf /media/mmcblk0p1/ • halt • Remove power and SD card • Copy gserial.inf from SD to PC • Plug USB from Beagle to your PC • Select driver • Start Hyperterminal • Newest serial port, max baud, n81, no flow • Optional • nand erase 0x260000 0x20000
Native development • Not limited to embedded/cross tools • Reach out to broader developer community • Native tools easy to install • Immediately see impact of your changes • Edit local source files with familiar editors • You still need to manage your code! • Version control with git, svn, cvs, … • Also possible to perform distributed builds • Some packages may require larger memory
Managed code • Easier to create an emulation environment • But what about performance? • JIT compilers may be sufficient • Performance bottlenecks are often in just a few places • Just optimize where the issue is, but build the rest fast! • Important to make sure the rest is open for optimization • Certainly not for every market • If you already know C/GTK+/Qt, use what you know! • If you are new, this may be a way to get started
Web-based UI developmenthttp://www.programmableweb.com/scorecard • Familiar paradigm for consumers • Enables remote control and monitoring • Many HTML/JavaScript developers • Opens up use of other web services • Mapping • Order fulfillment • Storage • Social networking and media
Web-based UI development • Helma is one option for the server side • Based on Java Servlet Container and Mozilla Rhino • Provides sessions, user management, • Write entire applications in XML/HTML and JavaScript • No recompilation required, allowing for dynamic development • Database options for object storage with automatic persistence • Native XML database for flexibility • Java database connection (JDBC) for scale • Drop-in Java .jar files for access to huge libraries of functions • Accessing Linux shell and drivers • rt=Packages.java.lang.Runtime.getRuntime(); rt.exec(“…”) • new Packages.java.io.File(“…”)
Beagle web control demo • beagle-web-control-demo used at ARM Developers’ Conferencehttp://www.beagleboard.org/gitweb/?p=beagle-web-control-demo.git;a=summary • cd • If not root: sudo ./beagle-web-control-demo/script/permissions.sh • ./helma-1.6.1/start.sh & • tail -f helma-1.6.1/log/helma.beaglewebcontroldemo.event.log • Browse (using Midori) to • http://localhost:8080/demo/static/ARM_DevCon/slide34.html • Turn LEDs “on” and “off”