Skip to main content
+ link to doc
Source Link
Edgar Bonet
  • 44.3k
  • 4
  • 41
  • 79

Try this:

asm volatile("lds r24, %0" : : "i" (&Driver.ISR_param));

The "i" constraint means you provide an integer constant. It can be any integer, unlike the uppercase "I" constraint which is limited to 6-bit positive integers.

Addendum: The constraints supported by gcc are listed in the gcc documentation, section Constraints for asm Operands:

  • The "i" constraint is listed in the subsection “Simple Constraints” and is described as:

An immediate integer operand (one with constant value) is allowed. This includes symbolic constants whose values will be known only at assembly time or later.

  • The "I" constraint is in the subsection “Machine Constraints” and, for the AVR architecture, is defined as

Constant greater than -1, less than 64.

Try this:

asm volatile("lds r24, %0" : : "i" (&Driver.ISR_param));

The "i" constraint means you provide an integer constant. It can be any integer, unlike the uppercase "I" constraint which is limited to 6-bit positive integers.

Try this:

asm volatile("lds r24, %0" : : "i" (&Driver.ISR_param));

The "i" constraint means you provide an integer constant. It can be any integer, unlike the uppercase "I" constraint which is limited to 6-bit positive integers.

Addendum: The constraints supported by gcc are listed in the gcc documentation, section Constraints for asm Operands:

  • The "i" constraint is listed in the subsection “Simple Constraints” and is described as:

An immediate integer operand (one with constant value) is allowed. This includes symbolic constants whose values will be known only at assembly time or later.

  • The "I" constraint is in the subsection “Machine Constraints” and, for the AVR architecture, is defined as

Constant greater than -1, less than 64.

Source Link
Edgar Bonet
  • 44.3k
  • 4
  • 41
  • 79

Try this:

asm volatile("lds r24, %0" : : "i" (&Driver.ISR_param));

The "i" constraint means you provide an integer constant. It can be any integer, unlike the uppercase "I" constraint which is limited to 6-bit positive integers.