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.

CCS/LAUNCHXL-F28377S: Problem writing code to flash

Part Number: LAUNCHXL-F28377S


Tool/software: Code Composer Studio

I'm having a problem while using the CPU1_FLASH configuration for the F28377S.

When I compile my code and write it to the RAM of the MCU, everything executes as expected. However, trying to write the code to flash results in my program running into the weeds.

The code executes as expected up to memory adress 0x0823a7

0823a7:   0203        MOVB         ACC, #3
0823a8:   76408131    LCR          SysCtl_delay
235         // Don't proceed to the PLL initialization if an MCD failure is detected.
0823aa:   7622        EALLOW  

from there it jumps to

3fe493:   7625        ESTOP0      

The corresponding assembler code for the RAM configuration looks like this

000322:   0203        MOVB         ACC, #3
000323:   7640013C    LCR          SysCtl_delay
235         // Don't proceed to the PLL initialization if an MCD failure is detected.
000325:   7622        EALLOW 

and executes without trouble.

The C-Code in question is

    //
    // Check the arguments.
    //
    ASSERT((config & SYSCTL_OSCSRC_M) != SYSCTL_OSCSRC_M); // 3 is not valid

    //
    // Don't proceed to the PLL initialization if an MCD failure is detected.
    //
    if(SysCtl_isMCDClockFailureDetected())

and belongs to the file sysctl.c which is provided in the f2837xs driverlib.

Does anyone have an idea on what is going on here?

Best regards,

Patrick Stiller

  • Hi Patrick,

    The error is due to the non-availability of 'SysCtl_delay' function code in CPU1_FLASH configuration.
    In RAM configuration, SysCtl_delay is located in a RAM section.
    In FLASH configuration, the code should have been copied to a RAM location.

    Can you please check if the following code is getting executed as part of device initialization?

    --> memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    If the above code gets executed the ram functions gets copied to 0x8000.
    In your case, the memory location(0x8000) might be filled with 0's. Please check the memory location 0x8000 - 0x8800 once.

    Note: The code will get enabled if the symbol '_FLASH' is defined in the CCS project properties -> 'Predefined Symbols'.

    Thanks,
    Katta
  • Thank you for the quick reply.

    It turned out I tried to executed the memcpy command after trying to initialize the clock. Moving the code so it executed before the clock initialization resolved the issue.