os_printf with a char pointer parameter causes an exception

ddze7374
Posts: 9
Joined: Tue Dec 06, 2016 4:09 pm

os_printf with a char pointer parameter causes an exception

Postby ddze7374 » Wed Sep 13, 2017 10:28 pm

Hello,

I am trying to debug some code and need to display the content of the char pointer. But everytime it gives an exception.

Code: Select all

static void ICACHE_FLASH_ATTR someCb(const char *data){
   os_printf( "LED = %s", *data);
}

Fatal exception 28(LoadProhibitedCause):
epc1=0x40245abe, epc2=0x00000000, epc3=0x40246461, excvaddr=0x00000023, depc=0x00000000
ÿ
ets Jan 8 2013,rst cause:2, boot mode:(1,6)


Is there a way to access the content of this pointer ?

By the way is there a downloadable xtensa-lx106-elf-gdb debugger ?

ddze7374
Posts: 9
Joined: Tue Dec 06, 2016 4:09 pm

Re: os_printf with a char pointer parameter causes an exception

Postby ddze7374 » Thu Sep 14, 2017 1:10 am

Solved , the flash needs an access to the aligned data.

jcmvbkbc
Posts: 11
Joined: Fri Oct 24, 2014 7:27 pm

Re: os_printf with a char pointer parameter causes an exception

Postby jcmvbkbc » Thu Sep 14, 2017 4:05 am

ddze7374 wrote:

Code: Select all

static void ICACHE_FLASH_ATTR someCb(const char *data){
   os_printf( "LED = %s", *data);
}

Fatal exception 28(LoadProhibitedCause):
epc1=0x40245abe, epc2=0x00000000, epc3=0x40246461, excvaddr=0x00000023, depc=0x00000000
ÿ
ets Jan 8 2013,rst cause:2, boot mode:(1,6)



The call to os_printf should be

Code: Select all

os_printf( "LED = %s", data);
without dereferencing data. Otherwise you use the value of the first character of data as a pointer, which points to 0x00000023 in your case (that's the value of excvaddr), which is wrong.

ddze7374 wrote:Solved , the flash needs an access to the aligned data.


The original problem doesn't seem to have anything related to data alignment.

ddze7374
Posts: 9
Joined: Tue Dec 06, 2016 4:09 pm

Re: os_printf with a char pointer parameter causes an exception

Postby ddze7374 » Fri Sep 15, 2017 6:52 pm

jcmvbkbc,

you beleive I have not tried without the dereferencing "star"?

Only, I agree with you that does take the pointer, not the dereferenced value like I described.
But in either case did not work for me.

Who is online

Users browsing this forum: No registered users and 4 guests