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.

Trying to get our F28069 code into FLASH (using CCS v5.4.0.00091), but spra958l is missing some crucial information

Other Parts Discussed in Thread: CONTROLSUITE

As background info, we bypassed the daunting task of building a project by taking an existing example (Example_2806xCpuTimer), gutting it, and adding our code to it. All went well until it became time to run from FLASH.

TI pointed us to spra958l (a .pdf and a collection of example code) to learn how to get our code into FLASH. So far, we have spent more time on this task (without success) than we have on our power converter (running successfully, but under emulation).

I have read most of the document three times (!), and walked through the "nonBIOS" example code for the F28069 for both the RAM and the FLASH examples.

The only difference (nonBIOS RAM versus FLASH) between the spra958l source directories is in DelayUs.asm: a different constant for a NOP delay loop (78 versus 68).

Since the examples' RAM and FLASH .cmd files were so similar, we chose to modify a copy of the example RAM .cmd file to work with our project, and once that was done, to apply the appropriate changes to a copy of the example FLASH .cmd file.

The only change that we ended up making to the FLASH .cmd file was to have .ebss point to L8DPSARAM because our code has some big arrays.

spra958l.pdf's page 14 instructed us to add to the .cmd file a SECTIONS entry for secureRamFuncs. There was already an entry, though some parts varied because the MEMORY names differred between the spra958l.pdf text and the actual example files.

spra958l.pdf's page 14 also instructed us to add to the beginning of our main() some externs, a memcpy() to copy secureRamFuncs_loadsize words of code from secureRamFuncs_loadstart to secureRamFuncs_runstart, and then call InitFlash().

spra958l.pdf told us about CodeBranchStart.asm. We put the example's copy into our source directory, only to find a conflict due to one in the controlSUITE, so we removed it.

spra958l.pdf says that "The codestart section should be placed in memory with the user linker command file." It was unclear how to do so, but our linker output shows a F2806x_CodeStartBranch.obj, so it would appear that it has made it into the code.

Are we done? Apparently not, as the board doesn't run from FLASH, and the linker reports the following two warnings:

=====================================

"C:/ti/ccsv5/tools/compiler/c2000_6.1.4/bin/cl2000" -v28 -ml -mt --cla_support=cla0 --float_support=fpu32 --vcu_support=vcu0 -g --define="_DEBUG" --define="LARGE_MODEL" --quiet --verbose_diagnostics --diag_warning=225 --issue_remarks --output_all_syms --cdebug_asm_data -z --stack_size=0x200 -m"Example_2806xCpuTimer.map" --warn_sections -i"C:/ti/ccsv5/tools/compiler/c2000_6.1.4/lib" -i"C:/ti/ccsv5/tools/compiler/c2000_6.1.4/include" -i"C:/ti/controlSUITE/device_support/f2806x/v130/F2806x_common/lib" -i"C:/ti/controlSUITE/libs/math/IQmath/v15c/lib" -i"C:/ti/controlSUITE/libs/math/FPUfastRTS/v100/lib" --reread_libs --priority --verbose_diagnostics --issue_remarks --xml_link_info="Example_2806xCpuTimer_linkInfo.xml" --entry_point=code_start --rom_model -o "Example_2806xCpuTimer.out" -l"rts2800_fpu32_fast_supplement.lib" -l"rts2800_fpu32.lib" "./src/spi.obj" "./src/sm.obj" "./src/serial.obj" "./src/powertracker.obj" "./src/main.obj" "./src/led.obj" "./src/interrupt.obj" "./src/dsp.obj" "./src/calc.obj" "./src/Passwords.obj" "./F2806x_usDelay.obj" "./F2806x_SysCtrl.obj" "./F2806x_PieVect.obj" "./F2806x_PieCtrl.obj" "./F2806x_GlobalVariableDefs.obj" "./F2806x_DefaultIsr.obj" "./F2806x_CpuTimers.obj" "./F2806x_CodeStartBranch.obj" "./F2806x_Adc.obj" -l"IQmath_fpu32.lib" "../F28069_nonBIOS_flash.cmd" "C:/ti/controlSUITE/device_support/f2806x/v136/F2806x_headers/cmd/F2806x_Headers_nonBIOS.cmd"
warning: creating output section "ramfuncs" without a SECTIONS specification
warning: entry-point symbol other than "_c_int00" specified: "code_start"
'Finished building target: Example_2806xCpuTimer.out'

=====================================

Earlier, we (and from the forums, some others) were told not to worry about the "entry-point symbol" symbol warning, but the other warning was an obvious concern.

After some digging, we looked at the 'init' functions for the DSP in the controlSUITE, and apparently, some of them must be run from RAM, and it became evident that the example files on which we based our work used their own versions of these functions (which apparently must not have the same requirements), ramfuncs is never referenced.

Unfortunately, ramfuncs is never mentioned in spra958l.pdf, and we cannot quite figure out what simple changes (if any) must be made to either our .cmd file, and what simple changes (if any) must be made to our code in order to copy this ramfuncs section from FLASH to RAM (apparently before calling InitFlash, but we are also unsure of that).

After reading nearly one-hundred forum entries, the best-looking resource was provided by another F28069 user, but he was in the forum because he too was unable to get it to work.

