This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF Connect SDK1.8.0 simple code infinite restart

Hi,

nRF Connect SDK1.8.0, Windows10 X64.

as follow simple code,it will infinite restart.

but all short change to int or char,  it work well.

#define LTMFF 266
void w16copy(short *y, short *x, int size)
{
   while ((size--)>0) *y++ = *x++;
}
struct BState {
   short   x[LTMFF];
   short   b[64];
};
void main(void)
{
  struct BState dstate ;
  short y[LTMFF];
  w16copy(y, dstate.x, LTMFF);
  printf("Hello World! NCS \n");
}

the same code, run in nRF SDK will be ok,both Keil5 and SES.as follow:

"while ((size--)>0) *y++ = *x++;" change to "for(int i=0;i<size;i++) y[i]=x[i];"

or "memcpy((char*)y,(char*)x,size*sizeof(short));"

or  "char *a=(char*)y,*b=(char*)x; while ((size*sizeof(short)--)>0) *a++ = *b++;"

the same infinite restart.

Is it Zephyr's bad support for short?

how to change the code ?

thanks

Parents Reply Children
No Data
Related