arduino / arduino/ArduinoCore-avr
USART define warnings - U3Xn in HardwareSerial_private.h
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
there is an error in the USART define links. A bit definition called **U3Xn** does not exist. This is surely a typo and must be **U2Xn**. n stands for USART 0...3. If you activate the compiler flag -Wundef you get the following output. Can someone please correct this in HardwareSerial_private.h?
Thank you.
```cpp
In file included from C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial.cpp:33:0:
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:29: warning: "U3X3" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:37: warning: "U3X0" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
In file included from C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial2.cpp:27:0:
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:29: warning: "U3X3" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:37: warning: "U3X0" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
In file included from C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial0.cpp:27:0:
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:29: warning: "U3X3" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:37: warning: "U3X0" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
In file included from C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial1.cpp:27:0:
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:29: warning: "U3X3" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:37: warning: "U3X0" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
In file included from C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial3.cpp:27:0:
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:29: warning: "U3X3" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
C:\Arduino IDE Portable\Mega2560\arduino-1.8.19\portable\packages\arduino\hardware\avr\1.8.5\cores\arduino\HardwareSerial_private.h:80:37: warning: "U3X0" is not defined, evaluates to 0 [-Wundef]
UDRIE3 != UDRIE0 || U3X3 != U3X0 || UPE3 != UPE0 || \
^~~~
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Open cores/arduino/HardwareSerial_private.h and inspect the comparison around line 80, where the -Wundef warnings identify U3X3 and U3X0. Verify the corresponding USART bit definitions and correct the erroneous U3Xn references to U2Xn. Rebuild the AVR core with -Wundef and confirm these warnings no longer appear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100