DNP5370

From Electrolab
Revision as of 00:48, 30 May 2014 by Mael (Talk | contribs)

Jump to: navigation, search

Purpose

When we get for the first time the DNP5370 from SSV vendor, the configuration used in it is optimized for server application. Specially, two problems appear:

  • 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 a freeze.

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 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 dnp5370, or to maintain it after a wrong manipulation (erasing of flash memory for example.

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 dedicated to dnp5370 only.

Prerequisites

Before we start, we have to get several tools optimized for blackfin. Note that the common tools won't work for a blackfin, 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. See the "cross compilation" section,
  • a linux kernel distribution, blackfin dedicated,
  • a buildroot tool, specifically for Blackfin target. Note that this one comes with an integrated linux kernel directory in it, that can be used directly,
  • a bootloader, here u-boot, which will be used to start the kernel at the blackfin starting up.

All those tools will be treated in dedicated paragraphs later, with the link on the sources.

The bootloader

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