Jump to content
  • 0

Storing Atlys PLB project to SPI/Flash


chcollin

Question

Hi FPGA gurus !

Merry Christmas and happy new year to all of you FPGA lovers at Digilent !

I'm trying (unsuccessfully) to store Atlys HDMI demo to SPI/Flash so that whenever I turn the Atlys board on the project runs, without the need to upload and launch it through SDK.
Atlys HDMI demo is a PLB based project and the only piece of info I can find about storing projects to SPI/Flash is for AXI based projects.

Can anybody help me achieving this ? Any help would be greatly appreciated.

Cheers

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

OK, final post and probably most humorous...

I thought I had no choice but to use a bootloader to launch apps from flash... which if true is your app is too big to fit in BRAM.
In that case, you need a bootloader to copy app to DDR where it can fit and start. This is the bootloader's sole purpose !

I never realized that I didn't need a bootloader if my app was small enough to fit in BRAM, which is the case (Atlys has 2.1Mb of them) :)

So I ended up giving up  this bootloader thing... :D:D:D

Sorry for having made you very kind guys at Digilent waste your time ! ?
Especially a big thank you @JColvin who helped me much on this thing even though I finally found a workaround (or should I say a straightforward method, the bootloader being the workaround !)

Cheers

Link to comment
Share on other sites

Update 2

OK, the bootloader side of things happens to be the dark side of things ;)

People here at Digilent might help me on one point (googleing didn't give results).
Could anyone tell me what is the flash family I should choose for the xilisf library ?
Here is what is available :

#define ATMEL           1 /**< Atmel family device */
#define INTEL           2 /**< Intel family device */
#define STM             3 /**< STM family device */
#define WINBOND         4 /**< Winbond family device */
#define SPANSION        5 /**< Spansion family device */
#define SST             6 /**< SST family device */

Secondly : Following the tutorial given by @JColvin, it is suggested to replace bootloader.c with a custom one (it substitutes regular memory reads by SPI Flash reads).
I managed to find this custom bootloader.c file (attached to this post), unfortunately it doesn't compile.

preprocessor rises an error for undeclared symbol  XPAR_SPI_FLASH_DEVICE_ID.

I've been greping all header files in ISE 14.7 for that symbol... unsuccessfully ?

Any suggestion ?

Cheers

bootloader.c

Link to comment
Share on other sites

Update 3 - Major step in progression !

I finally ended up programming the SPI Flash :)

First, the bootloader would not work. It was due to a bad value for XPAR_SPI_FLASH_DEVICE_ID.

Looking at bootloader.c, I noticed this comment :      

        /*
         * Initialize the SPI driver so that it's ready to use,
         * specify the device ID that is generated in xparameters.h.
         */

SO I checked SREC_bsp/microblaze_0/include/xparameters.h | grep SPI and found this declaration :

#define XPAR_XPS_SPI_0_DEVICE_ID 0
#define XPAR_SPI_0_DEVICE_ID 0

And finaly declared in bootloader.c :

#define SPI_DEVICE_ID        XPAR_SPI_0_DEVICE_ID

After recompiling and programming flash, the bootloader now outputs messages.

However, there seems to be a problem with finding srec image, as the bootloader raises an error :

SREC Bootloader
Loading SREC image from flash @ address: 00170000
ERROR: Error while reading an SREC line from flash

After a few reading, I'm a bit confused and have several questions :

1) Should FLASH_IMAGE_BASEADDR in blconfig.h be an absolute address or relative one ?
I've seen some users telling it should be flash base address + offset. In lscript.ld, I can see :
ilmb_cntlr_dlmb_cntlr 0x00000050
So I tried setting FLASH_IMAGE_BASEADDR to 0x00170050 but same result (didn't change off set MCS generation, kept using 0x00170000)

2) Shouldn't the SREC image be modified with the bootgen command ?
Once again, I've read users with similar bootloader error talking about this command.

I'm getting close to it, but it's not done yet !
Anyone with a suggestion ? That would be much appreciated.

EDIT : There seems to be a problem for the bootloader programm to access the SPI Flash.
I've been printing data retrieved by srec read function in bootloader.c and it displays only 0s.
So there might be a problem with serial flash family and/or interface.
I'm gonna try different values and see if I get better results.

Cheers

Link to comment
Share on other sites

OK, linker doesn't find xilisf functions. There might be problems with missing -L or -l options to gcc, but this is an ISE issue, so I'll post on xilinx forum instead.
I'll be back after I solve this problem and try to boot The Atlys with this thing :)

 

EDIT : For some unknown reason, the "Generate Linker Script" Option generates a objects.mk file with missing -xilisf option for linker.
I ended up editing this file manually to add this option and finally every thing went smooth.

I now have a download.bit ready to be uploaded to Atlys' SPI Flash :)

Chances are low that everything works ok at first try, but it's going in the right direction !

Thx again for your help @JColvin

Link to comment
Share on other sites

Hi @chcollin,

I think you still might need the Micron flash family based on the Xilinx xilisf documentation and based on the paragraph starting on line 35 on the Xilinx GitHub here; mostly I'm pointing this out since I'm not sure how the flash will react to incorrect commands (it all depends if it cancels the command or does something unexpected). But there is also the chance that my Micron family thought is incorrect.

I'll look for an equivalent version of the FLASH_DEVICE_ID that you found.

Thanks,
JColvin

Link to comment
Share on other sites

@JColvin , first off, many thanks. It's very kind of you having done all this research and giving me all those tips. I really appreciate it.

