Flameman/blackfin-bf537-stamp

From eLinux.org
< Flameman
Revision as of 10:51, 17 April 2012 by Legacy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For more interesting projects done by Flameman and Legacy, be sure to check out his project index

soon coming ...



bfin

image of the board

Blackfin-bf537-stamp-board.jpg

resources from Analog Devices


(archive)


read about blackfin

jtag


discussion about alternatives


urjtag

use gnICE/gnICE+

Flameman/blackfin-bf537-gnice-jtag


bfin command

About the usage of bfin command of urjtag. bfin is a Blackfin specific command. It has the following subcommands:

  • bfin emulation enter, Make Blackfin processor enter the emulation mode such that we can run bfin execute command.
  • bfin emulation exit, Make Blackfin processor leave the emulation mode such that the processor can run as normal.
  • bfin emulation status, Show DBGSTAT register.
  • bfin execute INSTRUCTIONs, INSTRUCTIONs is a sequence of Blackfin encoded instructions, double quoted assembly statements and [EMUDAT_IN]s. After execution, EMUDAT_OUT will be printed out.


Example

If you want to execute the following instructions:

R0 = 1;
R1 = 2;
R0 = MAX (R0, R1);

You can just using the following command:

bfin execute "R0 = 1; R1 = 2; R0 = MAX (R0, R1); EMUDAT = R0;"

urjtag will search bfin-elf-as, bfin-uclinux-as, bfin-linux-uclibc-as in $PATH and call it to assemble the instructions. So one of these commands is required to be available in $PATH to use this assembly statements in bfin execute command. bfin-elf-objcopy, bfin-uclinux-objcopy or bfin-linux-uclibc-objcopy is also required.

If GAS has not supported the the assembly statements you want to execute, or because other reasons, you cannot use assembly statement, you can use encoded instructions.

You can write an assembly file:

t.s:
R0 = EMUDAT;
R1 = EMUDAT;
R0 = MAX(R0, R1);
EMUDAT = R0;

Then as and objdump:

bfin-elf-as -o t.o t.s
bfin-elf-objdump -d t.o

t.o:     file format elf32-bfin

Disassembly of section .text:

00000000 <.text>:
      0:	c7 31       	R0 = EMUDAT;
      2:	cf 31       	R1 = EMUDAT;
      4:	07 c4 01 00 	R0 = MAX (R0, R1);
      8:	38 3e       	EMUDAT = R0;
	...

The instructions passed to bfin execute command will be:

[0x1]        -- EMUDAT = 0x1
0x31c7       -- R0 = EMUDAT;
[0x2]        -- EMUDAT = 0x2
0x31cf       -- R1 = EMUDAT;
0xc4070001   -- R0 = MAX (R0, R1);
0x3e38       -- EMUDAT = R0;

Pay attention to the byte order of the instructions.


Below is a run of these instructions:

./jtag --quiet
jtag> cable FT2232 ftdi-mpsse 403:6010
Initializing on FTDI device 403:6010
jtag> detect
IR length: 5
Chain length: 1
Device Id: 00100010011111001000000011001011 (0x00000000227C80CB)
     Manufacturer: Analog Devices
     Part(0):         BF537
     Stepping:     2
     Filename:     /home/jie/installs/jtag/share/urjtag/analog/bf537/bf537
jtag> bfin emulation enter
jtag> bfin execute "R0 = 1; R1 = 2; R0 = MAX (R0, R1); EMUDAT = R0;"
EMUDAT = 0x2
jtag> bfin execute [0x1] 0x31c7 [0x2] 0x31cf 0xc4070001 0x3e38
EMUDAT = 0x2
jtag> bfin execute [0x1] 0x31c7 "R1 = 2; R0 = MAX (R0, R1);" 0x3e38
EMUDAT = 0x2
jtag> bfin emulation exit