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: [CC2640]How to use NOINIT on stack 4.2

Other Parts Discussed in Thread: BLE-STACK, CC2640

Tool/software: TI C/C++ Compiler

Hi All

I have a case need to upgrade stack4.0 to stack4.2.

I have two versions of CCS(7.4 and 8.1) in different PC.

Then add "pargma NOINIT" in the glucose sample code of stack 4.0 & 4.2

In stack 4.0 is success.(sample code not modified)

In Stack 4.2, glucose sample code, CCS7.4 & 8.1
<main.c>
#pragma NOINIT (GLUValue)
uint8_t GLUValue;
.......
int main()
{
     RegisterAssertCback()
     PIN_init()
     ICall_init()
     ICall_createRemoteTask()
     GAPRole_createTask()

GLUValue = 1;   <== if have assign value, The program will stop in create task.

     GlucoseSensor_createTask()
     BIOS_start()
     return 0;
}


<glucose.c>
GlucoseSensor_createTask(void)
{
          .........
          Task_construct(&glucoseTask, GlucoseSensor_taskFxn, &taskParams, NULL);  <== stop here(CCS 7.4 & 8.1 are the same )
}

---------------------------

Have tried to tune the optimization leve on CCS. The same situation.

What should I do?

  • Initializing NOINIT variables is not supported.  The ARM compiler manual, in the section titled The NOINIT and PERSISTENT Pragmas, states:

    The NOINIT pragma may only be used with uninitialized variables.

    Thanks and regards,

    -George

  • Sorry, I didn't explain the details,
    I have re-edited.
  • Sorry, I didn't explain the details,
    I have re-edited.

    #pragma NOINIT (GLUValue)
    uint8_t GLUValue;
    .......
    int main()
    {
    RegisterAssertCback()
    PIN_init()
    ICall_init()
    ICall_createRemoteTask()
    GAPRole_createTask()

    GLUValue = 1; <==== assign value
  • Am curious on the answer

  • Hi kuo,

    What is the purpose of using NOINIT in this use-case? I think that NOINIT may not currently be supported on BLE-Stack projects based on the linker files provided. I'll take an action to file this.

    Regards,
    Katie
  • Hi Katie Pier

    This is an existing project that my customer has already listed.

    Now, My customer hope to upgrade BLE 4.2.

    So, I can't modify the program at will.

    Use NOINIT at:

    #pragma NOINIT (dev_type)

    uint8_t dev_type;

    2640 power on --> uart tx send cmd --> multiple device(dev1 or dev2 or...) --> uart rx receive cmd

    --> dev_type = dev1 --> sw reset --> 

    switch(dev_type)
    {
         case dev1:
              GlucoseSensor_createTask();  <== Second run
              Custom_createTask();
              break;
         case dev2:
              BloodPressure_createTask();   <== Second run
              Custom_createTask();
              break;
         "case  dev3, dev4....."
         default:
              Custom_createTask();   <== First run --> get devX --> sw reset
              break;
    }

    Of course, There are other code to handle like this.

  • Hi kuo austin,

    Thank you I think I understand better now. We don't usually use the naming convention of 4.0 and 4.2 in regards to our stack versions as these refer more to the BLE SIG spec version. Can you clarify what is the BLE-STACK version used on the working case, and on the failing case? You can find this version from the file system folder naming convention for the stack, or from the release notes included with the stack. This can help us determine what is different. 

    Can you also confirm that the device you are using is CC2640 not CC2640R2? 

    Regards,

    Katie

  • Ok, It's fail on the "ble_sdk_2_02_02_25"

    Sample code path: "C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\glucose_sensor"

    NOINIT work normal on the "ble_cc26xx_2_01_00_44423"

    Sample code path:"C:\ti\simplelink\ble_cc26xx_2_01_00_44423_meter\Projects\ble\GlucoseSensor"

    Hope to work on the stack 2.2.2.

    It will be troublesome if I need to modify it.

    Or...Is there another sdk version of bluetooth 4.2 and support to use NOINIT?

    Thanks a lot.

  • Hi Katie

    Do you have any idea?

  • Dear Katie,

    Austin have updated the SDK they used. Could you kindly help look at NOINIT usage in different version SDK?
    NOINIT is normal pragmas usage, and I think Austin's use is correct.
    Why does he meet the problem in different version SDK?

    Please feel free to let us know if you have any suggestion.
    Thanks a lot.
  • Hi Janet, Austin,

    Sorry for the delay. I have consulted with the team, and here is the root cause and solution.

    Root cause: the linker command file does not define a .TI.noinit section. Therefore, the linker uses the default placement of FLASH. Obviously this then causes problems when there is a variable assigned here as the variable should be in RAM.

    Workaround: fortunately the linker cmd file is open source, so this is easy to workaround without having to wait for a new release with a fix. In your CCS project, expand the TOOLS folder and open the file cc26xx_app.cmd. Find the area for "GROUP > SRAM". Simply add ".TI.noinit" before ".data" in this section.

    	GROUP > SRAM
    	{
    	    .TI.noinit
    	    .data
    	    .bss
    		.vtable
    	    .vtable_ram
    	     vtable_ram
    	    .sysmem
        	.nonretenvar
    	} LOAD_END(heapStart)

    Regards,

    Katie

  • Thanks a lot.
    It's worked