# BeagleBoard 101

Slides available at: http://beagleboard.org/beagleboard101

This is your introduction to the BeagleBoard where you will learn:

- What is a BeagleBoard?
- How do you get software running on a BeagleBoard?
- How do you engage the BeagleBoard community?
- How can you perform native development with the provided Angstrom Distribution Cloud9 IDE demo image?
- How do you discover other available community and commercial software that might be of interest?

# What is the BeagleBoard?

## http://beagleboard.org/static/beagleboard_flyer.pdf

The BeagleBoard is an open hardware project featuring two designs:

- BeagleBoard-xM: Open software desktop experience with extra MHz and extra memory
- BeagleBone: Hardware I/O focus with single cable development experience

BeagleBoard.org designs have a common philosophy:

- Bring your own peripherals [1]
- Entry level cost
- ARM Cortex-A8 (superscalar)
- Graphics (and possibly DSP) accelerated
- Linux and open source community
- Environment for innovators

# BeagleBoard-xM Details

## http://beagleboard.org/hardware-xM

# BeagleBone Details

## http://beagleboard.org/hardware-bone

# Some BeagleBoard examples

##

- Video encoding and playback
- Perform 3D rendering
- Stream and process data from peripherals

# Getting up and running

##

- Setup an SD card with the factory image and backup your own

- Learn to use 'dd' and 'gzip'
- Know which /dev/sdX is your SD card through use of 'dmesg'
- Ubuntu Win32DiskImager and 7-zip are good if you are stuck in Windows
- Use mkcard.txt or Linaro Image Tools to build your own new SD card image
- Remember to design for the smallest possible available good blocks

- Try multiple pre-built SD card images from Angstrom, Ubuntu, Linaro and Rowboat (Android)
- Can also start with Windows Compact Embedded 7, QNX, RISC OS, Puppy Bits, Symbian, Debian, Gentoo, Fedora, ...
- Check out the registered projects
- Encourage project owners to supply SD card images

# Classroom setup

## Equipment is meant to stay in the classroom

- BeagleBoard-xM Rev C
  - Same as the ESC give-away board
- BeagleBoardToys ULCD Lite
- 4GB microSD card with customized Angstrom image
  - Give-away SD has a factory image, but you can replace it
  - On-line image builder tool
  - Starting Narcissus image
  - Content updates
  - Final SD card image
- 5V 2A power adapter
- USB keyboard
- USB mouse
- USB to serial adapter (optional)

# Matrix GUI

- Just a web browser
  - Renders HTML code on the board
  - Based on QtWebKit
- Modified to launch apps
- Power/Clocks -> 1GHz
- Click on Exit to get to desktop

# Gnome Desktop

- Just one desktop option
  - Angstrom Distribution provides several others
- Menu bar at top gives list of installed apps
- Processor speed displayed in the Panel
- Applications -> Accessories -> Terminal
  - Restart Matrix GUI with 'matrix_gui /usr/share/matrix/html/menu_main_1.html'
  - Shutdown with 'poweroff'

# Lab - Edit Matrix GUI menu

##

    root@beagleboard:~# cd ~/labs/matrix
    root@beagleboard:~/labs/matrix# ls -l
    root@beagleboard:~/labs/matrix# gedit menu_main_1.html

Search for "p1" and replace the title with your name.

    root@beagleboard:~/labs/matrix# cat run_matrix_gui
    root@beagleboard:~/labs/matrix# ./run_matrix_gui

# Why work with community?

##

- Faster innovation
  - Off-cycle development
  - Engage innovators
  - Direct peer interaction
- Better solutions
  - Expert peer review
  - Community support
  - Early feedback

# Why push code to mainline?

##

- Stable snapshot development
  - Increases stability
  - Isolates from community
  - High update cost with reduced support and external contribution
- Community synchronized
  - Increased potential churn
  - Leverages the community
  - Requires defined method for maintaining value-add

# Engaging the community

## Ask questions the smart way

- Before you ask
  - Learn about the on-line resources and documentation
  - Try to find the answer yourself
  - Don't assume you are entitled to an answer
- Ask in the right way in the right place
  - Question should be easy to answer for someone who knows
  - Detail your objective, what you tried and the results
  - Use meaningful and specific subject headers
  - Using the on-line chat can help you formulate your question for the mailing list
- Listen to the answers, even if they seem unhelpful
- Share useful lessons you learn

# What do I work with the community on?

##

- There are hundreds of projects with BeagleBoard-specific interest
- It is really up to your heart's desire
- Linux is known for its community
- Many communities build upon Linux
- Let's start with the projects required to boot Linux

# Typical BeagleBoard-xM boot process

## The five phases

1. ROM loads x-load (MLO)
   - Performs external DRAM configuration
2. x-load loads u-boot
   - Default location is /media/mmcblk0p1/u-boot.bin
3. u-boot executes default environment/commands
   - Default location is /media/mmcblk0p1/uEnv.txt
   - USERBUTTON will cause search for /media/mmcblk0p1/user.txt
   - By default, 'uenvcmd' is executed