Please give us this information, or at least, please point us in the direction of an example that uses the controlSUITE (as do the many example projects available from the Project Explorer).

During the previously mentioned digging through the controlSUITE code whose functions we call, the following discoveries were also made:

=====================================

In F2806x_SysCtrl.c:

// Functions that will be run from RAM need to be assigned to
// a different section. This section will then be mapped to a load and
// run address using the linker cmd file.
//
// *IMPORTANT*
// IF RUNNING FROM FLASH, PLEASE COPY OVER THE SECTION "ramfuncs" FROM FLASH
// TO RAM PRIOR TO CALLING InitSysCtrl(). THIS PREVENTS THE MCU FROM THROWING
// AN EXCEPTION WHEN A CALL TO DELAY_US() IS MADE.

#pragma CODE_SECTION(InitFlash, "ramfuncs");

=====================================

In F2806x_Adc.c:

// NOTE: ADC INIT IS DIFFERENT ON F2806x DEVICES COMPARED TO OTHER 28X DEVICES
//
// *IMPORTANT*
// IF RUNNING FROM FLASH, PLEASE COPY OVER THE SECTION "ramfuncs" FROM FLASH
// TO RAM PRIOR TO CALLING InitSysCtrl(). THIS PREVENTS THE MCU FROM THROWING
// AN EXCEPTION WHEN A CALL TO DELAY_US() IS MADE.

Note that there is no #pragma in F2806x_Adc.c. Why? How does it work?

=====================================

In F2806x_usDelay.asm:
;// *IMPORTANT*
;// IF RUNNING FROM FLASH, PLEASE COPY OVER THE SECTION "ramfuncs" FROM FLASH
;// TO RAM PRIOR TO CALLING InitSysCtrl(). THIS PREVENTS THE MCU FROM THROWING AN EXCEPTION
;// WHEN A CALL TO DELAY_US() IS MADE.
;//
.def _DSP28x_usDelay
.sect "ramfuncs"

=====================================

Should there be a #pragma in F2806x_Adc.c? If not, why not? If yes, should we actually change the controlSUITE code? That does not seem like a good idea.

Is the spra958l .cmd file (that we have slightly modified) compatible with the functions in controlSUITE?

And finally, what is the difference between ramfuncs (in the controlSUITE) and secureRamFuncs (in spra958l)?

Surely, we are not the first team to run into this problem. Please provide us with the necessary information, or point us to a resource that gets us in the right direction.

Thanks -- Mark

  • Hi Mark!

    Mark Walsh1 said:

     warning: creating output section "ramfuncs" without a SECTIONS specification

    warning: entry-point symbol other than "_c_int00" specified: "code_start"

    Regarding warning #1

    If you apply copying some code from Flash to RAM, then you need the following:

    1) main.c:

    #pragma CODE_SECTION(some_isr1, "ramfuncs");

    #pragma CODE_SECTION(some_isr2, "ramfuncs");

    __interrupt void some_isr1(void);
    __interrupt void some_isr2(void);

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadSize;
    extern Uint16 RamfuncsRunStart;

    void main(void)
    {

    ...............................some initialization code

    memcpy((uint16_t *)&RamfuncsRunStart,(uint16_t *)&RamfuncsLoadStart, (unsigned long)&RamfuncsLoadSize);

    InitFlash();

    ................................some code

    }

    __interrupt void some_isr1(void)

    {

    ............................

    }

    __interrupt void some_isr2(void)

    {

    ..............................

    }

    2) command linker file (*.CMD):

    ..............................................

    SECTIONS
    {

    /* Allocate program areas: */
    .cinit : > FLASHA PAGE = 0
    .pinit : > FLASHA, PAGE = 0
    .text : > FLASHA PAGE = 0
    codestart : > BEGIN PAGE = 0
    ramfuncs : LOAD = FLASHD,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    ..................................................

    This is only example. Also refer please to this AR 8836.Copying Compiler Sections From Flash to RAM.pdf

    Regarding warning #2

    You can refer to this link http://processors.wiki.ti.com/index.php/C28x_Compiler_Error_and_Warning_Messages#Warning:_entry-point_symbol_other_than_.22_c_int00.22_specified:_.22code_start.22

    Regards,

    Igor

  • Mark,

    The first problem that I see is that your linker cmd file does not appear to have a SECTION for ramfuncs.  If no SECTION is assigned to code, the linker will choose where to put it and will often choose badly.  In addition, this particular case is odd anyway: we want the linker to store ramfuncs in flash (done by the linker) and then copy it over to ram (done by memcopy but location is chosen by the linker) pretty quickly after code starts executing.  The .cmd file should be edited as Igor suggests.

    Also, note that some of our example projects define a symbol "FLASH" in the project itself if the FLASH configuration is made active (right-click the project and then look at the Predefined Symbols section).  This can be a hidden source of frustration if you don't see that it's being done.  If you are using a RAM project as the foundation for your software, it may be worthwhile to look into this. 

    I think the above two notes should get you further on your way.   At the very least the SECTIONs warning should go away. The first step should be to be have a project which is running in flash but connected to and started by the debugger.  After this you'll want to try to get the software to run stand-alone.


    Thank you,
    Brett