# Warning causing target crash?

**URL:** <https://forum.sierrawireless.com/t/warning-causing-target-crash/1317>\
**Category:** Open AT\
**Created:** [May 15, 2007, 11:09am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317 "2007-05-15T11:09:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark.C](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Mark.C](https://forum.sierrawireless.com/u/Mark.C)\
**Post date:** [May 15, 2007, 11:09am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/1 "2007-05-15T11:09:55Z")

</div>

Why i get this warnings and can this warnings “crash” the target ?

> [@](#):
>
> passing argument 4 of ‘adl\_tmrSubscribe’ from incompatible pointer type

```auto
void myGpioOutput(void)	
{
adl_atSendResponse(ADL_AT_RSP,"\r\n GPIO runing\r\n");
TRACE (( 3, "gpio running" ));		
adl_ioWriteSingle(GpioOutputHandle, ADL_IO_Q2686_GPIO_2, ADL_IO_HIGH);
TRACE (( 3, "HIGH" ));
adl_ioWriteSingle(GpioOutputHandle, ADL_IO_Q2686_GPIO_2, ADL_IO_LOW);
TRACE (( 3, "LOW" ));	
}

void setGpioOutput(void)
{
TRACE (( 3, "Config" ));
GpioOutputHandle = adl_ioSubscribe ( 1, Gpio2Config, 0, 0, 0 );	
adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, myGpioOutput );
adl_atSendResponse(ADL_AT_RSP,"\r\n Gpio - Config\r\n");
}
```

* * *

> [@](#):
>
> previous implicit declaration of ‘Timer\_stop’ was here [Conflicting names]  
> conflicting types for ‘Timer\_stop’ [Conflicting names]

```auto
void timerHandler (u8 id)
{
adl_atCmdCreate("AT+ADC?", TRUE,ADC_Handler,"*", NULL);  
...
Timer_stop();
}

void Timer_stop()
{
adl_tmrUnSubscribe(setTimer,(adl_tmrHandler_t)timerHandler,ADL_TMR_TYPE_100MS);
setTimer = NULL;
}
```

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [May 15, 2007, 12:13pm UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/2 "2007-05-15T12:13:56Z")

</div>

> [@Mark.C.](#):
>
> Why i get this warnings

The clue is in the name: They are called “Warnings” because they Warn you about a potential [color=orange]problem in your code.

> [@](#):
>
> can this warnings “crash” the target ?

Of course not!  
It’s not the Warning itself that crashes your target; it’s the underlying [color=orange]problem that causes the crash - that’s why the compiler is warning you!

If somebody warned you, “That car doesn’t look safe”, you would do well to consider whether or not the car is safe before getting into it, wouldn’t you?  
If you just ignore them and go speeding off down the autobahn, and it turns out that the car really was unsafe, it’s not the fault of that person or their warning if you get hurt, is it?

Exactly the same applies to warnings that you may receive from a compiler!

> [@](#):
>
> passing argument 4 of ‘adl\_tmrSubscribe’ from incompatible pointer type

Pointers are probably the most powerful feature of ‘C’ - unfortunately, this also means that they are also the most [color=red]dangerous when used carelessly or incorrectly!

The warning is about argument 4 of your call to ‘adl\_tmrSubscribe’ - so take a look at it:

```auto
void myGpioOutput(void)	
{
   :
   :
}

void setGpioOutput(void)
{
   :
   adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, myGpioOutput );
   :
}
```

Now, go back to the ADL User Guide - what does it tell you about the 4th parameter of adl\_tmrSubscribe?  
Does your setGpioOutput function match what the ADL User Guide tells you…?

---

<div class="post-metadata">

**Author:** ![Mark.C](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Mark.C](https://forum.sierrawireless.com/u/Mark.C)\
**Post date:** [June 11, 2007, 8:23am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/3 "2007-06-11T08:23:16Z")

</div>

> [@](#):
>
> conflicting types for ‘Timer\_stop’ [Conflicting names]  
> conflicting types for ‘myFunction’ [Conflicting names]  
> :  
> :

If i compile the code under RTE i get upper messages under “error” section.  
If i compile the same code under Target i get those messages under “warning” section.

In both ways, how to correct this errors.  
This is the example on one such function:

> [@](#):
>
> void myFunction(void){  
> TRACE (( 3, “Im in my function” ));  
> GpioInputHandle = adl\_ioSubscribe ( 1, GpioConfig, 0, 0, 0 );   
> }

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 11, 2007, 9:54am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/4 "2007-06-11T09:54:09Z")

</div>

> [@Mark.C.](#):
>
> If i compile the code under RTE i get upper messages under “error” section.  
> If i compile the same code under Target i get those messages under “warning” section.

The Remote (RTE) and Target builds use different compilers:  
The Remote build uses a native PC compiler (eg Microsoft);  
The Target build uses an ARM Cross-Compiler (eg, GCC).

That explains why the messages are slightly different.

> [@](#):
>
> In both ways, how to correct this errors.

They are both telling you that the types don’t match - so make them match!

---

<div class="post-metadata">

**Author:** ![Mark.C](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Mark.C](https://forum.sierrawireless.com/u/Mark.C)\
**Post date:** [June 11, 2007, 10:24am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/5 "2007-06-11T10:24:51Z")

</div>

> [@](#):
>
> They are both telling you that the types don’t match - so make them match!

could you be more precisely. What would you do…

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 11, 2007, 11:23am UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/6 "2007-06-11T11:23:44Z")

</div>

> [@Mark.C.](#):
>
> could you be more precisely. What would you do…

For a start, look at the exact messages, and see which particular parameter(s) are affected.

Then look at the types of the actual parameter(s) you have supplied.

Then look in the ADL manual to find what types are required.

If they differ, then that’s your problem!

---

<div class="post-metadata">

**Author:** ![Mark.C](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Mark.C](https://forum.sierrawireless.com/u/Mark.C)\
**Post date:** [June 11, 2007, 1:27pm UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/7 "2007-06-11T13:27:36Z")

</div>

> [@](#):
>
> For a start, look at the exact messages, and see which particular parameter(s) are affected.

- If i call one function, one time, then i get no warnings/errors ??
- functions are different but the error is always the same.
- the function that i have sent is the whole function, there nothing else so i can not see what can be problem.
- the gpioconfig part is OK.

---

<div class="post-metadata">

**Author:** ![jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jan](https://forum.sierrawireless.com/u/jan)\
**Post date:** [June 11, 2007, 2:11pm UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/8 "2007-06-11T14:11:59Z")

</div>

C doesn’t like calling a function before it is declared.

try to reverse the code like this:

```auto
void Timer_stop() 
{ 
adl_tmrUnSubscribe(setTimer,(adl_tmrHandler_t)timerHandler,ADL_TMR_TYPE_100MS); 
setTimer = NULL; 
}

void timerHandler (u8 id) 
{ 
adl_atCmdCreate("AT+ADC?", TRUE,ADC_Handler,"*", NULL);  
... 
Timer_stop(); 
}
```

or do define the prototype, if you don’t want or can’t reverse the code:

```auto
void Timer_stop();

void timerHandler (u8 id) 
{ 
adl_atCmdCreate("AT+ADC?", TRUE,ADC_Handler,"*", NULL);  
... 
Timer_stop(); 
} 

void Timer_stop() 
{ 
adl_tmrUnSubscribe(setTimer,(adl_tmrHandler_t)timerHandler,ADL_TMR_TYPE_100MS); 
setTimer = NULL; 
}
```

In the case of ‘myFunction’ this might also apply.

Best Regards,  
Jan

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 11, 2007, 4:10pm UTC](https://forum.sierrawireless.com/t/warning-causing-target-crash/1317/9 "2007-06-11T16:10:54Z")

</div>

> [@jan](#):
>
> C doesn’t like calling a function before it is declared.

and if you do it, ‘C’ is likely to make default assumptions about its type & parameters - which may well not be as you require, so may well end up givig you errors/warnings about type errors and/or mismatches…
