I'm attempting to use Winbond W25Q16JV quad flash on the xCORE-200 multimedia dev board.
Here's my device definition file:
Code: Select all
26, /* libflash device id */
256, /* page size */
8192, /* num pages */
3, /* address size */
8, /* log2 clock divider */
0x9f, /* SPI_RDID */
0, /* id dummy bytes */
3, /* id size in bytes */
0xef4015, /* device id */
0x20, /* SPI_SSE */
0, /* full sector erase */
0x06, /* SPI_WREN */
0x04, /* SPI_WRDI */
PROT_TYPE_SR, /* protection through status reg */
{{0x1c,0x00},{0,0}}, /* SR protect and unprotect cmds */
0x02, /* SPI_PP */
0x0b, /* SPI_READFAST */
1, /* 1 read dummy byte */
SECTOR_LAYOUT_REGULAR, /* sane sectors */
{4096,{0,{0}}}, /* regular sector size */
0x05, /* SPI_RDSR */
0x01, /* SPI_WRSR */
0x01, /* SPI_WIP_BIT_MASK */
Here's the .xn file modification:
Code: Select all
<ExternalDevices>
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="WINBOND_W25X16">
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
<Attribute Name="QE_REGISTER" Value="quad_spi_qe_location_status_reg_1"/>
<Attribute Name="QE_BIT" Value="quad_spi_qe_bit_1"/>
</Device>
</ExternalDevices>
And here's the output of the xflash command:
xflash --boot-partition-size 0x40000 --verbose --spi-spec WINBOND_W25X16 --loader loader.o --factory app.xe
Code: Select all
XFlash_Options::ListDevices : xgdb --batch -q --ex "listdevices" devl-1234124b
XFlash_Application found _start :40000 on Node 0
XFlash_Application found _DoSyscall :439fc on Node 0
XFlash_Application found _DoException :42e94 on Node 0
XFlash_Application found _start :40000 on Node 0
XFlash_Application found _DoSyscall :45904 on Node 0
XFlash_Application found _DoException :44d68 on Node 0
XFlash_Application : Attempting to Compress Binary Data
libcompressor marker 1=187
libcompressor marker 2=246
libcompressor marker 3=83
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 3 2 5
libcompressor best marker length 4 2 5
libcompressor DoCompression_Compress took : 390ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-54893827" -x xn "target-xn-v0-10862654
" -o decompressor-cdb5e8be
libcompressor validating decompressor decompressor-cdb5e8be
libcompressor launching simulator decompressor-cdb5e8be --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7ff5a
libcompressor decompressor validated
XFlash_Application on Node : 0 compressed from : 20384 bytes to : 13156 bytes (35.46%)
libcompressor marker 1=187
libcompressor marker 2=218
libcompressor marker 3=222
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 4 2 4
libcompressor DoCompression_Compress took : 1130ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-1bd06657" -x xn "target-xn-v0-10862654
" -o decompressor-72c14fe3
libcompressor validating decompressor decompressor-72c14fe3
libcompressor launching simulator decompressor-72c14fe3 --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7ff58
libcompressor decompressor validated
XFlash_Application on Node : 0 compressed from : 30740 bytes to : 21112 bytes (31.32%)
XFlash::DoXFlash
XFlash::DoImageProgramming
XFlash::GetDeviceInfo
XFlash_DeviceInfo::GetDeviceInfo_Hardware
XFlash_DeviceInfo::GetDeviceInfo_Hardware_IssueCompileCommand : xcc -Xmapper --dontenablesodlinks -Xmapper --wnoXN -x xc "spiinfo-f65af5bb" -x xn "tar
get-xn-v0-10862654" -o "spiinfo-b93177ac" -lquadflash -D xnPORT_SQI_CS0=PORT_SQI_CS -D xnPORT_SQI_SCLK0=PORT_SQI_SCLK -D xnPORT_SQI_SIO0=PORT_SQI_SIO
XFlash_Utils::BuildRunCommand : xrun --io spiinfo-b93177ac
Warning: F03098 Factory image and boot loader cannot be write-protected on flash device on node 0
XFlash::BuildFlashBinaryFile
XFlash_Builder_S2L::BuildStage2Loaders Factory
Stage2_Loader::Compile : xcc -Wno-bidirectional-buffered-port -Xmapper --dontenablesodlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --
image-base -Xmapper 0x40080 -Xmapper --image-size -Xmapper 0x3ff80 -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=c99 -O2 -x xn "target-xn-
v0-10862654" -x xc s2l-n0-30ec200c -lstage2loader -lswitchsetup -lsqiaccess -x none loader.o -lxcc -o s2l-n0-c13d7405
Stage2Loader found _DoSyscall : 0x40558 on Node 0
Stage2Loader found _DoException : 0x403c8 on Node 0
Stage2_Loader : Attempting to Compress Binary Data
libcompressor marker 1=37
libcompressor marker 2=38
libcompressor marker 3=42
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 3 2 5
libcompressor best marker length 4 2 4
libcompressor best marker length 4 2 5
libcompressor DoCompression_Compress took : 110ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-a58d5298" -x xn "target-xn-v0-10862654
" -o decompressor-884cea36
libcompressor validating decompressor decompressor-884cea36
libcompressor launching simulator decompressor-884cea36 --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7feda
libcompressor decompressor validated
Stage2_Loader on Node : 0 compressed from : 3620 bytes to : 2788 bytes (22.98%)
Stage2_SwitchSetup::Compile : xcc -c -march=xs2a -x assembler-with-cpp swstup-n0v0-ca4b4a30 -o swstup-n0v0-8881eb1f
Stage2_SwitchSetup::Compile : xcc -nostartfiles -Wno-bidirectional-buffered-port -Xmapper --first -Xmapper swstup-n0v0-8881eb1f -Xmapper --dontenables
odlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=c99 -O2 -x xn "target-xn-v0-10862654"
-x xc swstup-n0v0-ace4c4da -lswitchsetup -o swstup-n0v0-3c525896
XFlash_Builder_Image::BuildImages Factory
XFlash_Builder_Image::BuildImageTable
master node = 0
node = 0
XFlash_Builder_Image::BuildImageTable num cores for image table = 2
XFlash_Builder_Image::CalculateBufferSize Starting calculation _total_image_size=0
XFlash_Builder_Image::CalculateBufferSize Add Image Header _total_image_size=34
XFlash_Builder_Image::CalculateBufferSize Add Switch Setup header _total_image_size=3c
XFlash_Builder_Image::CalculateBufferSize Add Per Core header _total_image_size=54
XFlash_Builder_Image::CalculateBufferSize_SwitchSetup _total_image_size=78c
XFlash_Builder_Image::CalculateBufferSize_Application application size = 3368 _total_image_size = 3af4
XFlash_Builder_Image::CalculateBufferSize_Application application size = 527c _total_image_size = 8d70
XFlash_Builder_Image::BuildImageTable allocated image buffer size = 8d70
XFlash_Builder_Image::WriteBuffer_ImageHeader
XFlash_Builder_Image::WriteBuffer_SwitchSetup current switch setup table offset : 34
XFlash_Builder_Image::WriteBuffer_SwitchSetup current application data offset : 54
XFlash_Builder_Image::WriteBuffer_SwitchSetup size : 734
XFlash_Builder_Image::WriteBuffer_SwitchSetup aligned_size : 738
XFlash_Builder_Image::WriteBuffer_SwitchSetup init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application
XFlash_Builder_Image::WriteBuffer_Application for node : 0
XFlash_Builder_Image::WriteBuffer_Application for core : 0
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 3c
XFlash_Builder_Image::WriteBuffer_Application current application data offset : 78c
XFlash_Builder_Image::WriteBuffer_Application size : 3364
XFlash_Builder_Image::WriteBuffer_Application aligned_size : 3368
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80020002
XFlash_Builder_Image::WriteBuffer_Application for core : 1
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 48
XFlash_Builder_Image::WriteBuffer_Application current application data offset : 3af4
XFlash_Builder_Image::WriteBuffer_Application size : 5278
XFlash_Builder_Image::WriteBuffer_Application aligned_size : 527c
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80030002
XFlash_Builder_Image::WriteBuffer_CRC
XFlash_Builder_Binary::BuildBinary
XFlash_Builder_Binary::CalculateBufferSize_Factory
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l size word (4)4
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l app (b64) b68
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l crc (4)b6c
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding factory app (8d70) 98dc
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding sector padding (724) a000
XFlash_Builder_Binary::CalculateBufferSize_Factory : First User Sector offset = a000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (a000) 0
XFlash_Builder_Binary::CalculateBufferSize_Data
XFlash_Builder_Binary::BuildBinary : Allocating buffer - a000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (a000) 0
XFlash_Builder_Binary::WriteBufferToBinary : flash_bin_node0
XFlash_Programmer_Program::DoProgram
XFlash_Programmer_Program::GenerateSource
XFlash_Programmer_Program::IssueCompileCommand :xcc -w -Xmapper --dontenablesodlinks -O2 -lquadflash -x xc "fp-5d59133c" -x xn "target-xn-v0-10862654"
-D VERBOSE=1 -D MONITOR=1 -D ERASE_ALL_FIRST=1 -o "fp-a2701068"
XFlash_Utils::BuildRunCommand : xrun --io fp-a2701068
Site Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x9d).Verify failed for page 0x00000000, offset 0x0001 (read 0x00, expected
0x20).Verify failed for page 0x00000000, offset 0x0004 (read 0x00, expected 0xf3).Verify failed for page 0x00000000, offset 0x0005 (read 0x00, expect
ed 0x37).Verify failed for page 0x00000000, offset 0x0007 (read 0x00, expected 0x09).Verify failed for page 0x00000000, offset 0x0009 (read 0x00, expe
cted 0x0a).Verify failed for page 0x00000000, offset 0x000a (read 0x20, expected 0x00).Verify failed for page 0x00000000, offset 0x000b (read 0x02, ex
pected 0x00).Verify failed for page 0x00000000, offset 0x000c (read 0x22, expected 0x00).Verify failed for page 0x00000000, offset 0x000d (read 0x02^C
What I don't understand is, even though the location of the QE bit is specified, how does xflash know how to access status register 1? (The 2nd status register, as the first status register is register 0.) It's command 35h and 31h to read and write this register, respectively. These commands are not specified anywhere. Are they known by convention?
On the other hand, the W25Q16JVIQ part that I'm using has the QE bit set (quad mode enabled) from the factory, so I guess this doesn't need to be set by xflash, anyway.