Application Restarting


#1

Hi to al,

      I got a problem in handling of datas.Actually i am trying to get a string  through UART1,writing  in flash and reading  back the stored string when it is required.....

In data hdlr i did this…

bool Data_Hdlr(u16 Datalen,u8 *Data)
{
    wm_strncpy(Wdata,(ascii *)Data,Datalen);
    Wdata[Datalen]='\0';
    return TRUE;
}

This is how i am writing the string…

adl_flhWrite(HANDLE,(u16)ID,(u16)wm_strlen(Wdata),(u8 *)Wdata)

And reading the string from the flash…

adl_flhRead(HANDLE,(u16)ID,(u16)adl_flhExist((ascii*)HANDLE,ID),(u8 *)Flhmem)

I declared Wdata as
ascii *Wdata;

My code gets restarted in this case… :frowning:
I tried in many ways, finally i solved the issue also :slight_smile:
my application is not restaring once i declared Wdata as
ascii Wdata[10];

Even though i solved this issue i need to know the cause :question:

Regards,
Chan.


#2

You need to look carefully in your ‘C’ textbook, and consider the difference between a pointer definition such as

ascii *Wdata;

and an arraay definition such as

ascii Wdata[10];

You might also like to spend some time at c-faq.com/aryptr/index.html

This is basic ‘C’ stuff - nothing specifically to do with Open-AT.


#3

The link is very usefull…
Thanks Awneil.