Garbage at end of line

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

Hello, I have a problem with my code, because, Atmel Studio show me some errors, and I can't solve that, I need some help. 

 

The errors are:

 

Severity Code Description Project File Line Source

Error garbage at end of line GccApplication2 C:\Users\steven\AppData\Local\Temp\ccWEkVqj.s 63 Build

Severity Code Description Project File Line Source

Error garbage at end of line GccApplication2 C:\Users\steven\AppData\Local\Temp\ccWEkVqj.s 67 Build

 

Severity Code Description Project File Line Source

Error garbage at end of line GccApplication2 C:\Users\steven\AppData\Local\Temp\ccWEkVqj.s 453 Build

 

Severity Code Description Project File Line Source

Error garbage at end of line GccApplication2 C:\Users\steven\AppData\Local\Temp\ccWEkVqj.s 457 Build

 

Severity Code Description Project File Line Source

Error recipe for target 'main.o' failed GccApplication2 D:\Universidad\Microprocesadores\Microprocesadores\ESTUDIO DE PROMACIÓN\GccApplication2\GccApplication2\Debug\Makefile 79 Build

 

My code is:

 

#define F_CPU 16000000UL


#include <avr/io.h>
#include <util/delay.h>																	// PARA USAR DELAYS																		// PERMITE LA UTILIZACIÓN DE LCD
#include <stdlib.h>																		// CONVIERTE NUMEROS EN CADENAS DE CARACTERES
#include <avr/interrupt.h>																// PERMITE EL USO DE INTERRUPCIONES EXTERNAS
#include <string.h>																		// PERMITE EL USO DE CADENAS


#define APORT_LCD PORTA																	// DEFININCIÓN Y ACTIVACIÓN DEL PUERTO A
#define ADDR_LCD DDRA																	// DEFININCIÓN Y ACTIVACIÓN DEL PUERTO A
#define CPORT_LCD PORTC																	// DEFININCIÓN Y ACTIVACIÓN DEL PUERTO C
#define CDDR_LCD DDRC																	// DEFININCIÓN Y ACTIVACIÓN DEL PUERTO C
#define RS_LCD 0																		// RS, RW y E junto a sus respectivos valores,
#define RW_LCD 1																		// indican a que pines del puerto C se deben cambiar los bits para el control de la LCD
#define E_LCD 2


int16_t ValorTemperatura;																// VARIABLE TIPO ENTERA DE 16 BITS, DEBIDO A QUE ALLI REPOSARAN LOS VALORES OBTENIDOS POR
// EL ADC, EL CUAL ES DE 10 BITS, POR ELLO SE REQUIERE UNA VARIABLE DE 16 BITS, QUE PUEDA
// ALMACENAR DICHA CANTIDAD DE BITS
float Temperatura;																		// VARIABLE FLOTANTE, LA CUAL ENVIARÁ VALORES AL PUETO A, CADA CIERTO TIEMPO
char array[] = {"Temperatura"};															// CONTIENE EL MENSAJE TEMPERATURA, LA ELECCIÓN DEL TIPO CHAR SE HACE DE ACUERDO
// A LA IMPLEMENTACIÓN DE LA SUBRUTINA DE IMPRESIÓN EN LA LCD




void EscribirComando_LCD (unsigned char cmd);
void EscribirDato_LCD(unsigned char dat);
void print_LCD(char *string);
void Print_N(unsigned int a);


