Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The other day at work someone was asking how much ‘executable’ flash memory we need. Isn't it possible to execute out of all flash memory?

If I'm wrong, then how does executable flash memory differ from non-executable flash memory?

EDIT This has to do with embedded systems. We're designing a new system at work and we're picking a processor. One requirement that came up was how much memory we needed. The quote above was in regards to a clarification on that requirement.

share|improve this question
1  
Could we have a bit more context? Does this have anything to do with an embedded system? Or is it referring to PC secondary storage (SSD/flash drive)? Or something else? –  Bob Oct 26 '12 at 17:48
    
@Bob - embedded system, edited the post with this point. –  Mike Oct 26 '12 at 18:31

2 Answers 2

up vote 3 down vote accepted

No, it's not possible to execute out of all flash memory. For example, say you have a serial flash chip that requires a number of instructions just to read a single byte out of that flash chip. How could you execute code from that flash chip?

Pretty much every PC has a flash chip on every RAM stick containing the RAM's specifications. You sure can't execute the code in that flash chip, since it's not mapped into memory and can only be accessed by complex sequences of code talking to the memory controller.

Or consider a CPU that has separate executable and data address spaces. A flash chip that was mapped into data address space wouldn't be executable either.

The details are very device-specific. But it's not uncommon at all for a device to have flash that is not executable.

Think about an SSD or USB flash drive. You can't execute code out of those without copying it to RAM first. (And embedded systems often don't have enough RAM to hold a copy.)

Also, some CPUs have performance requirements on memory that is executable. Some CPUs don't have the ability to insert wait states on program fetches but do on data fetch. So executable flash must be very fast. It's not unusual to use cheaper flash for data. (The DS80C320, for example, can tolerate slower data memory but executable memory must run at its full speed.)

share|improve this answer
    
So what makes flash "executable" then? The speed? The type of bus that it's accessed by? Or am I over simplifying this and the answer is "it depends"? –  Mike Oct 26 '12 at 18:58
    
I think "it depends" is the best you can do. Basically, whether or not the CPU can execute code out of it, which depends on all those kinds of factors. –  David Schwartz Oct 26 '12 at 19:33

In many microcontrollers, which are used for many embedded applications, there are at least two types of memory: Flash memory (which usually contains the embedded firmware), and RAM (which is used to hold runtime values, registers, stack, etc).

Some microcontrollers have more than 1 flash memory, and not all can be used to store programs (firmware). The other flash memory regions are used for non-volatile storage only.

In all these cases, the flash memory is typically programmed during development (like loading data onto a hard drive) and not overwritten by the running programs. In some cases the flash can be written to, and you have self-reprogrammable systems.

To be clear, the programs are executed from this flash memory, but we are not talkng about anything like a flash disk.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.