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.

LAUNCHXL-F280025C: Code in FLASH memory does not run.

Part Number: LAUNCHXL-F280025C
Other Parts Discussed in Thread: C2000WARE,

I did small customization to my linker file (.cmd) because I was running out of RAM. Now I am putting some parts of the code in the FLASH memory as is indicated in the SECTION of the linker file:

MEMORY
{
   BEGIN           	: origin = 0x000000, length = 0x000002
   BOOT_RSVD        : origin = 0x00000002, length = 0x00000126
   RAMM0            : origin = 0x00000128, length = 0x000002D8
   RAMM1            : origin = 0x00000400, length = 0x000003F8     /* on-chip RAM block M1 */
// RAMM1_RSVD       : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
   
/* RAMLS4           : origin = 0x0000A000, length = 0x00000800
   RAMLS5           : origin = 0x0000A800, length = 0x00000800
   RAMLS6           : origin = 0x0000B000, length = 0x00000800
   RAMLS7           : origin = 0x0000B800, length = 0x00000800 */

   /* Combining all the LS RAMs */
   RAMLS4567        : origin = 0x0000A000, length = 0x00002000
   RAMGS0           : origin = 0x0000C000, length = 0x000007F8
// RAMGS0_RSVD      : origin = 0x0000C7F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
   
   RESET            : origin = 0x003FFFC0, length = 0x00000002

   // FLASHBANK1       : origin = 0x00080000, length = 0x00010000
   /* Flash sectors */
   /* BANK 0 */
   FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x000FFE
   FLASH_BANK0_SEC1  : origin = 0x081000, length = 0x001000
   FLASH_BANK0_SEC2  : origin = 0x082000, length = 0x001000
   FLASH_BANK0_SEC3  : origin = 0x083000, length = 0x001000
   FLASH_BANK0_SEC4  : origin = 0x084000, length = 0x001000
   FLASH_BANK0_SEC5  : origin = 0x085000, length = 0x001000
   FLASH_BANK0_SEC6  : origin = 0x086000, length = 0x001000
   FLASH_BANK0_SEC7  : origin = 0x087000, length = 0x001000
   FLASH_BANK0_SEC8  : origin = 0x088000, length = 0x001000
   FLASH_BANK0_SEC9  : origin = 0x089000, length = 0x001000
   FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
   FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
   FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
   FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
   FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
   FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x000FF8
// FLASH_BANK0_SEC15_RSVD : origin = 0x08FFF0, length = 0x000010  /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */

   BOOTROM          : origin = 0x003F0000, length = 0x00008000
   BOOTROM_EXT      : origin = 0x003F8000, length = 0x00007FC0
}


SECTIONS
{
   .text            : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4,   ALIGN(8)
   .TI.ramfunc      : > RAMM0
   .cinit           : > RAMM0
   .switch          : > RAMM0
   .reset           : > RESET,                  TYPE = DSECT /* not used, */
   .cio             : > RAMGS0
   codestart        : > BEGIN

   .stack           : > RAMM1
#if defined(__TI_EABI__)
   .bss             : > RAMLS4567
   .bss:output      : > RAMLS4567
   .init_array      : > RAMM0
   .const           : > FLASH_BANK0_SEC1,  ALIGN(8)
   .data            : > RAMLS4567 | RAMGS0
   .sysmem          : > RAMLS4567
#else
   .pinit           : > RAMM0
   .ebss            : > RAMLS4567
   .econst          : > RAMGS0
   .esysmem         : > RAMLS4567
#endif

    ramgs0 : > RAMGS0

    /*  Allocate IQ math areas: */
   IQmath           : > RAMLS4567 | RAMGS0
   IQmathTables     : > RAMLS4567 | RAMGS0
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/

The problem I am having the code Is not working. When I was loading everything to the RAM it worked without a problem but now that part of the code is being allocated in the FLASH my firmware is not working.

I guess I am missing something but I do not know what is it. If I use the linker file provided by TI for this board I have the same result and my applications do not work.

Do you know what am I missing that is preventing my code from working?

  • Wilson,

    Flash tools and kernels (TI or 3rd party) are developed for fully embedded applications only.  When you want to load your application to flash, all of the initialized sections in the linker cmd file should be mapped to flash only.  Flash tools do not guarantee loading to RAM.   

    I would suggest to take a look at the examples provided in the C2000Ware.  You can choose flash build configuration for the examples.

    Please take a look at this FAQ: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/878674/faq-flash---how-to-modify-an-application-from-ram-configuration-to-flash-configuration 

    Thanks and regards,
    Vamsi

  • Vamsi,

    Thanks for your response. In the link that you provide me, it says "To change the build configuration from RAM to Flash, users can import the project into CCS and right-click on the project and select 'Build Configurations' -> 'Set Active' -> 'Flash'.", but the only options I have following this procedure is either 'Debug' or 'Release' so I cannot select the Flash.

    Am I missing something that does not allow me to select the FLASH memory?

    Regards,

    Wilson

  • Wilson,

    Which C2000Ware version are you using? And which example? Please provide the path.

    Thanks and regards,
    Vamsi

  • Vamsi,

    The version of the C2000Ware is 3.04.00.00 but I am working in port our application from another MCU brand, so I am not working with a TI example. Also trying some C2000Ware examples in the LAUNCHXL-F280025C I don't know how to keep the application running. As soon as I unplug the board and plug it again it seems like the program erases or doesn't keep in the memory.

  • Wilson,

    I would suggest to take a look at a C2000Ware example like led_ex1_blinky at C:\ti\c2000\C2000Ware_x_xx_xx_xx\driverlib\f28002x\examples\led 

    Choose the flash build config as suggested in FAQ and execute step by step to understand the flow.

    Regarding the application not executing after power cycle:  Make sure the boot mode pins are configured for flash boot.

    Thanks and regards,

    Vamsi

  • Vamsi,

    Which FAQ should I review?

    Properties --> Configuartion

    As you can see in Properties -> Configuration I only have the option to pick either Debug or Release. In the led_ex1_blinky example, you have different options that I do not have on mine.

    Do you know why is that?

    Thanks,

    Wilson

  • Wilson,

    This is the FAQ that I shared earlier with you: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/878674/faq-flash---how-to-modify-an-application-from-ram-configuration-to-flash-configuration 

    Let me check with our team on why the flash build configurations are not provided.

    Meanwhile, you can go through the blinky example's flash build configuration example.

    Thanks and regards,
    Vamsi

  • HI Wilson,

    I see that most examples in the C2000ware has separate RAM and Flash configuration for both ControlCard and Launchpad.

    May I know which example you are referring to?

    Regards,

    Veena

  • Veena,

    I am not referring to a specific example. I followed the guidance that Vamsi gave me about the blinky example, and it is working. The problem is that we are porting a stand-alone application from another MCU brand. That porting process is fairly advanced at this point, but we are having trouble with things like this. The TI examples work well, but it does not make sense that to build a new project you have to copy one TI example as a start point, other ways you don't have an explanation of how things like RAM or FLASH are setting up.


    We created a new project in Code Composer Studio, and we are using the 28002x_generic_flash_lnk.cmd linker file to boot from the FLASH, but as soon as I unplug the board and plug it again, it seems like the program is not booting. We are using the LAUNCHXL-F280025C only for prototyping, so we want to be able to have a completely different configuration than the one this board has.
    I hope you can help me with that.

    Regards,

    Wilson

  • Hi Wilson,

    Few things to take care :

    - Check if the bootpins are configured correctly

    - Check if the .text, .const, .cinit are loaded to Flash regions

    - Check if the Flash module is initialized (Flash_initModule function) and incase you are using ramfuncs, make sure the code is copied from Flash to RAM.

    - Check if BEGIN memory is mapped at 0x80000 and the code_satrt section is correctly loaded at this memory

    - Check if you have watchdog disabled at code_start (WD_DISABLE  .set  1 in f28002x_codestartbranch.asm

    Regards,

    Veena

  • Veena,

    I am not sure how to "check if the boot pins are configured correctly". Where can I find an example of this configuration?

    How can I "check if you have watchdog disabled at code_start"? Do I need to include the f28002x_codestartbranch.asm file in my project? Do I need to modify this file?

    Thanks for your help,

    Wilson

  • Wilson,

    1) Boot pin configuration:  Please look at 4.3 Device Boot Modes in TRM https://www.ti.com/lit/pdf/spruin7 

    2) Regarding the Watchdog disable and codestartbranch.asm:  Below is copied from the FAQ that I shared above in my earlier replies in this post. 

       (b) Disable watchdog in the f28x_codestartbranch.asm (WD_DISABLE  .set  0; should be replaced with WD_DISABLE  .set  1; in this asm file).  This helps to avoid watchdog reset before reaching main().  If there are lot of global variables in the application, the cinit routine may take more time to initialize all of them before reaching main.  During this time, watchdog may expire and hence suggested to disable it.  You can enable it again in the main() as needed by your application. 

              Note: If you don't have many global variables, above watchdog disable suggestion is not applicable.

       (c) Please make sure that f28x_codestartbranch.asm file is included in your application and that the codestart is mapped to the flash entry point location (generally defined as BEGIN in TI provided linker CMD files) in the linker cmd file.

             Note: In the FAQ, I explained what codestartbranch.asm does and why it is important to include in your project.

    Thanks and regards,

    Vamsi

  • Vamsi,

    Thank you so much. After including the .asm file the firmware is now booting from the FLASH after reset.