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.

memory model problem when linking Driverlib with SYSBIOS

Other Parts Discussed in Thread: SYSBIOS, MSP430WARE, MSP430F5438, MSP430F5324, MSPWARE

I am trying to link Driver library with SYSBIOS. I have created a SYSBIOS project with given minimal template and modified the main.c file and .cfg file as per my requirement.

In project properties, I have set include path as MSP430ware path and added driverlib.lib in "File Search path".
and In Processor options, I have set Data memory model = large.

after that, I build the project and getting error that driverlib needs large data memory model but restricted large data memory model is provided.

I checked makefile (Path: <project>/Debug/makefile) and found that --data_model = large. It is proper.

I checked makefile (Path: <project>/src/sysbios/makefile) and found that --data_model = restricted is there even though i have set large data memory model in processor option. I replaced "restricted" with "large" and save & Build again.

After building, In makefile(Path: <project>/src/sysbios/makefile) --data_model = restricted was there even though i have replaced it with "large".

In Conclusion, "--data_model = restricted" comes by default even if i set it as large. What will be the problem for that? and How to solve Data memory model error.

I have added compilation output here


**** Build of configuration Debug for project sysbios_memory_model_issue3 ****

/opt/ti/ccsv5/utils/bin/gmake -k all
making ../src/sysbios.a430X ...
cl430X /opt/ti/bios_6_34_02_18/packages/ti/sysbios/BIOS.c ...
asm430X /opt/ti/bios_6_34_02_18/packages/ti/sysbios/family/msp430/TaskSupport_asm.asm ...
asm430X /opt/ti/bios_6_34_02_18/packages/ti/sysbios/family/msp430/Hwi_switch_asm.asm ...
ar430X BIOS.obj msp430_TaskSupport_asm.obj msp430_Hwi_switch_asm.obj ...
Building file: ../app.cfg
Invoking: XDCtools
"/opt/ti/xdctools_3_24_05_48/xs" --xdcpath="/opt/ti/bios_6_34_02_18/packages;/opt/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/packages;/opt/ti/ccsv5/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.msp430.MSP430X -p ti.platforms.msp430:MSP430F5438 -r release -c "/opt/ti/ccsv5/tools/compiler/msp430_4.1.2" --compileOptions "-g --optimize_with_debug" "../app.cfg"
making package.mak (because of package.bld) ...
generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
configuring app.x430X from package/cfg/app_p430X.cfg ...
warning: ti.sysbios.BIOS: "/opt/ti/bios_6_34_02_18/packages/ti/sysbios/BIOS.xs", line 195: ti.targets.msp430.MSP430X : Support for the MSP430 COFF targets will be eliminated in future SYS/BIOS releases. Please switch to building with the corresponding ti.targets.msp430.elf MSP430 target.
generating custom ti.sysbios library makefile ...
generating custom ti.sysbios.family.msp430 Hwi stubs ...
Starting build of library sources ...
making /root/workspace/sysbios_memory_model_issue3/src/sysbios.a430X ...
Build of libraries done.
cl430X package/cfg/app_p430X.c ...
Finished building: ../app.cfg

Building file: ../main.c
Invoking: MSP430 Compiler
"/opt/ti/ccsv5/tools/compiler/msp430_4.1.2/bin/cl430" -vmspx --abi=coffabi --data_model=large -g --include_path="/opt/ti/ccsv5/ccs_base/msp430/include" --include_path="/opt/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30" --include_path="/opt/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --advice:power=all --define=__MSP430F5438__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU15 --silicon_errata=CPU18 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --printf_support=minimal --preproc_with_compile --preproc_dependency="main.pp" --cmd_file="./configPkg/compiler.opt" "../main.c"
"../main.c", line 54: remark #1530-D: (ULP 5.1) Detected modulo operation(s). Recommend moving them to RAM during run time or not using as these are processing/power intensive
"../main.c", line 67: remark #1530-D: (ULP 5.1) Detected modulo operation(s). Recommend moving them to RAM during run time or not using as these are processing/power intensive
Finished building: ../main.c

