UC3B using memc,mems,memt with inline assembler

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

How do i use mems with avr32-gcc?

   uint8_t abc = 0;

    asm( "mems %0, 1" : "=n" (abc) : "n" (abc) );

I tried this but i get following error:

output number 0 not directly addressable

 

Any idea whats the syntax looks like?

This topic has a solution.
Last Edited: Thu. Sep 5, 2019 - 12:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Write some C that will use the same the use - save-temps to see the Asm it generates

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

I think the problem is that im passing the variable "abc" incorrectly to the inline assembly. 

I tried your suggesting but I dont even know how to force gcc to use "mems".

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

The AVR32 memx instructions (x = c, s, or t) only work with constant (immediate) parameters so you can't pass in a variable value.

Letting the smoke out since 1978

 

 

 

 

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

Thank you. I also found that avr32-gcc already includes __builtin_memx. But I'm not really sure what is meant with constant (immediate) parameters. Like a const variable at global scope?

 

EDIT: I went with __sync_ operation for my problem.

Last Edited: Thu. Sep 5, 2019 - 12:57 PM