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.

Unable to Write to (most of) Flash on EK-TM4C129XL Launchpad

Other Parts Discussed in Thread: EK-TM4C1294XL

Hello All,

I have recently unboxed a new EK-TM4C1294XL Launchpad. I have successfully been able to load on the simple example programs provided through TivaWare. However, when I tried to load an example TI-RTOS project (the basic hello world one), the upload would fail, saying:

CORTEX_M4_0: Loader: One or more sections of your program falls into a memory region that is not writable. These regions will not actually be written to the target. Check your linker configuration and/or memory map.

I checked both the linker command file and the device memory map, and both were consistent with the memory addresses given in the datasheet. Because of this, I disabled verification of errors in the project properties, and deployed anyway. The program did not work, and upon inspection of the registers, I noticed that the Undefined Instruction Usage Fault bit in the NVIC_FAULT_STAT register had been set. After some more time and research, I looked in the memory browser and disassembly view, and saw that all of the flash memory after address 0x786 was empty (0xFFF...), including a large part of the deployed code. I power cycled the board, changed USB cables, and restarted Code Composer Studio multiple times, but none of it worked. Upon downloading smaller applications (ie. less than 0x786 bytes long) they worked fine. This only seems to affect flash memory, however, SRAM and registers function normally

Attached I have the source directory of the broken project, flash memory save, and CPU peripheral registers save, as well as some screenshots and debug logs.

CCS version: 6.1.3.00033

Compiler version: TI v15.12.1.LTS

TI-RTOS version: 2.16.1.14

TivaWare version: 2.1.2.111

OS: Windows 7 64 bit

I previously posted this on the TM4C forum, but was sent here instead.

Original post: https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/517168/1878685#1878685

Any help would be most appreciated,

Brian Duemmer

CCSlogData.zip

  • Brian Duemmer said:
    CORTEX_M4_0: Loader: One or more sections of your program falls into a memory region that is not writable. These regions will not actually be written to the target. Check your linker configuration and/or memory map.

    To clarify, that message is normally a sign of a problem the memory regions being incorrect, in the program or debugger. However, in this case don't believe that since:

    1. On my Windows 7 PC with CCS 6.1.3 I am unable to repeat the error using the same project, in that the download of the program is successful.
    2. The debug server logging on the referenced thread shows that on the PC which suffers the problem the FlashOperations::MatchFlashDLL() call is reported as failing, which leads CCS to think "Flash programming not supported on current device."

    I think there are two issues:

    • On the PC with the failure why does the FlashOperations::MatchFlashDLL() call fail?
    • When the FlashOperations::MatchFlashDLL() call fails, could CCS report a more helpful error message rather than "CORTEX_M4_0: Loader: One or more sections of your program falls into a memory region that is not writable"?

    Brian Duemmer said:
    Any help would be most appreciated

    One other suggestion is under CCS Project Properties -> Debug -> Flash Settings tick the "Enable Verbose Output" option and see if that reports any more diagnostic messages in the CCS console when attempt to flash the problematic example.

  • Hello Chester,

    I hit the Enable Verbose Output button, but unfortunately, nothing new was printed to the console. Should I try updating or reinstalling CCS?

    Brian

  • Brian Duemmer said:
    Should I try updating or reinstalling CCS?

    Before reinstalling CCS try:

    1. Delete the .launches subdirectory within the problematic project and then restart CCS.
    2. If 1) doesn't fix the problem, try creating a new CCS workspace and import the TI-RTOS example into the new workspace

    The reasons for these suggestions is that from the debug server log file in your failure case the 1st parameter to the FlashOperations::MatchFlashDLL() function is "Flash DLL Delegate", whereas in my working case the parameter was "JTAG". From looking at the ccsv6\ccs_base\DebugServer\bin\FlashDLLDB.xml file in a CCS 6.1.3 installation believe the "Flash DLL Delegate" means CCS is attempting to use a serial interface to program the flash, rather than the JTAG interface on the EK-TM4C1294XL.

    I managed to repeat the problem with the following sequence:

    1) Import the hello_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT example into CCS 6.1.3. Set the connection to "Stellaris In-Circuit Debug Interface". Successfully flash and run the example from the CCS debugger.

    2) Use LM Flash Programmer to erase the entire flash (to confirm if the next step does re-program the flash).

    3) In the target configuration add a UART connection for the Stellaris Virtual Serial Port on the EK-TM4C1294XL. Successfully flash and run the example from the CCS debugger.

    4) Use LM Flash Programmer to erase the entire flash.

    5) In the target configuration delete the UART connection, i.e. leaving only the Stellaris In-Circuit Debug Interface. Attempting to download the program now causes the CCS Console to report errors:

    CORTEX_M4_0: GEL Output: 
    Memory Map Initialization Complete
    CORTEX_M4_0: Loader: One or more sections of your program falls into a memory region that is not writable.  These regions will not actually be written to the target.  Check your linker configuration and/or memory map.
    CORTEX_M4_0: File Loader: Verification failed: Values at address 0x00000000 do not match Please verify target memory and memory map.
    CORTEX_M4_0: GEL: File: C:\Users\Mr_Halfword\workspace_v6_1_3\hello_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT\Debug\hello_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT.out: a data verification error occurred, file load failed.
    

    LM Flash Programmer reports that the flash is blank, meaning CCS has not attempted to program any of the program.

    6) Delete the .launches sub-directory from the hello_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT directory in the workspace, and then restart CCS. Successfully flash and run the example from the CCS debugger.

    I think the issue is that CCS can end-up caching some information which causes it to attempt to use a serial interface to program flash, rather than using JTAG. Do you know if you ever attempted to set up a UART connection in the target configuration for the problematic project?

  • Hello Chester,
    That seemed to do it! Yes, I originally had a UART configured in my target configuration file as I was initially setting everything up. I deleted the UART eventually, but evidently it still hung around. After deleting the .launches directory and restarting CCS, it finally forgot about that UART configuration.
    Many thanks to all,
    Brian