Skip to content

Commit fe280fe

Browse files
authored
remove compile flag for risc-v MCUs which is only valid for xtensa MCUs (#21665)
1 parent 2115e09 commit fe280fe

File tree

4 files changed

+19
-31
lines changed

4 files changed

+19
-31
lines changed

pio-tools/add_c_flags.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@
55

66
# General options that are passed to the C compiler (C only; not C++).
77
env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration", "-Wno-incompatible-pointer-types"])
8+
9+
10+
# Remove build flags which are not valid for risc-v
11+
build_flags = env['BUILD_FLAGS']
12+
chip = env.get("BOARD_MCU").lower()
13+
14+
if "c" in chip:
15+
build_flags.pop(build_flags.index("-mno-target-align"))
16+
build_flags.pop(build_flags.index("-mtarget-align"))

pio-tools/strip-floats.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
Import('env')
22

3-
build_flags = " ".join(env.GetProjectOption("build_flags"))
3+
link_flags = " ".join(env['LINKFLAGS'])
4+
build_flags = " ".join(env['BUILD_FLAGS'])
45

56
#
67
# Dump build environment (for debug)
7-
#print env.Dump()
8+
#print(env.Dump())
89
#
910

10-
flags = " ".join(env['LINKFLAGS'])
11-
flags = flags.replace("-u _printf_float", "")
12-
flags = flags.replace("-u _scanf_float", "")
11+
link_flags = link_flags.replace("-u _printf_float", "")
12+
link_flags = link_flags.replace("-u _scanf_float", "")
1313
if "FIRMWARE_SAFEBOOT" in build_flags:
1414
# Crash Recorder is not included in safeboot firmware -> remove Linker wrap
15-
flags = flags.replace("-Wl,--wrap=panicHandler", "")
16-
flags = flags.replace("-Wl,--wrap=xt_unhandled_exception", "")
17-
newflags = flags.split()
15+
link_flags = link_flags.replace("-Wl,--wrap=panicHandler", "")
16+
link_flags = link_flags.replace("-Wl,--wrap=xt_unhandled_exception", "")
17+
18+
new_link_flags = link_flags.split()
1819

1920
env.Replace(
20-
LINKFLAGS=newflags
21+
LINKFLAGS=new_link_flags
2122
)

platformio_tasmota_cenv_sample.ini

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ build_flags = ${env:tasmota32_base.build_flags}
8181
[env:tasmota32c3-bluetooth]
8282
extends = env:tasmota32_base
8383
board = esp32c3
84-
build_unflags = ${env:tasmota32_base.build_unflags}
85-
-mtarget-align
8684
build_flags = ${env:tasmota32_base.build_flags}
8785
-DFIRMWARE_BLUETOOTH
8886
; -DUSE_EQ3_ESP32
@@ -111,8 +109,6 @@ lib_ignore = Micro-RTSP
111109
[env:tasmota32c3-mi32]
112110
extends = env:tasmota32_base
113111
board = esp32c3
114-
build_unflags = ${env:tasmota32_base.build_unflags}
115-
-mtarget-align
116112
build_flags = ${env:tasmota32_base.build_flags}
117113
-DFIRMWARE_BLUETOOTH
118114
-DUSE_MI_EXT_GUI
@@ -133,8 +129,6 @@ lib_ignore = Micro-RTSP
133129
[env:tasmota32c6-mi32]
134130
extends = env:tasmota32_base
135131
board = esp32c6
136-
build_unflags = ${env:tasmota32_base.build_unflags}
137-
-mtarget-align
138132
build_flags = ${env:tasmota32_base.build_flags}
139133
-DFIRMWARE_BLUETOOTH
140134
-DUSE_MI_EXT_GUI

platformio_tasmota_env32.ini

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
7171
extends = env:tasmota32_base
7272
board = esp32c2
7373
board_build.app_partition_name = safeboot
74-
build_unflags = ${env:tasmota32_base.build_unflags}
75-
-mno-target-align
7674
build_flags = ${env:tasmota32_base.build_flags}
7775
-DFIRMWARE_SAFEBOOT
7876
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c2-safeboot.bin"'
@@ -83,8 +81,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
8381
extends = env:tasmota32_base
8482
board = esp32c3
8583
board_build.app_partition_name = safeboot
86-
build_unflags = ${env:tasmota32_base.build_unflags}
87-
-mno-target-align
8884
build_flags = ${env:tasmota32_base.build_flags}
8985
-DFIRMWARE_SAFEBOOT
9086
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3-safeboot.bin"'
@@ -95,8 +91,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
9591
extends = env:tasmota32_base
9692
board = esp32c3ser
9793
board_build.app_partition_name = safeboot
98-
build_unflags = ${env:tasmota32_base.build_unflags}
99-
-mno-target-align
10094
build_flags = ${env:tasmota32_base.build_flags}
10195
-DFIRMWARE_SAFEBOOT
10296
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3ser-safeboot.bin"'
@@ -117,8 +111,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
117111
extends = env:tasmota32_base
118112
board = esp32c6
119113
board_build.app_partition_name = safeboot
120-
build_unflags = ${env:tasmota32_base.build_unflags}
121-
-mno-target-align
122114
build_flags = ${env:tasmota32_base.build_flags}
123115
-DFIRMWARE_SAFEBOOT
124116
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6-safeboot.bin"'
@@ -129,8 +121,6 @@ lib_ignore = ${safeboot_flags.lib_ignore}
129121
extends = env:tasmota32_base
130122
board = esp32c6ser
131123
board_build.app_partition_name = safeboot
132-
build_unflags = ${env:tasmota32_base.build_unflags}
133-
-mno-target-align
134124
build_flags = ${env:tasmota32_base.build_flags}
135125
-DFIRMWARE_SAFEBOOT
136126
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6ser-safeboot.bin"'
@@ -187,8 +177,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
187177
[env:tasmota32c2]
188178
extends = env:tasmota32_base
189179
board = esp32c2
190-
build_unflags = ${env:tasmota32_base.build_unflags}
191-
-mno-target-align
192180
build_flags = ${env:tasmota32_base.build_flags}
193181
-DFIRMWARE_TASMOTA32
194182
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c2.bin"'
@@ -198,8 +186,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
198186
[env:tasmota32c3]
199187
extends = env:tasmota32_base
200188
board = esp32c3
201-
build_unflags = ${env:tasmota32_base.build_unflags}
202-
-mno-target-align
203189
build_flags = ${env:tasmota32_base.build_flags}
204190
-DFIRMWARE_TASMOTA32
205191
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3.bin"'
@@ -209,8 +195,6 @@ lib_ignore = ${env:tasmota32_base.lib_ignore}
209195
[env:tasmota32c6]
210196
extends = env:tasmota32_base
211197
board = esp32c6
212-
build_unflags = ${env:tasmota32_base.build_unflags}
213-
-mno-target-align
214198
build_flags = ${env:tasmota32_base.build_flags}
215199
-DFIRMWARE_TASMOTA32
216200
-DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c6.bin"'

0 commit comments

Comments
 (0)