Hi all, I've stumbled across another problem with ATmega2560 support. Although the problem is triggered from avr-libc, I believe this to be a gcc problem.
I'm trying to use the rand() function. The function that calls rand() is close to the 128K flash boundary in lower flash, and the rand() function (and practically all of the std library) is placed above the 128K boundary. The compiler generates a direct CALL to the rand() function. So far, so good. Then, the rand() function calls do_rand(), defined in the avr-libc rand.c file. Again, so far, so good. Then the do_rand() calls __prologue_saves__. That function saves the appropriate registers, but then assembles an EIJUMP without setting the proper value in EIND. This wouldn't matter on anything *but* an ATmega2560. On my code, EIND = 0 (because I've never made an EICALL to set EIND = 1) so the code jumps into lower flash and I'm dead. I *assume* (yeah, bad that) that the _prologue.* file is under the jurisdiction of GCC since I was unable to find it in the avr-libc source. But then, I could be smoking something wonderful and hallucinating badly. I don't have a test case (yet), but will generate one if/when asked. I can also give my current disassembled code of these three areas, if anyone is interested. Best regards, Stu Bell Senior Software Engineer DPHI, Inc. (DataPlay) _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list