Building target: sysbios_memory_model_issue3.out
Invoking: MSP430 Linker
"/opt/ti/ccsv5/tools/compiler/msp430_4.1.2/bin/cl430" -vmspx --abi=coffabi --data_model=large -g --advice:power=all --define=__MSP430F5438__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU15 --silicon_errata=CPU18 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --printf_support=minimal -z --stack_size=160 -m"sysbios_memory_model_issue3.map" --heap_size=160 --use_hw_mpy=F5 -i"/opt/ti/ccsv5/ccs_base/msp430/include" -i"/opt/ti/ccsv5/tools/compiler/msp430_4.1.2/lib" -i"/opt/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --rom_model -o "sysbios_memory_model_issue3.out" -l"./configPkg/linker.cmd" "./main.obj" -l"libc.a" -l/opt/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/CCS/driverlib.lib "../lnk_msp430f5438.cmd"
<Linking>
error #16019-D: file "/opt/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/CCS/driverlib.lib<gpio.o>" specifies large data memory model, which is not compatible with restricted large data memory model specified in a previous file or on the command line
error #16019-D: file "/opt/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/CCS/driverlib.lib<wdt.o>" specifies large data memory model, which is not compatible with restricted large data memory model specified in a previous file or on the command line
error #10010: errors encountered during linking; "sysbios_memory_model_issue3.out" not built
remark #10372-D: (ULP 4.1) Detected uninitialized Port A in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
remark #10372-D: (ULP 4.1) Detected uninitialized Port B in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
remark #10372-D: (ULP 4.1) Detected uninitialized Port C in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
remark #10372-D: (ULP 4.1) Detected uninitialized Port D in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
remark #10372-D: (ULP 4.1) Detected uninitialized Port E in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
remark #10372-D: (ULP 4.1) Detected uninitialized Port F in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.

