-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor strip-flags.py * refac more readable * make failsafe * move var to top * align
- Loading branch information
Showing
2 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
Import("env") | ||
|
||
build_flags = env['BUILD_FLAGS'] | ||
chip = env.get("BOARD_MCU").lower() | ||
|
||
# General options that are passed to the C++ compiler | ||
env.Append(CXXFLAGS=["-Wno-volatile"]) | ||
|
||
# General options that are passed to the C compiler (C only; not C++). | ||
env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration", "-Wno-incompatible-pointer-types"]) | ||
|
||
|
||
# Remove build flags which are not valid for risc-v | ||
build_flags = env['BUILD_FLAGS'] | ||
chip = env.get("BOARD_MCU").lower() | ||
|
||
if "c" in chip: | ||
build_flags.pop(build_flags.index("-mno-target-align")) | ||
build_flags.pop(build_flags.index("-mtarget-align")) | ||
if chip in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"): | ||
try: | ||
build_flags.pop(build_flags.index("-mno-target-align")) | ||
except: | ||
do_nothing="" | ||
try: | ||
build_flags.pop(build_flags.index("-mtarget-align")) | ||
except: | ||
do_nothing="" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
Import('env') | ||
|
||
link_flags = " ".join(env['LINKFLAGS']) | ||
link_flags = env['LINKFLAGS'] | ||
build_flags = " ".join(env['BUILD_FLAGS']) | ||
|
||
if "FIRMWARE_SAFEBOOT" in build_flags: | ||
# Crash Recorder is not included in safeboot firmware -> remove Linker wrap | ||
link_flags = link_flags.replace("-Wl,--wrap=panicHandler", "") | ||
link_flags = link_flags.replace("-Wl,--wrap=xt_unhandled_exception", "") | ||
|
||
new_link_flags = link_flags.split() | ||
|
||
env.Replace( | ||
LINKFLAGS=new_link_flags | ||
) | ||
try: | ||
link_flags.pop(link_flags.index("-Wl,--wrap=panicHandler")) | ||
except: | ||
do_nothing="" | ||
try: | ||
link_flags.pop(link_flags.index("-Wl,--wrap=xt_unhandled_exception")) | ||
except: | ||
do_nothing="" |