2008-09-18 14:35:58     Unable to erase flash beyond 0x20200000

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

2008-09-18 14:35:58     Unable to erase flash beyond 0x20200000

Ben Burleson (UNITED STATES)

Message: 62398   

 

I'm trying to save both u-boot and uImage in flash so the device will not need to netboot.  I'm a little surprised I can't find any good documentation about this!

 

I thought the process would be pretty straightforward, but I've run into a wall.  Here's what I have done so far:

 

1. Flash u-boot to the first sector.

 

2. Boot device and stop u-boot's autoboot.

 

3. TFTP uImage to 0x1000000 (filesize is stored)

 

4. Move uImage to flash starting at 0x20040000

 

4.a unprotect sectors starting at 0x20040000

 

4.b erase sectors starting at 0x20040000

 

4.c copy 0x100000 to 0x20040000 (using filesize from 3.)

 

This is the first sign of trouble, the dreaded "Copy to Flash... Flash not Erased" message.

 

Here is a console replay:

 

U-Boot 1.1.6-svn6811 (ADI-2008R1) (Sep 17 2008 - 17:38:13)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2)

Board: ADI BF537 LCO board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz

RAM:   32 MB

Flash:  4 MB

*** Warning - bad CRC, using default environment

 

Warning: Generating 'random' MAC address

In:    serial

Out:   serial

Err:   serial

Flash protect error at address 203e0000

Command Sequence Error.

Block locked.

Vpp Low Error.

Net:   Blackfin EMAC

MAC:   BA:6D:68:08:09:7F

I2C:   ready

Hit any key to stop autoboot:  0

bfin> tftp $(loadaddr) uImage-fw75a-02

Using Blackfin EMAC device

TFTP from server 172.16.4.206; our IP address is 172.16.4.232

Filename 'uImage-fw75a-02'.

Load address: 0x1000000

Loading: #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         ######################################################

done

Bytes transferred = 2937651 (2cd333 hex)

bfin> print filesize

filesize=2cd333

bfin> flinfo              

 

Bank # 1: CFI conformant FLASH (16 x 16)  Size: 4 MB in 32 Sectors

Erase timeout 4096 ms, write timeout 1 ms, buffer write timeout 2 ms, buffer size 32

  Sector Start Addresses:

    20000000 (RO) 20020000      20040000      20060000      20080000   

    200A0000      200C0000      200E0000      20100000      20120000   

    20140000      20160000      20180000      201A0000      201C0000   

    201E0000      20200000      20220000      20240000      20260000   

    20280000      202A0000      202C0000      202E0000      20300000   

    20320000      20340000      20360000      20380000      203A0000   

    203C0000      203E0000   

bfin> protect off 0x20040000 0x203DFFFF

............................. done

Un-Protected 29 sectors

bfin> erase 0x20040000 0x203DFFFF

 

............................. done

Erased 29 sectors

bfin> cp.b $(loadaddr) 0x20040000 $(filesize)

Copy to Flash... Flash not Erased

bfin> cmp.b $(loadaddr) 0x20040000 $(filesize)

byte at 0x011c0000 (0xfd) != byte at 0x20200000 (0xd5)

Total of 1835008 bytes were the same

bfin> md.b 0x201FFFF8 F

201ffff8: 39 8f 0b a9 72 7f 3d 62 fc 01 fc 01 fc 01 fc    9...r.=b.......

bfin> md.b 0x20200000 ff

20200000: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200010: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200020: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200030: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200040: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200050: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200060: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200070: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200080: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

20200090: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000a0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000b0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000c0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000d0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000e0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01    ................

202000f0: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc    ...............

bfin>

 

 

 

It seems like the flash starting at 0x20200000 refuses to erase!

 

I read Mike's comment about 2M of flash mapped at a time here:

 

http://blackfin.uclinux.org/gf/project/u-boot/forum/?action=ForumBrowse&forum_id=51&_forum_action=ForumMessageBrowse&thread_id=27278

 

and wondered if that is my problem.  But what is this "pf4" command?

 

Thanks,

 

Ben

QuoteReplyEditDelete

 

 

2008-09-18 15:10:12     Re: Unable to erase flash beyond 0x20200000

Mike Frysinger (UNITED STATES)

Message: 62400   

 

looks more like your second async bank is not properly wired.  check your ebiu settings and your hardware.

 

the pf4 comment in the other thread applies *only* to CM-BF537 boards.

QuoteReplyEditDelete

 

 

2008-09-18 17:01:13     Re: Unable to erase flash beyond 0x20200000

Ben Burleson (UNITED STATES)

Message: 62404   

 

OK, I feel stupid.  I was using the wrong flavor u-boot.  I am on the CM-BF537E board. (Originally, I didn't notice there was support for this board built in, so I had hacked the STAMP config.)  I just grabbed your svn trunk and built it with cm-bf537e configured.  Everything looks a little more sane now.

 

And I see the pf4 command listed when I type help.  But I still don't know how to use it.  Is there any documentation?  If I try to 'protect off' or 'erase', I get this: Error: cannot span across banks when they are mapped in reverse order

 

If I want to write my uImage to flash (that will span the two 2M banks) how do I do that?  I feel like this must be documented somewhere, I just can't find it!

 

Thanks,

 

Ben

QuoteReplyEditDelete

 

 

2008-09-18 17:11:38     Re: Unable to erase flash beyond 0x20200000

Mike Frysinger (UNITED STATES)

Message: 62405   

 

the built in command help seems pretty clear to me:

pf4- set/clear pf4 mem bank switch

    - set (1) uses 2nd bank clear (0) uses 1st bank

 

otherwise you can refer to the CM-BF537E manual

 

you shouldnt need to toggle the GPIO line directly when using the flash commands ... the flash driver itself should be doing this for you.  i dont have my cm-bf537e board on me at the moment, so i cant test.  i do know that the 2008R1.5 release worked fine for updating u-boot itself.

 

the forum you already referred to said how to span the boundary.  you need to copy the first portion yourself, use the pf4 command, and then copy the remaining portion.  to boot the image, you have to do the reverse of those steps to copy things into memory first.

QuoteReplyEditDelete

 

 

2008-09-18 17:34:28     Re: Unable to erase flash beyond 0x20200000

Ben Burleson (UNITED STATES)

Message: 62406   

 

Using the pf4 command, I'm still unable to erase the 2nd bank of flash.

 

Do I have the syntax correct below?

 

 

 

U-Boot 1.1.6-svn1340 (ADI-2009R1-pre) (Sep 18 2008 - 21:11:44)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.2)

Board: Bluetechnix CM-BF537E board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 525 MHz, Core: 525 MHz, System: 131 MHz

RAM:   32 MB

Flash: Device ID of the Flash is 890016

Flash Memory Start 0x20000000

Memory Map for the Flash

0x20000000 - 0x203FFFFF Single Flash Chip (4MB)

Using PF4 as a 2M bank switch

Please type command flinfo for information on Sectors

4 MB

*** Warning - bad CRC, using default environment

 

In:    serial

Out:   serial

Err:   serial

Net:   Blackfin EMAC

MAC:   4E:49:4C:6C:6D:54

Hit any key to stop autoboot:  0

bfin> flinfo

 

Bank # 1: MT_MANUFACT_on_CM-BF537

    20000000 (RO) 20020000 (RO) 20040000      20060000      20080000   

    200A0000      200C0000      200E0000      20100000      20120000   

    20140000      20160000      20180000      201A0000      201C0000   

    201E0000      20200000      20220000      20240000      20260000   

    20280000      202A0000      202C0000      202E0000      20300000   

    20320000      20340000      20360000      20380000      203A0000   

    203C0000      203E0000   

bfin> pf4 clear

bfin> erase 0x20040000 0x201fffff

 

Erasing Flash locations, Please Wait

Sector 2 erased.

Sector 3 erased.

Sector 4 erased.

Sector 5 erased.

Sector 6 erased.

Sector 7 erased.

Sector 8 erased.

Sector 9 erased.

Sector 10 erased.

Sector 11 erased.

Sector 12 erased.

Sector 13 erased.

Sector 14 erased.

Sector 15 erased.

Erased 14 sectors

bfin> md.b 0x20040000 f

20040000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ...............

bfin> md.b 0x201ffff0 f

201ffff0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ...............

bfin> pf4 set

bfin> erase 0x20200000 0x203fffff

 

Erasing Flash locations, Please Wait

Sector 16 erased.

Sector 17 erased.

Sector 18 erased.

Sector 19 erased.

Sector 20 erased.

Sector 21 erased.

Sector 22 erased.

Sector 23 erased.

Sector 24 erased.

Sector 25 erased.

Sector 26 erased.

Sector 27 erased.

Sector 28 erased.

Sector 29 erased.

Sector 30 erased.

Sector 31 erased.

Erased 16 sectors

bfin> md.b 0x20200000 f

20200000: fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc 01 fc    ...............

bfin>

 

QuoteReplyEditDelete

 

 

2008-09-18 17:38:23     Re: Unable to erase flash beyond 0x20200000

Mike Frysinger (UNITED STATES)

Message: 62407   

 

like i said, the pf4 command means nothing when using the flash commands like erase

 

what you're missing is that the addresses shown by flinfo and such are not all real.  only the first async bank can access the flash ... all other addresses do *not* go to the flash, so attempts to use them directly will obviously fail (as you've shown).

QuoteReplyEditDelete

 

 

2008-09-18 19:56:53     Re: Unable to erase flash beyond 0x20200000

Ben Burleson (UNITED STATES)

Message: 62410   

 

OK, I got it figured out.

 

cp [memory -> flash] spans flash banks, does not require pf4

 

cp [flash -> memory] requires pf4

 

uImage starts at 0x20040000

 

Here is my u-boot default command line:

 

cp.b 0x20040000 0x1000000 1c0000;pf4 clear;cp.b 0x20000000 0x11c0000 10d334;bootm

 

 

 

Thanks for the hints.  I don't feel knowledgable enough to document this myself on the wiki, but I feel like this should really be out there somewhere.

 

-Ben

QuoteReplyEditDelete

 

 

2008-09-18 20:07:03     Re: Unable to erase flash beyond 0x20200000

Mike Frysinger (UNITED STATES)

Message: 62411   

 

then you should let the Bluetechnix guys know that they need more/better documentation:

http://blackfin.uclinux.org/gf/project/bluetechnix/

 

those are not ADI boards

Attachments

    Outcomes