>> Compilation failure
gmake: *** [sysbios_memory_model_issue3.out] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

  • Amit,
    the options in src/sysbios/makefile are determined by the target selection in the configuro command line. The option -t ti.targets.msp430.MSP430X selects the target with the restricted data model. Unfortunately, there is no RTSC target that supports the large data model. The only difference between the large and the restricted model is that in the restricted model you can't have arrays larger than 64K. If you don't have such arrays I would recommend you to change data model to Restricted in your project.

     

  • Hi Sasha Slijepcevic,

    Thanks for your reply.

    You have mentioned about array of size < 64K. Here array means simple C array or anything else ?

    I don't need to use any C array but I want to use Driver library provided in MSP430Ware.

    SYSBIOS provides driverlib package but when i included that and used driverlib APIs then it cant be resolved by compiler. therefore I included Driver library(Path: ccsv5/ ccs_base/ msp430/ msp430ware_1_25_00_30/ driverlib/ 5xx_6xx/ CCS/ driverlib.lib) in Project Properties-> MSP430 Linker-> File Search Path-> include library path then APIs get resolved by compiler but driver library needs large data memory model and i am getting error for that.

    What is solution of this problem? Can i change data memory model of driver library?

    Is there any way to use APIs of Driver library provided by SYSBIOS?

    Thanks,
    Amit Bhorania 

  • Hi Sasha Slijepcevic,

    I have described my problem of data memory model in last post. I tried a new approach and I have presented its result

    My Application + SYSBIOS + Driver library --> gives Data memory model mismatch problem

    but I tried My Application + Driver libray --> No error
    I removed SYS BIOS and included only Driver library then it needs Large Data memory model. and when i set  data memory model = large then it compiled successfully.
    This Time there is no <project>/ src  Directory in my project and there is only one makefile in <project>/ Debug/ Directory . and it contains Data memory model = large.

    This is just for checking and posted it thinking that it might help you to identify the problem in my case.

    I need to use both SYSBIOS & Driver library in my project.

    Thanks,
    Amit Bhorania 

  • Amit,
    I can see that driverlib ships with the sources, and I see there are CCS project files in the directory CCS, so I am guessing that you can rebuild it. There is also a User's Guide in doc/driverlib, which should contain instructions for rebuilding driverlib. Once you rebuild driverlib for the restricted data model, you'll be able to link with SYS/BIOS libraries.

  •  Hi Sasha Slijepcevic,

                                           Thanks for your reply. I have rebuild the driver library with restricted data memory model and its working fine with SYSBIOS. It solved my problem. Two things I can't understand is that
    1. what is difference between "large" and "restricted" Data memory model ?
    2. Why I am not able to use Inbuilt SYSBIOS's Driver library package?

    Thanks,
    Amit Bhorania 

  • Amit,
    the first question could be probably answered better in the compiler forum, but as far as I know the difference between "large" and "restricted" data model is in the instructions that the compiler generates for accessing arrays. In "restricted" data model, only arrays of up to 64K can be accessed. Because of that you can't mix that code with object files where there are no restrictions on array sizes.

    As for the second question, are you asking why Driverlib is prebuilt for "large" data model? Driverlib can be used without SYS/BIOS, and there are users who can use it without rebuilding. I hope this answers your question. 

  • Hi Sasha Slijepcevic,

                                         I got my answers but for my second question, I have already used driverlib without SYSBIOS and without rebuilding it. but when you open any SYSBIOS Project in CCS, you have .cfg file and in that we can add driverlib module in a same way we use Hwi, Task, Timer module in SYSBIOS.

                                         By my question, I mean that I dont want to include driverlib.lib file in " project properties-> MSP430 Linker -> File search Path" for SYSBIOS Project. But I want to use inbuilt driverlib module found in SYSBIOS .cfg file. Is there any way to use this module?

    Thanks,
    Amit Bhorania 

  • Amit,
    I am not aware of any SYS/BIOS module that includes driverlib. You may be talking about the module DriverLib that is delivered with msp430ware, and when you use that module, the following line is added to your script:

    var DriverLib = xdc.useModule('ti.mcu.msp430.drivers.product.DriverLib');

    Is that the module you are talking about? As far as I can tell, that module does not add driverlib.lib into the list of libraries that are linked in your app automatically, the way the SYS/BIOS libraries are added. However, you don't need to change File search path. You can right-click on the project->Add Files, and then find driverlib.lib in the file browser. When you click OK, you'll be asked if you want to link driverlib.lib to your project or copy it. You can choose which one of those works for you.

  • Yes. I was talking about this module. Thanks for your precious help and instant replies.

    Thanks,
    Amit Bhorania 

  • Despite changing the data model to 'restricted' via project settings, it keeps creating the driverlib.lib and all obj files with the large data model. I have changed the setting for debug and release configurations. 

    I get the following error

    Description Resource Path Location Type

    #16019-D file "C:\ti\ccsv5\ccs_base\msp430\msp430ware_1_25_00_30\driverlib\5xx_6xx\CCS\driverlib.lib<adc12.obj>" specifies large data memory model, which is not compatible with restricted large data memory model specified in a previous file or on the command ....

    I am using MSP430F5324 MCU with SysBIOS  and driverlib.

    Compiler version is TI v4.1.2 and outputformat is eabi(ELF)

    Silicon version is mspx

    Code model is undefined

    What data must be near is undefined

    In the target application, driverlib is included as "${workspace_loc:/driverlib/Debug/driverlib.lib}"

    Ofcourse I have cleaned and rebuilt many times. I have also given physical path to the lib instead of workspace reference.

    Am I supposed to change anything else ?

  • Hi Mohammed Lokhandwala,

                                                           I think you should delete the other files except the source file for driverlib project and rebuild it. After that link generated driverlib with of your application project. Next compile your application project and check the result. Let me know your results.

    Thanks,
    Amit Bhorania

  • Amit, No luck.

    I deleted the Debug folder completely. Deleted all the .o and .nfo outside of Debug folder leaving only the source files and the project files. Rebuilt driverlib, still same issue. Really can't figure the cause. 

  • Hi Mohammed Lokhandwala,

                                                          Have u check all the settings of driverlib project. Try to generate a driverlib with new name. In Compiler options-> Basic options-> uncheck use large data memory model option.

    Thanks,
    Amit Bhorania

  • The summary of flags shows large memory model

    -vmspx --abi=eabi --data_model=restricted -O0 -g --include_path="C:/ti/ccsv5/ccs_base/msp430/include" --include_path="C:/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30" --include_path="C:/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --define=__MSP430F5324__ --diag_warning=225 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --large_memory_model --printf_support=minimal

    I don't know where that comes from exactly or if it is a problem because restricted is also large actually.

    Here are my "Processor Options"

  • This processor options are of your driverlib project or your application project ?

    list the setting of your driverlib project......

    Thanks,
    Amit Bhorania

  • Amit,  these are from the driverlib project. However the settings in my main project are also same.

    What other settings would you like to see. 

  • Open a new project for Driverlib. and in that, what changes you did to make it work with restricted data memory model. List that changes.

    Thanks,
    Amit Bhorania

  • 1. Created a new Driverlib project from MSPWare in workspace.

    2. Project properties ->

    changed MCU to MSP430F5324

    changed compiler version to 4.1

    changed format to ealb from COFF

    changed data memory model to restricted.

    3. Cleaned, 

    4. Deleted Debug folder

    5. Rebuild all.

    6. Check the file date time for output file. driverlib.lib - all okay, current

    7. Include driverlib.lib into my project using MSP Linker - File Search Path option

    8. Clean all, rebuild project.

    9. Find error.

    Also check this, it is passing the restricted option correctly to the compiler...

    'Building file: C:/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/adc10b.c'
    'Invoking: MSP430 Compiler'
    "C:/ti/ccsv5/tools/compiler/msp430_4.1.2/bin/cl430" -vmspx --abi=eabi --data_model=restricted -O0 -g --include_path="C:/ti/ccsv5/ccs_base/msp430/include" --include_path="C:/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30" --include_path="C:/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --define=__MSP430F5324__ --diag_warning=225 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --large_memory_model --printf_support=minimal --preproc_with_compile --preproc_dependency="adc10b.pp" "C:/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/adc10b.c"
    'Finished building: C:/ti/ccsv5/ccs_base/msp430/msp430ware_1_25_00_30/driverlib/5xx_6xx/adc10b.c'
    ' '

  • Find "Use Large Data memory Model Option" in Run time model option menu or Basic options........

    It must be unchecked.....

    Let me know your findings.....

    What is your operating system and CCS Version?

  • Yes, unchecking uselargememorymodel did the trick. That was the only thing I had not been doing! Thanks Amit.

    I thought 'restricted' is also large with restrictions, but I guess not.