No doubt, the best simple UART I/O module yet ( ha ! )

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No doubt, the best simple UART I/O module yet ( ha ! )

https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

stevech wrote:
No doubt, the best simple UART I/O module yet ( ha ! )

I downloaded files and changed onlu UBBRL_VALUE to 23 in order to adapt it to the crystal used. But, when I try to "Make All" I get

> "make.exe" all

-------- begin --------
avr-gcc (GCC) 3.4.5
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

make.exe: *** No rule to make target `Main.o', needed by `Main.elf'. Stop.

> Process Exit Code: 2
> Time Taken: 00:01

I am using WinAVR, January version.

All files from folder are zipped and attached,

Thanks for any help.

Pop

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After some testing I found an error in Makefile, but now I get warnings in compilation:

main.c:28: warning: passing arg 1 of `UART_puts_P' discards qualifiers from pointer target type

The line 28 is:

UART_puts_P(PSTR("Enter text\r\n"));

and function UART_puts_P is

// Print string from flash memory
void UART_puts_P( char *p)  {
	char b;
	
	while ( (b = pgm_read_byte(p++) ) != 0)
		UART_putc(b);
}

Any ideas?

Pop

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check casing of filenames. The GNU tools that are at the core of WinAVR are coming out of the Unix/Linux world and are case sensitive.

If the filename is actually main.c but the makefile contains the name Main.c you will get the error message "No rule to make target..."

Either update/change the filename on disk or change the filename in the makefile.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pop48m wrote:
After some testing I found an error in Makefile, but now I get warnings in compilation:

Well as it's just a warning it doesn't really matter does it as presumably the original author was happy that it just worked?

His error, though, is in the type of pointer being passed into the UART_puts_P() function. My equivalent functions (that compile without warning) are:

send_str_P(PSTR( "ADCPM is ON\r\n"));

void
send_str_P(
	PGM_VOID_P str
){
	uint16_t 	p;
	uint8_t 	c;

	p = (uint16_t) str;
	c = pgm_read_byte(p);

	while (c != '\0') {
		send_char(c);
		p++;
		c = pgm_read_byte(p);
	}
}

void send_char(
	uint8_t 	c
){
        while (!(UCSRA & (1<<UDRE))); // wait till transmit Data register is empty
        UDR = c; // send the character
}

So it's that UART_puts_P() function probably wants to be taking a PGM_VOID_P as parameter and not a char *

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ Johan
That was exactly the error in Makefile that I found myself (see my previous response). Thank you anyway for pointing this common error.

@ Cliff

Quote:
Well as it's just a warning it doesn't really matter does it as presumably the original author was happy that it just worked?

I suspect that original author didn't even check his program, since it was impossible to compile it because of an error in #include section that I corrected at the very begining.
Your advice is correct. After correcting pointer types, the program compiles fine and it's working. Now, I can go to the other, more serious part of the whole program.

Thanks again to both of you.

Pop