2010-11-15 10:38:02     gnICE+, WinXP and vdsp-flash-programmer...

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2010-11-15 10:38:02     gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 95856   

 

I'm struggling a little with trying to get the vdsp-flash-programmer.sh shell to connect and load a flash driver onto a BF534...

 

My main problem is obviously the fact I'm using Windows... I have followed the Visual-DSP- Flash Programmer (http://docs.blackfin.uclinux.org/doku.php?id=visualdsp:flash-programmer) carefully and have tried to step through it manually with gdbproxy, gdb and the flash driver that I know works correctly.

 

Here's what I've done (rightly or wrongly!?)...

 

 

 

Microsoft Windows XP [Version 5.1.2600]

 

(C) Copyright 1985-2001 Microsoft Corp.

 

 

 

Z:\>win-bash

 

bash$ cd c:/vdsp/bin

 

bash$ bfin-elf-gdb

 

GNU gdb 6.6

 

Copyright (C) 2006 Free Software Foundation, Inc.

 

GDB is free software, covered by the GNU General Public License, and you are

 

welcome to change it and/or distribute copies of it under certain conditions.

 

Type "show copying" to see the conditions.

 

There is absolutely no warranty for GDB.  Type "show warranty" for details.

 

This GDB was configured as "--host=i586-mingw32msvc --target=bfin-elf".

 

(gdb) target remote :2000

 

Remote debugging using :2000

 

0xef000000 in ?? ()

 

(gdb) source vdsp-flash-programmer

 

(gdb) load Flash.dxe

 

Loading section L1_data_b, size 0xab4 lma 0xff900000

 

Loading section L1_code_cache, size 0x10c lma 0xffa00000

 

Loading section L1_code_cache, size 0x18bc lma 0xffa10000

 

Start address 0xffa00000, load size 9340

 

Transfer rate: 74720 bits in <1 sec, 3113 bytes/write.

 

(gdb) load Flash.dxe

 

Loading section L1_data_b, size 0xab4 lma 0xff900000

 

Loading section L1_code_cache, size 0x10c lma 0xffa00000

 

Loading section L1_code_cache, size 0x18bc lma 0xffa10000

 

Start address 0xffa00000, load size 9340

 

Transfer rate: 74720 bits in <1 sec, 3113 bytes/write.

 

(gdb) fldrvinfo

 

Flash Programmer information:

 

No symbol table is loaded.  Use the "file" command.

 

(gdb) file vdsp-flash-programmer

 

A program is being debugged already.

 

Are you sure you want to change the file? (y or n) y

 

"c:\vdsp\bin/vdsp-flash-programmer": not in executable format: File format not recognized

 

(gdb)

 

 

 

In my newbie experience I would have thought the symbol table would have been loaded with the 'source vdsp-flash-programmer' command? What does the 'file' command do?

 

Whenever I try to use it, it suggests that the vdsp-flash-programmer isn't in the correct format...

 

I know this is exceptionally simple and what I'm doing is probably stupid, but any help would be very appreciated!

 

Thanks,

 

Chris.

QuoteReplyEditDelete

 

 

2010-11-15 15:32:48     Re: gnICE+, WinXP and vdsp-flash-programmer...

Mike Frysinger (UNITED STATES)

Message: 95867   

 

you're missing the most important part -- the whole "vdsp-flash-programmer.sh" script.  it doesnt simply execute gdb and source a few gdb scripts.  it heavily cleans up the VDSP ELF to remove all the **** that is not compatible with the GNU toolchain.

QuoteReplyEditDelete

 

 

2010-11-17 13:42:22     Re: gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 95930   

 

Thanks for that Mike.

 

I have installed VirtualBox and got the scripts working as intended in a linux environment now...

 

The next step is to try to implement this in a Windows environment, If possible?

 

When I try to run the shell script in $win-bash it fails throwing up...

 

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

 

Z:\>c:

 

C:\>win-bash

 

bash$ ./vdsp-flash-programmer.sh Flash.dxe

INFO: Cleaning up driver: Flash.dxe

path = C:\WINDOWS\TEMP/tmp.XXXXXXXXXX

lpPathBuffer = C:\TEMP\

szTempName = C:\TEMP\tmp9B.tmp

path = C:\TEMP\tmp9B.tmp

fd = 3

INFO: Launching gdb

path = C:\WINDOWS\TEMP/tmp.XXXXXXXXXX

lpPathBuffer = C:\TEMP\

szTempName = C:\TEMP\tmp9C.tmp

path = C:\TEMP\tmp9C.tmp

fd = 3

.\vdsp-flash-programmer.sh: 4113888: No such file or directory

bash$

 

I have had to install a windows compiled mktemp to get this far but have lost direction now...

 

This is why I have gone back to the shell script source to decipher what it is doing.

 

The script seems to produce a temp file a do a certain amount of stripping. Is there anyone who could explain what these commands below do and whether I can then replicate them on the original .dxe I have to make it compatible with the rest of the script, in a windows environment?

 

set -e

 

err() { echo "ERROR: $*" 1>&2; exit 1; }

info() { echo "INFO: $*"; }

 

drv=$1

cross=bfin-elf-

 

[ -e "${drv}" ] || err "Usage: ${0##*/} <vdsp flash driver>"

 

info "Cleaning up driver: ${drv}"

 

tmp=$(mktemp)

cp "${drv}" "${tmp}"

drv=${tmp}

 

# GDB barfs if there is no .text section, so rename it #4337

#${cross}objcopy --rename-section L1_code=.text "${drv}"

# Filter out all unnessary noise to avoid conflicts between VDSP's

# ELF implementation and the GNU implementation

syms=`${cross}readelf -W -s "${drv}" | awk '($NF ~ /AFP_/ || ($5 == "GLOBAL" && $4 != "NOTYPE")) { print $NF }'`

${cross}strip `printf -- '-K %s ' ${syms}` "${drv}"

 

Any help would be very much appreciated!!

 

Thanks,

 

Chris.

QuoteReplyEditDelete

 

 

2010-11-18 04:55:34     Re: gnICE+, WinXP and vdsp-flash-programmer...

Mike Frysinger (UNITED STATES)

Message: 95938   

 

do you need this to be dynamic ?  in other words, are people going to be using arbitrary flash drivers ?  or is the driver list static/known ?

 

if the latter, i would simply create a package of pre-stripped flash drivers and distribute that to people.

QuoteReplyEditDelete

 

 

2010-11-22 12:36:39     Re: gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 96093   

 

Hi Mike,

 

I had come to the same conclusion. Thanks!

 

I have run these commands manually to produce a stripped out version of the Flash driver.

 

When I bfin-elf-strip them to a new .dxe I get an error as follows...

 

 

 

bash$ syms=`bfin-elf-readelf -W -s "Flash.dxe" | awk '($NF ~ /AFP_/ || ($5 == "GLOBAL" &&

 

$4 != "NOTYPE")) { print $NF }'`

 

bash$ bfin-elf-strip `printf -- '-K %s ' ${syms}` "Strip_Flash.dxe"

 

