world leader in high performance signal processing
Trace: » intro

ADSP-BF548 EZ-KIT Quick Start: Introduction

www.analog.com_static_imported-files_images_product_descriptions_680755565image1a.jpg

Distribution Modifications

The distribution of uClinux provided on the customised Ubunu ISO that accompanies this guide is customised for the BF548-EZKIT and this guide. This involves changes such as by making it produce a 128MB ext2 image by default. Below is the list of modifications made to the distribution. It is available in the folder ”/home/uclinux/Blackfin” on the custom Ubuntu ISO.

You can also download this distribution from bf548-quick-start under the files tab.

Kernel Distribution Configuration Notes:

  • Based on 2011R1-RC3 with latest Git updates applied (patch available as upgrade.patch in linux-2.6.x on custom Ubuntu ISO)
  • Set configuration to BF548-EZKIT board defaults.

Configured kernel settings:

  • Disabled (N) Networking Support > IrDA (infrared) subsystem support
  • Enabled (Y) Device Drivers > Input device support > Event Interface
  • Enabled (Y) Device Drivers > Input device support > Keyboards > GPIO Buttons
  • Enabled (Y) Device Drivers > Input device support > Touchscreens > AD7877 based touch screens
  • Enabled (Y) Device Drivers > Input device support > Miscellaneous devices > Blackfin Rotary Support
  • Enabled (Y) Device Drivers > MMC/SD/SDIO card support > MMC Block Driver

Configured vendor settings:

  • Enabled(Y) Blackfin Build Options > Binary format > FDPIC
  • Disabled (N) Blackfin app programs > pngview
  • Enabled (Y) Blackfin app programs > ALSA utils
  • Enabled (Y) Miscellaneous Applications > Audio Tools > mp3play
  • Disabled (N) Miscellaneous Applications > Video Tools > jpegview
  • Enabled (Y) Library Configuration > Build ALSA lib
  • Enabled (Y) Library Configuration > Build libSDL
  • Enabled (Y) Library Configuration > Build Qt
  • Enabled (Y) Library Configuration > Build SDL_gfx
  • Enabled (Y) Library Configuration > Build SDL_image
  • Enabled (Y) Library Configuration > Build SDL_mixer
  • Enabled (Y) Library Configuration > Build SDL_net
  • Enabled (Y) Library Configuration > Build SDL_ttf
  • Enabled (Y) Library Configuration > Build tslib
  • Enabled (Y) Library Configuration > Build libusb
  • Enabled (Y) Library Configuration > Build directfb

Modified Files:

  • Applied latest git updates to the linux kernel
    (blackfin-linux-dist/linux-2.6.x/upgrade.patch)
  • Added “--enable-input-tslib” flag to sdl library Makefile
    (blackfin-linux-dist/lib/libsdl/Makefile)
  • Added tslib dependency for libsdl to library kconfig.
    (blackfin-linux-dist/lib/kconfig.local)
  • Adjusted makefile to build libsdl after tslib and in turn sdl_gfx after libsdl
    (blackfin-linux-dist/lib/Makefile.local)
  • Predownloaded qt-embedded-linux-opensource-src-4.5.1.tar.gz for building Qt
    (blackfin-linux-dist/download)
  • Adjusted Qt Makefile to symbolic link freetype library to correct directory
    (blackfin-linux-dist/lib/qt-embedded/Makefile)
  • Adjusted BF548-EZKIT makefile to build a 128mb ext2 rootfs image
    (blackfin-linux-dist/vendors/AnalogDevices/BF548-EZKIT/Makefile)
  • Adjusted BF548-EZKIT makefile to auto add vmImage into ext2 rootfs image
    (blackfin-linux-dist/vendors/AnalogDevices/BF548-EZKIT/Makefile)
  • Added default tslib.env file for BF548-EZKIT rootfs & added installation to BF548-EZKIT makefile
    (blackfin-linux-dist/linux-2.6.x/vendors/AnalogDevices/BF548-EZKIT/Makefile)
  • Modified BF548-EZKIT makefile to create copy of ext2 rootfs image with suffix .img for easier use with Disk application
    (blackfin-linux-dist/linux-2.6.x/vendors/AnalogDevices/BF548-EZKIT/Makefile)
  • Modified rotary encoder to provide +/- key events as well as relative events
    (blackfin-linux-dist/linux-2.6.x/arch/blackfin/mach-bf548/boards/ezkit.c)
  • Modified ezkit configuration file to add default usb hid function descriptor for usb demo
    (blackfin-linux-dist/linux-2.6.x/arch/blackfin/mach-bf548/boards/ezkit.c)

