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.

Compiler/F28M36P63C2: Unintialised .const section when using NDK

Part Number: F28M36P63C2

Tool/software: TI C/C++ Compiler

I am having some trouble with using the TI-RTOS NDK on the M3 core of an F28M36 Concerto.

Following the tcpecho example, I attempted to add the NDK to the .cfg file as follows.

/* ================ NDK configuration ================ */
var Ndk       = xdc.loadPackage('ti.ndk.config');
var Global    = xdc.useModule('ti.ndk.config.Global');
var Ip        = xdc.useModule('ti.ndk.config.Ip');
var Tcp       = xdc.useModule('ti.ndk.config.Tcp');
var Udp       = xdc.useModule('ti.ndk.config.Udp');

Global.IPv6 = false;
Global.stackLibType = Global.MIN;
Global.networkOpenHook = "&net_open_hook";

/* automatically call fdOpen/CloseSession for our sockets Task */
Global.autoOpenCloseFD = true;

Global.pktNumFrameBufs = 10;
Global.memRawPageCount = 6;
Global.ndkThreadStackSize = 8192;
Global.lowTaskStackSize = 1024;
Global.normTaskStackSize = 1024;
Global.highTaskStackSize = 1024;
Tcp.transmitBufSize = 1024;
Tcp.receiveBufSize = 1024;

When this is added, the entire .const section is uninitialised, which naturally causes failure to boot due to crashing on the first de-reference of anything in .const, which happens to be when the XDC runtine Startup_execImpl (which is .const:xdc_runtime_Startup_execImpl__C) is used as a pointer.

This is the only change made. There is also no change to the linker .cmd file.

Without NDK in .cfg file, the .map file shows:

.init_array
*          0    00218000    00000000     UNINITIALIZED

.const     0    00227a80    0000233e
                  00227a80    00001840     prog_m3_pem3.oem3 (.const:xdc_runtime_Text_charTab__A)

With NDK in .cfg file:

.init_array
*          0    00218000    00000000     UNINITIALIZED

.const     0    00233364    00002554     UNINITIALIZED
                  00233364    0000186f     prog_m3_pem3.oem3 (.const:xdc_runtime_Text_charTab__A)
                  
What could be causing this section to become uninitialised, and how can I fix it?

The compiler is arm_15.12.3.LTS and the TI-RTOS version is tirtos_c2000_2_16_01_14.

  • Hi John,

    I just built the tcpEcho example with CC6.2 using tirtos_c2000_2_16_01_14 and arm_15.12.2.LTS. The .const was initialized (as expected). What changes did you make to the out-of-box example? The above lines were already in the .cfg file.

    Todd
  • Hi Todd,

    Thanks for the reply. The example builds OK, but when transposing the above config into my ongoing project, the previously-initialised .const section becomes uninitialised.

    The only change I make to my project is adding this section. I have checked the rest of the configuration for differences, but other than a few allocation sizes and so on, it's basically the same.

    I haven't added any calls that need the NDK to the code, not even EMAC_init(). Literally the only thing required to cause it in my project is to add the lines in the .cfg file. This appears to be the smallest config I can put:

    var Ndk       = xdc.loadPackage('ti.ndk.config');
    var Global    = xdc.useModule('ti.ndk.config.Global');
    var Ip        = xdc.useModule('ti.ndk.config.Ip');

    Global.memRawPageCount = 6;

    Omitting any line here either results in undefined symbol linker errors, or (for the page count) fails to place the .bss section. .const is always uninitialised.

  • This does not make sense. Can you attach the mapfiles and .cfg files for
    1. Without the 4 lines from the last post in the .cfg
    2. With the 4 lines from the last post in the .cfg and the .const is uninitialized.