Other Parts Discussed in Thread: OMAPL138, SYSBIOS, OMAP-L138
I need to create an application that needs a relatively large vector in memory. I am using a board design identical to the OMAPL138 LCDK using a DDR2 of 256MB or so. I am also using the TI RTOS. The application runs well when running using the debugger, at least it is functionally doing what is supposed to do, but fails when I flash it.
I have stripped off almost everything off my program to find the solution to this problem with no luck. Right now, I am using only one source file main.c file and the .cfg file. In this simplified program I turn ON/OFF two LEDs alternatively. I also define two vectors of a certain size = UPP_BUFFER_SIZE. All I do with these two vectors is to fill them with dummy values in sequence over an over again. Essentially my main.c is shown below, obviating some functions.
When I run this using JTAG (debug mode) I can see both LEDs working as expected, no matter what value I choose for UPP_BUFFER_SIZE, 8192, 16384, 65536 for my two vectors, which are stored in addresses after 0xc0000000, which is DDR as defined in my .cfg file (I think I attached it to this msg). However, when I flash this code into the part I can only seem to make it work when UPP_BUFFER_SIZE < = 8192. It doesn't work for UPP_BUFFER_SIZE>8192 (for instance 8193, 16384, or 65536). I have tried this also on the LCDK observing the same behavior. Why would this code work when I am running using JTAG and not when flashing for UPP_BUFFER_SIZE > 8192? (it does work fine after flashing for UPP_BUFFER_SIZE <=8192). Where is the limitation that seems to want less than or equal to 8192?. I follow the flashing procedure using the out2rc and sfh application to convert app.out into app.bin and later download via UART (along with the boot.ais), which in all cases claims to be successful (no matter what program I download to flash). My .cfg is also there, I am not really using BIOS, so I don't do BIOS_start etc). I do define a stack of 8192 and a heap of 8192 for SYS/BIOS, but that doesn't make a difference as I am not using it (i.e., I increase that and I can't still make it work after flashing when using UPP_BUFFER_SIZE > 8192), also why would it work when running using JTAG but not when flashing?
main.c :
#define UPP_BUFFER_SIZE 16384 //Dimension in Words Uint16 (16-bit Words)
Uint16 uPPRxBufferI[UPP_BUFFER_SIZE];
Uint16 uPPRxBufferQ[UPP_BUFFER_SIZE];
void main(void) {
hardware_init(); // init hardware
Uint32 i=0;
while (1) {
LED_ON(4); //turn ON LED 4
delay(1E6); //SOME delay with a dummy for loop
LED_ON(5);//turn ON LED 5
delay(1e6);
for (i=0;i<(UPP_BUFFER_SIZE);i++){
uPPRxBufferI[i]=i;
uPPRxBufferQ[i]=i+1;
}
}
}
//-----------------------------------------------------------------------------
// hardware_init()
//-----------------------------------------------------------------------------
void hardware_init(void) {
device_init();
}
void device_init(void) {
//PLL configuration ---------------------------------------------------
setupPll0(24); // will do 24 MHZ x (24+1) / 2 = 300 MHz SYSCLK1
//---------------------------------------------------------------------
//Pin Multiplexing setup ----------------------------------------------
pinMUX();
//---------------------------------------------------------------------
// GPIO SETUP ---------------------------------------------
// Enable the GPIO Module in the PSC
gpioPowerOn();
gpioDirection();
}
var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Error = xdc.useModule('xdc.runtime.Error'); var Log = xdc.useModule('xdc.runtime.Log'); var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var Main = xdc.useModule('xdc.runtime.Main'); var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Text = xdc.useModule('xdc.runtime.Text'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); var Swi = xdc.useModule('ti.sysbios.knl.Swi'); var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi'); // Added when flashing the code to the target var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys'); Hwi.resetVectorAddress = 0xc0000000; // Adedd when flashing the code. It's the place in // memory where appication will start off /* * Uncomment this line to globally disable Asserts. * All modules inherit the default from the 'Defaults' module. You * can override these defaults on a per-module basis using Module.common$. * Disabling Asserts will save code space and improve runtime performance. Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; */ /* * Uncomment this line to keep module names from being loaded on the target. * The module name strings are placed in the .const section. Setting this * parameter to false will save space in the .const section. Error and * Assert messages will contain an "unknown module" prefix instead * of the actual module name. */ Defaults.common$.namedModule = false; /* * Minimize exit handler array in System. The System module includes * an array of functions that are registered with System_atexit() to be * called by System_exit(). */ System.maxAtexitHandlers = 4; /* * Uncomment this line to disable the Error print function. * We lose error information when this is disabled since the errors are * not printed. Disabling the raiseHook will save some code space if * your app is not using System_printf() since the Error_print() function * calls System_printf(). Error.raiseHook = null; */ /* * Uncomment this line to keep Error, Assert, and Log strings from being * loaded on the target. These strings are placed in the .const section. * Setting this parameter to false will save space in the .const section. * Error, Assert and Log message will print raw ids and args instead of * a formatted message. */ Text.isLoaded = false; /* * Uncomment this line to disable the output of characters by SysMin * when the program exits. SysMin writes characters to a circular buffer. * This buffer can be viewed using the SysMin Output view in ROV. */ SysMin.flushAtExit = false; /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ //BIOS.heapSize = 4096; BIOS.heapSize = 8192; /* System stack size (used by ISRs and Swis) */ //Program.stack = 0x400; Program.stack = 8192; /* Circular buffer size for System_printf() */ SysMin.bufSize = 128; /* * Create and install logger for the whole system */ var loggerBufParams = new LoggerBuf.Params(); //loggerBufParams.numEntries = 4; //var logger0 = LoggerBuf.create(loggerBufParams); //Defaults.common$.logger = logger0; //Main.common$.diags_INFO = Diags.ALWAYS_ON; System.SupportProxy = SysMin; /* * Build a custom BIOS library. The custom library will be smaller than the * pre-built "instrumented" (default) and "non-instrumented" libraries. * * The BIOS.logsEnabled parameter specifies whether the Logging is enabled * within BIOS for this custom build. These logs are used by the RTA and * UIA analysis tools. * * The BIOS.assertsEnabled parameter specifies whether BIOS code will * include Assert() checks. Setting this parameter to 'false' will generate * smaller and faster code, but having asserts enabled is recommended for * early development as the Assert() checks will catch lots of programming * errors (invalid parameters, etc.) */ BIOS.libType = BIOS.LibType_Custom; //BIOS.logsEnabled = true; BIOS.assertsEnabled = true; LoggingSetup.enableTaskProfiler = true; /*var clock0Params = new Clock.Params(); clock0Params.instance.name = "clock0"; clock0Params.period = 5000; clock0Params.startFlag = true; Program.global.clock0 = Clock.create("&WD_Kick", 5000, clock0Params);*/ //HWI Interrupt for uPP /*var hwi0Params = new Hwi.Params(); hwi0Params.instance.name = "HWUPP"; hwi0Params.eventId = 94; hwi0Params.priority = 2; hwi0Params.enableInt = true; Program.global.HWUPP = Hwi.create(6, "&upp_isr", hwi0Params);*/ var loggerSys0Params = new LoggerSys.Params(); loggerSys0Params.instance.name = "loggerSys0"; Program.global.loggerSys0 = LoggerSys.create(loggerSys0Params); var loggerBuf0Params = new LoggerBuf.Params(); loggerBuf0Params.instance.name = "loggerBuf0"; Program.global.loggerBuf0 = LoggerBuf.create(loggerBuf0Params); Error.common$.logger = Program.global.loggerBuf0; LoggingSetup.loadTaskLogging = true;
var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Error = xdc.useModule('xdc.runtime.Error'); var Log = xdc.useModule('xdc.runtime.Log'); var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf'); var Main = xdc.useModule('xdc.runtime.Main'); var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Text = xdc.useModule('xdc.runtime.Text'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); var Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); var Clock = xdc.useModule('ti.sysbios.knl.Clock'); var Swi = xdc.useModule('ti.sysbios.knl.Swi'); var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi'); // Added when flashing the code to the target var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys'); Hwi.resetVectorAddress = 0xc0000000; // Adedd when flashing the code. It's the place in // memory where appication will start off /* * Uncomment this line to globally disable Asserts. * All modules inherit the default from the 'Defaults' module. You * can override these defaults on a per-module basis using Module.common$. * Disabling Asserts will save code space and improve runtime performance. Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; */ /* * Uncomment this line to keep module names from being loaded on the target. * The module name strings are placed in the .const section. Setting this * parameter to false will save space in the .const section. Error and * Assert messages will contain an "unknown module" prefix instead * of the actual module name. */ Defaults.common$.namedModule = false; /* * Minimize exit handler array in System. The System module includes * an array of functions that are registered with System_atexit() to be * called by System_exit(). */ System.maxAtexitHandlers = 4; /* * Uncomment this line to disable the Error print function. * We lose error information when this is disabled since the errors are * not printed. Disabling the raiseHook will save some code space if * your app is not using System_printf() since the Error_print() function * calls System_printf(). Error.raiseHook = null; */ /* * Uncomment this line to keep Error, Assert, and Log strings from being * loaded on the target. These strings are placed in the .const section. * Setting this parameter to false will save space in the .const section. * Error, Assert and Log message will print raw ids and args instead of * a formatted message. */ Text.isLoaded = false; /* * Uncomment this line to disable the output of characters by SysMin * when the program exits. SysMin writes characters to a circular buffer. * This buffer can be viewed using the SysMin Output view in ROV. */ SysMin.flushAtExit = false; /* * The BIOS module will create the default heap for the system. * Specify the size of this default heap. */ //BIOS.heapSize = 4096; BIOS.heapSize = 8192; /* System stack size (used by ISRs and Swis) */ //Program.stack = 0x400; Program.stack = 8192; /* Circular buffer size for System_printf() */ SysMin.bufSize = 128; /* * Create and install logger for the whole system */ var loggerBufParams = new LoggerBuf.Params(); //loggerBufParams.numEntries = 4; //var logger0 = LoggerBuf.create(loggerBufParams); //Defaults.common$.logger = logger0; //Main.common$.diags_INFO = Diags.ALWAYS_ON; System.SupportProxy = SysMin; /* * Build a custom BIOS library. The custom library will be smaller than the * pre-built "instrumented" (default) and "non-instrumented" libraries. * * The BIOS.logsEnabled parameter specifies whether the Logging is enabled * within BIOS for this custom build. These logs are used by the RTA and * UIA analysis tools. * * The BIOS.assertsEnabled parameter specifies whether BIOS code will * include Assert() checks. Setting this parameter to 'false' will generate * smaller and faster code, but having asserts enabled is recommended for * early development as the Assert() checks will catch lots of programming * errors (invalid parameters, etc.) */ BIOS.libType = BIOS.LibType_Custom; //BIOS.logsEnabled = true; BIOS.assertsEnabled = true; LoggingSetup.enableTaskProfiler = true; /*var clock0Params = new Clock.Params(); clock0Params.instance.name = "clock0"; clock0Params.period = 5000; clock0Params.startFlag = true; Program.global.clock0 = Clock.create("&WD_Kick", 5000, clock0Params);*/ //HWI Interrupt for uPP /*var hwi0Params = new Hwi.Params(); hwi0Params.instance.name = "HWUPP"; hwi0Params.eventId = 94; hwi0Params.priority = 2; hwi0Params.enableInt = true; Program.global.HWUPP = Hwi.create(6, "&upp_isr", hwi0Params);*/ var loggerSys0Params = new LoggerSys.Params(); loggerSys0Params.instance.name = "loggerSys0"; Program.global.loggerSys0 = LoggerSys.create(loggerSys0Params); var loggerBuf0Params = new LoggerBuf.Params(); loggerBuf0Params.instance.name = "loggerBuf0"; Program.global.loggerBuf0 = LoggerBuf.create(loggerBuf0Params); Error.common$.logger = Program.global.loggerBuf0; LoggingSetup.loadTaskLogging = true;