> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 1 12:35:11 UTC 2024 x86_64 GNU/Linux 10:10:28 up 3 days 21:16, 2 users, load average: 1.44, 1.06, 0.84
This commit is contained in:
parent
874f1d92f6
commit
f2c726e647
68 changed files with 561 additions and 38 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10
abstract-machine/am/CMakeLists.txt
Normal file
10
abstract-machine/am/CMakeLists.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
add_library(am_interface INTERFACE)
|
||||
target_include_directories(am_interface INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include/abstract-machine>)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
install(DIRECTORY include/ DESTINATION include/abstract-machine)
|
47
abstract-machine/am/src/CMakeLists.txt
Normal file
47
abstract-machine/am/src/CMakeLists.txt
Normal file
|
@ -0,0 +1,47 @@
|
|||
if(ISA MATCHES "native")
|
||||
set(SOURCEDIR "./${PLATFORM}")
|
||||
else()
|
||||
set(SOURCEDIR "./${ISA}/${PLATFORM}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(${SOURCEDIR})
|
||||
|
||||
target_include_directories(am-${ARCH}
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
||||
$<INSTALL_INTERFACE:include/abstract-machine>)
|
||||
target_link_libraries(am-${ARCH}
|
||||
PUBLIC klib_interface
|
||||
INTERFACE m)
|
||||
if(INCLUDE_LINKER_SCRIPT)
|
||||
target_link_options(am-${ARCH} INTERFACE -T${LINKER_SCRIPT})
|
||||
endif()
|
||||
|
||||
# Interface compile flags
|
||||
target_link_options(am-${ARCH} INTERFACE
|
||||
-znoexecstack)
|
||||
|
||||
target_compile_options(am-${ARCH} INTERFACE
|
||||
-fno-asynchronous-unwind-tables
|
||||
-fno-builtin
|
||||
-fno-stack-protector
|
||||
-U_FORTIFY_SOURCE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-ffreestanding>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
|
||||
|
||||
install(TARGETS am-${ARCH} klib_interface am_interface
|
||||
EXPORT amTargets
|
||||
LIBRARY DESTINATION lib)
|
||||
|
||||
install(EXPORT amTargets
|
||||
FILE amTargets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
|
||||
|
||||
configure_package_config_file(${CMAKE_SOURCE_DIR}/cmake/am-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/am-${ARCH}-config.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/am-${ARCH})
|
26
abstract-machine/am/src/native/CMakeLists.txt
Normal file
26
abstract-machine/am/src/native/CMakeLists.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
include(CheckPIESupported)
|
||||
check_pie_supported()
|
||||
|
||||
set(SOURCES
|
||||
trap.S
|
||||
cte.c
|
||||
ioe.c
|
||||
mpe.c
|
||||
platform.c
|
||||
trm.c
|
||||
vme.c
|
||||
ioe/audio.c
|
||||
ioe/disk.c
|
||||
ioe/gpu.c
|
||||
ioe/input.c
|
||||
ioe/timer.c
|
||||
)
|
||||
add_library(am-native ${SOURCES})
|
||||
|
||||
# FIXME: get free(): invalid address when user program compiled without pie
|
||||
set_target_properties(am-native PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_link_libraries(am-${ARCH} PUBLIC SDL2::SDL2)
|
27
abstract-machine/am/src/riscv/nemu/CMakeLists.txt
Normal file
27
abstract-machine/am/src/riscv/nemu/CMakeLists.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
include(nemu-settings)
|
||||
|
||||
add_library(am-${ISA}-nemu
|
||||
cte.c
|
||||
start.S
|
||||
trap.S
|
||||
vme.c
|
||||
${NEMU_SOURCES}
|
||||
)
|
||||
|
||||
target_compile_options(am-${ISA}-nemu PRIVATE
|
||||
${NEMU_COMPILE_OPTIONS}
|
||||
${RISCV_COMPILE_OPTIONS})
|
||||
target_link_options(am-${ISA}-nemu PRIVATE
|
||||
${NEMU_LINK_OPITIONS}
|
||||
${RISCV_LINK_OPTIONS})
|
||||
target_include_directories(am-${ISA}-nemu PRIVATE
|
||||
${NEMU_INCLUDE_DIRECTORIES})
|
||||
|
||||
target_compile_definitions(am-${ISA}-nemu PUBLIC
|
||||
ARCH_H="arch/riscv.h")
|
||||
target_compile_definitions(am-${ISA}-nemu PRIVATE
|
||||
ISA_H="riscv/riscv.h")
|
||||
|
||||
set_target_properties(am-${ISA}-nemu PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE OFF)
|
Loading…
Add table
Add a link
Reference in a new issue