arduino / arduino/ArduinoCore-avr

Compiler warning for Arduino NG or older (ATmega8 only). Warning: PE redefined

Open
#148 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

While compiling code for the ATmega8 with compiler warnings turned on, I get this error every time I compile. PE is already defined in the iom8.h file, but gets redefined in the Arduino.h file. This, but itself isn't a problem. The problem (?) appears in the HardwareSerial_private.h file, where the redefined PE value us used:
`#if !defined(UPE) && defined(PE)`
`#define UPE PE`
`#endif`

Should the PE value be defined 2 or 5 for ATmega8?

**Compiler warning:**

> n file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_private.h:33:0,
> from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c:28:
> /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:187:0: warning: "PE" redefined [enabled by default]
> #define PE 5
> ^
> In file included from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/io.h:350:0,
> from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_private.h:28,
> from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_digital.c:28:
> /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/iom8.h:534:0: note: this is the location of the previous definition
> #define PE 2
> ^

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with cores/arduino/Arduino.h and cores/arduino/HardwareSerial_private.h, then inspect the ATmega8 definition in avr/iom8.h shown in the compiler output. Reproduce a warnings-enabled ATmega8 compilation and compare how PE and UPE are used. Done means the warning is resolved without breaking the affected serial definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.