Replying to my own email... But I found out more information...
If the following statement is included the problem occurs:
char *my_packet_types[]
= {"unk","ping","pong","unk","unk","ack","nak","eeread","eeresp",
"alive","eedetailsreq","eedetailsresp","updaterp",
"esensordata","sensordata","reset"};
I can easily reproduce the problem by just watching the
__malloc_heap_start variables in either the avr simulator or using the
jtag-ice on the hardware. It seems like the DATA is somehow becoming
corrupt when loading the default values from program memory. That is how
it works, right? The initialized values are loaded from program memory
in one of the .init sections.. When the above piece of code is included,
somehow my sram contains various strings from the AVRStudio like
"Loading Program Memory", but in double byte format (unicode?). I see
the same data in the program memory, at the end of the program. So the
program memory is somehow not getting the right value and this is then
being copied to SRAM...
In the process of writing this email, I think I found it might be a
ELF/dwarf-2 problem. It happens with the .elf file in avr studio, but
not the .hex file from the same build. I was trying to use GDB and
simulavr to determine if the problem is in avr studio or in the
elf/dwarf-2 creation, but didn't get anywhere.
I am willing to provide the .hex and .elf file if someone else would be
willing to take a look at it.
Thanks!
-jr
James Russo wrote:
> Hello,
>
> Ok, I give up. Spent the last 4 hours on this problem. I have a ~12k
> application trying to go into a atmega128. I seem to have this problem
> when this one module is loaded in, malloc starts returning large values
> greater then the size of ram. Its like it almost thinks that I have 65k
> of memory installed. Removing the one module seems to solve the
> problem? I am using a JTAG-ICE to debug the problem.
>
> Here is the avr-size output.
>
> text data bss dec hex filename
> 12426 192 846 13464 3498 main.elf
>
> The first address returned should be 192 + 846 + 2 (malloc size).
>
> can someone give me a hint?
>
> Thanks,
>
> -James
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=129s2s9n8/M=295196.4901138.6071305.3001176/D=groups/S=1706554205:HM/EXP=1097034954/A=2128215/R=0/SIG=10se96mf6/*http://companion.yahoo.com>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/AVR-Chat/
>
> * To unsubscribe from this group, send an email to:
> AVR-Chat-unsubscribe@yahoogroups.com
> <mailto:AVR-Chat-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>Message
Re: [AVR-Chat] malloc/heap issues?
2004-10-05 by James Russo
Attachments
- No local attachments were found for this message.