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

Avoid tests being compiled by Arduino build system #48

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Avoid tests being compiled by Arduino build system #48

merged 1 commit into from
Mar 10, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jul 1, 2021

The placement of the tests program in the root of the library caused it to be compiled by the Arduino build system, which
causes serious problems:

  • Compilation fails for boards whose toolchain doesn't provide iostream ("iostream: No such file or directory")
  • When compilation doesn't fail, the test main() overrides the Arduino core library's main(), completely nuking the user's sketch. On MCUs with native USB (e.g., ATSAMD21G18), this includes the USB CDC code that provides a serial port for uploads on native USB MCUs (e.g., ATSAMD21G18), soft bricking the board.

The new location for the file is fairly standardized. For example:
https://github.com/arduino-libraries/ArduinoIoTCloud/tree/master/extras/test
The extras folder is intended to be a place to put things that should be ignored by the Arduino development software and build system:
https://arduino.github.io/arduino-cli/latest/library-specification/#extra-documentation

The placement of the tests program in the root of the library caused it to be compiled by the Arduino build system, which
causes serious problems:

- Compilation fails for boards whose toolchain doesn't provide iostream
- When compilation doesn't fail, the test `main()` overrides the Arduino core library's `main()`, completely nuking the
  user's sketch, including the USB CDC code that provides a serial port for uploads on native USB MCUs (e.g., ATSAMD21G18),
  soft bricking the board.
@sobrinho
Copy link

@ivanseidel ping!

@lucameier
Copy link

hi @ivanseidel
i could not compile my sketch without an error. this would have fixed it.
please merge.
see https://forum.arduino.cc/t/compilererror-undefined-reference-samd51/967414/4

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

Successfully merging this pull request may close these issues.

No output to Serial Output iostream compilation error on Arduino Mega Compile error for Arduino Nano
4 participants