Skip to content

Commit

Permalink
remove compile flag for risc-v MCUs which is only valid for xtensa MC…
Browse files Browse the repository at this point in the history
…Us (#21665)
  • Loading branch information
Jason2866 authored Jun 20, 2024
1 parent 2115e09 commit fe280fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
9 changes: 9 additions & 0 deletions pio-tools/add_c_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@

# 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"))
19 changes: 10 additions & 9 deletions pio-tools/strip-floats.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
Import('env')

build_flags = " ".join(env.GetProjectOption("build_flags"))
link_flags = " ".join(env['LINKFLAGS'])
build_flags = " ".join(env['BUILD_FLAGS'])

#
# Dump build environment (for debug)
#print env.Dump()
#print(env.Dump())
#

flags = " ".join(env['LINKFLAGS'])
flags = flags.replace("-u _printf_float", "")
flags = flags.replace("-u _scanf_float", "")
link_flags = link_flags.replace("-u _printf_float", "")
link_flags = link_flags.replace("-u _scanf_float", "")
if "FIRMWARE_SAFEBOOT" in build_flags:
# Crash Recorder is not included in safeboot firmware -> remove Linker wrap
flags = flags.replace("-Wl,--wrap=panicHandler", "")
flags = flags.replace("-Wl,--wrap=xt_unhandled_exception", "")
newflags = flags.split()
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=newflags
LINKFLAGS=new_link_flags
)
6 changes: 0 additions & 6 deletions platformio_tasmota_cenv_sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ build_flags = ${env:tasmota32_base.build_flags}
[env:tasmota32c3-bluetooth]
extends = env:tasmota32_base
board = esp32c3
build_unflags = ${env:tasmota32_base.build_unflags}
-mtarget-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_BLUETOOTH
; -DUSE_EQ3_ESP32
Expand Down Expand Up @@ -111,8 +109,6 @@ lib_ignore = Micro-RTSP
[env:tasmota32c3-mi32]
extends = env:tasmota32_base
board = esp32c3
build_unflags = ${env:tasmota32_base.build_unflags}
-mtarget-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_BLUETOOTH
-DUSE_MI_EXT_GUI
Expand All @@ -133,8 +129,6 @@ lib_ignore = Micro-RTSP
[env:tasmota32c6-mi32]
extends = env:tasmota32_base
board = esp32c6
build_unflags = ${env:tasmota32_base.build_unflags}
-mtarget-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_BLUETOOTH
-DUSE_MI_EXT_GUI
Expand Down
16 changes: 0 additions & 16 deletions platformio_tasmota_env32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
extends = env:tasmota32_base
board = esp32c2
board_build.app_partition_name = safeboot
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_SAFEBOOT
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c2-safeboot.bin"'
Expand All @@ -83,8 +81,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
extends = env:tasmota32_base
board = esp32c3
board_build.app_partition_name = safeboot
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_SAFEBOOT
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3-safeboot.bin"'
Expand All @@ -95,8 +91,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
extends = env:tasmota32_base
board = esp32c3ser
board_build.app_partition_name = safeboot
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_SAFEBOOT
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3ser-safeboot.bin"'
Expand All @@ -117,8 +111,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
extends = env:tasmota32_base
board = esp32c6
board_build.app_partition_name = safeboot
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_SAFEBOOT
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6-safeboot.bin"'
Expand All @@ -129,8 +121,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
extends = env:tasmota32_base
board = esp32c6ser
board_build.app_partition_name = safeboot
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_SAFEBOOT
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6ser-safeboot.bin"'
Expand Down Expand Up @@ -187,8 +177,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
[env:tasmota32c2]
extends = env:tasmota32_base
board = esp32c2
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_TASMOTA32
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c2.bin"'
Expand All @@ -198,8 +186,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
[env:tasmota32c3]
extends = env:tasmota32_base
board = esp32c3
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_TASMOTA32
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3.bin"'
Expand All @@ -209,8 +195,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
[env:tasmota32c6]
extends = env:tasmota32_base
board = esp32c6
build_unflags = ${env:tasmota32_base.build_unflags}
-mno-target-align
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_TASMOTA32
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6.bin"'
Expand Down

0 comments on commit fe280fe

Please sign in to comment.