About 500 warnings ?

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

Hallo AVR friends..

 

In my Atmel Studio 7 project, I have over 500 same warnings. I think they come through the inline function in my header file op.h

 

warnings:  "output constraint '=' for operand 0 is not at the beginning"

 

My code:

 

oscillator.c

....

//interpolation sample
      sample1 = hugemem_read8(p + addr);
      sample2 = hugemem_read8(p + addr + 1);
      uint8_t phase_x = (phase >> 8) & 0xff;
      sample = U8MixShift8(sample1,sample2, phase_x);
...

op.h

static inline uint8_t U8MixShift8(uint8_t a, uint8_t b, uint8_t balance) {
  uint16_t sum;
  asm(
  "mul %3, %2"      "\n\t"  // b * balance
  "movw %A0, r0"    "\n\t"  // to sum
  "com %2"          "\n\t"  // 255 - balance
  "mul %1, %2"      "\n\t"  // a * (255 - balance)
  "com %2"          "\n\t"  // reset balance to its previous value
  "add %A0, r0"     "\n\t"  // add to sum L
  "adc %B0, r1"     "\n\t"  // add to sum H
  "eor r1, r1"      "\n\t"  // reset r1 after multiplication
  : "&=r" (sum)
  : "a" (a), "a" (balance), "a" (b)
  );
  return sum >> 8;
}

 

Download my Atmel Studio7 project file (its free): https://drive.google.com/open?id=0BxbpDqwYdkvEMkdqS3JxbTdMZjg

 

Here my project blog: http://mutable-instruments.net/forum/discussion/2504/shruthi-synthesizer-and-my-wave-1#Item_1094

 

Thanks for your help :)) Rolf from germany

 

 

This topic has a solution.

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

Last Edited: Sun. Apr 30, 2017 - 04:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you have 500 errors the only important one is the first one. Often when you fix that you fix the next 499 as a consequence. So what is the very first error? 

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

Yes is right, but i have no idea what I can do ?

 

I have the op.h file include in c files. See example...

 

op.h file

/*
 * op.h
 *
 * Created: 29.04.2017 23:31:39
 *  Author: rolfd
 */ 

#ifndef OP_H_
#define OP_H_
#define INLINE static inline
#endif /* OP_H_ */

//*************************************************************************
// inline function
//*************************************************************************
INLINE uint8_t U8U8MulShift8(uint8_t a, uint8_t b) {
	uint8_t result;
	asm(                                          // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	"mul %1, %2"      "\n\t"
	"mov %0, r1"      "\n\t"
	"eor r1, r1"      "\n\t"
	: "=r" (result)
	: "a" (a), "a" (b)
	);
	return result;
}

and more inline code....

 

modulation.c

/*
 * modulation.c
 *
 * Created: 26.06.2016 11:51:26
 *  Author: rolfd
 */ 

#include "modulation.h"
#include "filter.h"
#include "sequencer.h"
#include "oscillators.h"
#include "display/displ_funktion.h"
#include "op.h"