int main(void)
{
	DDRA=0xFF;				//DEFINE EL PUERTO A COMO SALIDA
	DDRC=0xFF;				//DEFINE EL PUERTO C COMO SALIDA
	DDRF=0x00;				//DEFINE EL PUERTO F COMO ENTRADA (ADC)
	DDRB=0xFF;				//DEFINE EL PUERTO B COMO SALIDA
	ADMUX=0B01000000;		//MISMO ADMUX DEL LAB2
	ADCSRA=0B11101111;		//MISMO ADCSRA DEL LAB2
	ADCSRB=0B00000110;		//MISMO ADCSRB DEL LAB2
	DIDR0 |=(1<<ADC0D);		//DEFINE EL PIN ADC0 COMO ENTRADA PARA LM35
	asm("LDI R25, 0B00000101");
	asm("STS TCCR1B, R25");
	asm("LDI R24, 0B00000001");
	asm("STS TIMSK1, R24");
	asm("SEI");				// HABILITA LAS INTERRUPCIONES GLOBALES
	asm("LDI R23, HIGH(0XC2F7)");
	asm("LDI R22, LOW(0XC2F7)");
	asm("STS 0x85, R23");
	asm("STS 0x84, R22");
	
	EscribirComando_LCD(0x01);  //LIMPIAR EL LCD
	_delay_ms(2);
	EscribirComando_LCD(0X30);
	_delay_us(40);

	
	
	
	while (1)
	{
		
		EscribirComando_LCD(0x80 + 0);
		_delay_us(40);
		print_LCD(array);
		_delay_us(40);
		EscribirComando_LCD(0x80 + 0x0B);
		_delay_us(40);
		Print_N(ValorTemperatura);
		EscribirComando_LCD(0x01);
		_delay_us(82);
	}
	
	
}
ISR(TIMER1_OVF_vect){
	
	asm("LDI R23, HIGH(0XC2F7)");
	asm("LDI R22, LOW(0XC2F7)");
	asm("STS 0x85, R23");
	asm("STS 0x84, R22");
	ADCSRA|=(1<<ADSC);
	while(ADCSRA&(1<<ADSC))
	{
		ValorTemperatura=ADC;
		
	}
	
	asm("COM R26");
	asm("OUT PORTB, R26");
	
	
	
}




void EscribirComando_LCD(unsigned char cmd)												// LO PRIMERO QUE SE REALIZA ES EL ENVIÓ DEL COMANDO A TRAVÉS DEL PUERTO A.
// DESPUÉS SE GENERA UN RETRASO DE 40US, PARA QUE EL COMANDO ENVIADO NO LLEGUE TAN RÁPIDO A LA LCD
{
	APORT_LCD=cmd;
	_delay_us(40);
	CPORT_LCD &= ~(1<<RS_LCD);
	CPORT_LCD|=(0<<RW_LCD);
	CPORT_LCD|=(1<<E_LCD);
	_delay_ms(2);
	CPORT_LCD &=~(1<<E_LCD);
	_delay_ms(1);
}
void EscribirDato_LCD(unsigned char dat)
{
	APORT_LCD=dat;
	_delay_us(40);
	CPORT_LCD |= (1<<RS_LCD);
	CPORT_LCD |= (0<<RW_LCD);
	CPORT_LCD |= (1<<E_LCD);
	_delay_ms(2);
	CPORT_LCD &=~(1<<E_LCD);
	_delay_ms(1);
	
}

void print_LCD(char *string)
{
	while(*string)
	{
		EscribirDato_LCD(*string++);
	}
}

void Print_N(unsigned int a)
{
	EscribirDato_LCD((a/10)+0x30);
	_delay_us(40);
	EscribirDato_LCD((a%10)+0x30);
}

 

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

HIGH() and LOW() is the wrong syntax for the assembler being part of avr-gcc.

But all the inline assembler is pointless anyway.

For example:

	asm("LDI R25, 0B00000101");
	asm("STS TCCR1B, R25");

What's wrong with "TCCR1B = 0b00000101;"?

Or even better yet "TCCR1B = (1<<CS12) | (1<<CS10);".

Stefan Ernst

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

If you're going to use inline assembly, you should take a look at the Inline Assembly Cookbook

 

 

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

You have a LOT of comments that are NOT commented like "PRIMERO QUE SE REALIZA ES EL ENVIÓ DEL COMANDO A TRAVÉS DEL PUERTO A."
 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

@js: I can't see any such. Are you sure that's not line wraps "at your end" (or introduced by the forum software) ?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

oops I have just discovered I must be a bit of a lefty! My eyes didn't go that way to the right of the screen, the comments double slashes are there. blush

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Weird. I have those double slashes on the left...

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

Probably down to the OP using TABs - which is a certain way to get weird layout!

 

See: http://www.avrfreaks.net/comment...

 

And: http://www.avrfreaks.net/comment...

Last Edited: Wed. Nov 1, 2017 - 10:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In this case it would have been be better to get the failing file(s) as attachments, so that we could study it's exact contents.

 

Also: Two of the errors are on lines 453 and 457 of file C:\Users\steven\AppData\Local\Temp\ccWEkVqj.s

 

1. The errors are pertaining to a temp file, which seems strange..

2. The code presented in the OP is nowhere near 500 lines long...

3. ...and since all four errors mentioned are for this same temp file then the code presented is not this temp file.

 

