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.

CCS/TM4C129ENCPDT: Max Heap size for dynamic memory allocation

Part Number: TM4C129ENCPDT

Tool/software: Code Composer Studio

Hi,

I am trying to implement MODBUS TCP Server (Slave) device using TM4C129ENCPDT Evaluation Kit. So for memory allocation, I just made the following reference table. The memory allocation for the four modbus data types has to be made as configurable in the program itself.

Based on the table, I inferred that we need 41.5kB (not sure correct or not) of memory to be allocated dynamically if we configure to use all the addresses for the modbus datatypes. 

Since my controller has 256kB of RAM in it, can I directly go and put  42496 (41.5kB x 1024) bytes in the heap size in the project properties-->CCS BUILD-->ARM Linker-->Basic Option.

Does allocating 41.5kB of memory as the heap, affects the performance of the controller in any way?

Thank you for your time.

  • Hi,
    Is MODBUS TCP the only thing you are running on your application? If this is the case, then I don't think increasing the heap size to 41kB will affect the performance. However, if you are under load with many modules all running then you need to make sure you runtime tasks do not dynamically request more heap memory than you allocated. Otherwise, I think you will be fine.
  • Thank you, Charles.

    Along with Modbus my program has ethernet communication using lwIP, at least two SSI modules, and one I2C module.  

    Is there a way to calculate the required dynamic memory allocation size?

    Thank you! 

  • RAGHUL N M said:
    Is there a way to calculate the required dynamic memory allocation size?

    I don't know an automated method to determine the required dynamic memory allocation size.

    However, see Compiler/DK-TM4C129X: any way to maximize the heap size? for a method to use all remaining RAM for the heap.

  • Hi Chester,

      Thank you so much for sharing your knowledge and tips in the thread you referenced. I'm not aware of any tools to calculate the dynamic memory used/allocated automatically. This is normally to be handled by the application. It is not something intrinsic to the C language.  

  • Thank You.

    Actually, after seeing my project requirement, it seems that the inbuilt RAM of 256 kB in the TM4C129ENCPDT will not be enough. The program will have Graphics libraries and operations with large strings.

    So we are planning for an external RAM. There are many options like NVRAM, SDRAM etc.

    Can anyone suggest which one to go for? 

  • Hi,
    You will need to make that decision based on your system requirements. The only comment I have is that you are wanting to increase your RAM for stack/heap. Why would you want to use non-volatile memory such as NVRAM?
  • Thank You, Charles.

    The data I will be maintaing in the heap/stack will be modified frequently (atleast after every second). And I need to restore those data if the power to the controller is made OFF and powered ON again.
    In my previous project I have done this by writing the modified data to the EEPROM inside the controller after every modification. So once the power to the controller is made OFF and ON again, I'll first read the EEPROM and restore the last modified data. But writing and reading from EEPROM for every second makes my system slow. And for Modbus I need to write a hude amount of data into EEPROM after every second.

    So we planned for a NVRAM separately for heap memory and by that I can also restore the data last modified from it if my controller got reset due to power OFF and ON.

    Kindly suggest me any such RAM ICs that can be interfaced with the TM4C129ENCPDT controller IC.

    Thank You for your time.
  • Hi,
    You will need to do your own research on the external parts. Below is just one example of external EEprom. You can use the MCU's EPI interface to access the external EEprom. Please refer to the datasheets for details.

    ww1.microchip.com/.../doc0270.pdf