DNP5370
Contents
Purpose
The purpose of this webpage is not to explain in details how does linux work, which is already documented everywhere on the web, but to give a small survivor kit to be able to make a new customized image for the µClinux target (dnp5370, or to maintain it after a wrong manipulation (erasing of flash memory for example).
As an example, and since my work is on that king of target, I will present the DNP5370 from SSV vendor. This is a powerful and size optimized target, usefull for my other UAV's works, but it has several problems. When it comes from the supplier, the default configuration is made for webserver, and not at all for quick response embedded controlling system:
- The mutex is too long, when a process takes it the next kernel switch can't happen before 20 ms, even if the process activity goes to "sleep",
- The use of the old "can4linux" module integrated to the target leads to a dramatic kernel panic, and freezes.
For those 2 reasons, and also to keep an up to dated version of kernel and file system, we need to make a new target.
The things I describe here comes from documentation over internet, mainly from the official Blackfin uClinux website. I'll add as much links as possible, but this page is mainly dedicated to dnp5370.
The study is done on the dedicated tool for µClinux applications: Buildroot, which will allow us to build:
- A new Bootloader to program and start the target,
- A new kernel, optimized with only the functions we need on our application,
- A new filesystem where the application and dependencies could already be present.
The data and howto described here comes from many sources, including:
- [1]: The complete µClinux reference website
Prerequisites
Before we start, we have to get several tools optimized for blackfin. Note that the common tools won't work for a blackfin target, we need to use those that are optimized (and patched) for Blackfin.
So we need :
- a toolchain, since we build a kernel and tools for a target which is not the host computer. So the generic gcc compiler won't work: [2]
- a linux kernel distribution, blackfin dedicated: [3]
- a buildroot tool, a µClinux builder patched for Blackfin target. Note that this one comes with an integrated linux kernel directory in it, that can be used directly: [4]
- a bootloader, here u-boot: [5]
Then you need a computer using linux, a powerful is better since compilation is pretty long. Explanation are based on Ubuntu commands. The installation steps are described in the installation files for each tool, and present no difficulties.
To be able to use all the configuration views, several other small tools are required :
sudo apt-get install qt4-dev-tools
sudo apt-get install subversion
On a x64 system :
sudo apt-get install lib32z1
The bootloader
"Well, first step... Erase the bootloader and all memory.
You kidding me, right?"
JTAG
If something goes wrong during an attempt to replace the u-boot already installed, and you can be sure that something will go wrong, you need to restore the previous configuration. That means basically that you have to load the last working u-boot version you have (normally the one given by SSV in the sk28 kit).
- How to know that u-boot is dead?
- The 3 LED flashes together at about 1 Hz, with a 25% on cyclical rate. And when you attempt to communicate with the chip using either IP link or RS232, nothing happens. That means it is dead... But no panic, here is the solution :
The best way to recover it is to use a JTAG emulator, for example gnICE+. For 100 Euros, it is a good investment. No need to install anything, except the toolchain (that you should already have installed on your host). The JTAG use two programs :
- bfin-gdbproxy : used for debugging purpose,
- bfin-jtag : used for memory programming
I will describe here how to program memory using the bfin-jtag function on an Ubuntu host with the last available blackfin toolchain installed and exported in the .bashrc file.
First, buy the gnICE+ device (or any JTAG probe that is supported for Blackfin, but the gnICE or gnICE+ from Bluetechnix are the most commonly used). The JTAG device can be connected to the host using a simple USB port (USB 2.0).
- >Check for the driver installation< **
Then, open a terminal in your tftp directory, where you should have copied all the [u-boot.bin] files that you tried to program on the chip. It is the better place to have all the programs together.
Switch to a root console, since the USB connection will requires admin rights :
host> sudo -s password: **** host#
Then open the jtag connection :
host# bfin-jtag -q
This should start the jtag environment:
jtag>
To connect the target, several steps :
jtag> cable gnICE+ jtag> detect jtag> initbus bf53x
The dnp5370 is not available in the target recognized by gnICE+, so we use the generic configuration for bf53x family.
Then the following sequence will copy the u-boot.bin file in the memory of the target.
jtag> detectflash 0x20000000 jtag> endian little jtag> flashmem 0x20000000 u-boot.bin jtag> instruction BYPASS jtag> shift ir jtag> quit
Note that you can also use a path to the file if it is not in the tftpboot directory, or if you have no tftpboot directory:
jtag> flashmem 0x20000000 /somewhere/something.bin