Skip to content

Commit

Permalink
fix(xtask): Fix cmake compilation flags
Browse files Browse the repository at this point in the history
Fixes an issue caused by `cmake-rs` auto-generating C flags which caused a larger binary size than expected.
  • Loading branch information
AnthonyGrondin committed Sep 22, 2023
1 parent 90568c3 commit 76d7219
Show file tree
Hide file tree
Showing 17 changed files with 9 additions and 17 deletions.
Binary file modified libs/riscv32imc-unknown-none-elf/libmbedcrypto.a
Binary file not shown.
Binary file modified libs/riscv32imc-unknown-none-elf/libmbedtls.a
Binary file not shown.
Binary file modified libs/riscv32imc-unknown-none-elf/libmbedx509.a
Binary file not shown.
Binary file modified libs/xtensa-esp32-none-elf/libmbedcrypto.a
Binary file not shown.
Binary file modified libs/xtensa-esp32-none-elf/libmbedtls.a
Binary file not shown.
Binary file modified libs/xtensa-esp32-none-elf/libmbedx509.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s2-none-elf/libmbedcrypto.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s2-none-elf/libmbedtls.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s2-none-elf/libmbedx509.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s3-none-elf/libmbedcrypto.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s3-none-elf/libmbedtls.a
Binary file not shown.
Binary file modified libs/xtensa-esp32s3-none-elf/libmbedx509.a
Binary file not shown.
8 changes: 0 additions & 8 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,6 @@ fn compile(workspace: &Path, compilation_target: &CompilationTarget) -> Result<(
.host("riscv32")
.profile("Release")
.out_dir(target_dir)
.cflag(&format!(
"{}",
if compilation_target.arch == Arch::Xtensa {
"-mlongcalls"
} else {
""
}
))
.build();

log::info!("Copying libraries into workspace");
Expand Down
4 changes: 2 additions & 2 deletions xtask/toolchains/toolchain-esp32.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set(CMAKE_C_COMPILER xtensa-esp32-elf-gcc)
set(CMAKE_CXX_COMPILER xtensa-esp32-elf-g++)
set(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc)

set(CMAKE_C_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C++ Compiler Base Flags")
set(CMAKE_C_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C Compiler Base Flags" FORCE)
set(CMAKE_CXX_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C++ Compiler Base Flags" FORCE)
6 changes: 3 additions & 3 deletions xtask/toolchains/toolchain-esp32c3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set(CMAKE_C_COMPILER riscv32-esp-elf-gcc)
set(CMAKE_CXX_COMPILER riscv32-esp-elf-g++)
set(CMAKE_ASM_COMPILER riscv32-esp-elf-gcc)

set(CMAKE_C_FLAGS "-march=rv32imc" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-march=rv32imc" CACHE STRING "C++ Compiler Base Flags")
set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -march=rv32imc --specs=nosys.specs" CACHE STRING "Linker Base Flags")
set(CMAKE_C_FLAGS "-march=rv32imc" CACHE STRING "C Compiler Base Flags" FORCE)
set(CMAKE_CXX_FLAGS "-march=rv32imc" CACHE STRING "C++ Compiler Base Flags" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -march=rv32imc --specs=nosys.specs" CACHE STRING "Linker Base Flags" FORCE)
4 changes: 2 additions & 2 deletions xtask/toolchains/toolchain-esp32s2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set(CMAKE_C_COMPILER xtensa-esp32s2-elf-gcc)
set(CMAKE_CXX_COMPILER xtensa-esp32s2-elf-g++)
set(CMAKE_ASM_COMPILER xtensa-esp32s2-elf-gcc)

set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags")
set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags" FORCE)
set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags" FORCE)
4 changes: 2 additions & 2 deletions xtask/toolchains/toolchain-esp32s3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set(CMAKE_C_COMPILER xtensa-esp32s3-elf-gcc)
set(CMAKE_CXX_COMPILER xtensa-esp32s3-elf-g++)
set(CMAKE_ASM_COMPILER xtensa-esp32s3-elf-gcc)

set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags")
set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags" FORCE)
set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags" FORCE)

0 comments on commit 76d7219

Please sign in to comment.