• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » Can I map initialized global variables to L1DSRAM/L2SRAM area?
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Can I map initialized global variables to L1DSRAM/L2SRAM area?

Can I map initialized global variables to L1DSRAM/L2SRAM area?

This question is answered
j-breeze
Posted by j-breeze
on Feb 24 2012 03:56 AM
Expert1670 points

Hi Champ,

I'm using C6742 with SYS/BIOS, and configure L1DSRAM 16kB and L2SRAM 128kB.
So, is it allowed to map initialized global variables to these areas?

Thank you very much in advance.

Best regards,
j-breeze

C674x cache SRAM
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • touse
    Posted by touse
    on Feb 24 2012 04:12 AM
    Expert1475 points

    Sure, you can use cmd file to allocate the global variable to any available space.

    Before the allocation, you may need the #pragma DATA_SECTION() to declare the sections to locate the global variables.

    BR

    Digital Signal Processing, ARM DSPs, Embedded System, Multi-core Programming

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Feb 24 2012 05:33 AM
    Expert1670 points

    touse-san,

    Thank you for your prompt reply, and I'd like to ask you a little bit more.

    I configured L1DSRAM and L2SRAM using BIOS configuration tool and checked the initialization sequence as follows:

      1)  Load and run the program
      2)  Occur a break at a point where "initialized global variables" are initialized (use hardware breakpoint)
              -> The initialization completed
      3)  Call XDStools "runtime_startup_startMod_I" function
      4)  Call SYS/BIOS "ti_sysbios_family_c64p_cache_module_startup_E" function
      5)  Occur  a break at a point where L1DCFG and L2CFG registers are accessed  (use hardware breakpoint)

    In the above sequence, L1DSRAM and L2SRAM configuration is done after "initialized global variables" initialization.
    I wonder if there is any effects on the  initialization.

    Actually I saw sometimes that the "initialized global variables" are changed after 5) L1DCFG and L2CFG registers access when I increase or decrease the number of  variables.
     
    Any information or considerations would be appreciated.

    Best regards,
    j-breeze

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • judahvang
    Posted by judahvang
    on Feb 24 2012 12:15 PM
    Verified Answer
    Verified by j-breeze
    Genius16715 points

    j-breeze,

    The state of the device after reset is L1D 32KB Cache and L2 0KB Cache.  If you want some of L1D to be RAM, you can do that with some caution.
    The call sequence you stated above is correct.  This could be a problem,  namely, the L1D is not changed from Cache to RAM until the Cache startup function is called.
    This could mean that some portions of L1D that you initialized as RAM could have been used as Cache and trashed your RAM data.

    I do think there's a hole here which needs to be addressed by SYSBIOS.  For now what you can do do minimize this is the following:

    In your *.cfg file:

    var Reset = xdc.useModule('xdc.runtime.Reset');
    Reset.fxns[Reset.fxns.length++] = "&nameYourFxn";

    Then in your *.c file:

    #include <ti/sysbios/family/c64p/Cache.h>

    Void nameYourFxn()
    {
        Cache_Size size;

        size.l1pSize = Cache_L1Size_32K;
        size.l1dSize = Cache_L1Size_16K;
        size.l2Size = Cache_L2Size_128K;

    } 

    This will call your fxn earlier in the sequence to change the cache sizes before the cinit processing.

    Judah

    If my reply answers your question please mark the thread as answered

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Nikolay Kokorin
    Posted by Nikolay Kokorin
    on Feb 25 2012 12:17 PM
    Intellectual875 points

    You forgot to apply the cache settings

    Void nameYourFxn()
    {
        Cache_Size size;

        size.l1pSize = Cache_L1Size_32K;
        size.l1dSize = Cache_L1Size_16K;
        size.l2Size = Cache_L2Size_128K;

        Cache_setSize(&size);

    } 

    ps: what does this mean (in bold font)?

    Reset.fxns[Reset.fxns.length++]

    Sorry for my English :-)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Feb 29 2012 19:51 PM
    Expert1670 points

    Judah-san, Nikolay-san,

    Thank you so much for your suggestions.
    I'will Chek it a.s.a.p.

    Best regards,
    j-breeze

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Mar 21 2012 04:56 AM
    Expert1670 points

    Hi Judah-san,

    Could you please help me with building the code that you suggested before?

    I use SYS/BIOS v6.21.03.21 and C6000 CGTools v6.1.15. My code is the following:

      - *.cfg file

        var xdc_runtime_Startup = xdc.useModule('xdc.runtime.Startup');
        xdc_runtime_Startup.resetFxn = "&nameMyFxn";

      - *.c file

        #include <ti/sysbios/family/c64p/Cache.h>

        Void nameMyFxn()
        {
            Cache_Size size;

            size.l1pSize = Cache_L1Size_32K;
            size.l1dSize = Cache_L1Size_16K;
            size.l2Size = Cache_L2Size_128K;

            Cache_setSize(&size);
        } 

    Then, I built and got three error messages below.

        - identifier "Cache_L1Size_16K" is undefined
        - identifier "Cache_L1Size_32K" is undefined
        - identifier "Cache_L2Size_128K" is undefined

    I'd like to know what I shoud do.
    I'm sorry to bother you, but I'm beginner of bios6.

    Thanks in advance for your cooperation.

    Best regards,
    j-breeze 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Nikolay Kokorin
    Posted by Nikolay Kokorin
    on Mar 21 2012 09:36 AM
    Intellectual875 points

    Hi,

    I think you use a target or platform which this symbols undefined. 

    Try to use some others.

    Regards, Nikolay

    Sorry for my English :-)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Mar 21 2012 12:19 PM
    Genius15150 points

    j-breeze,
    can you post all #includes at the top of your file? There could be a problem there caused by the order of different includes. Can you also try to use ti_sysbios_family_c64p_Cache_L1Size_16K just to verify that the long names for constants still work?

    Thanks,
    Sasha

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Mar 21 2012 23:33 PM
    Expert1670 points

    Nikolay-san,  Sasha-san,

    Thank you so much for your advices.
    I tried the other target, the order of different includes and the long name, but still got the same error messages.

    So, I'd like to post my c code, build options and tools I use. 
    Any suggestions and advices would be appreciated.

    - My c source code (based on "Hello Example" of RTSC configuration template)

        #include <xdc/std.h>
        #include <xdc/runtime/System.h>

        #include <ti/sysbios/family/c64p/Cache.h>

        Void CacheInitFxn()
        {
            Cache_Size size;

            size.l1pSize = Cache_L1Size_32K;
            size.l1dSize = Cache_L1Size_16K;
            size.l2Size = Cache_L2Size_128K;

            Cache_setSize(&size);
        }

        Void main()
        {
            System_printf("hello world\n");
        }

    - Additinal code to common.cfg

        var xdc_runtime_Startup = xdc.useModule('xdc.runtime.Startup');
        xdc_runtime_Startup.resetFxn = "&CacheInitFxn";

    - Copiler options

        -mv6740
        -g
        --include_path="<INST_DIR>/C6000 Code Generation Tools 6.1.15"
        --include_path="<INST_DIR>/bios_6_21_03_21/packages"
        --include_path="<INST_DIR>/xdctools_3_16_05_41/packages"
        --diag_warning=255

    - Linker options

        -z
        --warn_sections
        -i"<INST_DIR>/C6000 Code Generation Tools 6.1.15/lib"
        -i"<INST_DIR>/C6000 Code Generation Tools 6.1.15/include"
        --reread_libs
        --rom_model

    - XDCtools options

        --xdcpath="<INST_DIR>/bios_6_21_03_21/packages;"
        xdc.tools.configuro
        -o "configPkg"
        -t ti.targets.C674
        -p ti.platforms.evm6747
        -r whole_program_debug
        -c "<INST_DIR>/C6000 Code Generation Tools 6.1.15"

    - Using tools

        - CCS v4.1.3.00038
        - C6000 CGTools v6.1.15
        - SYS/BIOS v 6.21.03.21
        - XDC Tools v3.16.05.41

    Best regards,
    j-breeze

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Mar 22 2012 17:41 PM
    Genius15150 points

    Can you try the following:
    - click on Project->Properties->CCS Build->C6000 Compiler->Parser Preprocessing Options.
    - set Mode to "manual" and turn on the last option "Preprocess only; maintain line directives", and rebuild your project
    - that will generate a file with the extension .pp in the top project directory. Please post that file.

    Then,
    - go to the same option window and turn off  "Preprocess only; maintain line directives"
    - in the box for the option "Generate list of pre- user-defined macros", type "../hello.ppm", and rebuild your project
    - that will generate a file hello.ppm in the top project directory. Please post that file too.

    Thanks,
    Sasha

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Mar 22 2012 22:49 PM
    Expert1670 points

    Sasha-san,

    Thank you for your suggestions.

    I'd like to post the files nemed hello.pp(hello_pp.txt) and hello.ppm(hello_ppm.txt) below.
    Could you please check  them out?

    Thank you very much in advance for your cooperation.

    - hello.pp

        8446.hello_pp.txt

    - hello.ppm

        4527.hello_ppm.txt

    Best regards,
    j-breeze

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Mar 23 2012 13:10 PM
    Genius15150 points

    j-breeze,
    at the bottom of the first file you posted, the lines that caused the errors are different from what's in your post:
    size.l1pSize = Cashe_L1Size_32K;
    size.l1dSize = Cashe_L1Size_16K;
    size.l2Size  = Cashe_L2Size_128K;

    You have Cache spelled as Cashe.

    Please verify that your code looks like this:

    size.l1pSize = Cache_L1Size_32K;
    size.l1dSize = Cache_L1Size_16K;
    size.l2Size  = Cache_L2Size_128K;

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • j-breeze
    Posted by j-breeze
    on Mar 26 2012 01:18 AM
    Expert1670 points

    Sasha-san,

    I really must apologize for my careless mistakes in the spell.  And I thank you very much for  your kindly supoort.
    I verified and re-build my code, however I got another error message below.


      - In "Problems" tab

          unresolved symbol _ti_sysbios_family_c64p_Cache_setSize__E, first referenced in ./hello.obj

      - In "Console" tab

          <Linking>

            undefined                                                                    first referenced
               symbol                                                                            in file
            ---------------                                                                  -----------------
            _ti_sysbios_family_c64p_Cache_setSize__E    ./hello.obj

          error:  unresolved symbols remain
          error:  errors encountered during linking;


    I'm very sorry for the inconvenience which it might have caused in spending your time, but I'd like to post the hello.pp (hello.ppm was not generated).
    I would appreciate it if you could check it again.

      - hello.pp

          8814.hello_pp.txt

    Best regards,
    j-breeze

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Slijepcevic
    Posted by Sasha Slijepcevic
    on Mar 26 2012 14:41 PM
    Genius15150 points

    You are most likely missing a statement in your config script that includes a Cache module. Do you have
    xdc.useModule("ti.sysbios.hal.Cache");
    somewhere in your CFG script? If you don't try adding it and rebuilding.

    When you use a module in your C code, you have to declare in the CFG script that you are using it, and then the config will generate the required data and functions. It may look incorrect that you are using ti.sysbios.family.c64p.Cache in your C code and ti.sysbios.hal in your CFG script, but the reasoning behind it is that ti.sysbios.hal is a generic cache module that will load the correct cache module for your device, in this case ti.sysbios.family.c64p.Cache. By doing so, you won't need to change the config script if you switch to another device or architecture.

     

    If my reply answers your question please mark the thread as answered.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use