From 4c40b578710f99115b003102c6fe1b9740adf371 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 27 May 2022 17:56:55 +0300 Subject: [PATCH 1/5] Improve support for hand-written asm source files --- tools/platformio-build-esp32.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index 6c82fce96ef..ba396dd73cf 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -36,7 +36,11 @@ env.Append( ASFLAGS=[ - "-x", "assembler-with-cpp" + "-mlongcalls", + ], + + ASPPFLAGS=[ + "-x", "assembler-with-cpp", ], CFLAGS=[ From 779b84ce475911dfa090a4e9f73a740433fba430 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 27 May 2022 18:04:46 +0300 Subject: [PATCH 2/5] Improve support for hand-written asm source files --- tools/platformio-build-esp32c3.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/platformio-build-esp32c3.py b/tools/platformio-build-esp32c3.py index 26a85a4a879..ed5e3b7401c 100644 --- a/tools/platformio-build-esp32c3.py +++ b/tools/platformio-build-esp32c3.py @@ -35,24 +35,32 @@ assert isdir(FRAMEWORK_DIR) env.Append( + # common assembler flags for .s, .S, .asm, etc. ASFLAGS=[ - "-x", "assembler-with-cpp" + "-march=rv32imc", + ], + + # .S flags + ASPPFLAGS=[ + "-x", "assembler-with-cpp", ], + # .c flags CFLAGS=[ - "-march=rv32imc", "-std=gnu99", "-Wno-old-style-declaration" ], + # .cpp flags CXXFLAGS=[ - "-march=rv32imc", "-std=gnu++11", "-fexceptions", "-fno-rtti" ], + # common flags for .c & .cpp CCFLAGS=[ + "-march=rv32imc", "-ffunction-sections", "-fdata-sections", "-Wno-error=unused-function", @@ -76,8 +84,8 @@ ], LINKFLAGS=[ + "-march=rv32imc", "-nostartfiles", - "-march=rv32imc", "--specs=nosys.specs", "-Wl,--cref", "-Wl,--gc-sections", From c0d5b4ca96f07d5752bdc7d4bb03453eba7e928d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 27 May 2022 18:07:57 +0300 Subject: [PATCH 3/5] Document flag scopes --- tools/platformio-build-esp32.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index ba396dd73cf..2b67e0018ce 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -35,30 +35,34 @@ assert isdir(FRAMEWORK_DIR) env.Append( + # common assembler flags for .s, .S, .asm, etc. ASFLAGS=[ "-mlongcalls", ], + # .S flags (preprocessor) ASPPFLAGS=[ "-x", "assembler-with-cpp", ], + # .c flags CFLAGS=[ - "-mlongcalls", "-Wno-frame-address", "-std=gnu99", "-Wno-old-style-declaration" ], + # .cpp flags CXXFLAGS=[ - "-mlongcalls", "-Wno-frame-address", "-std=gnu++11", "-fexceptions", "-fno-rtti" ], + # common flags for .c & .cpp CCFLAGS=[ + "-mlongcalls", "-ffunction-sections", "-fdata-sections", "-Wno-error=unused-function", From f428290819ed217bd2f5fa6a6e28d68c72a9609a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 27 May 2022 18:10:13 +0300 Subject: [PATCH 4/5] Improve support for hand-written asm source files --- tools/platformio-build-esp32s2.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/platformio-build-esp32s2.py b/tools/platformio-build-esp32s2.py index 7fa190bc51b..6377c72c148 100644 --- a/tools/platformio-build-esp32s2.py +++ b/tools/platformio-build-esp32s2.py @@ -35,24 +35,32 @@ assert isdir(FRAMEWORK_DIR) env.Append( + # common assembler flags for .s, .S, .asm, etc. ASFLAGS=[ - "-x", "assembler-with-cpp" + "-mlongcalls", + ], + + # .S flags (preprocessor) + ASPPFLAGS=[ + "-x", "assembler-with-cpp", ], + # .c flags CFLAGS=[ - "-mlongcalls", "-std=gnu99", "-Wno-old-style-declaration" ], + # .cpp flags CXXFLAGS=[ - "-mlongcalls", "-std=gnu++11", "-fexceptions", "-fno-rtti" ], + # common flags for .c & .cpp CCFLAGS=[ + "-mlongcalls", "-ffunction-sections", "-fdata-sections", "-Wno-error=unused-function", From 269f106e70b3bc79d6b934962efe878ace13b39d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 27 May 2022 18:11:52 +0300 Subject: [PATCH 5/5] Improve support for hand-written asm source files --- tools/platformio-build-esp32s3.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/platformio-build-esp32s3.py b/tools/platformio-build-esp32s3.py index ca9d6b78740..b3e8fee3b83 100644 --- a/tools/platformio-build-esp32s3.py +++ b/tools/platformio-build-esp32s3.py @@ -35,24 +35,32 @@ assert isdir(FRAMEWORK_DIR) env.Append( + # common assembler flags for .s, .S, .asm, etc. ASFLAGS=[ - "-x", "assembler-with-cpp" + "-mlongcalls", + ], + + # .S flags (preprocessor) + ASPPFLAGS=[ + "-x", "assembler-with-cpp", ], + # .c flags CFLAGS=[ - "-mlongcalls", "-std=gnu99", "-Wno-old-style-declaration" ], + # .cpp flags CXXFLAGS=[ - "-mlongcalls", "-std=gnu++11", "-fexceptions", "-fno-rtti" ], + # common flags for .c & .cpp CCFLAGS=[ + "-mlongcalls", "-ffunction-sections", "-fdata-sections", "-Wno-error=unused-function",