What is non-executable flash memory?

1

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.

Mike

Posted 2012-10-26T17:46:50.473

Reputation: 849

1Could 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 – 2012-10-26T17:48:52.090

@Bob - embedded system, edited the post with this point. – Mike – 2012-10-26T18:31:28.250

Answers

3

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.)

David Schwartz

Posted 2012-10-26T17:46:50.473

Reputation: 58 310

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 – 2012-10-26T18:58:04.583

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 – 2012-10-26T19:33:38.343

1

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.

KevinM

Posted 2012-10-26T17:46:50.473

Reputation: 415