Debugging with PlatformIO: Part 4. Using Semihosting on ARM Targets

You can link it a bit differently and force every symbol of the librdimon library to be used unconditionally (over the symbols defined by Arduino, the whole archive), like this.

Import("env")

env.Append(
    # Use the semihosted version of the syscalls
    LINKFLAGS=[
        "-Wl,--whole-archive",
        "-lrdimon_nano",
        "-Wl,--no-whole-archive"
    ],
)

Note that since the Arduino firmware builds with --specs=nano.specs you also need the nano version of librdimon: There’s two.

Then it works without modifying any Arduino core files.

2 Likes