Now, about the XPAR_SPI_FLASH_DEVICE_ID thing :
I(ve been downloading ISE 12.4 and searched header files for this symbol ... unsuccessufully.

I'm starting to think there is a missing header file / declaration with the tutorial.

But all your tips might help me on this trial. I've been greping xilisf header files about N25Q128, and this is what I found in xilisf_intelstm.h :

#define XISF_NM_DEV_N25Q128        0xBA18     /**< Device ID for N25Q128 */
#define XISF_MIC_DEV_N25Q128        0xBB18    /**< Device ID for N25Q128 */

So... maybe the STM flash family is the good choice and maybe I should declare
#define
XPAR_SPI_FLASH_DEVICE_ID XISF_NM_DEV_N25Q128

... assuming MIC is Micron and NM is Numonyx ...

OK, it"s a bit straight forward, I admit... But it might be worse trying this.
I'll try programming SPI Flash with this parameter value and see how things go.

Cheers

Link to comment
Share on other sites

Hi @chcollin,

Re-reading the tutorial, the bootloader that is provided is intended to reader from the SPI flash via the Xilinx In-System Flash library (as opposed to the default provided by SDK that uses parallel NOR Flash) specifically for the flash on the Spartan-6 LX9 MicroBoard.

Based on Table 5-5 (Spartan-6 FPGA Bitstream Length) in the corresponding User Guide, the default bitstream length is much larger for the LX45 device (11,939,296 bits), corresponding to 1.4574 MB. Looking at the flash used on the Atlys (a N25Q128 Numonyx chip which has 64 KByte sectors), this would use the first 23 sectors, leaving 233 sectors (~14,900 KBytes) for the application. It is also possible to compress the bitstream to have it use less resources, though I don't know how much it would get compressed. Extrapolating from the Avnet tutorial, the offset to choose in the blconfig.h file (create boot loader application, step 9) should be 0x170000.

With regards to the flash family, I think you would want to choose the 5th one (Spansion) based on the Xilinx documentation for xilisf, since that Spansion option also apparently counts for Micron (and I understand the Numonyx chips are now owned by Micron), though I am uncertain about this since the tutorial I linked you to states that Micron devices have the same control set as STM (option 3).

I'm not certain on the XPAR_SPI_FLASH_DEVICE_ID bit; everything that I have found leaves this value unchanged. I'll keep looking and let you know if I find something.

Thanks,
JColvin

Link to comment
Share on other sites

Update 1

I managed to add xps_spi core to HDMI_DEMO project and export design ?

As I didn't know how to configure it, I started a new XPS project from scratch using BSB wizard and Atlys_PLB_BSB_Support files to retrieve those needed information.
Then, back to HDMI_DEMO project, I configured my new xps_spi core as follows :

Added those lines to system.ucf :
Net xps_spi_0_SCK_pin LOC=R15  |  IOSTANDARD=LVCMOS33;
Net xps_spi_0_MISO_pin LOC=R13  |  IOSTANDARD=LVCMOS33;
Net xps_spi_0_MOSI_pin LOC=T13  |  IOSTANDARD=LVCMOS33;

Connected xps_spi core ports to those.

Finaly, configured xps_spi core as indicated in screenshots.
Export was successful. I'll do the SDK part tomorrow.

Thanks again @JColvin

system.png

user.png

Link to comment
Share on other sites

Hi @chcollin,

I don't have EDK available to me to be able to test the Atlys HDMI demo (nor did I directly find answers to the questions you put in quotes), but I was able to locate a reference design  for a Spartan 6 chip that creates a MicroBlaze SPI flash bootloader that uses PLB here: https://www.avnet.com/shop/us/products/avnet-engineering-services/aes-s6mb-lx9-g-3074457345628965461?aka_re=1. The Reference Design is called "EDK 12.4 Tutorials Creating a MicroBlzae SPI Flash Bootloader for AES-S6MB-LX9-G". I have attached the pdf tutorial that walks through the process that came with that download for convenience.

Let me know if you have any questions about this (or if this was not what you were looking for in your situation).

Thanks,
JColvin

 

MicroBlaze_SPI_Bootloader_12_4_1.pdf

Link to comment
Share on other sites

Actually, I'd like to find answers to the questions asked in this thread :
https://forums.xilinx.com/t5/Embedded-Development-Tools/Possible-to-use-a-SPI-SREC-Bootloader-on-a-plb-based-microblaze/td-p/690251

Quote

2) It seems like the 3 possible solutions are as follows. Am I missing anything?

  • Migrate the microblaze and the custom IPs from plb to axi
  • Create an axi microblaze, connect the axi_spi flash IP to it and use an axi_plbv46_bridge to connect the rest of my existing design as-is
  • Write my own driver to replace the readily available (on axi microblazes) xilisf

 

Link to comment
Share on other sites

Thank you @Cristian.Fatu, however I'm afraid this is not "that simple"...

From what I have understood, the tricky part is to generate a .bit file that contains both EDK implementation AND SDK PLB Microblaze binaries as well as a bootstrap loader.
If this solution is documented over the web for AXI based projects, I can't find any piece of info about PLB based projects.

Once this .bit file is obtained, indeed the way to store it is as you mentionned (using Adept).

As you might have understood now, my problem is not to store data to SPI, but to generate a bootloadable .bit file containing both EDK implementation and SDK LPB Microblaze binaries.
Hope this can be done ...

Cheers

Link to comment
Share on other sites

Hello,

Thank you for your wishes.
Atlys, being based on Spartan 6 is no longer supported by the current Xilinx line of tools (Vivado).

In order to program the flash on Atlys, you could use the Adept utility https://store.digilentinc.com/digilent-adept-2-download-only/. The Atlys reference manual explains (in 2.3 Flash Interface chapter) how to do it.

On the other hand, the Xilinx way to do it is by using Impact (Impact is part of ISE tools), see attached tutorial.

iMPACT SPI FLASH.docx

Still, we suggest you the first mentioned approach.

It seems that now is almost the time to wish you a Happy New Year !

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...