Re: Memory corruption (?) I don't understand

Trampas Stern <[email protected]> Tue, 22 Jun 2021 12:46:06 -0400
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CADqjcyjij9XRCZ8b2hjDrVde80+_x9NH3mCLDU0HPLy1VBL+5g@mail.gmail.com>
--00000000000056374e05c55d872b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Does the code run if you comment out 'lora_send("coucou", 7);
Does it still crash with simple main() { _delay_ms(1000);
stty_print("hello");}

That is start removing code until it works, when you find the line in main
that causes a crash, go into that function and start removing code until it
works.  Slowly you will find the problem.

On Tue, Jun 22, 2021 at 12:00 PM Ian Molton <[email protected]>
wrote:

> On 22/06/2021 12:59, BERTRAND Jo=C3=ABl wrote:
> >       Hello,
> >
> >       I'm writing a firmware for a board that uses a ATMega 1284.
> Firmware
> > continuously restarts
>
> This is likely a branch through zero.
>
> Common causes on AVR are bad function pointers, and stack damage.
>
> -Ian
>
>

--00000000000056374e05c55d872b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Does the code run if you comment out &#39;<span style=3D"b=
ackground-color:rgb(30,30,30);font-family:Consolas,&quot;Courier New&quot;,=
monospace;font-size:14px;white-space:pre;color:rgb(220,220,170)">lora_send<=
/span><span style=3D"background-color:rgb(30,30,30);color:rgb(212,212,212);=
font-family:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;white=
-space:pre">(</span><span style=3D"background-color:rgb(30,30,30);font-fami=
ly:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;white-space:pr=
e;color:rgb(206,145,120)">&quot;coucou&quot;</span><span style=3D"backgroun=
d-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Consolas,&quot;Cou=
rier New&quot;,monospace;font-size:14px;white-space:pre">,=C2=A0</span><spa=
n style=3D"background-color:rgb(30,30,30);font-family:Consolas,&quot;Courie=
r New&quot;,monospace;font-size:14px;white-space:pre;color:rgb(181,206,168)=
">7</span><span style=3D"background-color:rgb(30,30,30);color:rgb(212,212,2=
12);font-family:Consolas,&quot;Courier New&quot;,monospace;font-size:14px;w=
hite-space:pre">);

</span><div>Does it still crash with simple main() { _delay_ms(1000); stty_=
print(&quot;hello&quot;);}<br></div><div><br></div><div>That is start remov=
ing code until it works, when you find the line in main that causes a crash=
, go into that function and start removing code until it works.=C2=A0 Slowl=
y you will find the problem.=C2=A0</div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 22, 2021 at 12:00 PM Ia=
n Molton &lt;<a href=3D"mailto:[email protected]">avr_gcc-ian@mnem=
enth.co.uk</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">On 22/06/2021 12:59, BERTRAND Jo=C3=ABl wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0Hello,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0I&#39;m writing a firmware for a board that =
uses a ATMega 1284. Firmware<br>
&gt; continuously restarts<br>
<br>
This is likely a branch through zero.<br>
<br>
Common causes on AVR are bad function pointers, and stack damage.<br>
<br>
-Ian<br>
<br>
</blockquote></div>

--00000000000056374e05c55d872b--