BFD: sta03836: warning: allocated section `bsz_L1_data_b' not in segment

 

bash$

 

 

Does this have a  bearing on the function of the stripped out .dxe?

 

I have then produced a small file called (gdb_commands) that strips out the EOF commands from the original .sh script, to run on the 'bfin-elf-gdb --quiet -x gdb_commands Strip_Flash.dxe' command.

 

It seems to return something useful(ish)...

 

 

 

C:\vdsp>bfin-elf-gdb --quiet -x gdb_commands Strip_Flash.dxe

 

(no debugging symbols found)

 

0xef000000 in ?? ()

 

Loading section L1_data_b, size 0xab4 lma 0xff900000

 

Loading section L1_code_cache, size 0x10c lma 0xffa00000

 

Loading section L1_code_cache, size 0x18bc lma 0xffa10000

 

Start address 0xffa00000, load size 9340

 

Transfer rate: 74720 bits in <1 sec, 3113 bytes/write.

 

Hardware assisted breakpoint 1 at 0xffa10d9c

 

 

 

Flash Programmer information:

 

Title         : ADSP-BF534 SPI Flash W25X20

 

Description   : Winbond W25X20VSNIG

 

Buffer        : 0x84faee74

 

Size          : 0x600

 

ManCode       : 0

 

DevCode       : 0

 

Error         : 0

 

 

 

Flash layout: (8 bit, 64 sectors, 2778 MiB)

 

  0: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

  5: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

10: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

15: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

20: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

25: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

30: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

35: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

40: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

45: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

50: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

55: 0xadadadad 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

60: 0xadadadad 0xadadadad 0xadadadad 0xadadadad

 

 

 

(gdb)

 

 

Why does it look like the flinfo command returns all the same location?

 

Plus when I put the 'continue' command in the gdb_Commands file it just hangs...

 

If I do all of this manually in gdb, the command continue always causes the gdb tool to just hang.

 

Am I doing something wrong with my commands to end function?

 

Any help'd be very much appreciated...

 

 

 

# Connect to the target

 

target remote localhost:2000

 

 

 

# Grab all of our gdb helper commands

 

source vdsp-resolute

 

sanity_check_hwerr

 

 

 

# Load the Flash Driver

 

load

 

 

 

# get the mwl helper command

 

#source u-boot

 

 

 

# Zero out the BSS(s)

 

#$(eval `bfin-elf-readelf -l "Flash.dxe" | awk '$1 == "LOAD" && $5 != $6 { print "echo mwl $(("$3"+"$5")) 0 $((("$6"-"$5")/4))" }'`)

 

#sanity_check_hwerr

 

 

 

# Clear all breakpoints

 

delete breakpoints

 

 

 

# Halt on the canonical point

 

hbreak *(int *)&AFP_BreakReady

 

commands

 

silent

 

end

 

 

 

# Use hardware tracing when possible

 

#hbreak cpu_init_f

 

#commands

 

# hwtrace_on

 

# sanity_check_hwerr

 

# continue

 

#end

 

#hbreak evt_default

 

#sanity_check_hwerr

 

 

 

# Let the driver initialize itself

 

#continue

 

sanity_check_hwerr

 

 

 

# Dump the initial Flash Driver and Flash state

 

printf "\n"

 

fldrvinfo

 

printf "\n"

 

flinfo

 

printf "\n"

 

 

 

Thanks so far Mike,

 

 

 

Chris.

QuoteReplyEditDelete

 

 

2010-11-22 13:47:22     Re: gnICE+, WinXP and vdsp-flash-programmer...

Mike Frysinger (UNITED STATES)

Message: 96097   

 

that's a warning, not an error, and an example of why the DXE needs to be cleaned up first.  it most likely can be ignored.

 

the 0xadadadad is not the same location ... it is the default value memory is given at reset to help indicate read errors.  personally, i just tested one or two VDSP parallel flash drivers.  for SPI flashes, i used u-boot drivers.  so there might be an issue lurking there.

QuoteReplyEditDelete

 

 

2010-11-24 12:23:40     Re: gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 96178   

 

Within (gdb) when I type 'c' or 'continue' at the same point the shell script would do, the interface hangs on a blinking cursor after setting a break point at AFP_BreakReady. Could this be an issue with the cleaned up .dxe or is there something I'm not understanding fully...

 

Probably the latter or both...

 

P.S. Is there any easy tutorial as to how u-boot flashes are implemented?

 

Thanks,

 

Chris.

QuoteReplyEditDelete

 

 

2010-11-24 17:18:44     Re: gnICE+, WinXP and vdsp-flash-programmer...

Mike Frysinger (UNITED STATES)

Message: 96186   

 

are you using your own SPI flash driver ?  or one from ADI/VDSP ?  i should be able to test on a BF548-EZKIT with its SPI flash driver.

 

i'm not sure what you mean by "u-boot flashes" ... u-boot uses the same MTD layer as linux to handle CFI parallel NOR flashes and for NAND devices.  the SPI flash layer is a custom thing specific to u-boot.

QuoteReplyEditDelete

 

 

2010-11-25 04:02:15     Re: gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 96209   

 

I'm using a flash driver specific to our application. If you could test it on your kit I would be unbelievably appreciative!

 

What would also be really useful is to see if your symbol stripped and cleaned version of the Flash driver is the same size as mine? And maybe attach your version if at all possible?

 

The original size I have is 55kb and the 'elf-read' and 'elf-stripped' version is 23kb...

 

Thanks again Mike.

 

Chris.

 

Strip_Flash.dxe

BF534_Serial_Flash_Prog.dxe

QuoteReplyEditDelete

 

 

2010-12-10 07:01:05     Re: gnICE+, WinXP and vdsp-flash-programmer...

Chris Walter (UNITED KINGDOM)

Message: 96628   

 

I'm still struggling unfortunately...

 

If I wanted to write a couple of bytes to the external SPI flash memory using a gnICE+ and WinXP. What is the easiest way to do this?

 

Am I barking up the wrong tree with the VDSP flash driver and this script?

 

Can I connect to the board and somehow bit bang the flash memory to write a few bytes to the memory?

 

Any help'd be much appreciated..

 

Thanks,

 

Chris.

Attachments

    Outcomes