4. Commands load kernel
   - Default location is /media/mmcblk0p2/boot/uImage
5. Kernel reads root file system

# The default u-boot boot command

## omap3_beagle.h#l281

    281 #define CONFIG_BOOTCOMMAND \
    282  "if mmc rescan ${mmcdev}; then " \
    283   "if userbutton; then " \
    284    "setenv bootenv user.txt;" \
    285   "fi;" \
    286   "echo SD/MMC found on device ${mmcdev};" \
    287   "if run loadbootenv; then " \
    288    "echo Loaded environment from ${bootenv};" \
    289    "run importbootenv;" \
    290   "fi;" \
    291   "if test -n $uenvcmd; then " \
    292    "echo Running uenvcmd ...;" \
    293    "run uenvcmd;" \
    294   "fi;" \
    295   "if run loaduimage; then " \
    296    "run mmcboot;" \
    297   "fi;" \
    298  "fi;" \
    299  "run nandboot;" \

# Baseline software

##

- X-loader
- U-boot
- Linux Kernel
  - Temporary Linux home while git.kernel.org is down
  - Temporary Linux-OMAP home while git.kernel.org is down
  - Future home for BeagleBoard-patched kernels
- OE-core based BSP
  - This userspace was created with OE-classic instead
  - The bootloaders and kernel where build using this OE-core BSP
  - I didn't rebuild the DSP or SGX components for this kernel
  - This may move at some point to a TI or beaglboard.org server

# Highlighted community projects

##

- Linaro
- Yocto Project
- Qt

# Linaro

## www.linaro.org

- Linaro is a non-profit formed in June 2010
  - "to make it easier for ARM partners to deploy the latest technology into optimized Linux based products"
- Started by ARM
  - with Texas Instruments, Freescale, IBM, Samsung and ST Ericsson
- Focused on improving core open source tools and components for ARM Cortex-A processors
  - Compiler, debugger, profiler, kernel and middleware
  - Validation of efforts done with Ubuntu and Android
- Includes "landing teams" for SoC vendors
- The BeagleBoard-xM is one of their release platforms

# Yocto

## www.yoctoproject.org

- Yocto is a Linux Foundation project started in April 2011
  - "and is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture."
- The advisory board includes members from several key silicon vendors, embedded Linux suppliers and the OpenEmbedded community
  - including representation from Texas Instruments, Intel, Mentor Graphics, MontaVista, TimeSys and Dell
- Building on OpenEmbedded technology and providing board support package (BSP) development tools for embedded platforms
  - Committed to support ARM, PPC, MIPS, x86 and x86-64 ISAs
  - Aligned with the OpenEmbedded community through OE-core
- The BeagleBoard-xM is their ARM reference platform

# Qt

## qt.nokia.com

- Qt C++ framework is just one of the options for creating graphical applications, but it is fast, flexible, crossplatform and well-supported by an open source community
- Created by Trolltech
- Acquired by Nokia
- Passed to the community

# Qt modules

## qt.nokia.com

# Qt demos

## qt.nokia.com

- qtdemo
- Descriptions not compiled in here
- Lots of different GUI tools
- Many other programming tools, like networking, IPC, 3D, database, etc.

# Qt Creator

## qt.nokia.com

- Integrated development environment

- Runs on Windows, Mac, or Linux
- Designer for your GUI
- C++ editor and debugger

- Build your GUI on your PC, then move it over to the BeagleBoard to add functionality

- Angstrom Linux distribution has the compiler and libraries ready to build Qt apps natively on your BeagleBoard

- Qt Designer installed on your BeagleBoard. Try it "designer".

# Qt Hello World example

## qt.nokia.com

     #include <QApplication>
     #include <QPushButton>

     int main(int argc, char *argv[])
     {
         QApplication app(argc, argv);

         QPushButton hello("Hello world!");
         hello.resize(100, 30);

         hello.show();
         return app.exec();
     }

# Lab - Qt Hello World

##

    root@beagleboard:~# cd ~/labs/qt/hello
    root@beagleboard:~/labs/qt/hello# . /usr/share/qt4/environment-setup
    root@beagleboard:~/labs/qt/hello# ls
    root@beagleboard:~/labs/qt/hello# cat hello.cpp
    root@beagleboard:~/labs/qt/hello# qmake2 -project
    root@beagleboard:~/labs/qt/hello# qmake2
    qt_config.prf:7: include(file) requires one argument.
    root@beagleboard:~/labs/qt/hello# make clean
    root@beagleboard:~/labs/qt/hello# make
    root@beagleboard:~/labs/qt/hello# ls
    root@beagleboard:~/labs/qt/hello# ./hello

# Thanks!

##

- The BeagleBoard-xM works like a desktop computer, but is small, low-power and has the right embedded interfaces to put it just about anywhere
- There are many options for building up user interfaces and you can get started quickly
- Working with the community can open up new opportunities and improve results
- There's a lot to explore!