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

2021-06-22 Thread Trampas Stern
Also when you print out the size in the make file, how much SRAM does it indicate your program is using? On Tue, Jun 22, 2021 at 2:10 PM Trampas Stern wrote: > So I would recommend that you put in the ASSERT for the LDL_PEDANTIC() > macro. > > Secondly, you need to be careful with PROGMEM, that

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

2021-06-22 Thread BERTRAND Joël
Strange. Following function runs as expected. enum ldl_mac_status LDL_MAC_otaa(struct ldl_mac *self) { enum ldl_mac_status retval; union ldl_mac_response_arg arg; LDL_PEDANTIC(self != NULL) if(self->ctx.joined){ retval = LDL_STATUS_JOINED; } else

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

2021-06-22 Thread Trampas Stern
So I would recommend that you put in the ASSERT for the LDL_PEDANTIC() macro. Secondly, you need to be careful with PROGMEM, that is with AVR being a Harvard machine you can burn up SRAM quickly by not using PROGMEM for constants. For example with the LDL library you need to be sure that

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

2021-06-22 Thread BERTRAND Joël
BERTRAND Joël a écrit : > Trampas Stern a écrit : >> Does the code run if you comment out 'lora_send("coucou", 7); > > Yes. To be honnest, if I comment out LDL_MAC_otaa(), it runs. > >> Does it still crash with simple main() { _delay_ms(1000); >> stty_print("hello");} >> >> That is start

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

2021-06-22 Thread BERTRAND Joël
Trampas Stern a écrit : > Also when you print out the size in the make file, how much SRAM does it > indicate your program is using?  AVR Memory Usage Device: atmega1284 Program: 101324 bytes (77.3% Full) (.text + .data + .bootloader) Data: 6890 bytes (42.1% Full) (.data

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

2021-06-22 Thread BERTRAND Joël
David Brown a écrit : > On 22/06/2021 18:00, Ian Molton wrote: >> On 22/06/2021 12:59, BERTRAND Joël 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

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

2021-06-22 Thread David Brown
On 22/06/2021 18:00, Ian Molton wrote: > On 22/06/2021 12:59, BERTRAND Joël 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,

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

2021-06-22 Thread Trampas Stern
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

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

2021-06-22 Thread BERTRAND Joël
Trampas Stern a écrit : > Does the code run if you comment out 'lora_send("coucou", 7); Yes. To be honnest, if I comment out LDL_MAC_otaa(), it runs. > Does it still crash with simple main() { _delay_ms(1000); > stty_print("hello");} > > That is start removing code until it works, when

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

2021-06-22 Thread Trampas Stern
Can you comment out lines and have firmware run? Could it be that your power supply is dropping and browning out? On Tue, Jun 22, 2021 at 7:59 AM BERTRAND Joël wrote: > Hello, > > I'm writing a firmware for a board that uses a ATMega 1284. > Firmware > continuously restarts

Memory corruption (?) I don't understand

2021-06-22 Thread BERTRAND Joël
Hello, I'm writing a firmware for a board that uses a ATMega 1284. Firmware continuously restarts and I'm not able to fix this bug. It looks like a memory corruption, but after several days without finding this bug, I doubt. Hardware seems to be bug free and runs as expected.

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

2021-06-22 Thread BERTRAND Joël
Trampas Stern a écrit : > Can you comment out lines and have firmware run?   I don't understand. I have tried to comment out some lines. Sometimes firmware runs as expected, sometimes, it continuously reboots. When I comment out some lines or add some debug trace, firmware desn't

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

2021-06-22 Thread Ian Molton
On 22/06/2021 12:59, BERTRAND Joël 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

Re: Problem linking *without* avr-libc, libm, etc. (SOLVED)

2021-06-22 Thread Ian Molton
On 01/05/2021 01:11, David Kelly wrote: > Has been a long time for me but Once Upon A Time it wasn’t just a matter > of “not using functions in the library”. AVR-gcc required primatives > other than startup code. It still does - not just on AVR - also on ARM and others. It was quite amusing when

Re: Build gcc 10.3.0 for avr on a amd64 linux host

2021-06-22 Thread Ian Molton
On 21/05/2021 20:50, BERTRAND Joël wrote: > Hello, > > I'm trying to build a recent gcc to check if my issue comes from > compiler or not. I recommend using crosstool-ng for this.