Skip to content

Not working with newest Arduino - fixes #65

Open
@JDuchniewicz

Description

@JDuchniewicz

Not opening a PR because I noticed that you have your own fork of Arduino-Makefile project and maintain it.

Took me some time to figure it out but now it works.

First of all, with new SAMD devices, this will fail to compile and it requires changes in the README (might open a PR just for that).
For the SAMD boards, there is no need for BOARD_SUB, everything is stored in BOARD_TAG.

With the newest commits from the upstream repository, the example project will still not build due to missing LTO plugins.

Suggested change is as follows:

diff --git a/Arduino.mk b/Arduino.mk
index 5a04506..9258f0f 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -1073,6 +1073,9 @@ CAT     = cat
 ECHO    = printf
 MKDIR   = mkdir -p

+# SPECIAL WORKAROUND FOR LIBRARIES
+LTO_PLUGIN_DIR = $(HOME)/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/lib/gcc/arm-none-eabi/7.2.1/liblto_plugin.so
+
 # recursive wildcard function, call with params:
 #  - start directory (finished with /) or empty string for current dir
 #  - glob pattern
@@ -1698,7 +1701,7 @@ else
 endif

 $(CORE_LIB):   $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)
-               $(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)
+               $(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS) --plugin $(LTO_PLUGIN_DIR)

 error_on_caterina:
                $(ERROR_ON_CATERINA)

I did not find a way to replace the arm-none-eabi-gcc-ar with a C++ one so this requires the LTO Plugin to be included. Feel free to alter it. Also I opened a PR upstream to fix zeroing the board before flashing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions