Thread: Ways to save RAM when RAM is very limited

  1. #16
    Join Date
    Nov 2004
    Quote Originally Posted by filker0
    The original posting from suzanne_lim stated something about microcontrollers, so I'm assuming that when she/he used the term "ROM", she/he meant ROM (or more likely, EEPROM). It doesn't need to be a video game, and the code is probably not copied into R/W RAM at runtime.

    Embedded programmers do write code that ends up in ROM.
    I know, but people were telling pretty much that stuff ends up in a computer's ROM at runtime which is blatantly false.

    And I've never in over 10 years in software heard anyone calling program code ROM...

  2. #17
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    West Virginia
    Quote Originally Posted by jwenting
    And I've never in over 10 years in software heard anyone calling program code ROM...
    And I didn't call program code ROM, I said that that's what ends up in ROM, in an embedded application. I write a lot of embedded code, which is stored in eeprom or flash ROM (in the old days, it was actual masked ROM) when the product ships. The code is executed directly out of that ROM; it is not copied to RAM. The non-read-only data is set up in RAM, as is the stack and the heap.
    Insert obnoxious but pithy remark here

  3. #18
    Join Date
    Nov 2004
    you didn't, but someone else did.
    In programming:
    ROM==The executable code
    RAM==The space for vars, objects, etc

  4. #19
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Saving ROM is probably much harder than saving RAM. Treat your code like you would an old TSR from the DOS days. You only want what absolutely has to be there for the code to run. As has been said library functions and other thirdy party functions often have far too much overhead to use in your code.

    To save RAM you can use shared memory techniques but they are not trivial to implement, however, I invite you to google them to find out more.

    I have no experience with EEPROM's but I do have experience writing pure assembly bootstraps and kernel code. Stuffing the kernel into memory in real mode is quite an interesting task as well as using RAM for the kernel when you still have to provide enough RAM to the user in order to actually have the computer do more than just boot up.

    Since I don't know the layout of the chip or how it processes instructions, opcode size, opcode byte ordering, etc., there is not much advice I can give you beyond this and beyond what has already been given.

    For once I would have to say that I totally agree with filker0.

  5. #20
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006


    It's funny, I didn't hear to call executable code ROM too (although it is). But I saw in Dave_Sinkula and others that are calling executable code "ROM". So I sent a post to prevent confusion.
    Last edited by siavoshkc; 02-04-2006 at 02:24 AM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #21
    Registered User fischerandom's Avatar
    Join Date
    Aug 2005
    Read the C-compilers manual for the microprocessor you are using. They usually give usefull advice on the topic you are asking about.

    And also, some microprocessors have only a single register and can thus not deal with pointers without a lot of instructions, thus eating EPROM (program) memory. But you were talking about the RAM. Use the proper type, if you need a single flag, a bit/bool, use such a type they may be directly supported by the processors instruction set and save up to 8 times the RAM usage compared to using a byte (char). For example the 16F8xx PIC processor have very little RAM, but supports single-bit instructions. What micro processor are you using?
    Last edited by fischerandom; 02-04-2006 at 04:59 PM.
    Bobby Fischer Live Radio Interviews

  7. #22
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Get rid of any recursive functions you might have.

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #23
    Registered User
    Join Date
    Aug 2005
    wow....thanks guys/gals for your time and your infos....btw i am using cypress CY8C27443 microprocessor. i think i'll start off with the bit thing. I keep all update. thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. save webpage? some save some not
    By kryptkat in forum Tech Board
    Replies: 3
    Last Post: 06-07-2005, 09:21 AM
  2. Ask user to save file before exiting.
    By Bajanine in forum Windows Programming
    Replies: 3
    Last Post: 11-15-2004, 06:34 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Major glitch losing source files with MSVC++ and WinXP
    By JasonD in forum C++ Programming
    Replies: 10
    Last Post: 08-14-2003, 12:15 PM