This is a general collection of some of the most frequently asked questions about Blackfin Linux. Some of the questions even have answers - to find them, click the question (like most of the side, you must have javascript enabled).
Some topics have so many FAQs, a page was created specifically for them!
What is the difference between uClinux and Linux?
Is it more difficult to debug uClinux applications than Linux applications?
Is Linux more stable than uCLinux?
How difficult is it to port a Linux application to uCLinux?
What is the licensing model for Linux? Where can I find more information on GPL and LGPL?
Which release shall I use? Live source or release?
Why isn't silicon revision XXX supported?
I have found a bug, where to report it?
Why do I need to use the same version of toolchain/kernel/uClibc/U-boot/uClinux-dist?
-mfdpic or shared flat), and attempt to use a different version of uClibc in the toolchain, than what runs on the target all kinds of undebuggable random errors may be encountered. From causing bus errors, to crashing on exit. This is because the uClibc code in entry and exit code is modified to fix bugs.
I want to learn more about Linux development. Can you recommend a good resource?
What is the typical Blackfin power consumption and what can I do to improve it?
What is the system boot time and what can I do to improve it?
What is the typical Blackfin Linux Flash Memory footprint what can I do to improve it?
I get errors about linux/mtd/ftl.h, flash_eraseall.c, or ftl_format.c
Can I build the uClinux-dist on a 2.4 host
flash_eraseall.c or ftl_format.c, this is most likely the problem of missing header “linux/mtd/ftl.h” on the host. If you are running into problems, you have a few options:Kernel/Library/Defaults Selection → Customize Vendor/User Settings → Flash Tools → mtd-utils.My host is running Linux 2.6, why I still cannot build the uClinux-dist
/usr/include/, so you may get an error like:$ gcc -I/usr/include -I. -o build/ftl_format ftl_format.c ftl_format.c:51:27: error: linux/mtd/ftl.h: No such file or directory
In this case, please try to find the headers files for mtd-utils in the host kernel source tree (kernel source will be installed in /usr/src/ by default): <kernel_src>/include/linux/mtd/. If it is not there, you can copy (or link) the target mtd directory from <target_kernel_src>/uClinux-dist/linux-2.6.x/include/mtd/ to usr/include/linux/mtd. (which hopefully is a path that your host's gcc looks at for include files).
While building, make aborts with "expand.c:489: allocated_variable_append: Assertion ... failed."
While building the uImage, genext2fs segfaults!
I get errors about "no free space" when generating EXT2 images
../bfin-elf-genext2fs: couldn't allocate a block (no free space)
This means that the ram files system for the target is not big enough to store all the data that you want to put in it. This is controlled in the ./vendors/AnalogDevices/BF5xx-XXXX/Makefile. For more information learn more about the root_file_system_structure
My uImage is too large to burn in my flash
uClinux-dist> find -P ./romfs/ -type f -printf "%s %p\n" | sort -nr | less
And just delete the large ones that you do not need.
Since this is easier said than done, you can run this little bit of shell script, which goes through the romfs, looking at which libraries are referenced by everything not in the /lib directory, and then goes through those libraries, and prints their dependencies.
rgetz@imhotep:~/blackfin/trunk/uClinux-dist> for i in $(bfin-elf-readelf -d $(find -P ./romfs -perm -001 -type f | grep -v "./lib/") | grep NEEDED | awk '{print $5}' | sort | uniq | sed -e 's/\[//' -e 's/\]//' ) ; do echo $i; bfin-elf-readelf -d ./romfs/lib/$i 2>/dev/null | grep NEEDED | awk '{print $5}' | sed -e 's/\[//' -e 's/\]//' ; done | sort | uniq
ld-uClibc.so.0
libcrypt.so.0
libc.so.0
libdl.so.0
libgcc_s.so.1
libid3tag.so.0
libjpeg.so.62
libmad.so.0
libm.so.0
libpng12.so.0
libpthread.so.0
libthread_db.so.1
libutil.so.0
libz.so.1
You should not remove anything in the list that the script generates (unless you are only building as flat, and do not want to do any fdpic developments).
./romfs. You need to either:
rm ./romfs/bin/strace && make image)romfs folder (rm -rf ./romfs && make romfs imagemake clean && make
Blackfin build options --->
[*] Install ELF shared libraries
[ ] Cull unused ELF shared libraries
This should be done after you have removed the libraries - but -- it will remove all shared libraries (or shared libraries which are not referenced by the current applications in the romfs directory. For example - if you have no threaded applications in the romfs directory, it will remove the pthread library (libpthread.so.0), but this will make it so no threaded applications will ever run on the system (without also replacing the pthread library.
I get "BINFMT_FLAT: bad flat file version 0x5" errors
I get errors about "BINFMT_FLAT: bad header magic" or "Applet not found"
-mfdpic (and make sure ELF support is turned on in the kernel) or specify -Wl,-elf2flt and run the flat file.
Have a look at:
simple_hello_world_application_example
Another common error is to transfer files via ftp to the board in ASCII mode. Make sure you transfer only in binary mode.
I get "bfin-uclinux-mkimage: command not found" errors
How do I enable Large File Support in uClibc / Toolchain
When I nfs mount the root file system, some directories look they are missing
cpio host application, sometimes the permissions on the directories can be set incorrectly. You have a few choices:chmod 755 <dir>)cpio application to something that isn't brokenBuilding packages fails with stdarg.h missing!
Running config.sub results in "machine `bfin' not recognized"
config.sub file is outdated. Simply copy the version from uClinux-dist/tools/config.sub over the local version.
rgetz@pinky:~/blackfin-trunk> grep MPFR_VERSION_STRING /usr/include/mpfr.h #define MPFR_VERSION_STRING "2.2.0
Some device nodes in /dev seem to be missing!
How do I access the Power Management features of the Blackfin?
How do I change the network settings for the Blackfin?
./uClinux-dist/vendors/AnalogDevices/BFXXX-XXXXX/rc file. This file is the startup script that is run each time the Blackfin boots. To set a static ip address of your choice, add the line
ifconfig eth0 192.168.0.1
Or to instead use DHCP for obtaining an IP address, add the line:
dhcpcd &
Then rebuild the kernel. You can also use this file to automatically mount shared drives and other things that need to be done at boot time.
A third option is to pass in a static IP address through U-Boot through the bootargs environment variable
setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off
This is equivalent to the addip command in U-Boot
For more details, see the setting_up_the_network page.
How do I allow more telnet sessions into the Blackfin? (error: All network ports in use)
Unix98 PTY support option in the kernel configuration under Character Devices. You must also deselect the option telnetd does not use openpty() in the vendor/user configuration. Then at runtime, you must mount the devpts pseudo filesystem on /dev/pts/. The default Analog Devices boards do all of this for you.
On older releases (2007R1 and older), the default behavior was a static list of legacy BSD pty's. The default was to only allow two telnet connections into the Blackfin at a given time. To allow more telnet sessions for the Blackfin, you will need to modify the ./uClinux-dist/vendors/AnalogDevices/BFXXX-XXXXX/device_table.txt file. The last number on the line for /dev/ttyp and /dev/ptyp control the number of telnet sessions available. In this case, up to 8 telnet sessions are allowed.
/dev/ttyp c 666 0 0 3 0 0 1 8 /dev/ptyp c 666 0 0 2 0 0 1 8
What does a normal Boot Look like?
stamp>bootm
## Booting image at 01000000 ...
Image Name: uClinux Kernel and Filesystem
Created: 2006-03-23 5:48:47 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 2829207 Bytes = 2.7 MB
Load Address: 00001000
Entry Point: 00001000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 1000
Linux version 2.6.12.1-BFIN-2005R4 (rgetz@home) (gcc version 3.4.4 (Blackfin 05R
Blackfin support (C) 2004 Analog Devices, Inc.
ADSP-BF533 Rev. 0.3
uClinux/BF533
Blackfin uClinux support by blackfin.uclinux.org
Processor Speed: 398 MHz core clock and 79 Mhz System Clock
Board Memory: 128MB
Memory map:
text = 0x001000-0x0d9d58
data = 0x0e6838-0x112fec
bss = 0x112ff0-0x1204b4
rootfs = 0x7700000-0x7f00000
stack = 0x0e8000-0x0ea000
Command line: 'root=/dev/mtdblock0 rw'
Instruction Cache Enabled
Data Cache Enabled (write-through)
Hardware Trace Enabled
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 rw
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Physical pages: 3c00
Memory available: 59648k/130149k RAM, (49k init code, 867k kernel code, 231k dat
Blackfin Scratchpad data SRAM: 4 KB
Blackfin DATA_A SRAM: 16 KB
Blackfin DATA_B SRAM: 16 KB
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin DMA Controller for BF533
stamp_init(): registering device resources
Real Time Clock Driver v1.10e
blackfin_dpmc_init
Dynamic Power Management Controller: major=10, minor = 254
DPMC Driver v0.1
BlackFin BF533 serial driver version 2.00 With DMA Support
io scheduler noop registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@cam.org>
Blackfin SMC91x interrupt setup: flag PF7, irq 27
eth0: SMC91C11xFD (rev 1) at 20300300 IRQ 27 [nowait]
eth0: Ethernet addr: 00:e0:22:fe:07:91
uclinux[mtd]: RAM probe address=0x7700000 size=0x800000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00800000 : "EXT2fs"
uclinux[mtd0]: set EXT2fs to be root filesystem
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 48k freed (0xda000 - 0xe5000)
ttyS0 at irq = 21 is a builtin BlackFin UART
bfin_change_speed: baud = 57600, cval = 0x13
Welcome to:
____ _ _
/ __| ||_| _ _
_ _| | | | _ ____ _ _ \ \/ /
| | | | | | || | _ \| | | | \ /
| |_| | |__| || | | | | |_| | / \
| ___\____|_||_|_| |_|\____|/_/\_\
|_|
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
BusyBox v1.00 (2006.02.17-14:21+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
root:~>
How do I port applications to Blackfin Linux?
root:~> modprobe snd-ad73311 soundcore: version magic '2.6.16.11-ADI-2006R1 gcc-4.1' should be '2.6.16.11-ADI-2006R1 gcc-3.4' insmod: cannot insert `/lib/modules//2.6.16.11-ADI-2006R1/kernel/sound/soundcore.ko': Invalid module format (-1): Exec format error
This error means you build the modules with a different version of the compiler than what the kernel is built with. You must build modules and kernel with the same version.
root:~> /foo /foo: not found
And I know my application is there:
root:~> ls -l /foo -rwxr-xr-x 1 0 0 5341 foo
This is normally because the shared library was not installed in the ./romfs/lib directory:
root:~> ls /lib/ modules root:~>
Just install the shared libs, and try again.
I get a "init: /bin/syslogd respawning too fast" error
syslogd dieing and then restarting. This can happen for a few reasons:syslogd writes to a log file - if it fails creating this log file, it dies.syslogd uses network socketsTo fix this error, you have a few choices:
syslogdCustomize Kernel Settings → Blackfin Processor Options → Clock Settings → Re-program Clocks while Kernel boots. The way the PLL works on the Blackfin is by taking the external crystal frequency, multiplying that up by VCO Multiplier (If you have a 25MHz clock, and set the Multipler to be 24, the VCO will be running at 600MHz). The core speed can be run slower than the VCO by programming the Core Clock Divider (Normally 1), and the SCLK must be run slower than the VCO, so it has it's own divisor, System Clock Divider. (If the VCO is running at 600MHz, a system clock divider of 5 will run things at 120MHz). Depending on the software load, it might be better to optimize things to have the fastest system clock possible, rather than the faster core clock.
CONFIG_SCLK_DIV in ./include/configs/<board_name>.h, it is not recommended, since you can quickly turn your board into a doorstop. Changing clocks in the kernel is the recommended way.
Blackfin board only shows ~60meg free with 128meg (Anomaly 05000263)
DESCRIPTION: There is an error in the hardware loop logic which can cause incorrect instructions to get executed when the processor is running loops and instruction ICPLB exceptions occur. WORKAROUND: Either: 1) Avoid using hardware loops, OR 2) Make sure hardware loops are located only in L1 memory, OR 3) Make sure ICPLB exceptions do not occur while executing a hardware loop located outside L1 memory.
Since we allow hardware loops in gcc 4.1, and in kernel and user assembly optimized library functions which all run out of L3, neither of the recommended workarounds will work for Linux. What we do, is ensure there is never an ICPLB exception. To do this, we have to cover 100% of the runnable memory in 16 of the entries in the iCPLB table. 1 is used for L1, 1 is used for jumping to zero (can be disabled), so that leaves 14 * 4Meg = 56 Meg available for Linux to use as it's global memory pool.
To reduce the impact of this, we put the file systems at the top of memory (data fetches don't cause ICPLB misses), hopefully above the 56Meg mark, so you can use the entire 56Meg as a kernel memory pool. If for example, you can see this when the kernel boots, when it prints out the system memory map:
Memory map: text = 0x00100000-0x0021f570 init = 0x00220000-0x0022ed18 data = 0x00232a08-0x0026a4e8 stack = 0x00234000-0x00236000 bss = 0x0026a4f0-0x002787ec available = 0x002787ec-0x025ff000 rootfs = 0x02600000-0x03e00000 DMA Zone = 0x03e00000-0x04000000
You can still utilize this memory yourself in your drivers, you just cannot allow instruction fetches to come from this non iCPLB covered memory. See the memory allocator page for some tips.
Depending on the silicon version you are using, it may not have this issue in it. BF533 rev 0.5, BF537 rev 0.3 this issue has been fixed. If you selected this version when building your kernel, this limitation will be removed.
How do I access system registers from user space?
Why is the blackfin serial port named ttyBF0? Shouldn't it be named ttyS0?
ln -s ttyBF0 /dev/ttyS0
How do I specify custom/high baud rates with the standard UART driver?
#include <asm/termios.h>
#include <asm/ioctls.h>
...
struct termios2 t;
ioctl(fd, TCGETS2, &t);
t.c_ospeed = t.c_ispeed = 543210;
t.c_cflag &= ~CBAUD;
t.c_cflag |= BOTHER;
ioctl(fd, TCSETS2, &t);
...
The older method requires a helper application. You have to set the baud to B38400 and then run the setserial program (which can be found in the uClinux vendor menu). So to set the actual divisor (UART_DLL/UART_DLH) on UART1 to a value of say 9, just do:
stty -F /dev/ttyBF1 38400 setserial -a /dev/ttyBF1 divisor 9 spd_cust
How do I tell the kernel not to print things out the UART?
console= and loglevel= options on the kernel command line. For more information, see the silent booting document.
I get "Read-only file system" errors
bootargs variable, if it doesn't say something like root=/dev/mtdblock0 rw (the ”rw” part is the important part), it will be mounted as read only. To modify things at runtime, just mount -o remount,rw / at the root prompt, and it will remount your root filesystem (the / part) as read write.
Why is the kernel start address in the middle of the kernel memory space?
Image Name: Linux-2.6.22.18-ADI-2008R1-svn Image Type: Blackfin Linux Kernel Image (gzip compressed) Data Size: 778200 Bytes = 760 kB Load Address: 00001000 Entry Point: 00144000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK
Starting Kernel at = 144000<code>
The Entry Point (where the Bootloader jumps to) is at 0x144000, not the base load address of the kernel (0x1000), since the entry point is where the kernel's chip initialization occurs. This is only done once (when the kernel boots), and is put into the init section, which is released/discarded after the kernel is finished with it. There is no point in keeping chip init code when we don't need it.
This is different behavior from older releases (where the load address and entry point were the same thing), so people using older vendor Makefiles may create broken uImages until they update their Makefile in the uClinux-dist. See any of the Analog Devices boards for the proper method to call the mkimage utility.
VFS: Cannot open root device "mtdblock0" or unknown-block(0,0) Please append a correct "root=" boot option; here are the available partitions: 1f00 5120 mtdblock0 (driver?) Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
The Linux kernel needs a valid root file system so that it can load and execute user space code. However, it needs to know what file system to use for its root file system, how to access the hardware where the file system lives, and how to read the particular file system. To these ends, people often times do not setup all of these important pieces:
root= to the proper device/partitionSince all of the kernel modules and user space programs live on the root file system, you cannot load modules before accessing the root file system. Many people forget this and build the required kernel pieces as modules instead of into the kernel.
Complete Table of Contents/Topics