Skip to content

Commit ebe4896

Browse files
committed
7.3.3
1 parent aaa9d43 commit ebe4896

File tree

7 files changed

+674
-664
lines changed

7 files changed

+674
-664
lines changed

cmake/qpc_sdk_import.cmake

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ if(QPC_FETCH_FROM_GIT AND (NOT QPC_URL))
2929
message(STATUS "using QPC_URL ('${QPC_URL}') since not specified")
3030
endif()
3131

32-
set(QPC_SDK_PATH "${QPC_SDK_PATH}" CACHE PATH "Path to the QPC SDK")
3332
set(QPC_URL "${QPC_URL}" CACHE PATH "URL to retrieve the QPC SDK from git")
3433
set(QPC_FETCH_FROM_GIT "${QPC_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
3534
set(QPC_FETCH_FROM_GIT_PATH "${QPC_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
@@ -43,16 +42,16 @@ if (NOT QPC_SDK_PATH)
4342
endif ()
4443
# GIT_SUBMODULES_RECURSE was added in 3.17
4544
FetchContent_Declare(
46-
QPC
45+
qpc
4746
GIT_REPOSITORY "${QPC_URL}"
4847
GIT_TAG master
4948
GIT_SUBMODULES_RECURSE FALSE
5049
GIT_SHALLOW ON
5150
)
5251

53-
if (NOT QPC)
52+
if (NOT qpc)
5453
message("Downloading QPC SDK")
55-
FetchContent_Populate(QPC)
54+
FetchContent_Populate(qpc)
5655
message("QPC source dir = '${qpc_SOURCE_DIR}', QPC binary dir = '${qpc_BINARY_DIR}'")
5756
set(QPC_SDK_PATH ${qpc_SOURCE_DIR})
5857
endif ()
@@ -64,16 +63,21 @@ if (NOT QPC_SDK_PATH)
6463
endif ()
6564
endif ()
6665

67-
get_filename_component(QPC_SDK_PATH "${QPC_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
66+
file(REAL_PATH "${QPC_SDK_PATH}" QPC_SDK_PATH BASE_DIRECTORY "${CMAKE_BINARY_DIR}")
6867
if (NOT EXISTS ${QPC_SDK_PATH})
6968
message(FATAL_ERROR "Directory '${QPC_SDK_PATH}' not found")
7069
endif ()
7170

72-
set(QPC_INIT_CMAKE_FILE ${QPC_SDK_PATH}/qpc_sdk_init.cmake)
71+
find_file(QPC_INIT_CMAKE_FILE qpc_sdk_init.cmake
72+
HINTS ${QPC_SDK_PATH}
73+
PATH_SUFFIXES qpc-src
74+
)
7375
if (NOT EXISTS ${QPC_INIT_CMAKE_FILE})
74-
message(FATAL_ERROR "Directory '${QPC_SDK_PATH}' does not appear to contain the QPC SDK")
76+
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the QPC SDK")
77+
else()
78+
cmake_path(GET QPC_INIT_CMAKE_FILE PARENT_PATH QPC_SDK_PATH)
7579
endif ()
7680

77-
set(QPC_SDK_PATH ${QPC_SDK_PATH} CACHE PATH "Path to the QPC SDK" FORCE)
81+
set(QPC_SDK_PATH "${QPC_SDK_PATH}" CACHE PATH "Path to the QPC SDK" FORCE)
7882

7983
include(${QPC_INIT_CMAKE_FILE})

cmake/toolchain/tc_armkeil.cmake

Lines changed: 112 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,112 @@
1-
# Append current directory to CMAKE_MODULE_PATH for making device specific cmake modules visible
2-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
3-
4-
# Target definition
5-
set(CMAKE_SYSTEM_NAME Generic)
6-
set(CMAKE_SYSTEM_PROCESSOR arm)
7-
8-
#---------------------------------------------------------------------------------------
9-
# Set toolchain paths
10-
#---------------------------------------------------------------------------------------
11-
set(TOOLCHAIN arm)
12-
13-
if(NOT DEFINED TOOLCHAIN_PREFIX)
14-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
15-
set(TOOLCHAIN_PREFIX "/usr")
16-
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
17-
set(TOOLCHAIN_PREFIX "/usr/local")
18-
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
19-
if($ENV{MINGW_PREFIX} MATCHES "^.*/(mingw|clang)64$")
20-
set(TOOLCHAIN_PREFIX $ENV{MINGW_PREFIX})
21-
# STRING(REGEX REPLACE "^.*/(mingw|clang)64$" "/\\164" TOOLCHAIN_PREFIX $ENV{MINGW_PREFIX})
22-
elseif(EXISTS "C:/Keil")
23-
set(TOOLCHAIN_PREFIX "C:/Keil")
24-
else()
25-
message(STATUS "Please specify the TOOLCHAIN_PREFIX !\n For example: -DTOOLCHAIN_PREFIX=\"C:/Program Files/GNU Tools ARM Embedded\" ")
26-
endif()
27-
else()
28-
set(TOOLCHAIN_PREFIX "/usr")
29-
message(STATUS "No TOOLCHAIN_PREFIX specified, using default: " ${TOOLCHAIN_PREFIX})
30-
endif()
31-
endif()
32-
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/bin)
33-
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/${TOOLCHAIN}/include)
34-
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/${TOOLCHAIN}/lib)
35-
36-
# Set system depended extensions
37-
if(WIN32)
38-
set(TOOLCHAIN_EXT ".exe" )
39-
else()
40-
set(TOOLCHAIN_EXT "" )
41-
endif()
42-
43-
# Perform compiler test with static library
44-
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
45-
46-
#---------------------------------------------------------------------------------------
47-
# Set compiler/linker flags
48-
#---------------------------------------------------------------------------------------
49-
50-
# Object build options
51-
# -O0 No optimizations, reduce compilation time and make debugging produce the expected results.
52-
# -mthumb Generat thumb instructions.
53-
# -fno-builtin Do not use built-in functions provided by GCC.
54-
# -Wall Print only standard warnings, for all use Wextra
55-
# -ffunction-sections Place each function item into its own section in the output file.
56-
# -fdata-sections Place each data item into its own section in the output file.
57-
# -fomit-frame-pointer Omit the frame pointer in functions that don’t need one.
58-
# -mabi=aapcs Defines enums to be a variable sized type.
59-
set(OBJECT_GEN_FLAGS "--thumb --gnu --split_sections")
60-
61-
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} --c99 " CACHE INTERNAL "C Compiler options")
62-
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} --cpp11 " CACHE INTERNAL "C++ Compiler options")
63-
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} " CACHE INTERNAL "ASM Compiler options")
64-
65-
66-
# -Wl,--gc-sections Perform the dead code elimination.
67-
# --specs=nano.specs Link with newlib-nano.
68-
# --specs=nosys.specs No syscalls, provide empty implementations for the POSIX system calls.
69-
set(MAPFILE "${CMAKE_PROJECT_NAME}.map" CACHE INTERNAL "Linker Map File")
70-
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "Linker options")
71-
72-
#---------------------------------------------------------------------------------------
73-
# Set debug/release build configuration Options
74-
#---------------------------------------------------------------------------------------
75-
76-
# Options for DEBUG build
77-
# -Og Enables optimizations that do not interfere with debugging.
78-
# -g Produce debugging information in the operating system’s native format.
79-
set(CMAKE_C_FLAGS_DEBUG "-O0 --debug" CACHE INTERNAL "C Compiler options for debug build type")
80-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 --debug" CACHE INTERNAL "C++ Compiler options for debug build type")
81-
set(CMAKE_ASM_FLAGS_DEBUG "--debug" CACHE INTERNAL "ASM Compiler options for debug build type")
82-
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "--debug" CACHE INTERNAL "Linker options for debug build type")
83-
84-
# Options for RELEASE build
85-
# -Os Optimize for size. -Os enables all -O2 optimizations.
86-
# -flto Runs the standard link-time optimizer.
87-
set(CMAKE_C_FLAGS_RELEASE "-Ospace --no_debug" CACHE INTERNAL "C Compiler options for release build type")
88-
set(CMAKE_CXX_FLAGS_RELEASE "-Ospace --no_debug" CACHE INTERNAL "C++ Compiler options for release build type")
89-
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")
90-
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "--no_debug" CACHE INTERNAL "Linker options for release build type")
91-
# set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-g3 -flto" CACHE INTERNAL "Linker options for release build type")
92-
93-
94-
#---------------------------------------------------------------------------------------
95-
# Set compilers
96-
#---------------------------------------------------------------------------------------
97-
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}cc${TOOLCHAIN_EXT} CACHE INTERNAL "C Compiler")
98-
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}c++${TOOLCHAIN_EXT} CACHE INTERNAL "C++ Compiler")
99-
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}cc${TOOLCHAIN_EXT} CACHE INTERNAL "ASM Compiler")
100-
101-
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PREFIX}/${${TOOLCHAIN}} ${CMAKE_PREFIX_PATH})
102-
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
103-
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
104-
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
105-
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
106-
1+
# Append current directory to CMAKE_MODULE_PATH for making device specific cmake modules visible
2+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
3+
4+
# Target definition
5+
set(CMAKE_SYSTEM_NAME Generic)
6+
set(CMAKE_SYSTEM_PROCESSOR arm)
7+
8+
#---------------------------------------------------------------------------------------
9+
# Set toolchain paths
10+
#---------------------------------------------------------------------------------------
11+
set(TOOLCHAIN arm)
12+
13+
if(NOT DEFINED TOOLCHAIN_PREFIX)
14+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
15+
set(TOOLCHAIN_PREFIX "/usr")
16+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
17+
set(TOOLCHAIN_PREFIX "/usr/local")
18+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
19+
if($ENV{MINGW_PREFIX} MATCHES "^.*/(mingw|clang)64$")
20+
set(TOOLCHAIN_PREFIX $ENV{MINGW_PREFIX})
21+
# STRING(REGEX REPLACE "^.*/(mingw|clang)64$" "/\\164" TOOLCHAIN_PREFIX $ENV{MINGW_PREFIX})
22+
elseif(EXISTS "C:/Keil")
23+
set(TOOLCHAIN_PREFIX "C:/Keil")
24+
else()
25+
message(STATUS "Please specify the TOOLCHAIN_PREFIX !\n For example: -DTOOLCHAIN_PREFIX=\"C:/Program Files/GNU Tools ARM Embedded\" ")
26+
endif()
27+
else()
28+
set(TOOLCHAIN_PREFIX "/usr")
29+
message(STATUS "No TOOLCHAIN_PREFIX specified, using default: " ${TOOLCHAIN_PREFIX})
30+
endif()
31+
endif()
32+
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/bin)
33+
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/${TOOLCHAIN}/include)
34+
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/${TOOLCHAIN}/lib)
35+
36+
# Set system depended extensions
37+
if(WIN32)
38+
set(TOOLCHAIN_EXT ".exe" )
39+
else()
40+
set(TOOLCHAIN_EXT "" )
41+
endif()
42+
43+
# Perform compiler test with static library
44+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
45+
46+
#---------------------------------------------------------------------------------------
47+
# Set compiler/linker flags
48+
#---------------------------------------------------------------------------------------
49+
50+
# Object build options
51+
# -O0 No optimizations, reduce compilation time and make debugging produce the expected results.
52+
# -mthumb Generat thumb instructions.
53+
# -fno-builtin Do not use built-in functions provided by GCC.
54+
# -Wall Print only standard warnings, for all use Wextra
55+
# -ffunction-sections Place each function item into its own section in the output file.
56+
# -fdata-sections Place each data item into its own section in the output file.
57+
# -fomit-frame-pointer Omit the frame pointer in functions that don’t need one.
58+
# -mabi=aapcs Defines enums to be a variable sized type.
59+
set(OBJECT_GEN_FLAGS "--thumb --gnu --split_sections")
60+
61+
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} --c99 " CACHE INTERNAL "C Compiler options")
62+
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} --cpp11 " CACHE INTERNAL "C++ Compiler options")
63+
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} " CACHE INTERNAL "ASM Compiler options")
64+
65+
66+
# -Wl,--gc-sections Perform the dead code elimination.
67+
# --specs=nano.specs Link with newlib-nano.
68+
# --specs=nosys.specs No syscalls, provide empty implementations for the POSIX system calls.
69+
set(MAPFILE "${CMAKE_PROJECT_NAME}.map" CACHE INTERNAL "Linker Map File")
70+
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "Linker options")
71+
72+
#---------------------------------------------------------------------------------------
73+
# Set debug/release build configuration Options
74+
#---------------------------------------------------------------------------------------
75+
76+
# Options for DEBUG build
77+
# -Og Enables optimizations that do not interfere with debugging.
78+
# -g Produce debugging information in the operating system’s native format.
79+
set(CMAKE_C_FLAGS_DEBUG "-O0 --debug" CACHE INTERNAL "C Compiler options for debug build type")
80+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 --debug" CACHE INTERNAL "C++ Compiler options for debug build type")
81+
set(CMAKE_ASM_FLAGS_DEBUG "--debug" CACHE INTERNAL "ASM Compiler options for debug build type")
82+
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "--debug" CACHE INTERNAL "Linker options for debug build type")
83+
84+
# Options for SPY build are same as DEBUG options
85+
set(CMAKE_C_FLAGS_SPY "${CMAKE_C_FLAGS_DEBUG} -DQ_SPY" CACHE INTERNAL "C Compiler options for spy build type")
86+
set(CMAKE_CXX_FLAGS_SPY "${CMAKE_CXX_FLAGS_DEBUG} -DQ_SPY" CACHE INTERNAL "C++ Compiler options for spy build type")
87+
set(CMAKE_ASM_FLAGS_SPY "${CMAKE_ASM_FLAGS_DEBUG} -DQ_SPY" CACHE INTERNAL "ASM Compiler options for spy build type")
88+
set(CMAKE_EXE_LINKER_FLAGS_SPY "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE INTERNAL "Linker options for spy build type")
89+
90+
# Options for RELEASE build
91+
# -Os Optimize for size. -Os enables all -O2 optimizations.
92+
# -flto Runs the standard link-time optimizer.
93+
set(CMAKE_C_FLAGS_RELEASE "-Ospace --no_debug" CACHE INTERNAL "C Compiler options for release build type")
94+
set(CMAKE_CXX_FLAGS_RELEASE "-Ospace --no_debug" CACHE INTERNAL "C++ Compiler options for release build type")
95+
set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")
96+
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "--no_debug" CACHE INTERNAL "Linker options for release build type")
97+
# set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-g3 -flto" CACHE INTERNAL "Linker options for release build type")
98+
99+
100+
#---------------------------------------------------------------------------------------
101+
# Set compilers
102+
#---------------------------------------------------------------------------------------
103+
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}cc${TOOLCHAIN_EXT} CACHE INTERNAL "C Compiler")
104+
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}c++${TOOLCHAIN_EXT} CACHE INTERNAL "C++ Compiler")
105+
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}cc${TOOLCHAIN_EXT} CACHE INTERNAL "ASM Compiler")
106+
107+
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PREFIX}/${${TOOLCHAIN}} ${CMAKE_PREFIX_PATH})
108+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
109+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
110+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
111+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
112+

0 commit comments

Comments
 (0)