arduino / arduino/ArduinoCore-samd

Only define Serial ISRs when used

Open
#489 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

(There is an identical issue for sam [here](https://github.com/arduino/ArduinoCore-sam/issues/100))

Currently, I think that the Serial interrupt handlers are always included in the link (or maybe always included if any serial object is used). Ideally, none of these would be included by default, and only the ISRs for serial objects that are actually used are included. This would leave the way open for libraries or sketches to define their own serial ISR for any otherwise unused serial ports.

This behaviour is already implemented on AVR, by putting the definition of each serial object and its corresponding ISR in a separate .cpp file, and separating all serial objects from each other. Due to the way linking works wrt .a files, this should have the desired effect (when care is taken not to include any stray references to these serial objects). See https://github.com/arduino/Arduino/pull/1711#issuecomment-29745866 for the analysis I did on the original implementation on AVR.

I created this issue for sam after suggesting this as an alternative for https://github.com/arduino/ArduinoCore-sam/pull/95 (and see also https://github.com/arduino/ArduinoCore-avr/pull/299), and it made sense to do the same for samd as well.

I will not have time to actually implement this, but I'm happy to support anyone that wants to give a stab at it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Compare the SAMD serial implementation with the AVR approach described in the issue, where each serial object and ISR is placed in a separate .cpp file. Inspect how the current serial handlers are linked and verify that unused ports can provide their own ISR. Done means only ISRs for used serial objects are included while unused ports remain available to sketches or libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.