refactor: use cmake macros to do objcopy, install and tests
All checks were successful
Build nix packages / build-matrix (am-kernels) (push) Successful in 2m26s
Build nix packages / build-matrix (rv32Cross.am-kernels-nemu) (push) Successful in 2m23s
Build nix packages / build-matrix (rv32Cross.am-kernels-npc) (push) Successful in 2m21s

This commit is contained in:
xinyangli 2024-08-15 17:52:04 +08:00
parent f6c3a13e7f
commit 8630fe7667
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
12 changed files with 64 additions and 54 deletions

View file

@ -12,9 +12,5 @@ add_executable(demo
target_include_directories(demo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(demo PRIVATE am-${ARCH} klib)
# -- Extract binary file from ELF
add_custom_command(TARGET demo
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary demo demo.bin)
install(TARGETS demo RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/demo.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
create_binary(demo)
install_target_and_binary(demo)

View file

@ -36,9 +36,9 @@ int main(const char *args) {
}
printf("Press Q to Exit\n");
while (1) {
AM_INPUT_KEYBRD_T ev = io_read(AM_INPUT_KEYBRD);
if (ev.keydown && ev.keycode == AM_KEY_Q) break;
}
// while (1) {
// AM_INPUT_KEYBRD_T ev = io_read(AM_INPUT_KEYBRD);
// if (ev.keydown && ev.keycode == AM_KEY_Q) break;
// }
return 0;
}