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/MSP430FR2675: Compiler does not link CapTIvate™ Software Library in ROM

Part Number: MSP430FR2675
Other Parts Discussed in Thread: MSP430FR2512, MSP430FR2522, MSP430FR2676,

Tool/software: Code Composer Studio

I use the Captivat function on this device. I managed to get the software and hardware to work fine (just 1 proximity sensor.

I realised, that the compiler does not link in the existing ROM lib.

 

I found the following lines in "rom_captivate.h"

//! MSP430FR2512 Device ROM Header File
//
#elif defined (__MSP430FR2512__)
#include "rom_headers/rom_captivate_msp430fr2522_family.h"

//! MSP430FR2676 Device ROM Header File

//
#elif defined (__MSP430FR2676__)
#include "rom_headers/rom_captivate_msp430fr2676_family.h"

#else
#warning "Failed to match a ROM include file."
#endif

 

 

(in the "rom_map_captivate.h" file the ROM_CAPT_XXX functions are declared and enabled

 

looks like there is no provision for the MSP430FR2675??? but according to data sheet ROM lib is in there

 

I changed the device to MSP430FR2676 in the project menu and compiled again.

I opened the "Memory Allocation" -> still no ROMLIB usage!!

 

1.) what do I missed to use the ROMLIB

2.) how do I get the FR2675 ROMLIB

 

Thanks very much

Best regards

Kurt

 

 

 

 

  • Hello Kurt,

    In the future, please use a more descriptive title when you make a new thread.

    Kurtlin said:
    looks like there is no provision for the MSP430FR2675??? but according to data sheet ROM lib is in there

    You're correct. Table 6-31 in the datasheet does show that the MSP430FR2676 device has the CapTIvate libraries in ROM.

    Kurtlin said:
    2.) how do I get the FR2675 ROMLIB

    Looking at the Devices with CapTIvate™ Software in ROM section in the CapTIvate ™ Technology Guide, I found the following instructions. They should help answer your question.

    Example:

    To call the library function “foo()”, it is recommended to make an implicit ROM call MAP_foo(). The complier parses through the rom_map_captivate.h file to determine if the function resides in ROM, and if it does, will make the ROM call. If this function does not exist in ROM then the compiler will make a call to the pre-compiled library version.

    It is possible to explicitly call the function “foo()” from the pre-compiled library using foo(). The linker will pull this function from the pre-compiled library during the link process, adding the function to FRAM program memory. To explicitly call the function “foo()” from ROM, use ROM_foo(). This will force the compiler to make a call to ROM, with no impact on FRAM program memory.

    Regards,

    James

  • Hi James,

     thanks for your answer.

    all the CAP-functions are all declared in the "rom_captivate_msp430fr2676_family.h"

    e.g.

     #define ROM_CAPT_computeArcTanApprox                                          \
            ((uint16_t (__cc_rom *)(int32_t i32XComp,                             \
                                    int32_t i32YComp))ROM_CAPTIVATE_JUMPTABLE[1])

    and

    the redefined in "rom_map_captivate.h"

    / ROM vs. FRAM Calling Macro for CAPT_computeArcTanApprox()
    #ifdef ROM_CAPT_computeArcTanApprox
    #define MAP_CAPT_computeArcTanApprox \
            ROM_CAPT_computeArcTanApprox
    #else
    #define MAP_CAPT_computeArcTanApprox \
            CAPT_computeArcTanApprox
    #endif

    so far so good, but when I open the map file:

    BSLCONFIGURATIONSIGNA 0000ff88   00000002  00000002  00000000  RWIX  ffff
      BSLCONFIGURATION      0000ff8a   00000002  00000002  00000000  RWIX  ffff MEMORY CONFIGURATION

             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      TINYRAM               00000006   0000001a  00000000  0000001a  RWIX
      BSL0                  00001000   00000800  00000000  00000800  RWIX
      INFO                  00001800   00000200  00000000  00000200  RWIX
      TLVMEM                00001a00   00000200  00000000  00000200  RWIX
      BOOTCODE              00001c00   00000400  00000000  00000400  RWIX
      RAM                   00002000   00001800  00000276  0000158a  RWIX
      FRAM                  00008000   00007f80  00004480  00003b00  RWIX
      JTAGSIGNATURE         0000ff80   00000004  00000004  00000000  RWIX  ffff
      BSLSIGNATURE          0000ff84   00000004  00000004  00000000  RWIX  ffff

      BSLI2CADDRESS         0000ffa0   00000002  00000002  00000000  RWIX  ffff
      INT00                 0000ffa2   00000002  00000000  00000002  RWIX

    no mentioning of a ROM!!!!???

    best regards

    Kurt

  • Hi Kurt,

    Nice work! I can't explain why the ROM isn't shown in the MAP file. Are you using the CapTIvate linker file? Did you select the right memory model? All CapTIvate™ software library projects for those devices must be compiled using the small code small data memory model in order to be compatible with the ROM functions and the pre-compiled library.

    Have you followed the instructions for Porting an Existing CapTIvate Project to a New Device?

    Regards,

    James

  • Hi James,

     if you use the small model the compiler throws an error,

    I found the following define statements

    #if (defined(__TI_COMPILER_VERSION__) && !defined(__LARGE_DATA_MODEL__)) || \
        (defined(__IAR_SYSTEMS_ICC__) && (__DATA_MODEL__!=__DATA_MODEL_LARGE__))
    #error "Only large data model supported for this ROM."
    #endif
    #ifndef ROM_CAPTIVATE_MSP430FR2676_H_
    #define ROM_CAPTIVATE_MSP430FR2676_H_

    #if (defined(__TI_COMPILER_VERSION__) && defined(__LARGE_CODE_MODEL__)) || \
        (defined(__IAR_SYSTEMS_ICC__) && (__CODE_MODEL__==__CODE_MODEL_LARGE__))

    looks like you have to use the large model?!!!

    best regards

    Kurt

  • Hi Kurt,

    I'll check on that. In the meantime, which CapTIvate Design Center version are you using? Is there a way that you could try updating to the latest version?

    Regards,

    James 

  • Hi Kurt:

    I can assist you moving forward. Sounds like you did some good work already. But like what James asked, what is your version? It is possible you may have a version from before FR2675 was released. Because I see FR2675 in "rom_captivate.h" on our side.

    And as you have encountered, I wouldn't worry too much about code/data model. Our headers will throw errors and point you in the right direction, it's not something we expect people to just know. You are correct in saying FR2675 should be using large code model.

  • Hi James / Wallace,

      I loaded the current CapTIvateDesignCenter from your website (1.82.00.06) and created a new project. I added a couple of calls in the main.c file to try it out. again, the same thing, no ROM lib used

    I think it's easier if I send you the project and you can try for yourself.PTL3_Type2_HRC.zip

    thanks for your help

    best regards

    kurt

  • Hi Kurt:

    Thanks for sharing. I think I have pinpointed the answer to your question.

    Clarification #1

    If you look at the .map file (from the project you posted):

    MEMORY CONFIGURATION
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      TINYRAM               00000006   0000001a  00000000  0000001a  RWIX
      BSL0                  00001000   00000800  00000000  00000800  RWIX
      INFO                  00001800   00000200  00000000  00000200  RWIX
      TLVMEM                00001a00   00000200  00000000  00000200  RWIX
      BOOTCODE              00001c00   00000400  00000000  00000400  RWIX
      RAM                   00002000   00002000  0000017e  00001e82  RWIX
      FRAM                  00008000   00007f80  000011c4  00006dbc  RWIX
      JTAGSIGNATURE         0000ff80   00000004  00000004  00000000  RWIX  ffff 
      RESET                 0000fffe   00000002  00000002  00000000  RWIX
      FRAM2                 00010000   00008000  00000000  00008000  RWIX
      ROMLIB                000c0000   00004000  00000000  00004000  RWIX
      BSL1                  000ffc00   00000400  00000000  00000400  RWIX
    The "used" section is calculated only by how much code the application inserts into that memory section called ROMLIB. In all cases, whether ROM is used or not, that "used" section will always be 0 because the ROM is already there: the application does not put any code into that section. It does not represent how much code is being used from the ROMLIB section.
    Clarification #2

    Vast majority, but not all CAPT functions are placed into ROM. There are some that are left in FRAM nonvolatile memory for various reasons. Overall, you should still see significant memory and speed savings. So the CAPT functions that you see still taking up FRAM space are intentional, and that means they are not included in ROM (sometimes by user's choice, if they do not use MAP_ or ROM_ prefixes). What you cannot see is how many of the functions are successfully using ROM, of which there are many.
    Hope that helps!

     
    Extra information for the curious and future reference
    So how can you see which functions are using ROM?
    Long story short, there is no comprehensive way using only the map file. Since our ROM is pre-built/pre-loaded and called using pre-processor directives (#ifdef, #define) and function pointers, the linker that generates the map file has no knowledge of the contents.
    Naturally, you can track the progress of your function calls in the debugger and see that those function calls do go into ROM and not FRAM. But this is not the nice one file comprehensive breakdown like a .map file.
    The converse, however, is much easier. The map file can show you all the functions that are not called out of ROM, but in FRAM. This is most easily seen in the .text section of the .map file.
    A fun exercise is to verify that none of the functions listed being called out of captivate_fr2676_family.lib exist in ROM (it won't). It tells you exactly where the function starts in memory and how long it is in length.
    In this specific case study, if ROM was not being used, the .text section would be much much longer.
  • Hi Wallace,

       thanks very much for your reply. I can see that the ROM lib is used.

    I compiled for 2675 and 2676, in my program there is a difference of about 1k difference.

    my problem is now, I am using the 2675 which comes up with the compiler warning "no ROM lib used" as there is no defines for it.

    the rom_captive.h file has got only a defines for __MSP430FR2676__

    is it ok just to copy and rename the 

    rom_captivate_msp430fr2676_family.h    

    file to

    rom_captivate_msp430fr2675_family.h

    not sure what the differences are????

    thanks very much

    best regards

    Kurt

  • Hi Kurt:

    I'll answer your question in 2 parts:

    1. There happens to be no difference in the ROM between FR2676 and FR2675. But instead of renaming the file, you could add an
      #elif defined (__MSP430FR2675__)
      #include "rom_headers/rom_captivate_msp430fr2676_family.h"
      line inside of rom_captivate.h.
    2. However, this shouldn't be necessary because this has already been done in the last couple releases of CapTIvate software. As a matter of fact, I see this already has been done in the .zip of your project you have sent earlier. Can you please double-check you are using the latest version?

    Thanks,

    Wallace

  • Hi Wallace,

      thanks very much for your help. the zip file was created new, so the rom_captive.h had a newer version. I copied the new version into the BASE directory, all working fine!

    best regards

    Kurt