Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ArduinoCore-Linux/cores/arduino/Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,5 @@ void analogWriteResolution(uint8_t bits) {
* @note This is used to prevent watchdog timer resets in long-running loops
*/
void yield() {}

const String emptyString;
Comment on lines 234 to +236
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining emptyString in Arduino.cpp can force the linker to pull in this entire translation unit when only emptyString is referenced (e.g., from String/third-party libs). This can increase binary size and may also pull in unrelated globals (e.g., WifiMock WiFi behind SKIP_HARDWARE_WIFI). Consider moving the definition to a minimal dedicated .cpp (or wherever the String implementation lives) to keep the dependency surface and linked code small.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that this module is already pretty small, and very likely to be linked anyway since it defines millis() and delay() which are very commonly used. This Arduino core is for use on host machines which typically have lots of memory compared to the footprint of this compilation unit. If the maintainer would like for me to move it to a dedicated .cpp, I will do so, but at first glance it doesn't seem worthwhile.

6 changes: 5 additions & 1 deletion ArduinoCore-Linux/cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ using namespace arduino;

// supported by some platforms
void analogWriteFrequency(pin_size_t pin, uint32_t freq);
void analogWriteResolution(uint8_t bits);
void analogWriteResolution(uint8_t bits);

// ESP32-ism that is adopted by most Arduino implementations
// and used by, at least, ESPAsyncWebServer
extern const String emptyString;
Loading