Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@EangJS
Copy link
Contributor

@EangJS EangJS commented Nov 12, 2025

Optimize the CFLAGS length

Currently, there are many -I include paths appended to CFLAGS. This may cause the limit of 4096 to exceed.
This PR would edit the Makefile to generate a temporary response file containing all the CFLAGS instead of loading an entire CFLAGS string directly.

Also remove duplicate include paths

Duplicated Already Included by
CFLAGS += -I$(DIR_OSDEP) CFLAGS += -I$(COMPONENT_DIR)/os_dep
CFLAGS += -I$(DIR_MBED) CFLAGS += -I$(COMPONENT_DIR)/mbed/targets/hal/rtl8730e
CFLAGS += -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/armv7-a CFLAGS += -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/armv7-a
CFLAGS += -I$(TARGETDIR)/bootloader CFLAGS += -I$(TARGETDIR)/bootloader

Verification

Before
CFLAGS length: 3777 / 4096

After
CFLAGS length: 28 / 4096

Built with before and after modification, MD5 sum of TizenRT/build/output/bin/kernel_rtl8730e_200204.trpk match.

@EangJS EangJS force-pushed the bugfix/Reduce-CFLAGS-Length branch from cff45b9 to 87195cb Compare November 12, 2025 05:56
@EangJS EangJS marked this pull request as ready for review November 12, 2025 06:03
endif

# Generate response file containing all CFLAGS
CFLAGS_FILE := $(TOPDIR)/cflags.rsp
Copy link
Collaborator

Choose a reason for hiding this comment

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

The CFLAGS response file approach is a valid solution for addressing command line length limitations. However, the implementation should be carefully integrated with the existing build system to ensure robustness and maintainability. The approach is particularly useful for complex builds with many include paths and definitions.

Copy link
Contributor

@seokhun-eom24 seokhun-eom24 left a comment

Choose a reason for hiding this comment

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

If we use this approach, we should clean this file too.
And also add this file to .gitignore.

@EangJS EangJS force-pushed the bugfix/Reduce-CFLAGS-Length branch 2 times, most recently from 7f72a54 to 59d4033 Compare December 17, 2025 01:41
Copy link
Contributor

@seokhun-eom24 seokhun-eom24 left a comment

Choose a reason for hiding this comment

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

Can you seperate commit with Makefile and .gitignore for cherry-pick.

@EangJS EangJS force-pushed the bugfix/Reduce-CFLAGS-Length branch 3 times, most recently from ccbe921 to 92a0bd3 Compare December 17, 2025 03:45
* Generate a response file containing all the CFLAGS instead of loading an entire CFLAGS string directly.
* Remove duplicate include paths to clean up makefile

---

Built with before and after modification, MD5 sum of TizenRT/build/output/bin/kernel_rtl8730e_200204.trpk match.
@EangJS EangJS force-pushed the bugfix/Reduce-CFLAGS-Length branch from 92a0bd3 to 7d0d0b5 Compare December 17, 2025 04:00
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.

3 participants