How did you miss the fact that the errors are pointing to a  different file than the one you posted above? (Are you not reading the error messages?)

 

Also: The errors are presented as a copy of the Errors and Warnings list in Studio. It is of far more use to us (and thus improves your chances of getting good help) if we can see the complete build output. Switch to the Output tab, copy everything and paste in a post here.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

JohanEkdahl wrote:
1. The errors are pertaining to a temp file, which seems strange..
But all the C compiler does is convert C to Asm as a temporary .s file then feed that to the assembler. Clearly there's something "iffy" in that Asm. As the C compiler does not make mistakes writing Assembler it can only be from ill formed asm() in the C code which just says "copy this verbatim and plonk it into the .s file"

 

As Stefan has already said it seems to be the use of:

	asm("LDI R23, HIGH(0XC2F7)");
	asm("LDI R22, LOW(0XC2F7)");

As the manual (do people ever??) says....

 

https://sourceware.org/binutils/...

 

There is no such thing as high() and low(). Presumably the intention was hi8() and lo8()?

 

But as Stefan goes on to say:

What's wrong with "TCCR1B = 0b00000101;"?

Or even better yet "TCCR1B = (1<<CS12) | (1<<CS10);".

There seem to have been a few threads recently where the OP is making gratuitous use of asm() based on some tutor insisting that "you must mix C and asm()".  Seems like very bad tuition if that is what they are being told they have to do in their assignment with no justification (like "this section is time critical and must be optimised in hand assembly"), just using asm() to preempt the pro-pro/C compiler is monstrous!

 

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

Weird. I have those double slashes on the left...

Browser window width.

 

The OP's comments are placed to the right of a large number of tab characters following the code on each line.  Different browser window widths will result in a different line-wrapping behaviour.  Larger text and/or narrower window will cause more severe wrapping.  The slashes will land wherever the wrapping lands them.

 

If using FF or Chrom(e/ium), use CTRL-plus and CTRL-minus to change scaling, while observing the code block in the OP.  You'll see what happens.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

joeymorin wrote:
 a large number of tab characters 

See #8 - TABs are Evil!

 

 

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

See #8 - TABs are Evil!

Indeed.  However, the issue is the OP's lines are looooong, with looooots of whitespace, resulting in strange line-wrapping behaviour depending on window with and font size.  Although it would have taken more of them than tabs, spaces would have had the same result in this case.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Fair point.

 

Though it could be that the lines are a lot loooooooooonger than the OP was expecting because TABs here expand to (much) mooooooooore than in his setup ...

 

EDIT:

 

Bart Simpsons Chalkboard

Last Edited: Thu. Nov 9, 2017 - 06:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:
Browser window width.

Doh! Gahhhh!

 

"Funny" how my mind was made up that those comments where on their own "logical" lines.

 

Of-course, my conviction was boosted by the fact that that is my usual comment style. (I dislike greatly, i.e. despise, comments on the same line as actual code in almost all cases..)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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]

Last Edited: Thu. Nov 9, 2017 - 06:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
I dislike greatly, i.e. despise, comments on the same line as actual code 

So you would, in fact, agree with the description in the thread title: "garbage at end of line" ... ?!

 

wink

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

When I open the browser at full screen (26"!) I can see that the comments are correct.blush

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

awneil wrote:
See #8 - TABs are Evil!

Bull.  Who appointed y'all editing police?

 

First, then, remove TAB from the character sets.  Now, depending on your coloration, you might make a distinction between horizontal tabs and vertical tabs.  One can ascertain which group -- "good TAB" or "bad TAB" -- needs to be suppressed by observing which end of the boiled egg is broken first.

 

After the successful purge of TAB from the control characters section of character-set standards, the actual intent of the self-appointed evil cabal will be revealed. The TAB situation is just a feint; the real purpose is to attach the alphabet itself.  First target :  "F".  After all, without it there would be no F-word.

 

Following such adjustment to "content" I suppose "style" is next.  You mind my words -- if this continues, someone will start campaigning for 1TBS and anyone that disagrees will be subject to Darci Lynne  https://www.youtube.com/watch?v=... until they do, just like during other similar Inquisitions.

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Remave TABS fram Makefiles - mice du- (und, unlike Spanish, Umericuin has tuu many vawels : I just remuved ...) 

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

So... Wheres volterius?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

JohanEkdahl wrote:
So... Wheres volterius?

Spotted recently, getting rid of Tab...

Image result for drinking tab soda

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.