O Serial.print(float)
do Arduino não imprime nada.
Por exemplo, eu modifiquei tests/sys_arduino/arduino-test.sketch
para testar flutuadores também, este é o diff:
iff --git tests/sys_arduino/arduino-test.sketch tests/sys_arduino/arduino-test.sketch
index 1aa30a9cb..59c2da2c9 100644
--- tests/sys_arduino/arduino-test.sketch
+++ tests/sys_arduino/arduino-test.sketch
@@ -105,6 +105,10 @@ static void print_test(void)
Serial.print("): ");
Serial.println(ul, f);
}
+
+ Serial.print("print(float): ");
+ Serial.print((float)3.14);
+ Serial.println();
}
void loop(void)
2020-10-27 12:03:55,271 # Hello Arduino!
print
2020-10-27 12:03:57,307 # print(int, BIN): 1111101011000111
[...]
2020-10-27 12:03:58,441 # println(unsigned long, HEX): 499602d2
2020-10-27 12:03:58,458 # print(float): 3.14
Esta é a saída que recebo, testada com Arduino Uno:
2020-10-27 12:03:55,271 # Hello Arduino!
print
2020-10-27 12:03:57,307 # print(int, BIN): 1111101011000111
[...]
2020-10-27 12:03:58,441 # println(unsigned long, HEX): 499602d2
2020-10-27 12:03:58,458 # print(float):
Operating System Environment
----------------------------
Operating System: Gentoo
Kernel: Linux 5.4.66-gentoo x86_64 Intel(R) Core(TM) i3-5010U CPU @ 2.10GHz
System shell: GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)
make's shell: GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)
Installed compiler toolchains
-----------------------------
native gcc: gcc (Gentoo 9.3.0-r1 p3) 9.3.0
arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
avr-gcc: avr-gcc (Gentoo 9.3.0-r1 p3) 9.3.0
mips-mti-elf-gcc: missing
msp430-elf-gcc: missing
riscv-none-elf-gcc: missing
riscv64-unknown-elf-gcc: missing
riscv-none-embed-gcc: missing
xtensa-esp32-elf-gcc: missing
xtensa-esp8266-elf-gcc: missing
clang: clang version 10.0.1
Installed compiler libs
-----------------------
arm-none-eabi-newlib: "3.3.0"
mips-mti-elf-newlib: missing
msp430-elf-newlib: missing
riscv-none-elf-newlib: missing
riscv64-unknown-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-esp8266-elf-newlib: missing
avr-libc: "2.0.0" ("20150208")
Installed development tools
---------------------------
ccache: missing
cmake: cmake version 3.17.4
cppcheck: Cppcheck 1.88
doxygen: 1.8.17
git: git version 2.26.2
make: GNU Make 4.2.1
openocd: missing
python: Python 3.7.9
python2: Python 2.7.18
python3: Python 3.7.9
flake8: 3.8.1 (mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.7.9 on
coccinelle: missing
@aabadie O teste não cabe mais na memória (Arduino Uno), então tive que comentar as linhas acima. Mas sim, funciona!
O teste não cabe mais na memória (Arduino Uno)
Estranho, ele se encaixa quando eu construo no Docker (conforme relatado em # 15314). Qual é a versão do seu conjunto de ferramentas AVR?
$ avr-g++ --version
avr-g++ (Gentoo 9.3.0-r1 p3) 9.3.0
$ eix-installed -a | grep avr
cross-avr/avr-libc-2.0.0
cross-avr/binutils-2.34-r2
cross-avr/gcc-9.3.0-r1
dev-embedded/avrdude-6.3
Ok, então sua versão é muito mais recente do que a RIOT padrão:
$ docker run --rm -ti riot/riotbuild avr-g++ --version
avr-g++ (GCC) 5.4.0
[...]
Isso explica a diferença no tamanho do código, eu acho.