Author Topic: Programming with limited RAM  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Programming with limited RAM
« on: August 25, 2014, 08:13:11 AM »
As my adventure with the TI MSP430g2553 continues, I'm struck by something: there are only 512 bytes of RAM, compared to the Arduino and Axon II which has some 8KB (at least for the Mega).  Strangely, it has 16KB of flash.  So I was wondering something: are there tricks to writing large programs (ie: ones that could never fit into RAM but can easily fit in flash) that are used? 

I can imagine something like this: write the entire program in flash (including how it WOULD look in RAM once loaded), then write some kind of operating controller that selectively loads/unloads the RAM with the flash data as it is needed.  As long as you are doing everything sequentially and interrupts aren't killing you, that should work...right?

I know that we can optimize the code to use LESS RAM, but I'm talking about a case where there is just so much code that even after optimization you still have no hope of loading it all.

Mike
Current project: tactile sensing systems for multifingered robot hands

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Programming with limited RAM
« Reply #1 on: August 25, 2014, 11:20:13 AM »
Are you sure the code needs to be in RAM to run?? Most of these small processors execute code from FLASH, RAM is only used for variables and data buffers.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Programming with limited RAM
« Reply #2 on: August 25, 2014, 02:13:51 PM »
Huh, I guess, if that's the case, then that answers my question right away :-P  I suppose the question would still remain for very large arrays, but those are (relatively) easy to store in flash anyway.  Neat.
Current project: tactile sensing systems for multifingered robot hands

 


Get Your Ad Here