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.

RTOS/CC2640: memset() issue for a struct

Part Number: CC2640

Tool/software: TI-RTOS

Hi,

   I am an newbi in CC2640 developer.

   I meet a issue when I use memset() for a struct. When I do step over a memset() in IAR debug mode, the break point will move to the

 __ATTRIBUTES void * memset(void * _D, int _C, size_t _N)

  {

    __aeabi_memset(_D, _N, _C);

    return _D;

  }

inside DLib_Product_string.h

The break point will not be on the next line of memset() when I do step out the memset().

I can use memset() with a int or char variable, but I can use it for struct.

My struct definition is

 

typedef struct

{

    uint8_t ppg;

    uint8_t gsr;

    uint8_t ntc;

    uint8_t prv;

} SecondCounters_t;

My developing environment is

1. IAR V7.4

2. My Application bases on  C:\ti\simplelink\ble_cc26xx_2_01_01_44627

3. I have set the optimizations  as None for my application node - FlashROM

How can I resolve this issue?

Thank you for your kindly help.

Allen

  • Hi Allen,

    Are you putting the breakpoint in the main debugging view or in the disassembly window? The disassembly window will give you the most accurate breakpoint placement.
  • Hi Rachel,
    I also try to using the disassembly window to set the break point, but it is the same as debugging view.
    Actually, I set two break points at line 102 and 103. It will stop at line 102 first.

    My code:
    ....
    10 init();
    11 start();
    ......
    100 void init()
    101 {
    102 count.ppg = 0x11;
    103 memset(&counts, 0, sizeof(SecondCounters_t));
    104 sensorPeriod = SENSOR_DEFAULT_PERIOD;
    ......
    130 ....
    }

    Then I do Step over, it will break at the following line 75. After I do two Step overs to exit the memset(), it will break at above line 11.

    The DLib_Product_string.h code:

    73 __ATTRIBUTES void * memset(void * _D, int _C, size_t _N)
    74 {
    75 __aeabi_memset(_D, _N, _C);
    76 return _D;
    77 }


    Meanwhile, I check the sensorPeriod value and it is correct. It seems that the program had ran the line 104. Does it mean I can use memset(), but I will have some problems at debugging? Do you have any idea for this issue?

    Best Regards,
    Allen