Skip to content

Commit

Permalink
Merge branch 'zephyrproject-rtos:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleh-Kravchenko authored Jan 27, 2025
2 parents 0ce26bb + 8978f66 commit 35ce66c
Show file tree
Hide file tree
Showing 30 changed files with 584 additions and 168 deletions.
1 change: 1 addition & 0 deletions boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ zephyr_lcdif: &lcdif {
dma-names = "rx", "tx";
pinctrl-0 = <&pinmux_lpspi1>;
pinctrl-names = "default";
tristate-output;
};

&lpspi3 {
Expand Down
1 change: 1 addition & 0 deletions boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ zephyr_udc0: &usb1 {
/* DMA channels 0 and 1, muxed to LPSPI1 RX and TX */
dmas = <&edma0 0 13>, <&edma0 1 14>;
dma-names = "rx", "tx";
tristate-output;
pinctrl-0 = <&pinmux_lpspi1>;
pinctrl-names = "default";
};
Expand Down
2 changes: 1 addition & 1 deletion boards/others/esp32c3_supermini/esp32c3_supermini.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
compatible = "espressif,esp32c3_supermini";

chosen {
zephyr,sram = &sram0;
zephyr,sram = &sram1;
zephyr,console = &usb_serial;
zephyr,shell-uart = &usb_serial;
zephyr,flash = &flash0;
Expand Down
3 changes: 3 additions & 0 deletions cmake/bintools/bintools_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
# elfconvert_flag_final : Flags that must always be applied last at the elfconvert command
# elfconvert_flag_strip_all : Flag that is used for stripping all symbols when converting
# elfconvert_flag_strip_debug : Flag that is used to strip debug symbols when converting
# elfconvert_flag_strip_unneeded: Flag that is used to strip all unreferenced symbols when converting
# elfconvert_flag_compress_debug_sections: Flag that is used to compress debug sections when converting
# elfconvert_flag_intarget : Flag for specifying target used for infile
# elfconvert_flag_outtarget : Flag for specifying target to use for converted file.
Expand Down Expand Up @@ -142,6 +143,8 @@ set_property(TARGET bintools PROPERTY elfconvert_command ${CMAKE_COMMAND} -E ech
set_property(TARGET bintools PROPERTY elfconvert_formats "")
set_property(TARGET bintools PROPERTY elfconvert_flag "")
set_property(TARGET bintools PROPERTY elfconvert_flag_final "")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_debug "")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_unneeded "")
set_property(TARGET bintools PROPERTY elfconvert_flag_compress_debug_sections "")
set_property(TARGET bintools PROPERTY elfconvert_flag_outtarget "")
set_property(TARGET bintools PROPERTY elfconvert_flag_section_remove "")
Expand Down
2 changes: 2 additions & 0 deletions cmake/bintools/gnu/target_bintools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# elfconvert_flag_final : empty
# elfconvert_flag_strip_all : -S
# elfconvert_flag_strip_debug : -g
# elfconvert_flag_strip_unneeded: --strip-unneeded
# elfconvert_flag_compress_debug_sections: --compress-debug-sections
# elfconvert_flag_intarget : --input-target=
# elfconvert_flag_outtarget : --output-target=
Expand Down Expand Up @@ -34,6 +35,7 @@ set_property(TARGET bintools PROPERTY elfconvert_flag_final "")

set_property(TARGET bintools PROPERTY elfconvert_flag_strip_all "-S")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_debug "-g")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_unneeded "--strip-unneeded")

set_property(TARGET bintools PROPERTY elfconvert_flag_compress_debug_sections "--compress-debug-sections")

Expand Down
2 changes: 2 additions & 0 deletions cmake/bintools/llvm/target_bintools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# elfconvert_flag_final : empty
# elfconvert_flag_strip_all : -S
# elfconvert_flag_strip_debug : -g
# elfconvert_flag_strip_unneeded: --strip-unneeded
# elfconvert_flag_compress_debug_sections: --compress-debug-sections
# elfconvert_flag_intarget : --input-target=
# elfconvert_flag_outtarget : --output-target=
Expand Down Expand Up @@ -34,6 +35,7 @@ set_property(TARGET bintools PROPERTY elfconvert_flag_final "")

set_property(TARGET bintools PROPERTY elfconvert_flag_strip_all "-S")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_debug "-g")
set_property(TARGET bintools PROPERTY elfconvert_flag_strip_unneeded "--strip-unneeded")

set_property(TARGET bintools PROPERTY elfconvert_flag_compress_debug_sections "--compress-debug-sections")

Expand Down
1 change: 0 additions & 1 deletion cmake/compiler/gcc/target_arc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ set(LLEXT_REMOVE_FLAGS
-fno-pie
-ffunction-sections
-fdata-sections
-g.*
-Os
)

Expand Down
6 changes: 3 additions & 3 deletions cmake/compiler/gcc/target_arm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ set(LLEXT_REMOVE_FLAGS
-fno-pie
-ffunction-sections
-fdata-sections
-g.*
-Os
)

Expand All @@ -67,8 +66,9 @@ set(LLEXT_APPEND_FLAGS
list(APPEND LLEXT_EDK_REMOVE_FLAGS
--sysroot=.*
-fmacro-prefix-map=.*
)
-g.*
)

list(APPEND LLEXT_EDK_APPEND_FLAGS
-nodefaultlibs
)
)
2 changes: 1 addition & 1 deletion cmake/compiler/gcc/target_arm64.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ set(LLEXT_REMOVE_FLAGS
-fno-pie
-ffunction-sections
-fdata-sections
-g.*
-Os
)

