[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] I have a fdevopen problem under Linux. Help ...
From: |
francois schnell |
Subject: |
[avr-libc-dev] I have a fdevopen problem under Linux. Help ... |
Date: |
Thu, 14 Jul 2005 11:54:13 +0200 |
Hello,
As a science teacher I'm tinkering a project for
schools (http://www.liberlab.net/) with the goal to do a very cheap
data acquisition for example.
So far I used WinAvr since all the toolchain is nicely integrated but
I want to do the same now on my Ubuntu Hoary laptop.
I've installed:
gcc-avr 1:3.4.3-1
uisp 20040311-1
binutils-avr 2.15-1
avr-libc 1:1.0.5-1
For Linux I'm using Guido Socher makefile (not the winavr):
http://www.tuxgraphics.org/common/src2/article352/avrm8ledtest-0.2.tar.gz
Everything work fine and I can make a LED blink.
I've got a program which use the UART which works fine with winavr
but I've got the following problem when I do my "make" under Linux:
--------------------
avr-gcc -g -mmcu=atmega8 -Wall -Wstrict-prototypes -Os
-mcall-prologues -o avrm8ledtest.out -Wl,-Map,avrm8ledtest.map
avrm8ledtest.o
/usr/lib/gcc/avr/3.4.3/../../. ./../avr/lib/avr4/libc.a(calloc.o
)(.text+0x8):
In function `calloc':
/build/buildd/avr-libc-1.0.5
/build-avr5/libc/stdlib/../../../libc/stdlib/calloc.c:37:
undefined reference to `__mulhi3' make: *** [avrm8ledtest.out] Error 1
-------------------
In the program I've got:
-------------------
int UART_putchar (char c)
{
/* Sends a single char over the UART */
loop_until_bit_is_set (USR,UDRE); // Wait until the send register is empty
UDR = c; // Send char to send register
return 0;
}
int UART_getchar (void) // this
{
unsigned char c;
/* Holds program execution untill a char is received */
loop_until_bit_is_set (USR,RXC); // Wait untill a char is received
c = UDR;
int a;
for (a=0;a<100;a++) {}
/* This next line echo's the char, comment out if not needed */
UART_putchar (c);
return c;
}
void UART_first_init (void)
{
/* First init for the UART */
//UBRR = FOSC / (16 * BAUD) - 1; // The magic formula
UBRR = 9;
UCR = (1<<RXEN)|(1<<TXEN); // 8 Databits
UCSRC = (1<<URSEL) | (1<<USBS) | (3 << UCSZ0); //
fdevopen (UART_putchar, UART_getchar, 0);
}
------------------
If I comment the line "fdevopen (UART_putchar, UART_getchar, 0);" it
compile but oviously the program don't "work".
I read on avr-libc doc that the management for the UART is somewhat
different under Linux but I must say I'm a little lost here. Could
someone tell me how I should re-write this with Linux or give me an advise
or a better place more approriate to post this kind of question?
Thanks
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] I have a fdevopen problem under Linux. Help ...,
francois schnell <=