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 download program to Launchpad

Other Parts Discussed in Thread: TM4C123GH6PM

I am using CCS v6.0.1.00040 to interface with my EK-TM4C123GXL launchpad.

I am developing a program and when I try to debug/download the program it does not work.

Here are my steps:

1. Build program to verify no errors

2. Upon successful build, click "Debug"

3. Observe CCS switch to "CCS Debug" mode

4. Dialogue box briefly opens (< 1 second) then disappears, no progress is shown across the green progress bar

5. Console outputs:

CORTEX_M4_0: GEL Output: 

Memory Map Initialization Complete

6. Now stuck in this state, never entered debug mode. Clicking pause (run is unavailable) yields this message in the console:

CORTEX_M4_0: Error: Debug Port error occurred.

Additionally, this message appears:

No source available for "SysCtlDelay() at C:/Users\Austin Riffle\Google Drive\CCS Workspace\Senior Design\Debug\Senior Design.out:{3} 0x21009800{4}"

7. Viewing the disassembly, where I would normally see an instruction, I see: 

???? Memory Map Prevented Reading 0xXXXX, where XXXX is an address

I've attempted to follow this thread but it was not very helpful.

I have successfully debugged on this project previously, so I'm not sure what happened. I have added some C++ code and switched language to Embedded C++, and everything seems to be compiling fine.

Also, I've attached a zip of my project in case that helps with debugging. 

Thanks for your time.Senior Design.zip

  • Hello Austin,

    The code looks fine (manual read of the code). Did you check if the NVIC_FAULTSTAT has a bit set and if yes what the NVIC_FAULTADDR shows?

    Regards
    Amit
  • Hi Amit
    Thanks for the quick reply. What is the easiest way to check this? Download the Flash using the LM Flash programmer?
  • Hello Austin,

    Via the debugger when the CPU is halted is the best way.

    Regards
    Amit
  • I attempted to debug the project, then pause it to halt the processor. When pausing, I receive the "Debug Port error occurred." message and do not see any values in the Registers tab.
    Additionally, I don't see the NVIC_FAULTSTAT register listed by default, do I need to add this manually?
    Either way, I see no values in any of the registers because of the error.
  • Hello Austin,

    The address are 0xE000ED28 and 0xE000ED38 and can be viewed in memory browser. What I am not sure is the "Debug Port Error Occurred". That would mean something went wrong in execution or a debug browser is pointing to a non-mapped location

    Regards
    Amit
  • Hi Amit
    Here is an image of the memory at those locations. Yes, there are indeed bits set. However, I am not sure what NVIC indicates.

  • Hello Austin,

    The Error bits can be seen in the Section for Cortex M4 Peripherals of the data sheet. It basically indicates that the Instruction Bus has faulted. Now comes the tough part. You would need to isolate the faulting section of code in your program by setting breakpoints and using step debug, and then we can debug the dissasembly to see why the Instruction is not being fetched from the correct location.

    Regards
    Amit
  • Hi Amit
    Here is what I have got from further testing.

    1. Throughout this testing, I can download a TivaWare application and everything works fine

    2. I was trying to narrow down where the problem was, so I removed (commented) a lot of source code. The resulting file can be seen below:

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/tm4c123gh6pm.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/gpio.h"
    #include "driverlib/sysctl.h"
    int main(void)
    {
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlDelay(3);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
    SysCtlDelay(3);

    while (1)
    {
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
    SysCtlDelay(SysCtlClockGet() / (10 * 3));

    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
    SysCtlDelay(SysCtlClockGet() / (10 * 3));
    }
    }

    3. Since the error still persisted with this slimmed down code, I decided to pause and attempt some assembly steps. This yielded nothing except for being stuck on the assembly instruction seen below:

    f005fa0e: ???? Memory Map Prevented Reading: 0xF005FA0E [code=0x20000]

    4. Double clicking on the address f005fa0e results in this error message:
    Error enabling this function: Address exceeds the allowed range.

    5. Additionally, I am using the tm4c123gh6pm_startup_ccs.c file provided, but changed the extension to .cpp and the only #pragma from

    #pragma DATA_SECTION(g_pfnVectors, ".intvecs") to #pragma DATA_SECTION(".intvecs")

    for c++ syntax.


    I'm inclined to think that this may be an error somewhere in my project settings because the simplest of code will not work, but after a look through, I see nothing obviously wrong.
  • Hello Austin,

    What if the code is reverted to the C version of the startup file. In that case you check the bin file generated and diff it against the CPP version to see how interrupt vectors are being mapped.

    Regards
    Amit
  • Hi Amit
    Unfortunately, I am unable to change the file to a C file. This is because of a compilation error:

    Command-line error #928: option "embedded_c++" can be used only when compiling C++
    1 catastrophic error detected in this compilation.
    Compilation terminated.

    This compilation error occurs because the --embedded_cpp flag is being passed to the compiler. I'm not sure why it is being passed to the compiler, as I DO NOT have "Treat C files as C++ files (--cpp_default, -fg)" checkbox marked under Build->ARM Compiler->Advanced Options->Language Options. This is the reason for me changing the file extension and pragma in the first place. Do you know how to solve this issue?
  • Hi Amit
    I have solved the issue by reverting the tm4c123gh6pm_startup_ccs.cpp to tm4c123gh6pm_startup_ccs.c (including the #pragma), and then by changing the language dialect under the properties of that specific file.
    Thanks for your time and help in solving my issue.
  • Hello Austin,

    Can you send over the simplified CCS Project zipped files to examine?

    Regards
    Amit
  • Hi Amit, sorry for the delayed response. Here is the zip file. I believe this is the state I had the project in at the time of the error. It does seem weird that the cpp pragma would behave differently.

    Copy of Senior Design.zip

  • Hello Austin,

    I did not see the issue being resolved, and put in some time into it. It seems that the solution you found is the only way of handling such pragma's in cpp. May be Chester Gibon may be able to shed some more info.

    Regards
    Amit