Skip to content

Fix led init - #113

Merged
xconverge merged 3 commits into
bkshepherd:mainfrom
spamatica:fix-led-init
Oct 27, 2026
Merged

xconverge merged 3 commits into
bkshepherd:mainfrom
spamatica:fix-led-init

Conversation

@spamatica

Copy link
Copy Markdown
Contributor

Workaround for a bug in Led::init in wait for the upstreamed fix being released.
As far as I could find this was the only hurdle stopping use of a more recent compiler so I commented out that test.
I'm using the current gcc 15.3.1 at the moment.

spamatica and others added 2 commits October 27, 2026 15:50
libDaisy's Led::Init() never initialises the software-PWM phase (pwm_) and Led's
constructor does nothing, so an Led created on the stack starts with leftover stack
contents. Depending on the compiler and optimiser that can be huge or NaN, which
keeps the LED permanently off (or on); the update does `pwm_ += rate; if (pwm_ > 1)
pwm_ -= 1`, so a large value never comes back into range.

InitLeds now zeroes the object before calling Init(). Verified on hardware with
arm-none-eabi-gcc 13.3, where the LEDs did not work before. This is an upstream
libDaisy bug; libDaisy is a submodule so the workaround lives in the project.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread Software/GuitarPedal/Makefile Outdated
GCC_VERSION := $(shell $(GCC_CHECK) -dumpversion)
GCC_VERSION_MAJOR := $(word 1, $(subst ., ,$(GCC_VERSION)))
GCC_VERSION_MAJOR_REQUIRED := 10
# GCC_VERSION := $(shell $(GCC_CHECK) -dumpversion)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete this entire compiler version check instead of commenting it out

@xconverge

Copy link
Copy Markdown
Collaborator

@xconverge

Copy link
Copy Markdown
Collaborator

Thanks for this! Simplifies things a bit!

@spamatica

Copy link
Copy Markdown
Contributor Author

There were more lines with the compiler test I hadn't noticed to I removed it all now.

Not to countermand my assertion with more recent compilers. I had noticed before that there were new linker warnings but forgot (the firmware does work).
They must have changed the contents of libc_nano or something, starting with gcc 11 there are a bunch of warnings about functions not having an implementation. I checked and it's easy to make dummy implementations that will cleanup the output, but I'm not sure it's the right thing to do. it could be they removed their own dummy implementations just to make it obvious they aren't implemented.

@xconverge
xconverge merged commit 3c3c5f6 into bkshepherd:main Oct 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants