Skip to content

GD32: Fast GPIO optimization#27845

Merged
thinkyhead merged 2 commits intoMarlinFirmware:bugfix-2.1.xfrom
bmourit:patch-1
May 8, 2025
Merged

GD32: Fast GPIO optimization#27845
thinkyhead merged 2 commits intoMarlinFirmware:bugfix-2.1.xfrom
bmourit:patch-1

Conversation

@bmourit
Copy link
Contributor

@bmourit bmourit commented May 7, 2025

Description

Adding FORCE_INLINE to the fast GPIO functions gives us a couple benefits.
First, code folding will reduce these functions to their direct register accesses - which is ideal.
Second, it allows us to optimize away the pin-port map - reducing code size (~250 bytes or so) as well as eliminating all overhead.

This has been verified via decompilation.

The only down side is that the EEPROM (software IIC) seems to rely on this overhead to meet timing requirements, and since we now have zero overhead, writing to the EEPROM is broken.

I'll submit another PR with that fix.

Requirements

GD32 Board

Benefits

Zero overhead for IO and smaller code size.

Configurations

N/A

Related Issues

N/A

bmourit added 2 commits May 7, 2025 14:26
Adding FORCE_INLINE to the fast GPIO functions gives us a couple benefits.

First, code folding will reducing these functions to their direct register accesses - which is ideal.

Second, it allows us to optimize away the pin-port map - reducing code size (~250 bytes or so) as well as eliminating all overhead.

This has been verified via decompilation.

The only down side is that the EEPROM (software IIC) seems to rely on this overhead to meet timing requirements, and since we now have zero overhead, writing to the EEPROM is broken.

I'll submit another PR with that fix.
@thinkyhead thinkyhead merged commit fd11748 into MarlinFirmware:bugfix-2.1.x May 8, 2025
66 checks passed
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request May 15, 2025
rommo911 pushed a commit to rommo911/Marlin-e3v2 that referenced this pull request Sep 16, 2025
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