Other Parts Discussed in Thread: EK-TM4C1294XL, AM3359, TLK110, SYSBIOS
I’m using SYS/BIOS (version 6.42.01.20) with NDK (version 2.24.03.35) on the EK-TM4C1294XL LaunchPad, and am using IAR Embedded Workbench for ARM 7.2 for the compiler. Also using the DK-TM4C129X.
When I compile and debug my NDK application within the IAR IDE, everything runs fine. When I compile the application in release mode, convert it to a .bin file, and program it into the LaunchPad using the LM Flash Programmer utility, it appears to halt or otherwise stop working after a few seconds. After some investigation, it appears the halt happens when a System_printf function call is encountered. I had System_printf calls littered all throughout my code, so I commented them out, recompiled, and re-programmed into the LaunchPad, but the application was still halting. When I globally disabled the System_printf call by setting SysMin.bufSize = 0 in the .cfg file as per this post, the application worked. Looking through the NDK code, it seems there are some System_printf functions in the NDK code that get called. I tried configuring the NDK in the stack init hook to turn off debug messages via the code below:
uint DebugMsgLevel = DBG_NONE;
CfgAddEntry(Handle, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL, CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8*)&DebugMsgLevel, 0);
Also tried disabling SYS/BIOS diagnostics in the .cfg file as below:
Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
Defaults.common$.diags_STATUS = Diags.ALWAYS_OFF;
Still, the application always halts when SysMin.bufSize != 0, but always works when SysMin.bufSize == 0.
Is there a way to set up the code in the .cfg file so that when I am compiling in debug mode, System_printf is enabled, but when building the release image, System_printf is disabled? Is there anything else that can be done to disable System_printf in the application or NDK/SYS/BIOS code?
Aside from the execution time to perform the string formatting, is System_printf otherwise intended to be benign when the application is run outside of a debugging environment?
Some of the TI-RTOS examples have the following lines, which make adjustments to the program stack based on which compiler is being used, so perhaps something similar can be done to determine whether it is debug or release mode.
if (!Program.build.target.$name.match(/iar/)) {
/*
* Reducing the system stack size (used by ISRs and Swis) to reduce
* RAM usage.
*/
Program.stack = ...;
}
Thanks for any help on this.



