Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning about duplicate #define __SFR_OFFSET in TrinketMouse #22

Open
allyourcode opened this issue Jan 10, 2017 · 3 comments
Open

Warning about duplicate #define __SFR_OFFSET in TrinketMouse #22

allyourcode opened this issue Jan 10, 2017 · 3 comments

Comments

@allyourcode
Copy link

I'm able to use TrinketMouse successfully, but when I compile I get an annoying warning:

In file included from /Users/danielwong/Documents/Arduino/libraries/TrinketMouse/usbdrvasm_includer.S:24:0:
/Users/danielwong/Documents/Arduino/libraries/TrinketMouse/usbdrv/usbdrvasm.S:18:0: warning: "__SFR_OFFSET" redefined
 #define __SFR_OFFSET 0      /* used by avr-libc's register definitions */
 ^
In file included from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /Users/danielwong/Documents/Arduino/libraries/TrinketMouse/cmdline_defs.h:26,
                 from /Users/danielwong/Documents/Arduino/libraries/TrinketMouse/usbdrvasm_includer.S:22:
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/sfr_defs.h:141:0: note: this is the location of the previous definition
 #    define __SFR_OFFSET 0x20
 ^

I tried to solve this by commenting out line 18 in usbdrvasm.S, but that just broke everything. I also tried replacing that #define with #include <avr/sfr_defs.h> but that didn't do the trick either.

Obviously, this isn't the end of the world, but it would be nice to have clean builds.

@christakahashi
Copy link

I'm having the same issue. Arduino 1.8.2, windows 10. Same warning.

@jous
Copy link

jous commented Aug 15, 2018

The avr libraries (sfr_defs.h) first set _SFR_OFFSET to 0x20. Later on usbdrvasm165.inc and asmcommon.inc need _SFR_OFFSET to be 0x00. usbdrvasm.S sets it to 0x00, but this generates a warning because defined macros are supposed to be constant.

In usbdrvasm.S, please add

#undef __SFR_OFFSET

before the

#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */

line to suppress the message completely.

@jackhumbert
Copy link

I'm not sure if this is applicable here, but I had a similar issue, and solved it by using the __ASSEMBLER__ flag:

#ifndef __ASSEMBLER__
  #include <avr/io.h>
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants