• 0
Simon

CmodA7 . store program in MEMORY

Question

Hello, again,

How can I solve that, If remove the cable and source, I would like to store program in memory.

Thank in advance.

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0
Posted (edited)
13 hours ago, D@n said:

@Simon,

Just curious ... but why not store your program in flash and copy it to memory as part of a bootloader?

Dan

I took this tutorial https://reference.digilentinc.com/learn/programmable-logic/tutorials/htsspisf/start . I got some errors in SDK. I tried to set the microblaze_0_local_memory/ilmb_bram_if_cntlr's range to 32k, but unfortunately it didn't worked. Eventually can you send an example project?

 

 

SDKError.png

VivadoSettings.png

Edited by Simon

Share this post


Link to post
Share on other sites
  • 0

@Simon,

I'm not really one for using MicroBlaze, sorry.  I have been working for the last couple of years to develop a simpler, more logic friendly CPU, rather than MicroBlaze.  You can find my work on this ZipCPU here.

Two of my ZipCPU projects depend upon copying program code from the flash to the block RAM and/or SDRAM.  These are my CMod-S6 S6SoC project, and my Arty based OpenArty project.  Both projects use a simple boot-loader that copies data from flash to RAM, although ... the boot-loader requires an appropriate linker script (this one for the Arty, this one for the S6) to make it happen.  Still ... it's quite doable.

Ok, so that's two example projects and ... somehow I don't think either was what you were looking for.  ;)  I actually have no experience with MicroBlaze.  Still ...

Looking over your error above, it suggests that your program doesn't fit within block RAM.  Why not just adjust the linker script and place it ... somewhere else?  I mean, that flash resource is really wonderful for program code--just not for anything that's time dependent.

Dan

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, D@n said:

@Simon,

I'm not really one for using MicroBlaze, sorry.  I have been working for the last couple of years to develop a simpler, more logic friendly CPU, rather than MicroBlaze.  You can find my work on this ZipCPU here.

Two of my ZipCPU projects depend upon copying program code from the flash to the block RAM and/or SDRAM.  These are my CMod-S6 S6SoC project, and my Arty based OpenArty project.  Both projects use a simple boot-loader that copies data from flash to RAM, although ... the boot-loader requires an appropriate linker script (this one for the Arty, this one for the S6) to make it happen.  Still ... it's quite doable.

Ok, so that's two example projects and ... somehow I don't think either was what you were looking for.  ;)  I actually have no experience with MicroBlaze.  Still ...

Looking over your error above, it suggests that your program doesn't fit within block RAM.  Why not just adjust the linker script and place it ... somewhere else?  I mean, that flash resource is really wonderful for program code--just not for anything that's time dependent.

Dan

Unfortunately  I need to selve that with microblaze.

Share this post


Link to post
Share on other sites
  • 0

Hi @Simon,

In you Vivado project you will need to up the settings in Microblaze for the local Memory and cache Configuration to 16KB each.

cheers,

Jon

 

Share this post


Link to post
Share on other sites
  • 0
16 hours ago, jpeyron said:

Hi @Simon,

In you Vivado project you will need to up the settings in Microblaze for the local Memory and cache Configuration to 16KB each.

cheers,

Jon

 

Hello @jpeyron
I also tried to do with 16 KB local memory and 16 KB cache memory configuration, but it didn't work. (Based on the tutorial). The SDK gave these error messages.
I attached the block design and the address editor, I think, the problem is somewhere here. I attached (on the link as zip) also the full project, maybe it help to clear the things. 
You commented a similar post before, and as i read, i tried the 32k local and the 16k cache memory. It didn't give me these error messages, but the bootloder always failed.
Can you describe me what is the possible problems?

SDK_Error.PNG

blockdiagram.png

adresslist.png

Share this post


Link to post
Share on other sites
  • 0

Hi @Andris and @Simon,

Thank you, I was looking for that thread. I was adding more memory to local and cache until I didn't get error in sdk. My understanding is that you get the errors because because you need more memory than what you gave it. That's interesting that I was able to get the srec_spi_bootloader to not have and errors at 16 local and 16 cache in Vivado 2016.4. I'm not sure why that would change but I would suggest using 32KB for local and 16 KB for cache. @Andris did you compress the bitstream or just run as normal? If you did not compress the bitstream did you change the blconfig.h located in src's and change FLASH_IMAGE_BASEADDR to 0x00300000.

cheers,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hi, @jpeyron , I wanted a continous running hardware. For example if I write a Hello World programe, and I disconnect the board, and I re-connect the board I wanted to continue the program's activity from that point from where I interrupted. How can I solve this. With SPI Flash I upload the programe to the board, but I need to turn on the SDK and I need to run. I would like something like "plug-in and run". How can I solve it?

Share this post


Link to post
Share on other sites
  • 0

Hi @Simon,

First you load the quad_spi_flash of the CmodA7 with your program like we do with the hello world in the flash tutorial. Secondly, when you unplug the CmodA7 and plug it back in the program will restart from the beginning without having to reprogram it from SDK. When unplugging power and then plugging in power it will not restart from the point it stopped when power was removed. I know that you can read and write to flash while in use so you might be able to have a basic state machine that keeps track of where in the program you are in in case there is power loss so that when power comes back on it continues from the last state that it was in. Unfortunately I have never done anything like this so i would be very helpful for guidance. Here is a thread that talks about reading/writing to the quad spi flash.

cheers,

Jon 

Simon likes this

Share this post


Link to post
Share on other sites
  • 0

@Simon,

Whatever you do, do not unplug your device while the flash is writing.  You may end up with a flash that returns uncertain results--sometimes ones, sometimes zeros.  This will lead you to no end of problems, as you will struggle to debug it.  This becomes somewhat of an achille's heel with modern electronics.  You can read about it here.

I would recommend that you only consider continuing following being unplugged if you 1) maintain power somehow so as to maintain your state, or 2) restart your state from a known startup condition.

Dan

Simon likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now