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?
\$\begingroup\$
\$\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 SvenssonCommented Jun 16, 2018 at 15:54
-
1\$\begingroup\$ Are there any variants of the microcontroller you're using that have more RAM and less flash? \$\endgroup\$– Andrew MortonCommented Jun 16, 2018 at 16:08
-
\$\begingroup\$ I've never seen an mcu with more RAM than flash \$\endgroup\$– vicatcuCommented Jun 16, 2018 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\$– vicatcuCommented Jun 16, 2018 at 16:29
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
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.