-->
Page 1 of 2

error when registering an ISR

PostPosted: Mon Mar 18, 2019 4:48 am
by HEck
Hi Community,

I´m using the NONOS_SDK 3.0. When I want to register a ISR for GPIO interrups, I get this error message:

###############################
user_main.c: In function 'user_init':
user_main.c:124:2: error: passing argument 2 of 'ets_isr_attach' from incompatible pointer type [-Werror]
ETS_GPIO_INTR_ATTACH(I2C_Slave_ISR, NULL);
^
In file included from ../../include/os_type.h:28:0,
from ../../include/osapi.h:29,
from user_main.c:26:
../../include/ets_sys.h:67:6: note: expected 'ets_isr_t' but argument is of type 'void (*)(void)'
void ets_isr_attach(int i, ets_isr_t func, void *arg);
^
cc1: all warnings being treated as errors
make[1]: *** [.output/eagle/debug/obj/user_main.o] Error 1
make[1]: Leaving directory `/mnt/Share/ESP8266_NONOS_SDK-3.0/he_i2c_slave/user'
make: *** [.subdirs] Error 2
###############################

What could be wrong? What else must be done, that the compiler can recognize the expected 'ets_isr_t' in "etc_sys.h"?

Thank you for your support
Henry

Re: error when registering an ISR

PostPosted: Mon Mar 18, 2019 10:49 am
by RichardS
HEck wrote:###############################
user_main.c: In function 'user_init':
user_main.c:124:2: error: passing argument 2 of 'ets_isr_attach' from incompatible pointer type [-Werror]
ETS_GPIO_INTR_ATTACH(I2C_Slave_ISR, NULL);
^


it expects a pin # not NULL

ETS_GPIO_INTR_ATTACH(interrupt_handler, 12); // GPIO12 interrupt handler function

RichardS

Re: error when registering an ISR

PostPosted: Tue Mar 19, 2019 2:24 am
by quackmore
nope

don't think so

ETS_GPIO_INTR_ATTACH expects a function and a function parameter
check out the interrupt function declaration
or try forcing a cast

this is a working example

Code: Select allstatic void input_pulse(struct di_seq *seq);

{
...
struct di_seq *seq;
...
ETS_GPIO_INTR_ATTACH((ets_isr_t)input_pulse, seq);
...
}

Re: error when registering an ISR

PostPosted: Tue Mar 19, 2019 5:24 am
by HEck
Hi quackmore and RichardS,

thank you for your responds.

In the end: If I use this

ETS_GPIO_INTR_ATTACH((ets_isr_t)I2C_Slave_ISR, NULL);

then it works. So, the "(ets_isr_t)" declaration for the ISR-argument of the Reg_Function was missing. I could nowhere read such hint (except in yor example). Only the error message from the compiler pointed to this and not to the second argument, which could be a variable for the ISR. But this could also be nothing (NULL) in case no input values are necessary for the ISR. Why the compiler must occupy data space, when not needed.

Greetings
Henry