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.

MSP430F247 large array memory location

Other Parts Discussed in Thread: MSP430F247

Hi all,

I need to store a large array of bytes (4ko) in my MSP430F247, to do a fixed lookup table.

The elements of this table will be access in read mode only, they are never updated (write access) by the main program.

I think the code to define the lookup table will be like this:

lookup_table   DW   0,145,255,123,147,111,12     ;... (up to 4ko!!!) (please correct me if I'm wrong)

How can I proceed in assembler to choose the best memory location to store this fixed huge array?

Note that I don't use C, only assembler.

Thanks in advance for your help.

Kind regards.

  • Hi Karl,

    The MSP430 Assembly Language Tools v15.12.0.LTS User's Guide (SLAU131) contains examples of common array declarations made using the memory section specifications defined in the command linker file: www.ti.com/.../slau131l.pdf

    The .const section is most likely the memory location that works best for your constant array: processors.wiki.ti.com/.../Linker_Command_File_Primer

    Regards,
    Ryan
  • Thanks Ryan for the reply.

    I'm not familiar with the linker commands, but I will give it a try.

    I was also thinking on put the array declaration near the end of the main program, just before the "Interrupt Vectors".
    What do you think ?

    Here are the simplified code from my s43 file:



    #include "msp430x24x.h"
    DEBROM EQU 08000h
    DEBRAM EQU 01100h
    FINRAM EQU 020FFh

    ORG DEBRAM
    ;variables
    ...

    ; ******************************* Start of the main
    ORG DEBROM

    Reset
    ; stop watchdog
    ...

    ; SetInternalDCO
    ...

    ; Ports setup
    ...

    Mainloop
    ...
    JMP Mainloop

    ; ******************************* End of the main


    EVEN

    table_8
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,65,65
    DW 65,65,65,65,65,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97
    DW 97,97,97,97,97,97,97,225,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97
    DW 97,97,97,97,97,97,97,97,97,97,97,65,65,65,65,65,65,65,65,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,66,66,66,66,66,66,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,66,66,66,66,66,66,66,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,3,3,3,3,3,3,3,3,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
    DW 97,97,97,97,97,97,97,225,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97
    DW 97,97,97,97,97,97,97,97,97,97,97,65,65,65,65,65,65,65,65,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,66,66,66,66,66,66,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,66,66,66,66,66,66,66,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,66,66,66,66,66,66,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,66,66,66,66,66,66,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98
    DW 98,66,66,66,66,66,66,66,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    DW 0,3,3,3,3,3,3,3,3,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
    DW 97,97,97,97,97,97,97,225,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97

    ... up to 4096 values...

    ; ******************************* Interrupt Vectors
    ORG 0FFFEh
    DW Reset

    END
  • This is a similar format to what is seen on another E2E post: e2e.ti.com/.../259297

    Regards,
    Ryan
  • Yes it's a similar format, and I'm using IAR assembly language also.

    But as my array is 4ko large, do I have some think to worry about when using this format at the end of the program location?

    The MSP430F247 has 32ko memory, so it should be ok, but, am I missing something here ?
  • The IAR build will result in a linker error if your array is too large for the amount of space you've allowed it. We can consider your options if that point is reached, otherwise the rest of your application has plenty of memory space so this shouldn't be an issue. You can output a map file to further investigate your firmware solution's memory requirements.

    Regards,
    Ryan
  • Very thanks Ryan for your help.
    I will check it.
    :-)

**Attention** This is a public forum