Important Tips & Tricks

Some important things to note about uClinux if you have never used it before include its file system structure, its memory management, process forking, and several bf548-ezkit specific gpio. This section will quickly make you aware of these aspects so you have a starting point for further investigation.

Folder Structure

The typical file system structure for uClinux is as follows. You're free to add/change it as you see fit, but be aware that some applications require hard coded paths (such as /lib/ and /lib/modules/).

  • /bin - (Binaries) This directory contains the executable binaries for programs that were selected in the application configuration window when compiling the kernel.
  • /dev - (Devices) On the target system this directory will contain the device files for the system.
  • /etc - (Etc.) This directory contains various system configuration files.
  • /home - (Home) This directory provides a location for system users to store their files.
  • /lib - (Libraries) This directory is for shared libraries.
  • /mnt - (Mount) This directory contains any mounted file systems.
  • /proc - (Processes) This directory stores virtual files which contain information on system processes.
  • /tmp - (Temporary) In uClinux this directory is a link to /var/tmp.
  • /usr - (User) This directory stores various user programs.
  • /var - (Various) Unlike the other directories which exist on the device /dev/root, this directory exists on the device /dev/ram0, this makes it the only writable directory as the other directories exist on a read-only file system.

Source: Root Filesystems

Memory Management

Memory management is quite different on the Blackfin uClinux distribution than the standard linux distribution. This is because the Blackfin has a limited MMU (Memory Management Unit) and so there is no virtual memory addressing and a very limited MPU (Memory Protection Unit). You can read more about this at Memory in the Kernel but the most important thing to note is that means memory fragmentation can easily occur especially if an application leaks memory, and so you will find that your distribution cannot allocate large blocks of memory after it has been running for awhile. The recommended way to avoid this problem is to allocate your necessary memory early on start up.

A possible way to help free up memory between launching applications if necessary, is to use the drop_cache method. This method involves dropping the pagecache, dentries and inode to free up memory that was being used for cache. To run this method you would just run the following command on the Blackfin:

root:/> echo 3 > /proc/sys/vm/drop_caches

You can learn more about this at http://linux-mm.org/Drop_Caches.

Virtual Forks

Another side effect of not having a full fledged MMU means the Blackfin does not support fork() calls. While it does have an alternative, vfork(), this does not work exactly the same and you will find that your threads do not run in parallel. There is one workaround to get past this hurdle and it involves invoking vfork and in the child thread, running another program and terminating the thread so as to have invoked a seperate process that will run in parallel. This work around is described in the article found on living_without_forks however most application development for simple projects will not need it.

Source Distribution Folder Structure

Other things to take note of is the distribution set up, this is the distribution you will compile on your host development pc. The folder scheme is as follows:

  • bin - misc board-specific helper binaries; generally you should ignore this.
  • config - the uClinux-dist configuration program.
  • Documentation - board-specific documentation and notes.
  • images - final build output images.
  • lib - userspace library source.
  • linux-2.6.x - the Linux kernel source.
  • romfs - the compiled root file system image.
  • staging - locally installed (“staged”) libraries.
  • testsuites - scripts for testing various boards/packages/kernels/etc…
  • tools - misc uClinux-dist compile helper tools.
  • user - userspace applications.
  • vendors - vendor-specific configuration files and build instructions.

Source: uClinux-dist Build System

When configuring your distribution with kconfig, the saved configurations are config/.config and linux-2.6.x/.config and to preserve your settings incase of backups etc, these are the two configuration files to save.

Start Up Scripts

There are several ways to invoke your programs or scripts upon board start up, one of the most common ways is to edit the romfs/etc/rc file to add the bash script commands as this script is called upon system start.

To make uClinux boot when the board is turned on will require modifying the autoboot and bootcmd variables in U-Boot. You can learn more about this on U-Boot Environment

You can recompile U-Boot so that these variables are the defaults, you can learn more about this on Customizing U-Boot