//*************************************************************************
// calc modulation
//*************************************************************************
void modulation_matrix (void)
{
	// copy modulation sources in arry and scaled 0-255 -------------------
	uint8_t modulation_sources[15];
	modulation_sources[MOD_SRC_ENV1]	= Env.value_8[0];		// max. Value = 255
	modulation_sources[MOD_SRC_ENV2]	= Env.value_8[1];		// max. Value = 255
	modulation_sources[MOD_SRC_LFO1]	= LFO.out[0];			// max. Value = 255
	modulation_sources[MOD_SRC_LFO2]	= LFO.out[1];			// max. Value = 255
	modulation_sources[MOD_SRC_LFO3]	= LFO.out[2];			// max. Value = 255
	modulation_sources[MOD_SRC_VELO]	= midi_velocity << 1;	// max. Value = 255
	modulation_sources[MOD_SRC_NOTE]	= midi_note << 1;		// max. Value = 255
	modulation_sources[MOD_SRC_NOISE]	= Noise.sample;			// max. Value = 255
	modulation_sources[MOD_SRC_SEQ]		= SEQ.mod_value;		// max. Value = 255
	modulation_sources[MOD_SRC_MWHEEL]  = Midi.Modwheel;		// max. Value = 255
	modulation_sources[MOD_SRC_PBEND]   = U14ShiftRight6(midi_pitchbend);// max. Value = 255                    // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	modulation_sources[MOD_SRC_ATOUCH]  = Midi.Atouch;			// max. Value = 255
	modulation_sources[MOD_SRC_POTI1]	= poti1_value;
	modulation_sources[MOD_SRC_POTI2]	= poti2_value;
	modulation_sources[MOD_SRC_OFFSET]	= 127;					// DC_Offset


	// Load initial values of modulation and scale to 0-8192  -------------
	uint16_t dst_[19];
	dst_[MOD_DST_VCA]		= 255;								// VCA
	dst_[MOD_DST_VCA_BAL]	= 8192;								// VCA_BAL
	dst_[MOD_DST_VCF]		= U8U8Mul(VCF.cutoff_value, 128);	// VCF                                // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	dst_[MOD_DST_VCF_BAL]	= 8192;								// VCF_BAL
	dst_[MOD_DST_RESO]		= U8U8Mul(VCF.reso_value, 128);		// Resonance                          // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	dst_[MOD_DST_LFO1]		= (pgm_read_word (&(LFO_increment[LFO.rate_volume[0]])));
	dst_[MOD_DST_LFO2]		= (pgm_read_word (&(LFO_increment[LFO.rate_volume[1]])));
	dst_[MOD_DST_LFO3]		= (pgm_read_word (&(LFO_increment[LFO.rate_volume[2]])));
	dst_[MOD_DST_OSC1_f]	= 8192;								// max value osc1 fpitch
	dst_[MOD_DST_OSC2_f]	= 8192;								// max value osc2 fpitch
	dst_[MOD_DST_OSC12_f]	= 8192;								// max value osc1+2 fpitch
	dst_[MOD_DST_OSC1]		= 8192;								// max value osc1 pitch
	dst_[MOD_DST_OSC2]		= 8192;								// max value osc2 pitch
	dst_[MOD_DST_OSC12]		= 8192;								// max value osc1+2 pitch
	dst_[MOD_DST_Osc1_PRM]	= U8U8Mul(Osc.prm_value[0], 128);	// Osc1 parameter value                                        // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	dst_[MOD_DST_Osc2_PRM]	= U8U8Mul(Osc.prm_value[1], 128);	// Osc2 parameter value                                        // and more same warnings..
	dst_[MOD_DST_OSC_MIX]	= U8U8Mul(Osc.mix_value, 128);		//
	dst_[MOD_DST_Fx_Time]	= U8U8Mul(Fx.Time, 128);			// Fx_Time
	dst_[MOD_DST_Fx_PAN]	= 8192;								// max fx balance

	Poti1_LED_off;
	Poti2_LED_off;

and more code...

 

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

Last Edited: Sun. Apr 30, 2017 - 11:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Googling the error in the inline asm leads to this page as the first hit. The next hit also seems informative: https://gcc.gnu.org/onlinedocs/g... .

 

Slightly aside: Is the inline asm really "worth it"? Are you sure the compiler will not generate code that is efficient enough? E.g. have you tried writing an inline function in plain C?

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

But the warning doesn't match the code:

INLINE uint8_t U8U8MulShift8(uint8_t a, uint8_t b) {
	uint8_t result;
	asm(                                          // warnings:  "output constraint '=' for operand 0 is not at the beginning"
	"mul %1, %2"      "\n\t"
	"mov %0, r1"      "\n\t"
	"eor r1, r1"      "\n\t"
	: "=r" (result)
	: "a" (a), "a" (b)
	);
	return result;
}

 

You seem to have typed this in manually, rather than copy/pasting.  Or this is not the code pertaining to this warning.

 

I've dug up your other thread on the subject, posted only an hour ago:

https://www.mikrocontroller.net/topic/426227

static inline uint8_t U8MixShift8(uint8_t a, uint8_t b, uint8_t balance) {
  uint16_t sum;
  asm(
  "mul %3, %2"      "\n\t"  // b * balance
  "movw %A0, r0"    "\n\t"  // to sum
  "com %2"          "\n\t"  // 255 - balance
  "mul %1, %2"      "\n\t"  // a * (255 - balance)
  "com %2"          "\n\t"  // reset balance to its previous value
  "add %A0, r0"     "\n\t"  // add to sum L
  "adc %B0, r1"     "\n\t"  // add to sum H
  "eor r1, r1"      "\n\t"  // reset r1 after multiplication
  : "&=r" (sum)
  : "a" (a), "a" (balance), "a" (b)
  );
  return sum >> 8;
}

Note the difference in the operand.  It should be:

"=&r"

 

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

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

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

"Fast.  Cheap.  Good.  Pick two."

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

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's it..

 

Thank you for your help. Now I have 500,000 fewer warnings in atmel studio :))))))

 

Greetings from germany. Rolf

 

Windows 10 Home 64Bit, ASUS M4A89GTD-PRO/USB3, AMD Phenom II X6 1055T, Ram 2x 4GB, SSD Samsung EVO840 250GB, SATA HD 2.0TB, NVIDIA GeForce GTX 750

Last Edited: Sun. Apr 30, 2017 - 04:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Glad it was solved!

 

But if you come back here then please do a small correction if the forum software allows it. It is joeymorins post that should be marked as the solution.

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]