arduino / ArduinoCore-sam

81 stars 107 forks source link

Serial.write(0x00) fails to compile #94

Open gicking opened 4 years ago

gicking commented 4 years ago

just stumbled across a weird behavior. If I send a 0x00 via Serial.write(), compiler fails with the below error. Values other than 0x00 are fine, and also sending a variable with value 0x00 (see attached demo)

Notes:

Here the compiler output:

Serial.write.zip

Arduino: 1.8.10 (Linux), Board: "Arduino Due (Programming Port)"

/opt/arduino-1.8.10/arduino-builder -dump-prefs -logger=machine -hardware /opt/arduino-1.8.10/hardware -hardware /home/georg/.arduino15/packages -tools /opt/arduino-1.8.10/tools-builder -tools /opt/arduino-1.8.10/hardware/tools/avr -tools /home/georg/.arduino15/packages -built-in-libraries /opt/arduino-1.8.10/libraries -libraries /home/georg/Dokumente/Arduino/libraries -fqbn=arduino:sam:arduino_due_x_dbg -vid-pid=0X2341_0X003D -ide-version=10810 -build-path /tmp/arduino_build_862278 -warnings=none -build-cache /tmp/arduino_cache_314170 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.bossac.path=/home/georg/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.bossac-1.6.1-arduino.path=/home/georg/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.arm-none-eabi-gcc.path=/home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs=runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path=/home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -verbose /home/georg/Schreibtisch/Serial.write/Serial.write.ino /opt/arduino-1.8.10/arduino-builder -compile -logger=machine -hardware /opt/arduino-1.8.10/hardware -hardware /home/georg/.arduino15/packages -tools /opt/arduino-1.8.10/tools-builder -tools /opt/arduino-1.8.10/hardware/tools/avr -tools /home/georg/.arduino15/packages -built-in-libraries /opt/arduino-1.8.10/libraries -libraries /home/georg/Dokumente/Arduino/libraries -fqbn=arduino:sam:arduino_due_x_dbg -vid-pid=0X2341_0X003D -ide-version=10810 -build-path /tmp/arduino_build_862278 -warnings=none -build-cache /tmp/arduino_cache_314170 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.bossac.path=/home/georg/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.bossac-1.6.1-arduino.path=/home/georg/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino -prefs=runtime.tools.arm-none-eabi-gcc.path=/home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs=runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path=/home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -verbose /home/georg/Schreibtisch/Serial.write/Serial.write.ino Using board 'arduino_due_x_dbg' from platform in folder: /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12 Using core 'arduino' from platform in folder: /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12 Detecting libraries used... /home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10810 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -DSAM3X8E -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Due\"" -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp -o /dev/null Generating function prototypes... /home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10810 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -DSAM3X8E -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Due\"" -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp -o /tmp/arduino_build_862278/preproc/ctags_target_for_gcc_minus_e.cpp /opt/arduino-1.8.10/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_862278/preproc/ctags_target_for_gcc_minus_e.cpp Sketch wird kompiliert... /home/georg/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10810 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -DSAM3X8E -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Due\"" -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp -o /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp.o /home/georg/Schreibtisch/Serial.write/Serial.write.ino: In function 'void loop()': Serial.write:8:20: error: call of overloaded 'write(int)' is ambiguous Serial.write(0x00); // fails ^ /home/georg/Schreibtisch/Serial.write/Serial.write.ino:8:20: note: candidates are: In file included from /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x/variant.h:38:0, from /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/Arduino.h:201, from /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp:1: /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/UARTClass.h:55:12: note: virtual size_t UARTClass::write(uint8_t) size_t write(const uint8_t c); ^ In file included from /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/Stream.h:26:0, from /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/HardwareSerial.h:24, from /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/Arduino.h:195, from /tmp/arduino_build_862278/sketch/Serial.write.ino.cpp:1: /home/georg/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/Print.h:49:12: note: size_t Print::write(const char) size_t write(const char str) { ^ exit status 1 call of overloaded 'write(int)' is ambiguous

iddq commented 4 years ago

Serial.write((const uint8_t)0);