This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Program code Size more than CODE/DATA RAM

Hi ALL,

i am using Cypress fx2lp chip in my application & uVision2 IDE. i have 16KB of code & data memory but my code size is more than it. so i am planning to have two memory segments 1. fixed memory (around 10KB)
2. shared memory n(6KB)

i am planning to store code in EEPROM. where on reset chip will start loading code in fixed memory. the required part of the remaining code will be loaded by fixed code in to shared memory whenever required. can i do this? any other suggestions

-dhanraj

Parents
  • As Erik has pointed out, why do you need to do this?

    Are you trying to make a boot loader?

    The c51 series has several different address spaces. Code space is set as read only and is where the program executes from. XDATA is READ/WRITE along with internal RAM, neither of which you should execute from.

    You also run the risk of wearing the memory out as well. Flash and EEPROM have a certain number of cycles they can be written to before they begin going through various failure modes (mostly random bit errors). If you need to have more memory you have the option of bank switching more data into code space.

    Perhaps you could explain better what you are hoping to accomplish or intend to do?

    If your program is too large, consider how to reduce it's size by more efficient programming, and removing unnecessary code.

    Stephen

Reply
  • As Erik has pointed out, why do you need to do this?

    Are you trying to make a boot loader?

    The c51 series has several different address spaces. Code space is set as read only and is where the program executes from. XDATA is READ/WRITE along with internal RAM, neither of which you should execute from.

    You also run the risk of wearing the memory out as well. Flash and EEPROM have a certain number of cycles they can be written to before they begin going through various failure modes (mostly random bit errors). If you need to have more memory you have the option of bank switching more data into code space.

    Perhaps you could explain better what you are hoping to accomplish or intend to do?

    If your program is too large, consider how to reduce it's size by more efficient programming, and removing unnecessary code.

    Stephen

Children
  • It's not just a matter of "should" - it is impossible!

    The 8051 architecture cannot fetch instructions for execution from anything other than CODE space.

  • Stephen,

    it is not boot loader but similar stuff. fx2lp can talk to NAND flash. boot loader firmware is available for loading code from NAND flash for fx2lp. fx2lp is the perfect for my application but it has 16KB of internal memory only. though it can support 64KB of total i can not afford to have external memory(Huge quantity).my plan is to use memory overlay for 6KB memory & keep 10KB fixed code. i will always read from NAND so wearing issue is solved. remaining space in NAND will be used for mass storage purpose. i can manage mass storage & stuff. plan is compile some individual function & keep in hidden area of nand flash. load them into data/code memory whenever required (one at a time)& execute but how do i compile specific function individually which will be using global variable from fixed memory.

    any suggestion

    -dhanraj

  • i will always read from NAND so wearing issue is solved.
    since you need the CODE in CODE memory (which is flash) the wearing issue is NOT solved.

    Erik

  • still you would be far better off choosing a chip with more code memory (tons avaialble) or use an external code memory.

    Erik

  • I take it security is an obvious non issue? IE you don't care if your code is dumped and reversed engineered?

    That will be easy if you do things this way. There are reasons they don't use RAM for code space on many microcontrollers, theft is a one, another is people reprogramming it to do things you don't want it too. So property theft and liability are some of the main reasons you do not execute code from RAM on microcontrollers. Unless you are doing a consumer item that can't kill someone cause an explosion etc.

    Stephen