| Q: I have a program that uses printf or puts, and when building the project, I get the follow error. What does it mean? It used to work with V6 compiler!
!ERROR Function 'putchar' not defined. This is a hardware dependent function,
and it is not included in the ICCAVR default library. Please implement
this function to match your target requirements. You can find examples
of this function under the <install root>\examples.AVR directory. Make
a copy of a suitable example, add it to your project and modify it if
needed. You must #include the C header file (e.g. stdio.h) containing
both the function prototype and the "#pragma device_specific_function..."
statement in your source file(s) referencing 'putchar'.
A: For printf or puts to work, you must have a putchar() function that works for the target device. Previously the putchar in the library only works for some of the AVR chips, and for a portion of the users, the program will link successfully but then it will not work. There is no way to make a putchar() that works for all devices since Atmel places the UART IO register at different locations based on the AVR chip. The error describes exactly what needs to be done.
richard@imagecraft.com |