From ab9d7dd583230f161c15e2645c07ee72a6a813af Mon Sep 17 00:00:00 2001 From: Platinplayer23 Date: Mon, 27 Oct 2025 21:54:19 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20TS101=20PD=20negotiation=20regression=20(?= =?UTF-8?q?v2.22=20=E2=86=92=20v2.23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add special build rule for policy_engine.cpp to use -O1 optimization instead of -Os. This prevents aggressive compiler optimizations that disrupt timing-critical I2C communication with the FUSB302 PD controller. Root cause: Compiler update in commit 849d1f7d (Alpine 3.16 GCC 11.x to Alpine 3.19+ GCC 14.x) introduced aggressive optimizations. Fixes boot loops on TS101 when connected to USB-C power sources that worked with v2.22 but fail with v2.23+. Tested on TS101 with 100W USB-C power bank. --- source/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/Makefile b/source/Makefile index d97b10cd3..2201d171c 100644 --- a/source/Makefile +++ b/source/Makefile @@ -538,6 +538,11 @@ $(OUT_OBJS): $(OUTPUT_DIR)/%.o: %.c Makefile @test -d $(@D) || mkdir -p $(@D) @$(CC) -c $(CFLAGS) $< -o $@ + +# Special rule for policy_engine.cpp - use O1 optimization +$(OUTPUT_DIR)/Core/Drivers/usb-pd/src/policy_engine.o: Core/Drivers/usb-pd/src/policy_engine.cpp Makefile + @test -d $(@D) || mkdir -p $(@D) + @$(CPP) -c -O1 $(filter-out -Os -O3 -O2,$(CXXFLAGS)) $< -o $@ $(OUTPUT_DIR)/%.o: %.cpp Makefile @test -d $(@D) || mkdir -p $(@D) @$(CPP) -c $(CXXFLAGS) $< -o $@