NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Sitara Linux Training: UBoot Board Port

From Texas Instruments Wiki
Jump to: navigation, search


Return to the Sitara Linux Training List

TIBanner.png

Introduction



This lab is going to walk you through the process of porting u-boot to your custom board. The general flow will be to start with a minimal board file which will be downloaded over a serial port, and then add additional interfaces in each following lab section. For more information on the changes being done in each section you should refer to the accompanying board-port presentation or the source code which is commented with additional details.


NOTE: In this guide commands to be executed for each step will be marked in BOLD


Configure your Development Environment

Description

This section is going to walk you through the steps to make sure your development environment is properly configured. If you have taken the http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_Linux_Board_Port lab then many of these steps will be familiar to you. While some of these steps will not always be necessary in your real work development (such as closing your serial consoles) they are performed here to make sure that the system is in a known good state.

Prerequisites

  • A beaglebone board with the following cables:
    • USB to Mini-USB cable
    • Ethernet cable
    • 5 volt power supply
  • An SD card formatted using the Sitara Linux SDK.
    • In the TI hands on lab this SD card was created using the SD card image for the Sitara Linux SDK.
  • The sitara-board-port-linux git tree cloned into a directory
    • In the TI hands on lab this has been cloned for you in the /home/sitara/ti-sdk-am335x-evm-06.00.00.00/board-support/board-port-labs directory.
    • If you are cloning these sources yourself you can do so using the following command (Assuming you have git properly configured to work with your network proxy if you use one).

Key Points

  • How to connect the beaglebone to the development host

Lab Steps

  1. If you have not already done so remove the micro-SD card from the beaglebone
  2. If you have not already done so connect the USB to Mini-USB cable to the beaglebone. The board should now have the LED light on indicating it is powered on.
  3. If you have not already done so attach the 5 volt power supply to the beaglebone.
  4. If you do not already have a serial console connection to the beaglebone use the following steps to connect the beaglebone to your Linux laptop and open a minicom serial connection.
    • Open a terminal and run the following command to find the USB serial adapters available on the system. The beaglebone presents two serial interfaces to the Linux host. The first interface is the JTAG interface and the second one is the serial console interface. Depending on the FTDI driver on your machine, you may see one or both of these listed as possible console interfaces. Newer drivers only show one as a console interface.
    ls /dev/ttyUSB*
    You should see output like:
    /dev/ttyUSB0 /dev/ttyUSB1
    • As mentioned above since the Beaglebone serial interface is the second interface you will want to open a serial console to the second device node. In this case that is /dev/ttyUSB1. If only one interface is listed, choose it. This can be done by doing:
      • minicom -w -s
      • Select Serial port setup and press ENTER
      • Press A to modify the Serial Device and change the device to /dev/ttyUSB1. Press ENTER
      • Press ENTER to exit the serial setup
      • Select Exit and press ENTER
    • You should now see a minicom window. Press the reset button on the Beaglebone. The reset button is located next to the Ethernet connector. You should now see something like CCC printing in the window.
    U-boot minicom boot.png
    • You have successfully connected the Beaglebone board to a PC.

Template Board File

Description

This section will cover the addition of a template board file and how to verify basic booting of SPL and u-boot prior to adding additional device support.

Prerequisites

  • Serial connection to the target device
  • git and gitk installed on your Linux host
  • The Sitara Linux SDK installed to provide the cross-compile toolchain
  • Know the SDK version you are using so you can use that version in the lab steps where ever you see <SDK version>. For example the version may look like 06.00.00.00.

Key Points

  • Adding a basic board file for the am335x device that will allow SPL and u-boot to boot
  • Navigating the git tree to find the sources and see the changes

Lab Steps

  1. Open a new terminal window (leaving the minicom window open and running).
  2. Browse to the board port u-boot sources, which is a git tree containing the board port files for u-boot.
    cd /home/sitara/ti-sdk-am335x-evm-06.00.00.00/board-support/board-port-labs/sitara-board-port-uboot
  3. Take a look at the different git tags in this tree. We will be navigating these throughout the lab.
    git tag
  4. Checkout the tag in the git tree that corresponds to the u-boot source with a template board file added. This template file has just the basics required to boot SPL and u-boot from a serial port and display SPL and u-boot messages on the serial console.
    git checkout 06.00.00.00-template
    or, if using a different SDK version:
    git checkout <SDK version>-template
    NOTE

    Tab complete can be used to help navigate the different tags available.
  5. To view the changes made to add the template file use gitk to see the files affected and the diff of the changes. By default the active commit will be the one for the template file since that is the version of the repository checked out.
    gitk --all
    Sitara-Linux-gitk-uboot-template.jpeg
    • In the above gitk you can see
      • The list of commits in the git tree
      • The list of files modified by that commit
      • The differences in those files
    • NOTE: You can also see the changes using the command git diff 06.00.00.00-base..06.00.00.00-template which provides a diff of the changes between the master and the commit adding the template file.
  6. Exit out of gitk.
  7. Compile u-boot with this template board file. This u-boot will have limited functionality but will be useful to validate that it supports the device sufficiently to begin further development. NOTE: You can always recall the previous command using the up arrow. You can then just change the build target to avoid re-typing the whole command line. Or, you can use the history command to recall previously used commands.
    make ARCH=arm CROSS_COMPILE=/home/sitara/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf- am335x_evm
    NOTE

    The "i" in "i686" is lower case. There is a space between the final "-" and am335x_evm. Everything is typed on one line. If you made a mistake, just use the up arrow to recall the command and correct it.
    • When SPL/u-boot are finished building you should see output like
    Spl build with box.PNG
  8. Switch back to your minicom console window
  9. Since SPL/u-boot do not support MMC or Ethernet yet, the only option for downloading are over the serial port.
    IMPORTANT

    The following steps need to be executed quickly to avoid a timeout in the SPL for downloading the U-Boot code. Please familiarize yourself with these steps prior to beginning the download operation
    • Press Ctrl-A then S to start a serial download
    • Select xmodem
    • Page down to the [board-port] directory and select it (tap the space bar twice to select a directory)
    • Page down to the [sitara-board-port-uboot] directory and select it
    • Page down to the [spl] directory and select it
    • Select u-boot-spl.bin (press the space bar once to select a file) and press Enter
    • Now press the Reset button on the Beaglebone board to start xmodem download protocol of SPL
    • Minicom will display a message that the download is complete so press any key to continue. SPL is now running an xmodem protocol to download u-boot.img.
      Xmodem complt.png
      IMPORTANT

      SPL does have a timeout waiting for the u-boot download. Please try to start the u-boot.img download as soon as possible. If not, you might have to start with downloading SPL again
    • Press Ctrl-A then S to start serial download
    • Select xmodem
    • Select [..] to back up to the [sitara-board-port-uboot] directory
    • Page down to the u-boot.img file, select it, and press Enter
    • Press any key when minicom has completed the download
  10. You might see a few NAK before the actual download begins. That is fine.
  11. You should now see u-boot messages and a u-boot prompt.
    Uboot halted.png

Adding MMC/SD and Ethernet Support

Description

In this section you will apply changes that add MMC/SD support and Ethernet support and observe that SPL/u-boot boot from the SD Card and that u-boot recognizes an Ethernet interface.

Prerequisites

  • Micro-SD card.

Key Points

  • How to modify u-boot to add support for MMC/SD card devices
  • How to modify u-boot to add support for Ethernet
  • Rebuilding u-boot with MMC/SD support and Ethernet support and booting to a u-boot prompt from the Micro-SD card.

Lab Steps

  1. Switch back to the Linux console instead of the minicom console
  2. Checkout the tag in the git tree that corresponds to adding MMC support. This source revision builds on the previous one by adding MMC support to the board file.
    git checkout <SDK version>-mmc
  3. To view the changes made to add MMC support use gitk --all again. This time the active commit will be moved to the one adding MMC support because that is the state of the tree due to the git checkout command run above.
    Sitara-board-port-uboot-mmc.jpeg
    • NOTE: You can also see the changes using the command git diff 06.00.00.00-template..06.00.00.00-mmc which provides a diff of the changes between the commit adding the template file and the commit adding the mmc support.
    Selection 004.png
  4. Exit out of gitk.
  5. Rather than build this version of u-boot we will look at the Ethernet changes and then build u-boot.
  6. Checkout the tag in the git tree that corresponds to adding Ethernet support. This source revision builds on the previous one by adding Ethernet support to the board file.
    git checkout <SDK version>-ethernet
  7. To view the changes made to add Ethernet support use gitk --all again. This time the active commit will be moved to the one adding Ethernet support because that is the state of the tree due to the git checkout command run above.
    Sitara-board-port-uboot-ethernet.jpeg
    • NOTE: You can also see the changes using the command git diff 06.00.00.00-mmc..06.00.00.00-ethernet which provides a diff of the changes between the commit adding mmc support and the commit adding the ethernet support.
  8. Exit out of gitk.
  9. Rebuild SPL/u-boot to pickup the source changes that added MMC and Ethernet support.
    make ARCH=arm CROSS_COMPILE=/home/sitara/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usrbin/arm-linux-gnueabihf- am335x_evm
  10. Normally you would copy MLO and u-boot.img to the Micro-SD card, but to save time, they have been copied on the card in this lab. Insert the Micro-SD card into the Beaglebone and press the Reset button.
  11. You should see SPL and u-boot messages on the minicom window.
  12. Press any key during the u-boot countdown to stop at a u-boot prompt.
    Uboot halted.png

Adding NAND Support

Description

In this section you will apply changes that add NAND support for the NAND module on a memory cape and observe that NAND commands work.

Prerequisites

  • Micro-SD card.

Key Points

  • How to modify u-boot to add support for NAND devices
  • Rebuilding u-boot with NAND support and booting to a u-boot prompt from the Micro-SD card.

Lab Steps

  1. Disconnect minicom from the beaglebone so that we power down the beaglebone.
  2. Disconnect the USB cable and the 5V power cable from the beaglebone.
  3. Attach the memory expansion cape to the beaglebone.
  4. Attach the NAND Memory Module to the cape.
  5. Configure the Boot Switches for so that we can see the NAND:
    NAND boot.jpg
    IMPORTANT

    The boot switches are only sampled during power on. Anytime they are changed, you need to disconnect all power sources and reconnect them. The USB cable on the beaglebone actually provides enough power to power the board. So, to re-latch the sysboot pins, disconnect the 5V power cable and the USB cable.
  6. Re-attach the USB cable and the 5V power cable.
  7. Re-connect to the board from minicom.
  8. Switch back to the Linux console instead of the minicom console.
  9. Checkout the tag in the git tree that corresponds to adding NAND support. This source revision builds on the previous one by adding NAND support to the board file.
    git checkout <SDK version>-nand16
  10. To view the changes made to add NAND support use gitk --all again. This time the active commit will be moved to the one adding NAND support because that is the state of the tree due to the git checkout command run above.
    Sitara-board-port-uboot-nand16.jpeg
  11. Exit out of gitk.
  12. Rebuild SPL/u-boot to pickup the source changes that added NAND.
    make ARCH=arm CROSS_COMPILE=/home/sitara/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf- am335x_evm
  13. Normally you would copy MLO and u-boot.img to the Micro-SD card, but to save time, they have been copied on the card in this lab. Insert the Micro-SD card into the Beaglebone and press the Reset button.
  14. You should see SPL and u-boot messages on the minicom window.
  15. Press any key during the u-boot countdown to stop at a u-boot prompt.
    Uboot halted.png
  16. At the u-boot prompt, type in nand help to see the various nand commands.
    nand help
  17. Erase the nand with nand erase.chip. If you have ecc errors, use nand scrub.chip -y.
    nand erase.chip or nand scrub.chip -y

Adding NOR Support

Description

In this section you will apply changes that add NOR support for the NOR module on a memory cape and observe that flash commands work.

Prerequisites

  • Micro-SD card.

Key Points

  • How to modify u-boot to add support for NOR devices
  • Rebuilding u-boot with NOR support and booting to a u-boot prompt from the Micro-SD card.

Lab Steps

  1. Switch back to the Linux console instead of the minicom console
  2. Checkout the tag in the git tree that corresponds to adding NOR support. This source revision builds on the previous one by adding NOR support to the board file.
    git checkout <SDK version>-nor
  3. To view the changes made to add NOR support use gitk --all again. This time the active commit will be moved to the one adding NOR support because that is the state of the tree due to the git checkout command run above.
    Sitara-board-port-uboot-nor.jpeg
  4. Exit out of gitk.
  5. Rebuild SPL/u-boot to pickup the source changes that added NOR.
    make O=sees-nor ARCH=arm CROSS_COMPILE=/home/sitara/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usrbin/arm-linux-gnueabihf- am335x_evm_nor
    make O=boots-nor ARCH=arm CROSS_COMPILE=/home/sitara/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usrbin/arm-linux-gnueabihf- am335x_evm_norboot
  6. The first make builds SPL and u-boot.img that can be copied to other media to boot and see the NOR. The second make builds u-boot.bin that gets flashed to the NOR.
  7. Disconnect both the 5V power cable and the USB cable to power down the board.
  8. Remove the NAND Module from the Memory Expansion Cape.
  9. Attach the NOR Module to the Memory Expansion Cape.
  10. Set the Boot Pins to the below setting to be able to burn the NOR:
    NOR Burn.jpg
  11. Copy sees-nor/MLO and sees-nor/u-boot.img to the Micro-SD card. Copy boots-nor/u-boot.bin to the Micro-SD card. Insert the Micro-SD card into the Beaglebone.
  12. Reconnect the 5V power cable and the USB cable to the beaglebone.
  13. Reconnect minicom to the board if it doesn't connect automaticaly.
  14. You should see SPL and u-boot messages on the minicom window.
  15. Press any key during the u-boot countdown to stop at a u-boot prompt.
    Uboot halted.png
  16. At the u-boot prompt, turn off protection.
    protect off all
  17. Erase the entire NOR.
    erase all
  18. Load u-boot from the SD Card to RAM.
    fatload mmc 0 0x82000000 u-boot.bin
  19. Copy u-boot from RAM to the NOR.
    cp.b 0x82000000 0x08000000 0x60000
  20. Turn protection back on.
    protect on all
  21. Disconnect the 5V power cable and the USB cable to remove power.
  22. Remove the SD Card.
  23. Set the Boot pins to boot from NOR:
    NOR Boot.jpg
  24. Reconnect power and boot from NOR.

Navigation

Return to the Sitara Linux Training List

Archives

SDK 5.07