0

I am using the STM32F4Discovery board and I nedd to run my code with a library which takes about 500KB when is compiled. I am skeptical if this system can support the memory requirements of the library. This MCU have 192KB of RAM and 1MB of flash. Can this mcu run code directly from flash?

If this microcontroller can´t support this requirements, there is a commercial available way to expand the RAM on this system? What technology should I use?

  • I have yet to see a CPU not capable of running code from any kind of read-only memory, especially one *made* for embedded systems. Just remember to put the data and bss segments in RAM. – Some programmer dude Mar 13 '14 at 13:14
  • 1
    that chip is designed to run from flash, you are expected to run from flash, that is why there is so much flash relative to the amount of ram – old_timer Mar 13 '14 at 13:17
  • I have worked with at least one spi flash that we couldnt run code on because that part (family) would experience read-disturb. so other than that experience I would have said you can always run code on flash, but not I hesitate. Microcontrollers generally have a flash on board which is specifically there for you to run your code, if those were to experience read-disturb that would be a fail for the chip vendor and they would need to fix or obsolete that part. – old_timer Mar 13 '14 at 13:50
  • See related: http://electronics.stackexchange.com/questions/102764/flash-and-ram-code-execution – embedded.kyle Mar 14 '14 at 12:24

1 Answers1

3

The whole point of MCU flash is to hold code. So, yes, it can execute code from there or the flash would be completely worthless.

Lundin
  • 195,001
  • 40
  • 254
  • 396
  • These chips are actually pretty optimized for running code from flash as there is a dedicated bus for feeding flash data into the instruction decode - in effect, a semi-Harvard architecture. It is running from RAM which is slow, because then instruction and data access have to take turns, preventing the pipeline from running at full efficiency. (A few of the latest STM32 parts have an additional small RAM that is optimally executable) – Chris Stratton Mar 13 '14 at 15:01