GnIce: Unterschied zwischen den Versionen
en>Peter K (1 Version importiert) |
Peter (Diskussion | Beiträge) K (1 Version importiert) |
(kein Unterschied)
|
Aktuelle Version vom 31. Oktober 2023, 09:03 Uhr
Description
The gnICE is a fast and low cost USB JTAG In-Circuit-Emulator for Blackfin processors. It's designed to provide reliable JTAG debugging and CFI NOR Flash programming via USB. The gnICE JTAG Adapter Cable is an Open Source Hardware, based on the FT2232 chip from Future Technology Devices International Ltd.
gnICE description: https://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice
gnICE+ description (faster): https://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice-plus
Get a gnICE+
gnICE+ can be ordered from Bluetechnix, please see our web page.
Linux: Set proper USB permissions for gnICE/gnICE+
By default, you won't be able to communicate with the gnICE without root permissions.
To tell udev to set the proper permissions on gnICE's device files, add the file /etc/udev/rules.d/10-gnice.rules with the following content:
SUBSYSTEMS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end" SYSFS{idProduct}=="f001", SYSFS{idVendor}=="0456", MODE="660", GROUP="plugdev" SYSFS{idProduct}=="f000", SYSFS{idVendor}=="0456", MODE="660", GROUP="plugdev" LABEL="kcontrol_rules_end"
Afterwards, restart udev:
sudo /etc/init.d/udev restart
Programming flash memory with bfin-jtag from the GNU tool chain
Note #1: bfin-jtag does not support flash bank switching with GPIOs on Bluetechnix Core Modules, so on most modules, only 2MB of the flash memory will be available (but that is sufficient to program BLACKSheep or U-Boot)
Note #2: If this solution does not work for you, please read below!
Note #3: We recommend using tool chain version 2009R1.1-RC2
We use a Linux operating system and assume that bfin-jtag's path is in your ${PATH}.
Connect gnICE/gnICE+.
bfin-jtag -q
Now, enter the following commands to flash e.g. U-Boot.
cable gnICE - or - cable gnICE+ detect initbus $BOARDTYPE detectflash 0x20000000 flashmem 0x20000000 $BINFILE
where $BOARDTYPE depends on your Blackfin processor
- BF518: Use bf51x
- BF525: Use bf52x
- BF527: Use bf52x
- BF533: Use bf53x
- BF537: Use bf53x
- BF548: Use bf548_ezkit
- BF561: Use bf561_ezkit
and $BINFILE is a binary file containing the desired flash content (e.g. u-boot.bin).
Example
harald@WS-HP4600-35:~$ bfin-jtag -q jtag> cable gnICE Connected to libftdi driver. jtag> detect IR length: 10 Chain length: 2 Device Id: 01010010011110111011000011001011 (0x00000000527BB0CB) Manufacturer: Analog Devices Part(0): BF561 Stepping: 5 Filename: /home/harald/blackfin/toolchain2009r1.1-rc2/opt/uClinux//bfin-elf/bin/../share/urjtag/analog /bf561/bf561 Device Id: 01010010011110111011000011001011 (0x00000000527BB0CB) Manufacturer: Analog Devices Part(1): BF561 Stepping: 5 Filename: /home/harald/blackfin/toolchain2009r1.1-rc2/opt/uClinux//bfin-elf/bin/../share/urjtag/analog/bf561/bf561 jtag> initbus bf561_ezkit jtag> detectflash 0x20000000 Query identification string: Primary Algorithm Command Set and Control Interface ID Code: 0x0001 (Intel/Sharp Extended Command Set) Alternate Algorithm Command Set and Control Interface ID Code: 0x0000 (null) Query system interface information: Vcc Logic Supply Minimum Write/Erase or Write voltage: 2300 mV Vcc Logic Supply Maximum Write/Erase or Write voltage: 3600 mV Vpp [Programming] Supply Minimum Write/Erase voltage: 8500 mV Vpp [Programming] Supply Maximum Write/Erase voltage: 9500 mV Typical timeout per single byte/word program: 256 us Typical timeout for maximum-size multi-byte program: 512 us Typical timeout per individual block erase: 1024 ms Typical timeout for full chip erase: 0 ms Maximum timeout for byte/word program: 512 us Maximum timeout for multi-byte program: 1024 us Maximum timeout per individual block erase: 4096 ms Maximum timeout for chip erase: 0 ms Device geometry definition: Device Size: 8388608 B (8192 KiB, 8 MiB) Flash Device Interface Code description: 0x0001 (x16) Maximum number of bytes in multi-byte program: 64 Number of Erase Block Regions within device: 2 Erase Block Region Information: Region 0: Erase Block Size: 32768 B (32 KiB) Number of Erase Blocks: 4 Region 1: Erase Block Size: 131072 B (128 KiB) Number of Erase Blocks: 63 jtag> flashmem 0x20000000 /tftpboot/u-boot.ldr Manufacturer: Intel Chip: Unknown (0x8820)! program: block 0 unlocked erasing block 0: 0 addr: 0x20007F00 block 1 unlocked erasing block 1: 0 addr: 0x2000FF00 block 2 unlocked erasing block 2: 0 addr: 0x20017F00 block 3 unlocked erasing block 3: 0 addr: 0x2001FF00 block 4 unlocked erasing block 4: 0 addr: 0x2002A49A verify: addr: 0x2002A49A Done. jtag>
Programming flash memory with bfin-gdbproxy and Visual DSP++ Flash Tool Driver
The trunk repository of the GNU tool chain (File: e.g. blackfin-toolchain-2010R1-RC4.src.tar.bz2) contains some gdb-scripts, among them the vdsp-flash-programmer.sh script. This script uses a flash tool driver for the Visual DSP++ IDDE for flash programming.
Note #1: With this method, the whole flash size is available for programming, because the flash tool drivers are specifically implemented for our Core Modules.
- Get the gdb scripts:
svn checkout svn://firewall-sources.blackfin.uclinux.org:80/svn/toolchain/trunk/debug-helpers/gdb-scripts gdb-scripts
- Get the flash tool drivers:
- They are available via Bluetechnix SVN portal (https://support.becom-group.com/software/); you have to register to download them.
- Also see Flash tool driver files.
- Start bfin-gdbproxy (from the GNU tool chain). It will automatically detect gnICE and gnICE+ JTAG devices and connect to the Blackfin CPU.
bfin-gdbproxy bfin --reset
- Open a new terminal and execute vdsp-flash-programmer.sh
gdb-scripts/vdsp-flash-programmer.sh $FLASHTOOLDRIVER.dxe
- Optional: Set pagination mode off
set pagination off
- Use command flrestore for flash programming now, the syntax is as follows
flrestore $BIN_FILE 0 $FILE_SIZE_IN_HEX
- We recommend to round up the file size to the end of the next sector (One sector is normally 128 KiB large). We observed cases where the last byte was incorrectly written if the file was given exactly.
Example
GDB:
harald@WS-HP4600-35:~/temp$ gdb-scripts/vdsp-flash-programmer.sh CM-BF561_Flash.dxe INFO: Cleaning up driver: CM-BF561_Flash.dxe INFO: Launching gdb (no debugging symbols found) [New Thread 1] [New Thread 2] 0xef001fae in ?? () [New Thread 1] [New Thread 2] 0xef001fb0 in ?? () Loading section L1_data_b, size 0x10a4 lma 0xff900000 Loading section L1_code, size 0x3ef0 lma 0xffa00000 Loading section L1_code_cache, size 0x94a lma 0xffa10000 Start address 0xffa00000, load size 22750 Transfer rate: 138403 bits/sec, 7583 bytes/write. Hardware assisted breakpoint 1 at 0xffa01b8c Flash Programmer information: Title : CM-BF561-V2 Description : Intel P30 DeviceCompany : Intel BuildDate : Feb 3 2010 DrvVersion : 1.01.0 Buffer : 0xff804440 Size : 0x3000 ManCode : 0x89 DevCode : 0x20 Error : 0 ---Type <return> to continue, or q <return> to quit--- Flash layout: (16 bit, 256 sectors, 7 MiB) 0: 0x00000000 0x00008000 0x00010000 0x00018000 0x00020000 5: 0x00028000 0x00030000 0x00038000 0x00040000 0x00048000 10: 0x00050000 0x00058000 0x00060000 0x00068000 0x00070000 15: 0x00078000 0x00080000 0x00088000 0x00090000 0x00098000 20: 0x000a0000 0x000a8000 0x000b0000 0x000b8000 0x000c0000 25: 0x000c8000 0x000d0000 0x000d8000 0x000e0000 0x000e8000 30: 0x000f0000 0x000f8000 0x00100000 0x00108000 0x00110000 35: 0x00118000 0x00120000 0x00128000 0x00130000 0x00138000 40: 0x00140000 0x00148000 0x00150000 0x00158000 0x00160000 45: 0x00168000 0x00170000 0x00178000 0x00180000 0x00188000 50: 0x00190000 0x00198000 0x001a0000 0x001a8000 0x001b0000 55: 0x001b8000 0x001c0000 0x001c8000 0x001d0000 0x001d8000 60: 0x001e0000 0x001e8000 0x001f0000 0x001f8000 0x00200000 65: 0x00208000 0x00210000 0x00218000 0x00220000 0x00228000 70: 0x00230000 0x00238000 0x00240000 0x00248000 0x00250000 75: 0x00258000 0x00260000 0x00268000 0x00270000 0x00278000 80: 0x00280000 0x00288000 0x00290000 0x00298000 0x002a0000 85: 0x002a8000 0x002b0000 0x002b8000 0x002c0000 0x002c8000 90: 0x002d0000 0x002d8000 0x002e0000 0x002e8000 0x002f0000 95: 0x002f8000 0x00300000 0x00308000 0x00310000 0x00318000 Now you can use the commands (run 'help cmd' for more info): ---Type <return> to continue, or q <return> to quit--- fldrvinfo flinfo flstat flcmd flerase_sector flerase flwrite flrestore flread fldump (gdb) set pagination off (gdb) flrestore /tftpboot/u-boot.ldr 0 0x2A49C Restoring 0 to 0x2a49c (173212 bytes) Erase complete; Starting write cycle Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff807440) Restoring binary file /tftpboot/u-boot.ldr into memory (0xff804440 to 0xff8048dc) 0x49c bytes @ 0x2a000 (99%%) (gdb) (gdb) q The program is running. Exit anyway? (y or n) y Quitting: /tmp/tmp.58IX02eR6Y: No such file or directory. harald@WS-HP4600-35:~/temp$
bfin-gdbproxy:
harald@WS-HP4600-35:~$ bfin-gdbproxy bfin --reset Remote proxy for GDB, v0.7.2, Copyright (C) 1999 Quality Quorum Inc. MSP430 adaption Copyright (C) 2002 Chris Liechti and Steve Underwood Blackfin adaption Copyright (C) 2008 Analog Devices, Inc. GDBproxy comes with ABSOLUTELY NO WARRANTY; for details use `--warranty' option. This is Open Source software. You are welcome to redistribute it under certain conditions. Use the '--copying' option for details. Found USB cable: gnICE Connected to libftdi driver. IR length: 10 Chain length: 2 Device Id: 01010010011110111011000011001011 (0x527BB0CB) Manufacturer: Analog Devices, Inc. (0x0CB) Part(0): BF561 (0x27BB) Stepping: 5 Filename: /home/harald/blackfin/toolchain2010r1-rc4/opt/uClinux//bfin-elf/bin/../share/urjtag/analog/bf561/bf561 Device Id: 01010010011110111011000011001011 (0x527BB0CB) Manufacturer: Analog Devices, Inc. (0x0CB) Part(1): BF561 (0x27BB) Stepping: 5 Filename: /home/harald/blackfin/toolchain2010r1-rc4/opt/uClinux//bfin-elf/bin/../share/urjtag/analog/bf561/bf561 warning: bfin: no board selected, 2 cores are detected warning: bfin: cores: [BF561 BF561] notice: bfin: jc: waiting on TCP port 2001 notice: bfin: jc: (you must connect GDB before using jtag console) notice: bfin-gdbproxy: waiting on TCP port 2000 notice: bfin-gdbproxy: connected info: Resetting ... info: [0] locked: DBGSTAT [0x006A] info: bfin-gdbproxy: session killed. Will wait for a new connection notice: bfin-gdbproxy: connected info: Resetting ... info: [0] locked: DBGSTAT [0x006A] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin: [1] emulation single step: PC [0xFFA01B90] FP [0xFF8043E8] info: bfin: [1] watchpoint event occured: PC [0xFFA01B8C] FP [0xFF8043E8] info: bfin-gdbproxy: session killed. Will wait for a new connection ^C harald@WS-HP4600-35:~$