This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Program Execution Space



Hai,

      Suppose in my controller, program execution space must be  2 KB. 

Free space 

      1) 2.1 KB

      2) 3 KB

      3) 8 KB

In the above which free space condition it will works fine. Or there is no difference?

  • What is "execution space"? Do you mean program size? As long as your flash size is large enough to hold the compiled program, the code will fit into the processor. The compiler will tell you when trying to program the device. More critical is the size of the RAM.
  • Hai,
    Here execution space meant that the space for all data manipulations.
    Suppose I have a bit of code in 2 KB program space in controller. It works fine.Then the same code is implemented in 8 KB program space controller.
    Is there any difference in performance, when the same code , but different memory space?
  • No problem in that direction. Going from a larger sized model to a smaller one can cause problems. Sometimes you start a product on a larger controller and at the end you look if your code would fit into a smaller one as well. If so, you can save a bit of money. But writing code for a small processor and then use it on a larger one always works.
  • Btw.: "for all data manipulations" sounds like RAM, not flash.
  • This depends on where the used memory segment is placed within the MCU (see Datasheet). MSP430 has two addressing modes: 16-bit and 20-bit. Everything under the 64K (location) can be addressed with 16-bit and is the fastest method.

    Now, when you place the same (small) program in a larger MCU, be sure that all the used memory segments are in the region below 64K.

    This can be set in the "Linker Command File" (.cmd) (CCS) and by setting options as Code-model and Data model with Small or Large.

  • Leo Bosch said:

    This depends on where the used memory segment is placed within the MCU (see Datasheet). MSP430 has two addressing modes: 16-bit and 20-bit. Everything under the 64K (location) can be addressed with 16-bit and is the fastest method.

    Yes, but there are 20-bit address register instructions (mova, not movx.a, and so on) that will execute at 1 cycle, same as 16-bit. And if code is mostly based on 20-bit address register instructions, execution speed will be the same.

  • My question is based on RAM.
    Suppose a program works fine in a small memory model. Then I migrate it in to bigger memory model . There is no change of functioning in programe.
    Is there any advantages in second bigger memory model?
  • No; the additional memory is just unused. (Except when your code explicitly queries the memory size, and uses it, but you'd know if you'd do that.)
  • Possibly, the presence of more RAM memory can be used to expand the Stack and thus leading to a more efficient code.

**Attention** This is a public forum