list(APPEND LLEXT_EDK_REMOVE_FLAGS
--sysroot=.*
-fmacro-prefix-map=.*
-g.*
)

list(APPEND LLEXT_EDK_APPEND_FLAGS
Expand Down
1 change: 0 additions & 1 deletion cmake/compiler/gcc/target_xtensa.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
set(LLEXT_REMOVE_FLAGS
-ffunction-sections
-fdata-sections
-g.*
-Os
-mcpu=.*
)
Expand Down
1 change: 0 additions & 1 deletion cmake/compiler/xt-clang/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ include(${ZEPHYR_BASE}/cmake/compiler/xcc/target.cmake)
set(LLEXT_REMOVE_FLAGS
-ffunction-sections
-fdata-sections
-g.*
-Os
-mcpu=.*
)
Expand Down
67 changes: 22 additions & 45 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5656,6 +5656,7 @@ function(add_llext_target target_name)
target_link_options(${llext_lib_target} PRIVATE
$<TARGET_PROPERTY:linker,partial_linking>)
set_target_properties(${llext_lib_target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/llext
SUFFIX ${CMAKE_C_OUTPUT_EXTENSION})
set(llext_lib_output $<TARGET_FILE:${llext_lib_target}>)

Expand All @@ -5668,6 +5669,9 @@ function(add_llext_target target_name)

# Create a shared library
add_library(${llext_lib_target} SHARED ${source_files})
set_target_properties(${llext_lib_target} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/llext
)
set(llext_lib_output $<TARGET_FILE:${llext_lib_target}>)

# Add the llext flags to the linking step as well
Expand Down Expand Up @@ -5696,11 +5700,14 @@ function(add_llext_target target_name)
zephyr_generated_headers
)

# Make sure the intermediate output directory exists.
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/llext)

# Set up an intermediate processing step between compilation and packaging
# to be used to support POST_BUILD commands on targets that do not use a
# dynamic library.
set(llext_proc_target ${target_name}_llext_proc)
set(llext_pkg_input ${PROJECT_BINARY_DIR}/${target_name}.llext.pkg_input)
set(llext_pkg_input ${PROJECT_BINARY_DIR}/llext/${target_name}_debug.elf)
add_custom_target(${llext_proc_target} DEPENDS ${llext_pkg_input})
set_property(TARGET ${llext_proc_target} PROPERTY has_post_build_cmds 0)

Expand Down Expand Up @@ -5733,49 +5740,19 @@ function(add_llext_target target_name)
set(slid_inject_cmd ${CMAKE_COMMAND} -E true)
endif()

# Type-specific packaging of the built binary file into an .llext file
if(CONFIG_LLEXT_TYPE_ELF_OBJECT)

# No packaging required, simply copy the object file
add_custom_command(
OUTPUT ${llext_pkg_output}
COMMAND ${CMAKE_COMMAND} -E copy ${llext_pkg_input} ${llext_pkg_output}
COMMAND ${slid_inject_cmd}
DEPENDS ${llext_proc_target} ${llext_pkg_input}
)

elseif(CONFIG_LLEXT_TYPE_ELF_RELOCATABLE)

# Need to remove just some sections from the relocatable object
# (using strip in this case would remove _all_ symbols)
add_custom_command(
OUTPUT ${llext_pkg_output}
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.xt.*
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${llext_pkg_input}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${llext_pkg_output}
$<TARGET_PROPERTY:bintools,elfconvert_flag_final>
COMMAND ${slid_inject_cmd}
DEPENDS ${llext_proc_target} ${llext_pkg_input}
)

elseif(CONFIG_LLEXT_TYPE_ELF_SHAREDLIB)

# Need to strip the shared library of some sections
add_custom_command(
OUTPUT ${llext_pkg_output}
COMMAND $<TARGET_PROPERTY:bintools,strip_command>
$<TARGET_PROPERTY:bintools,strip_flag>
$<TARGET_PROPERTY:bintools,strip_flag_remove_section>.xt.*
$<TARGET_PROPERTY:bintools,strip_flag_infile>${llext_pkg_input}
$<TARGET_PROPERTY:bintools,strip_flag_outfile>${llext_pkg_output}
$<TARGET_PROPERTY:bintools,strip_flag_final>
COMMAND ${slid_inject_cmd}
DEPENDS ${llext_proc_target} ${llext_pkg_input}
)

endif()
# Remove sections that are unused by the llext loader
add_custom_command(
OUTPUT ${llext_pkg_output}
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>
$<TARGET_PROPERTY:bintools,elfconvert_flag_strip_unneeded>
$<TARGET_PROPERTY:bintools,elfconvert_flag_section_remove>.xt.*
$<TARGET_PROPERTY:bintools,elfconvert_flag_infile>${llext_pkg_input}
$<TARGET_PROPERTY:bintools,elfconvert_flag_outfile>${llext_pkg_output}
$<TARGET_PROPERTY:bintools,elfconvert_flag_final>
COMMAND ${slid_inject_cmd}
DEPENDS ${llext_proc_target} ${llext_pkg_input}
)

# Add user-visible target and dependency, and fill in properties
get_filename_component(output_name ${llext_pkg_output} NAME)
Expand Down Expand Up @@ -5833,7 +5810,7 @@ function(add_llext_command)
# ARM uses an object file representation so there is no link step.
if(CONFIG_ARM AND LLEXT_PRE_BUILD)
message(FATAL_ERROR
"add_llext_command: PRE_BUILD not supported on this arch")
"add_llext_command: PRE_BUILD not supported on this arch")
endif()

# Determine the build step and the target to attach the command to
Expand Down
Loading

0 comments on commit 35ce66c

Please sign in to comment.