Post on 31-Mar-2018
HOST system: Fedora core 6.0 installed
Blackfin toolchain: 2007R1 RC9
Blackfin uClinux: uClinux-dist-2007R1-RC3
Go to www.blackfin.uclinux.org for more detail information
uClinux on Blackfin
Linux Developing Environment
This will be upgraded continuously.
If you have any more question, email to shlee@awc.co.kr
Installing_the_blackfin_tool_chain
bash]# rpm –Uvh <filename>
(e.g. rpm –Uvh blackfin-toolchain-07r1-9.i386.rpm)
Installing the rpm on SuSE/Red Hat
Installing the rpm on Debian or coLinux
bash# alien –i <filename>
(e.g. alien –i blackfin-toolchain-07r1-9.i386.rpm)
- This will install to the directory /opt/uClinux/bfin-uclinux
When installing rpms, /opt must be writable. Normally if /opt is on a local machine, just become root, if /opt is network mounted, you will need to call your local IS person. If this is not possible –you should install from the tarball
.tar.bz2 files – They must be decompressed with bunzip2 and extracted with tar before being built
.tar.gz files – The sasme as *.tar.bz2 files except that they must be decompressed with gzip
.rpm files – These are Red Hat Package Management files.
Gdb requires termcap, ncurses, and ncurses-devel. Ensure these libraries are installed on your system before proceeding.
Setting the PATH environment variable
bash]# export PATH=$PATH:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin
After installing the Blackfin tool chain the environment variable PATH must be modified to include the directory where the blackfin tool chain is installed. This can be done by entering the following command before using the Blackfin tool chain (assuming the path where the Blackfin tool chain binaries are installed is /opt/uClinux/bfin-uclinux/bin)
bash]#vi .bash_profile (Fedor core 6.0)
export PATH=$PATH:/opt/uClinux/bfin-uclinux/bin:$PATH
Alternatively, to have PATH set automatically edit the file ~/.bashrc to include the following lines:
Basic_compilation
bash]# bunzip2 –d <filename> (for *.bz2 files)
bash]#gzip –d <filename> (for *.gz files)
bash]#tar –xvf <filename of unzipped file>
uClinux-dist]#make menucofing
If you would like to change a platform, e.g, from BF533 STAMP to BF537 STAMP, please do a “make clean” before compile. Otherwise, there may be unexpected errors. Also if you met unexpected errors while compiling kernel, you may try to do a “make clean”.
The default username for the Blackfin login is root and the password is uClinux.
If you receive errors indicating that certain files could not be found you may have to copy all the files from the directories …/uClinux-dist/linux-2.x.x/inlcude/ and …/uClinux-dist/lib/libc/include/ into a directory named <tool chain installation directory>/bin-elf/include/. You may have to create this directory if it does not already exist.
After the kernel has compiled successfully, the file linux will be created in the directory ./uClinux-dist/images.
Compiling u-boot-1.1.6
bash]# bunzip2 <filename>
bash]# tar xvf <filename>
bf533-stamp_config: for a BF533 stamp board
bf533-ezkit_config: for a BF533 ezkit board
bf537-stamp_config : for a BF537 stamp board
bf561-ezkit_config: for a BF561 ezkit board
bash]# make mrproper
bash]# make bf533-stamp_config
bash]# make
Make U-Boot Hex file
bash]# bfin-uclinux-objcopy –I binary –O ihex u-boot.bin u-boot.hex
For more information, please refer to release_note_2007R1.pdf
Terminal Programs for Linux - Minicom
bash]# minicom -s
57600 baud is the default serial transfer rate for U-Boot and the uClinux kernel, though this can be changed when compiling the kernel
Serial Device: /dev/ttyS0
Bps/Par/Bits: 57600 8N1 – parity(N for none), stop bits(1)
Hardware Flow Control: N0
Software Flow Control: N0
bash]# rpm –qa | grep tftp
bash]# yum install tftp
bash]# yum install tftp-server
bash]# vi /etc/xinetd.d/tftp
bash]#service xinetd restart
bash]#netstat –al | grep bootp
bash]#netstat –al | grep tftp
Installing tftp in Fedora
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
per_source = 11
cps = 100 2
flags =IPv4
}
Downloading to targetjffs2.img – JFFS2 root file system
linux – Bootable ELF object
rootfs.img – ext2 root file system
uImage – Bootable compressed Image
1. Copy the kernel into the tftpboot directory
uClinux-dist]# cp ./images/linux /tftpboot/linux
2. Tftp and boot-elf the file over using U-Boot
stamp> dhcp
Using MAC Address 00:E0:22:FE:47:7B
BOOTP broadcast 1
DHCP client bound to address 192.168.1.99
stamp> setenv serverip 192.168.1.1
stamp>saveenv
stamp>setenv serverip 192.168.1.1
stamp>setenv ipaddr 192.168.1.99
stamp>saveenv<code>At this point issue a “saveenv”command to keep these new values do this only when you need to change values.
-now transfer the image from the host to the target and boot<code>
stamp>tftp 0x1000000 linux
stamp>bootelf 0x1000000
Target download
You can add a uboot command to automate all this
stamp> setenv tftpl tftp 0x1000000 linux ₩; bootelf 0x1000000
stamp> saveenv
stamp> run tftpl
stamp> setenv bootcmd run tftpl
It is only necessary to set up the command one time, as long as you save it into the flash. Then the following command can be used to perform the download
This can be automated by defining the auto boot command
Porting Linux To Your Board (1)
choice
prompt
…
config BFIN537_FOOBER
bool “BF537-FOOBER”
depends on BF537
help
The FOOBER board that has a BF537 on it.
…
endchoice
In order to make the board appear in the kernel configuration menu, we need to update the Kconfig file. Open up the arch/blackfin/Kconfig file and update the System type choice section.
Once you’ve added your board here, it will show up in the kernel configuration:
Blackfin Processor Options
>> CPU (BF537) System type (BF537-FOOBER)
arch/blackfin/Kconfig
arch/blackfin/mach-CPU/boards/Makefile
arch/blackfin/mach-CPU/boards/BOARD.c
1) Kconfig
Porting Linux To Your Board (2)
2) MakefileThe kernel needs to know what source files to include when compiling the kernel, so we need to add one line to the arch/blackfin/mach-bf537/boards/Makefie:
Obj-$(CONFIG_BFIN537_FOOBER) += foober.o
Now the kernel knows that when you select the BF537-FOOBER board, it should compile the foober.c file in the arch/blackfin/mach-bf537/boards/ directory.
3) Board ResourcesThe last (and most important) step is declaring your board resources. This is done in a board-specific file, arch/blackfin/mach-bf537/boards/foober.c in this case.
We provide a generic board file for you to get started with, generic_board.c, so just copy that if you like. It’s as simple as:
$ cp arch/blackfin/mach-bf537/boards/generic_board.c arch/blackfin/mach-bf537/boards/foober.c
The tough part of course is changing the file to match your board. The general setup of the file looks like:
bfin_board_name – a short string describing the board
board_devices – an array of platform_devices
board_init – an arch_initcall() function that performs board registration (registers the devices)