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.

MSP430F67791A: How do I get an accurate estimate of RAM Usage ? Program doesn't boot even though it has enough memory.

Part Number: MSP430F67791A


I am using IAR Workbench and after making most of the variables global, I get the following in the memory map generated by IAR. Using small data model.

    *************************************************************************
                ****************************************
                *                                      *
                *      SEGMENTS IN ADDRESS ORDER       *
                *                                      *
                ****************************************


SEGMENT              SPACE    START ADDRESS   END ADDRESS     SIZE  TYPE  ALIGN
=======              =====    =============   ===========     ====  ====  =====
DATA16_AN                              015C - 015D               2   rel    0
                                       0202 - 0205               4 
                                       020A - 020B               2 
                                       0222 - 0225               4 
                                       022A - 022B               2 
                                       0242 - 0245               4 
                                       0262 - 0265               4 
                                       05E0 - 05E1               2 
                                       05E6 - 05E9               4 
                                       05EC - 05EF               4 
                                       05FA - 05FB               2 
                                       05FE - 05FF               2 
                                       0620 - 0621               2 
                                       0626 - 0629               4 
                                       062C - 062F               4 
                                       063A - 063B               2 
                                       063E - 063F               2 
                                       0800 - 0803               4 
                                       080C - 0815               A 
                                       0818 - 081D               6 
                                       0820 - 0825               6 
                                       0828 - 082D               6 
                                       0830 - 0835               6 
                                       0838 - 083D               6 
                                       0840 - 0845               6 
DATA16_I                               1C00 - 1C1F              20   rel    1
DATA16_Z                               1C20 - 2CA3            1084   rel    5
CODE_I                                    2CA4                       rel    1
DATA20_I                                  2CA4                       rel    1
DATA20_Z                                  2CA4                       rel    1
DATA20_N                                  2CA4                       rel    1
CSTACK                                 9B60 - 9BFF              A0   rel    1
DATA16_C                               C000 - C004               5   rel    0
DATA16_ID                              C006 - C025              20   rel    1
CSTART                                 C026 - C04D              28   rel    1
ISR_CODE                               C04E - C405             3B8   rel    1
<CODE> 1                               C406 - EF13            2B0E   rel    1
DATA20_ID                                 EF14                       rel    1
CODE_ID                                   EF14                       rel    1
DATA20_C                                  EF14                       rel    1
INTVEC                                 FF80 - FFF1              72   com    1
RESET                                  FFFE - FFFF               2   rel    1

                ****************************************
                *                                      *
                *        END OF CROSS REFERENCE        *
                *                                      *
                ****************************************

 12 130 bytes of CODE  memory
  4 420 bytes of DATA  memory (+ 100 absolute )
     37 bytes of CONST memory

Errors: none
Warnings: none

Is this a correct estimate of usage ? If yes, any pointers to why it fails to boot  if I use more DATA memory.

  • It looks plausible. I don't know where IAR fits the heap (you might check the Heap Size specification), but you certainly seem to have plenty to spare.

    What does "fails to boot" mean exactly? 

    One possibility is that the startup code is taking so long to clear the .bss (DATA16_Z) that the Watchdog timer is triggering. In CCS, the usual solution for this is to define a function named _system_pre_init function to stop the Watchdog early.

    In IAR, it appears this function is called __low_level_init, and you do it by modifying the function in 430/src/lib/low_level_init.c [Ref EW430 User Guide (C430-13) p. 138]. (I don't have IAR, so I don't know what it looks like exactly.)

    Just add the line "WDTCTL = WDTPW + WDTHOLD;" to it.

  • Thanks, `__low_level_init` was what I was looking for.

**Attention** This is a public forum