diff --git a/cmake/aspis.cmake b/cmake/aspis.cmake new file mode 100644 index 0000000000000000000000000000000000000000..6e6287d55a0454d16d387e8183b40e6e122e0cdf --- /dev/null +++ b/cmake/aspis.cmake @@ -0,0 +1,31 @@ +include(${SBS_BASE}/libs/miosix-kernel/miosix/cmake/cmake-utils/cmake/LLVMIRUtil.cmake) + +set(ASPIS_BASE_PATH ~/ASPIS) +set(ASPIS_PASSES_PATH ${ASPIS_BASE_PATH}/build/passes) + + +# function(aspis_passes source_files external_files) +# +# llvmir_attach_bc_target(${source_files}_ir ${source_files}) +# llvmir_attach_link_target(${source_files}_link ${source_files}_ir) +# llvmir_attach_opt_pass_target(${source_files}_eddi ${source_files}_link -${ASPIS_PASSES_PATH}/libEDDI) +# +# llvmir_attach_bc_target(${external_files}_ir ${external_files}) +# llvmir_attach_link_target(${external_files}_link ${external_files}_ir) +# +# endfunction() +function(aspis_passes TARGET) + set_target_properties(${TARGET} PROPERTIES LINKER_LANGUAGE CXX) + target_compile_options(${TARGET} PUBLIC "-O0") + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "5.0.0" OR + CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "5.0.0") + target_compile_options(${TARGET} PUBLIC -Xclang -disable-O0-optnone) + endif() + + llvmir_attach_bc_target(${TARGET}_ir ${TARGET}) + llvmir_attach_link_target(${TARGET}_link ${TARGET}_ir) + # llvmir_attach_opt_pass_target(${TARGET}_eddi ${TARGET}_link -${ASPIS_PASSES_PATH}/libEDDI) + llvmir_attach_executable(${TARGET}_exe ${TARGET}_link) + +endfunction() \ No newline at end of file diff --git a/cmake/sbs.cmake b/cmake/sbs.cmake index 25d03aa9b102ff174aed3c42c7b8220f95adbced..4ba733c68768da49745e8cc6a5c32baae3745edb 100644 --- a/cmake/sbs.cmake +++ b/cmake/sbs.cmake @@ -32,6 +32,9 @@ cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SBS_BASE) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) include(boardcore) +# Include cmake functions to use ASPIS in a simple way +include(aspis) + # Command to print all the available boards used by the sbs script string(REPLACE ";" "\\n" BOARDS_STR "${MIOSIX_BOARDS};${BOARDCORE_BOARDS}") add_custom_target( @@ -56,6 +59,9 @@ function(sbs_target TARGET OPT_BOARD) # Linker script and linking options are eredited from the kernel library + # Apply ASPIS passes + aspis_passes(${TARGET}) + # Add a post build command to create the hex file to flash on the board add_custom_command( TARGET ${TARGET} POST_BUILD diff --git a/libs/miosix-kernel b/libs/miosix-kernel index eaeffe5772540394d35b175c0cfa08a0cfaa3f43..9182ba50b49edccf12ac7f041b0c4eef6790cce0 160000 --- a/libs/miosix-kernel +++ b/libs/miosix-kernel @@ -1 +1 @@ -Subproject commit eaeffe5772540394d35b175c0cfa08a0cfaa3f43 +Subproject commit 9182ba50b49edccf12ac7f041b0c4eef6790cce0