running code from sd card

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there away to run say a program from sd card when I have the system setup to run from DDR???????????

Just out of curiosity lads!

This topic has a solution.
Last Edited: Mon. Mar 15, 2021 - 04:30 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

I'm not sure if the SAMA5 has XIP (execute in place) for the sdcard interface. Time for a read of the user manuals methinks. If it can, then there will be a means of mapping the data into the memory space and cache settings. My gut instinct tells me that it might be unlikely it does support XIP. Write your os to support virtual memory and have the SDCARD as backing store. Bonus points if you write a virtual machine that maps the sdcard into the virtual space like IBM did with the System38 (they didn't do it with a sdcard at the time).

 

As an aside, I've tried XIP using serial flash chips on a Cortex M7. It's like knocking the turbo off a F1 car. Cache is no substitute for memory bandwidth.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As  Kartman says, your key term here is "Execute In Place"

If your particular chip doesn't have than, then you'd need to read from the card into memory, then execute from that memory.

 

I think the latest Raspberry Pi microcontroller has XIP: https://www.avrfreaks.net/commen... - whether it works from SD-Card is another question, though.

 

So XIP is necessary - but not sufficient?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


XIP is CPU+Peripheral thing. 

 

For example, peripheral in A5D2 says this

 

The fetch size of QSPI is usually pretty small as well. So CPU does not need to wait too much if there is a branch instruction. Caching and other methods are already implemented to make sure this works properly.

 

 

But in the same device, I dont think XIP feature is there for SDMMC peripheral. It is just not implemented from what I can see. Implementing XIP for SDMMC is a bit tricky and costly in terms of die area.

 

So XIP is basically a CPUs ability to fetch code through a peripheral. It might support fetching code through a peripheral and might not support though other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks guys.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If that's answered the question, please mark the solution.

 

See Tip #5 in my signature:

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

As  Kartman says, your key term here is "Execute In Place"

If your particular chip doesn't have than, then you'd need to read from the card into memory, then execute from that memory.

 

I think the latest Raspberry Pi microcontroller has XIP: https://www.avrfreaks.net/commen... - whether it works from SD-Card is another question, though.

 

So XIP is necessary - but not sufficient?

 

I don't believe it has XIP, so I'll have to look into what Kartman says.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think what you might be wanting is called 'virtual memory'.  When you run out of real memory to allocate, you swap blocks in and out from secondary storage. The mmu is used to detect when you drop off the edge of allocated memory - this is called a page fault. Your os, then swaps data to/from the secondary storage to ram, you then fix up the mmu page tables and that task can run again. Demand Paged Virtual Memory - its what most larger os/s do.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Demand Paged Virtual Memory - its what most larger os/s do.

Indeed.

 

You've posted under Cortex-A; so likely you'd be using a "larger OS" such as Linux - so that would do this for you.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm actually looking to create this for a custom OS...