1# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
2# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
3#  i.e. CMake<Lang>Information and whatnot
4include(${CMAKE_CURRENT_LIST_DIR}/find_compiler.cmake)
5
6# include our Platform/PICO.cmake
7set(CMAKE_SYSTEM_NAME PICO)
8set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
9
10# Find ARMClang.
11pico_find_compiler(PICO_COMPILER_CC armclang)
12pico_find_compiler(PICO_COMPILER_CXX armclang)
13pico_find_compiler(PICO_COMPILER_ASM armasm)
14set(PICO_COMPILER_ASM "${PICO_COMPILER_ASM}" CACHE INTERNAL "")
15pico_find_compiler(PICO_OBJCOPY llvm-objcopy)
16pico_find_compiler(PICO_OBJDUMP llvm-objdump)
17
18# Specify the cross compiler.
19set(CMAKE_C_COMPILER ${PICO_COMPILER_CC} CACHE FILEPATH "C compiler")
20set(CMAKE_CXX_COMPILER ${PICO_COMPILER_CXX} CACHE FILEPATH "C++ compiler")
21set(CMAKE_C_OUTPUT_EXTENSION .o)
22
23# todo should we be including CMakeASMInformation anyway - i guess that is host side
24set(CMAKE_ASM_COMPILER ${PICO_COMPILER_ASM} CACHE FILEPATH "ASM compiler")
25set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>   -c <SOURCE>")
26set(CMAKE_INCLUDE_FLAG_ASM "-I")
27set(CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "")
28set(CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "")
29
30# Add target system root to cmake find path.
31get_filename_component(PICO_COMPILER_DIR "${PICO_COMPILER_CC}" DIRECTORY)
32get_filename_component(CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR}" DIRECTORY)
33
34# Look for includes and libraries only in the target system prefix.
35set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
36set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
37set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
38set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
39
40option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
41
42set(ARM_TOOLCHAIN_COMMON_FLAGS " --cpu=Cortex-M0plus")
43include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
44