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.

MSP430: Mismatch between the data memory model I requested in CCS and the one reported by assembler

Other Parts Discussed in Thread: MSP430F6736A

Hello!

I am using CCS6.0.1 and the TI C compiler version 4.4.1.  I think I am seeing a mismatch between the data memory model I select in the project properties in CCS, and what is used (or at least reported) by the TI assembler.  I am not 100% sure if this is causing different code generation, or maybe the assembler is printing the wrong thing at the top of the .asm file.  Possibly it's not a bug at all, and the options seen in Eclipse don't map 1:1 with what is in the .asm file.

The question: Should I expect the .asm file to report the same data memory model I selected in Eclipse?

The quick version:  If I compile the "Blink the LED" sample code for an MSP430F6736A, I see the following:

What I set in Eclipse / what appears on the console during build / what is reported in .asm file:

restricted / restricted / large

small / small / large

large / large / huge

blank / blank / small

What I think should be different: The memory model reported in the .asm file and the one I select in Eclipse should be the same.

If the compiler, assembler, or linker has the ability to detect that the project won't being compiled won't fit in the selected model, or is otherwise not suitable, it might be OK to automatically use a bigger/different one, but there should be a diagnostic message in case this happens.  The project I am testing with is very small, so I don't know what happens in this case.

Why I care:

I care about this because in my actual project, I think I need to use the large data memory model.  I was trying to set this up in Eclipse, but I wasn't always getting the results I expected when I tried to run the code for my actual project.  When looking at the .asm files, I noticed that what I set in Eclipse and what was at the top of the .asm didn't match.  This may not be the problem I am actually having with my project, but it at least seems odd to me.

Steps to reproduce:

1.  Start with a PC that has never had CCS on it before.  This may not be a hard requirement, but it was what I did.

2.  Download the offline installer of CCS 6.0.1.00040 from http://processors.wiki.ti.com/index.php/Download_CCS#Code_Composer_Studio_Version_6_Downloads and install it.

3.  Use the update feature within CCS to get the latest TI C compiler, version 4.4.1.

4.  Start a new CCS project.  Pick your MSP430 flavor (I picked MSP430F6736A, as that's what I have.)  Use the TI C compiler.  Select the "Basic Examples > Blink The LED" from the "Project templates and examples" box.

5.  Right click on the project in Project Explorer and select Properties.  Under CCS Build > MSP430 Compiler > Advanced Options > Assembler Options, check both the "Keep the generated assembly language (.asm) file" and the "Generate listing file" boxes.

6.  Under CCS Build > MSP430 Compiler > Processor Options, observe that the data memory model is set to restricted by default.

7.  Hit OK to close the project properties.

8.  From the Project menu, select Build All.

9.  Look at the console window.  Both the compiler and the linker will have --data_model=restricted in their command lines.  This is what I expect.

10. Open up the .asm file (in Eclipse or your favorite text editor).  The .compiler directive near the top will have --mem_model:data=large in it.  This is not what I expect; I expect it to be restricted.

11.  Back in Eclipse, right click on the project in Project Explorer, select Properties, go to CCS Build > MSP430 Compiler > Processor Options, set the data memory model to small, and click OK.

12.  From the Project menu, select Build All.

13.  Look at the console window.  Both the compiler and the linker will have --data_model=small in their command lines.  This is what I expect.

14. Open up the .asm file (in Eclipse or your favorite text editor).  The .compiler directive near the top will have --mem_model:data=large in it.  This is not what I expect; I expect it to be small.

15.  Repeat steps 11-13, setting large in Eclipse.  The console will show --data_model=large (as expected), but the .asm file will show --mem_model:data=huge (expected =large).

15.  Repeat steps 11-13, setting blank (nothing selected) in Eclipse - you may have to select this twice before the dropbox will stay blank.  The console will show no --data_model option to either the compiler or linker (probably OK).  The .asm file will show --mem_model:data=small .  I am not sure if "small" is OK, or if the .asm should show no compiler option at all.

Hardware details:

I am running CCS on Windows 7 Pro, SP1, 64-bit.  My connection to the target is via a TI MSP-FET430UIF, using SPY-BI-WIRE to the /RST and TEST pins on the MSP430.

Other notes:

The latest MSP430 C compiler manual (SLAU132J, http://www.ti.com/lit/ug/slau132j/slau132j.pdf  ) only talks about small, large, and restricted memory models.  "Huge" isn't mentioned.

If they would help, I have the console output and .asm files from trying to compile with different settings for the data_memory_model.  I may need to scrub a directory name out of them but I can provide them if needed.

Thanks!

Matt Roberds

(edit: corrected MSP part number and tags)

  • I understand your confusion.  The option --mem_model:data=something is not the same as --data_model=something. Moreover, the --mem_model:data option is not documented, and will remain that way.  The following table is subject to change without notice.  It is correct as of compiler versions 4.4.x.

    --data_model --mem_model:data
    default large
    small small
    large huge
    restricted large

    Thanks and regards,

    -George

  • OK, makes sense.  The mapping is not 1:1 between these two options.

    Your table nearly matches what I saw, except when I asked for "--data_model small", I got "--mem_model:data=large".  But since this mapping is not guaranteed, this is probably not very important.

    Followup question: is there any quick way to tell if the "--data_model" option took effect, especially if your code doesn't really need the restricted or large data models?

    In my project, as far as I can tell, everything fits in the first 64 KB; it will at least start and run when compiled with either the small or large data models.

    I could tell that the large data model was having some effect by inspecting the .asm file; part of my code defines an array of pointers, and when I went from the small to the large data model, the array elements went from 2 bytes wide to 4 bytes wide, which makes sense.  I am just wondering if there is any other way to check.

    Thanks!

    Matt Roberds

  • Matt Roberds said:
    is there any quick way to tell if the "--data_model" option took effect

    You can use the ofd430 utility to show you the build attribute in the object file.  The command would be similar to ...

    % ofd430 main.obj | fgrep Tag_Data_Model
                 Tag_Data_Model          3          (restricted large data)
    

    That command also works on executables (.out files) and libraries.

    Thanks and regards,

    -George

  • George Mock said:
    You can use the ofd430 utility to show you the build attribute in the object file.

    That works.  Thanks!

    Matt Roberds