46 lines
2 KiB
CMake
46 lines
2 KiB
CMake
# See the end of this file for copyright and license terms.
|
|
|
|
set(TOOLCHAIN_PATH "/usr/bin" CACHE STRING "Directory in which the toolchain binaries are located")
|
|
|
|
set(CMAKE_SYSTEM_NAME Generic)
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
set(CMAKE_CROSSCOMPILING 1)
|
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
|
|
set(CMAKE_AR ${TOOLCHAIN_PATH}/arm-none-eabi-ar${CMAKE_EXECUTABLE_SUFFIX})
|
|
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PATH}/arm-none-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX})
|
|
set(CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/arm-none-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX})
|
|
set(CMAKE_LINKER ${TOOLCHAIN_PATH}/arm-none-eabi-ld${CMAKE_EXECUTABLE_SUFFIX})
|
|
set(CMAKE_OBJCOPY ${TOOLCHAIN_PATH}/arm-none-eabi-objcopy${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
|
set(CMAKE_RANLIB ${TOOLCHAIN_PATH}/arm-none-eabi-ranlib${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
|
set(CMAKE_SZE ${TOOLCHAIN_PATH}/arm-none-eabi-size${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
|
set(CMAKE_STRIP ${TOOLCHAIN_PATH}/arm-none-eabi-strip${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
|
|
|
set(CMAKE_C_FLAGS "-Os -nodefaultlibs -nostartfiles -mcpu=cortex-m3 -mabi=aapcs")
|
|
if(DEBUG)
|
|
set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}")
|
|
endif()
|
|
|
|
# see CMakeLists.txt for config.ld generation
|
|
set(CMAKE_LINKER_FLAGS "-T${CMAKE_BINARY_DIR}/config.ld -T${CMAKE_CURRENT_LIST_DIR}/flash.ld --whole-archive")
|
|
set(ARDIX_LINKER_FLAGS
|
|
-T${CMAKE_BINARY_DIR}/config.ld
|
|
-T${CMAKE_CURRENT_LIST_DIR}/flash.ld
|
|
--whole-archive
|
|
)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|
|
# This file is part of Ardix.
|
|
# Copyright (c) 2021 Felix Kopp <owo@fef.moe>.
|
|
#
|
|
# Ardix is non-violent software: you may only use, redistribute,
|
|
# and/or modify it under the terms of the CNPLv6+ as found in
|
|
# the LICENSE file in the source code root directory or at
|
|
# <https://git.pixie.town/thufie/CNPL>.
|
|
#
|
|
# Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
# permitted by applicable law. See the CNPLv6+ for details.
|