arduino / arduino/ArduinoCore-megaavr

Unexpected problem-causing definition of initVariant()

Open
#141 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
111
Forks
65
PR merge metrics
No merged PRs in 30d

Description

When attempting to use initVariant() in a library I'm creating for the Arduino Nano Every I was getting linker errors about multiple definitions of the initVariant function which is weakly defined in main.cpp specifically so it can be defined elsewhere.

The issue is the following. At the bottom of the file: .arduino15/packages/arduino/hardware/megaavr/1.8.8/variants/nona4809/variant.c an apparently random definition of the initVariant() function exists. It's empty and it's the last function in the file with no comments as to why it's there.

The file came with the download when the board was selected.

The board was selected as follows:
Arduino megaAVR Boards by Arduino Version 1.8.8 INSTALLED
Boards included in this package:
Arduino UNO WiFi Rev2, Arduino Nano Every

I selected the 4809 version.

The fix is simple, remove the function from the file. It shouldn't be there as an empty shell anyway and prevents the initVariant function from being used for its intended purpose. I just commented it out in the file for now but it would be nice to not have to go find and comment it out for each future upgrade.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with .arduino15/packages/arduino/hardware/megaavr/1.8.8/variants/nona4809/variant.c and inspect the empty initVariant() definition at the end of the file. Build or link a Nano Every project that defines initVariant() and confirm the duplicate-definition error is gone; done means the variant no longer supplies that conflicting definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.