You need to log in to create posts and topics.

ATmega128 printf() not working in SimulIDE 1.1.0-SR2

Hello,

I found an issue with printf() when simulating the ATmega128 in SimulIDE.

Environment:

  • SimulIDE: 1.1.0-SR2

  • OS: Windows 11

  • Compiler: AVR-GCC 5.4.0 (AVR 8-bit GNU Toolchain 3.6.2, Microchip Studio 7)

  • MCU: ATmega128, 16 MHz

  • UART0: 9600 baud

Problem:

Direct UART output and puts() work correctly, but printf() produces no output. The same functionality works correctly with the ATmega328P in SimulIDE.

I also tested the sprintf() example from this earlier report:

https://simulide.com/p/forum/topic/avr-atmega128-sprintf-sscanf-not-working/

The following statement still does not work in SimulIDE 1.1.0-SR2:

sprintf(buffer, "\r\nTest %d", 10);

These issues may be related.

Attached files:

I've attached print_ex.zip, which contains two test examples:

  • ATmega128 (issue reproduced): printf_ex.c and printf_ex.sim1

  • ATmega328P (working reference): printf_ex_atmega328p.c and printf_ex_atmega328p.sim1

The two C source files are identical. The ZIP also includes compiled HEX/ELF files for both MCUs.

Could you please investigate this issue?

Thank you!

Uploaded files:

Hi. thanks for reporting (again).

Finally I could find the problem.

As a workaround you can fix it like this:
Edit simulide/resources/data/AVR/mega128.mcu and set prog="65535" at line 3.

Hi arcachofo,
Thank you very much for investigating this issue and finding the cause!

I changed `prog` to `65535` in `mega128.mcu` as you suggested, and confirmed that `printf()` now works correctly.

I also tested the examples from the earlier `sprintf()`/`sscanf()` report, and confirmed that those issues are resolved as well.

I really appreciate your time and effort in tracking down the problem.
Thanks again for your great work on SimulIDE!