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.

TM4C1294NCPDT: flashing program from debugger works; with LM Flash have to make odd code changes

Part Number: TM4C1294NCPDT

My program runs completely fine when flashed from within the CCS debug tools.

When I make a binary file and use LM Flash, I have to make odd adjustments to the code for it to run correctly.

For example, the following code runs correctly when flashed from within CCS.  But when converted to a binary and flashed with LM Flash, it crashes immediately.

int etherInit(void)
{
    /* normal code */
    ipaddr_aton(OUR_IP,&gd.requestedIpAddr);

    /* normal code */
    ipaddr_aton(OUR_SUBNET,&gd.subnetMask);
}

Inserting the following lines, allows the code to run both from CCS and LM Flash.

int etherInit(void)
{
    /* had to add this to have the program run correctly using LM Flash */
    gd.u32_junk_variable++;

    /* normal code */
    ipaddr_aton(OUR_IP,&gd.requestedIpAddr);

    /* had to add this to have the program run correctly using LM Flash */
    gd.u32_junk_variable++;

    /* normal code */
    ipaddr_aton(OUR_SUBNET,&gd.subnetMask);
}

Regardless what variants of compiler/linker configurations (optimization levels, data alignments, etc), the code always works when flashed with CCS.

But nothing will allow me to remove my junk variable incrementers when flashed with LM Flash.

Any suggestions would be very much welcomed,

Peter

Environment:

Code Composer Studio  Version: 11.2.0.00007

Invoking: ARM Compiler
"C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O1 --fp_mode=relaxed --include_path="C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/include" --include_path="C:/Users/peter/workspace_v11/FlexGen" --include_path="C:/ti/TivaWare/" --include_path="C:/ti/TivaWare/third_party/lwip-1.4.1/" --include_path="C:/ti/TivaWare/third_party/lwip-1.4.1/src/include/" --include_path="C:/ti/TivaWare/third_party/lwip-1.4.1/src/include/netif/" --include_path="C:/ti/TivaWare/third_party/lwip-1.4.1/ports/tiva-tm4c129/include" --include_path="C:/ti/TivaWare/third_party/lwip-1.4.1/src/include/ipv4" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=TARGET_IS_TM4C129_RA0 --define=LWIP_PROVIDE_ERRNO --define=LWIP_COMPAT_MUTEX -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --fp_reassoc=off --preproc_with_compile --preproc_dependency="ether.d_raw" "../ether.c"
Finished building: "../ether.c"

Building target: "FlexGen.out"
Invoking: ARM Linker
"C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O1 --fp_mode=relaxed --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=TARGET_IS_TM4C129_RA0 --define=LWIP_PROVIDE_ERRNO --define=LWIP_COMPAT_MUTEX -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --fp_reassoc=off -z -m"FlexGen.map" --heap_size=4096 --stack_size=8192 -i"C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/lib" -i"C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="FlexGen_linkInfo.xml" --rom_model -o "FlexGen.out" "./dataCollect.obj" "./dataLog.obj" "./define.obj" "./dq.obj" "./ether.obj" "./filter.obj" "./hardware.obj" "./intHandlers.obj" "./lwiplib.obj" "./main.obj" "./menu.obj" "./parameters.obj" "./pi.obj" "./pll.obj" "./sensor.obj" "./software.obj" "./tm4c1294ncpdt_startup_ccs.obj" "../tm4c1294ncpdt.cmd" -llibc.a -l"C:/ti/TivaWare/driverlib/ccs/Debug/driverlib.lib"
<Linking>
Finished building target: "FlexGen.out"

Building secondary target: "FlexGen.bin"
Invoking: ARM Hex Utility
"C:/ti/ccs1120/ccs/tools/compiler/ti-cgt-arm_20.2.5.LTS/bin/armhex" --fill=0 --binary -o "FlexGen.bin" "FlexGen.out"
Translating to Binary format...
"FlexGen.out" .intvecs ==> .intvecs
"FlexGen.out" .text ==> .text
"FlexGen.out" .const ==> .const
"FlexGen.out" .cinit ==> .cinit
Finished building secondary target: "FlexGen.bin"

  • Hello Peter,

    Debugging with an IDE adds some overhead to code execution which slightly slows execution. When you are free running, the code executes faster. So it looks like there needs to be a short delay to allow something to finish processing or sending for your code segment. When using the IDE the slower execution masks that need and that is why your free running image then crashes.

    Best Regards,

    Ralph Jacobi

  • Hi,

    Thanks for the quick response.

    For my own clarity, should I reduce the system clock frequency, or should I insert some sort of delay at the earliest entry point within the code?

    Thanks again,

    Peter

  • Looks like adding a short delay to the earliest point in the code has solved the problem.  Changing the system clock speed didn't have any affect.

    Thanks for the suggestion!

    I've been ripping my hair out for 2 days believing that I must have had a linker / armhex configuration issue.

    Peter