FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix: Add assembler include path for STM32 startup files by bbuyukyuksel · Pull Request #35 · STM32-base/STM32-base · GitHub

Fix: Add assembler include path for STM32 startup files - #35

Open
bbuyukyuksel wants to merge 1 commit into
STM32-base:masterfrom
bbuyukyuksel:bug/fix-asm-include
Open

bbuyukyuksel wants to merge 1 commit into
STM32-base:masterfrom
bbuyukyuksel:bug/fix-asm-include

Conversation

Copy link
Copy Markdown

Title

Fix: Add assembler include path for STM32 startup files


Description

This pull request resolves a build issue related to STM32F1xx and other devices startup files.

Problem

When building the project, the following error occurs:

can't open startup_common.s for reading

The startup assembly files (e.g., STM32F103xB.s) include startup_common.s via:

.include "startup_common.s"

Even though CPPFLAGS already contains -I$(BASE_STARTUP), this only affects the C/C++ compiler. The assembler (g++ -c <file>.s) does not automatically use the -I paths specified in CPPFLAGS for resolving .include directives. As a result, the assembler cannot find startup_common.s.

Solution

  • Added -Wa,-I$(BASE_STARTUP) to CPPFLAGS in make/common.mk.

    • -Wa, passes options directly to the assembler.
    • This ensures that the assembler can locate startup_common.s during compilation.
  • No changes to the source tree or startup files are required.

Benefits

  • Fixes the "can't open startup_common.s for reading" build error.
  • STM32F1xx startup files now compile correctly in all environments.
  • Maintains a clean project structure consistent with the STM32-base layout.

Verification

  • make clean && make succeeds for STM32F103 devices.
  • No regressions observed in linking or binary generation.

This change ensures both the C/C++ compiler and assembler correctly find include paths, resulting in a reliable and reproducible build.

System

  • OS:

Linux bbuyukyuksel-VirtualBox 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler:

arm-st-eabi-g++ (crosstool-NG 1.28.0_rc1) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

- Added `-Wa,-I$(BASE_STARTUP)` to CPPFLAGS to ensure the assembler can
  locate `startup_common.s` from the device-specific startup files.
- Prevents "can't open startup_common.s for reading" errors during build.
- This ensures STM32F1xx startup files compile correctly without modifying
  the source tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL