1. 前言
在开发PSDK体系中开发并不需要熟练使用concerto,只需要了解如何增、删、改、查操作即可。
2. 什么是concerto
concerto is a GNU make based build system used by many components within PSDK RTOS. It is a collection of make rules and make macro’s to stream line compile and link across multiple code gen tools, CPU arch’s, operating systems, SoC’s.
总得来说,就是多芯片编译框架。
3. 需要关注的文件有哪些
The software package, also referred to as project here, supports a concerto based build system when you find a folder named concerto at top level. You will also find a top level Makefile and a file target.mak.
- ${SW_COMPONENT}/concerto/
The concerto folder is agnostic of the software project and the same folder will be present in different software projects. - ${SW_COMPONENT}/Makefile
The /Makefile is the top level entry point to the project build. Doing make all or simply make will build all the software for this project. Doing make clean will clean all the build for this project. - ${SW_COMPONENT}/target.mak
The output of concerto build is kept in the folder ${SW_COMPONENT}/out/ . The files are arranged hierarchically, based on first PLATFORM, then CPU, then OS, then PROFILE, then module.
Example: out/J7/A72/LINUX/release/modulemodule contains multiple folder, one for each library or executable in this project. It will contain the string mentioned in TARGET variable in concerto.mak file - ${SW_COMPONENT}/**/concerto.mak
concerto会根据Makefile中 DIRECTORIES 搜寻子目录中的concerto.mak文件。concerto.mak文件标志着这个目录会编译出一个库 or 执行文件。
3.1. concerto.mak 文件中需要关注什么
3.1.1. 如何确定当前编译的target?
查看 concerto.mak 文件中相关代码
\$ ifeq ($(TARGET_CPU),A72)
这里 TARGET_CPU 在工程顶层 Makefile 中的 TARGET_COMBOS 定义
具体的类型有
Variable | Purpose |
|---|---|
TARGET_CPU | CPU architecture type |
TARGET_OS | OS type |
TARGET_PLATFORM | SoC or SoC family type |
TARGET_BUILD | Build profile |
3.1.2. 如何确定编译结果是什么样子?
查看 concerto.mak 文件中相关代码
include $(PRELUDE)
# all variable setup should be between PRELUDE and FINALE
# out文件夹中输出结果包含的名字
TARGET := my_lib_name
# 输出的类型 library , executable
TARGETTYPE := library
# 源文件
CSOURCES := $(call all-c-files)
include $(FINALE)
3.1.3. 在调试中可能需要关注的参数
查看 concerto.mak 文件中相关参数
Variable | Purpose |
|---|---|
CSOURCES | List of C files to build, list each file explicitly or use the macro $(call all-c-files) |
DEFS | -D defines to apply when compiling files for this target |
IDIRS | include search paths to apply when compiling files for this target |
CFLAGS | additional compiler flags to apply when compiling files for this target |
LDIRS | library search paths to apply when linking files for this executable target |
STATIC_LIBS | static libraries (.a) to link when creating executable |
SYS_SHARED_LIBS | shared libraries (.so) to link when creating executable |
LFLAGS | additional linker flags to apply when linking files for this executable target |
SKIPBUILD | when SKIPBUILD=1, it would skip build of this target, useful to temporarily skip building certain concerto.mak files |
4. 支持的操作有哪些
在Makefile文件所在目录执行
make command | Description |
|---|---|
make all | Build everything |
make clean | Clean everything |
make scrub | Delete all generated files |
make <maketarget> SHOW_COMMANDS=1 | Verbose build, shows compiler invocation including all arguments passed to the compiler |
make <maketarget> PROFILE=<profile name> | Build’s a specific profile, valid values are, debug release all |
make targets | List all granular targets (libraries or executables) enabled in current build |
make <maketarget> | Build a specific target listed during make targets |
5. 其他开发帮助
8.1.6.1. How do I build just one library or executable ?
Do make targets to list all enabled granular targets
Do make <targetname> to build a specific target
8.1.6.2. How do I clean just one library or executable ?
You need to know which PLATFORM, OS, CPU, PROFILE, you have built the library or executable.
You need to know the name of the target as mentioned in the concerto.mak file
Goto the folder out/<PLATFORM>/<OS>/<CPU>/<PROFILE>/module/
Delete the required <targetname> folder’s
8.1.6.3. How do I see what exact options were passed to the compiler, linker ?
Do make SHOW_COMMANDS=1
8.1.6.4. How do I not build a specific target or concerto.mak file ?
Add the variable SKIPBUILD=1 in the concerto.mak file. Make sure to add in between the include (FINALE).
8.1.6.5. My project executable depends on a library file from another concerto project, will concerto trigger a build of the external library ?
NO. concerto or rather make only builds libraries and executables within the current project. You need to add rules manually to trigger build of dependent external libraries.
8.1.6.6. Will usual make options like -jN work with concerto ?
Yes. concerto is not a build system on its own. It is a collection of common make rules and make variables. So all usual make options and make commands will work with concerto.
8.1.6.7. How do I integrate a new build macro into multiple projects ?
The Imaging, TI OpenVX, and Vision Apps projects all include a common file that contain shared flags. This file is located at tiovx/build_flags.mak. This file is included in the Makefiles of each of these projects. To create a new build macro, first add a new variable to this file. Next, edit the Makefiles of each of these projects to add a new flag to the BUILD_DEFS compiler flag based on the flag set in tiovx/build_flags.mak. If further projects need to add the same flag, the tiovx/build_flags.mak must be included within that project’s Makefile.