0
\$\begingroup\$

Is there anyway i can use micro-controllers flash memory as a RAM as i need 150kB of buffer but controller has 32kB of RAM and 512kB of Flash? Also can i use this ram as stack or heap?

\$\endgroup\$
4
  • 3
    \$\begingroup\$ I don't think you want to use the flash as RAM because the life cycles for the flash is much much much less than that of the RAM. This means that parts of your flash will stop working (the one that has been written to the most). \$\endgroup\$ – Harry Svensson Jun 16 '18 at 15:54
  • 1
    \$\begingroup\$ Are there any variants of the microcontroller you're using that have more RAM and less flash? \$\endgroup\$ – Andrew Morton Jun 16 '18 at 16:08
  • \$\begingroup\$ I've never seen an mcu with more RAM than flash \$\endgroup\$ – vicatcu Jun 16 '18 at 16:10
  • 2
    \$\begingroup\$ Actually I think take that back. If I'm not mistaken some processors, like the ESP8266 operate entirely out of RAM and use external flash chips just to boot from. \$\endgroup\$ – vicatcu Jun 16 '18 at 16:29
3
\$\begingroup\$

No, flash is flash, RAM is RAM.

The micro can probably program its own flash if you needed to calculate a look up table or similar, but you can't use it as you would a RAM.

The RAM you do have can probably be configured as stack and heap, these sections will be defined in a linker script, the format for which is toolchain dependant so check your compiler and linker's manual.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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