embeddedartistry / embeddedartistry/arduino-printf
Refactor library to move extras/ files back into src/
- Dominant language
- C
- Stars
- 102
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
From #37:
> Second, the library's .cpp file includes the printf.c file directly in order to supply default compile-time configuration options (e.g., to make it suitable for AVR targets). Including the printf.c source file in the src tree causes the Arduino IDE to automatically compile the files a second time, generating multiple definition errors at link time. Moving to the extras folder gave me a pattern that worked to achieve the goals above (at least with the Arduino IDE, CMake, and Meson builds) and passes the Arduino library linter that is run to determine whether your library can be included in the library manager. (All my headaches are caused by the "helpful" features like auto-compiling source files or auto-deleting "unnecessary" folders to save space or configuration options 😅).
>
> After this recent filing, I looked into refactoring the Arduino library code to use the recently provided configuration header support in printf.c to supply the default options, but its inclusion is dependent on another preprocessor definition instead of something like __has_include, so I cannot get around it without updating the upstream library. Ideally, I will work with the maintainer to get these changes rolled in (ideal scenario), otherwise I will have to deviate further on my own fork or in this library. One of those will happen, but not in the next few weeks, so again a stopgap would be welcome.
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect the extras/ and src/ directories and review how the Arduino IDE, CMake, and Meson builds discover and compile the files. The refactor is done when the configuration approach works across those builds without compiling printf.c twice or causing multiple-definition errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, c
- Domain
- build-system, embedded-iot
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100