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.

Usage of TI's flash library (with boot mode == "run to flash")

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Hello from Ubstadt, Germany,

currently, I'm developing a boot loader which is intended to be used instead of
TI's ROM boot loader (boot mode: "run to flash"), in order to simplify updating
the application, so that this procedure easily can be carried out by the final customer.

The bootloader shall use TI's flash library which comes along with TI's CCS software
in folder
   ...\ti\controlSUITE\libs\utilities\flash_api\2806x\v100a\...


------------------------------------------------------------------------------------------
When the boot ROM is skipped ("boot to flash"), 2 questions arise:   
-------------------------------------------------------------------------------------------

A)  From reading "Flash2806x_API_Readme.pdf", it's not readily clear, whether
      
   CopyMem ( &Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart );
      
   1.) must be called  INSTEAD OF -- OR 2.)  IN ADDITION TO
   
   CopyMem ( &RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart );   
      
   What is correct??
   
   
B) Is it correct, that after initialialization and these copies to RAM, the API functions can be called without further
preparation, such as defining own function pointers etc. ...?



Thanks in advance and best regards,
Goetz

  • Hi Goetz,

    Have you already looked at the F2806x Flash_API example within C2000ware?

    C:\ti\c2000\C2000Ware_1_00_06_00\libraries\flash_api\f2806x\Example_Flash2806x_API

    CopyMem ( &Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart );

    In the example, the above is used when copying the flash_API from Flash.

    CopyMem ( &RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart );

    As opposed to the above being used when copying the flash_API from the BootROM.

    This can better be seen within the linker command file of the example:

    /* Allocate program areas: */
       /* The Flash API functions can be grouped together as shown below.
          The defined symbols _Flash28_API_LoadStart, _Flash28_API_LoadEnd
          and _Flash28_API_RunStart are used to copy the API functions out
          of flash memory and into SARAM */
    
    /******************************************************************/
    /* For Piccolo we dont need to copy the API from Flash as it is */
    /* present in BOOT ROM											  */
    /******************************************************************/
    /*   Flash28_API: // Applicable only when API is not in BootROM
       {
            -lFlash2802x_API_V100a.lib(.text)
       }                   LOAD = FLASHD, 
                           RUN = PRAML0,  
                           LOAD_START(_Flash28_API_LoadStart),
                           LOAD_END(_Flash28_API_LoadEnd),
                           RUN_START(_Flash28_API_RunStart),
                           PAGE = 0
    */ 
       .cinit              : > FLASHA       PAGE = 0
       .pinit              : > FLASHA,      PAGE = 0
       .text               : > FLASHA       PAGE = 0
       codestart           : > BEGIN        PAGE = 0
       ramfuncs            : LOAD = FLASHA, 
                             RUN = PRAML0, 
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

    Please make sure you also use #pragma before calling flash_API functions so that they run from RAM, like below from the example:

    #pragma CODE_SECTION(Example_CallFlashAPI,"ramfuncs");

    Hope this helps,

    Kevin

  • Hello Kevin,
    first, thanks for your reply!
    Unfortunately, my CCS installation contains controlSUITE
  • Sorry, my last reply was nonsense, so again:

    Hello Kevin,

    first, thanks for your reply!

    Unfortunately, my CCS (V. 8.2.0) installation contains controlSUITE instead of C2000Ware.

    Moreover, I must state that I'm really not yet familiar with the CCS - Environment, so there's a lot of things being hard to interpret.

    And I'm not familiar with TI's linker cmd files...

    But --  if I understood you right -- I should use the call:

          "CopyMem ( &Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart ); "

    instead of (??????)

         "CopyMem ( &RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart );"

    when I use the flash library in C: \ti\controlSUITE\libs\.  

    About the the linker file as pasted (in part) at bottom:

    The green portion had been commented in the original file; I uncommented it, since we don't use the
    bootROM-API but the library's API.
    The black part wasn't commented. I don't know for sure what to do with it,
    since I don't really understand how  the cited  pragma

       #pragma CODE_SECTION(Example_CallFlashAPI,"ramfuncs");

    works together with the black linker file entry below.

    For instance, in our program, there is an additional function (in assembly) that establishes a label in the "ramfuncs" section:

    ========= citation: ==============================

          .def _DSP28x_usDelay
           .sect "ramfuncs"

            .global  __DSP28x_usDelay
    _DSP28x_usDelay:
            SUB    ACC,#1
            BF     _DSP28x_usDelay,GEQ    ;; Loop if ACC >= 0
            LRETR
    ==============================================

    Would the above pragma statement add a further label "__Example_CallFlashAPI" to section "ramfuncs"?
    Or what else happens?

    So far for the moment, best regards

    Goetz

    ==================== Linker file extract ==========================================

    [Could not be attached: (apparently, attaching/inserting a file does not work correctly)].

     

    // Flash28_API: Added according to example linker-cmd: Example_Flash28069_API.cmd
    SECTIONS
    {

       Flash28_API: // Applicable only when API is not in BootROM
       {
            -lFlash2802x_API_V100a.lib(.text)
       }                   LOAD = FLASHD,
                           RUN = PRAML0,
                           LOAD_START(_Flash28_API_LoadStart),
                           LOAD_END(_Flash28_API_LoadEnd),
                           RUN_START(_Flash28_API_RunStart),
                           PAGE = 0

       /* Allocate program areas: */
       .cinit              : > FLASHA,     PAGE = 0
       .pinit              : > FLASHA,     PAGE = 0
       .text               : > FLASHA,     PAGE = 0
       codestart           : > BEGIN,      PAGE = 0

     //  ramfuncs            : > RAMM0,      PAGE = 0

       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML4,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             PAGE = 0

    ...

    ...

  • Hi Goetz,

    The ControlSuite (v100a) and c2000ware example and Flash API library look to be the same. However I'd still suggest downloading the latest C2000ware at some point since it will be actively updated going forward.

    You should MemCopy both Ramfuncs and the Flash28_API actually. Ramfuncs would be used for functions that need to be run from RAM, but are not necessarily the Flash API functions.

    By default the example is configured to use/copy the Flash API from the BootROM, but can be configured to use/copy the Flash API from Flash by changing the build configuration. Follow the below steps, the example and files should be able to answer all your questions:

    Right click the project name in the 'Project Explorer' --> Scroll over 'Build Configurations' --> Scroll over 'Set Active' --> select 'Use_SW_API

    This will configure the example accordingly, using the linker command file 'Example_Flash2806x_SW_API.cmd' and altering the 'Example_Flash2806x_API.c' file somewhat (see' #ifdef SW_API').

    Hope this helps,

    Kevin

  • Hi Kevin,

    just tried your suggestion with my project, but it doesn't yield a 'Use_SW_API' entry in
    the 'Build config/Set Active' menu.
    So, I'll try it with one of the example projects of 'controlSuite'.
    But it is late now (16:30) in Germany and I'll continue tomorrow.

    I assume you reside in USA, so possibly we'll have no more occasion to communicate
    tomorrow -- due to time shift -- before I'll be in vacation until Jan, 07th.

    So, I wish happy xmas and a fine new year in advance!
    Regards, Goetz
  • Hi Goetz,

    Make sure you're using the v100a example if using ControlSuite. You might need to update your version if it still doesn't appear.

    C:\ti\controlSUITE\libs\utilities\flash_api\2806x\v100a\Example_Flash2806x_API

    That's correct. Thanks Goetz, you have the same! Going to close this thread for the time being, feel free to post once you get back.

    Best,

    Kevin

  • Hi once again,

    ...you were right: When using the example project, the pertaining menu entry appears and
    -- after build -- the matching linker file can be checked in order to see what's missing or wrong in my project's
    linker file.

    Thanks a lot and have fine vacancies -- if you have --
    Goetz