2019-04-06 15:08:09 +02:00
# SPDX-License-Identifier: Apache-2.0
2018-12-19 16:27:55 +01:00
# *DOCUMENTATION*
#
# Note that this is *NOT* the top-level CMakeLists.txt. That's in the
# application. See the Application Development Primer documentation
# for details.
#
# To see a list of typical targets execute "make usage"
# More info can be located in ./README.rst
# Comments in this file are targeted only to the developer, do not
# expect to learn how to build the kernel reading this file.
2018-06-04 11:47:45 +02:00
if ( NOT DEFINED ZEPHYR_BINARY_DIR )
2019-06-18 20:45:40 +02:00
message ( FATAL_ERROR " A user error has occurred.
2018-06-04 11:47:45 +02:00
c m a k e w a s i n v o k e d w i t h ' $ { C M A K E _ C U R R E N T _ L I S T _ D I R } ' s p e c i f i e d a s t h e s o u r c e d i r e c t o r y ,
b u t i t m u s t b e i n v o k e d w i t h a n a p p l i c a t i o n s o u r c e d i r e c t o r y ,
s u c h a s ' $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / s a m p l e s / h e l l o _ w o r l d ' .
D e b u g v a r i a b l e s :
C M A K E _ C A C H E F I L E _ D I R : $ { C M A K E _ C A C H E F I L E _ D I R }
" )
endif ( )
2019-06-01 00:37:40 +02:00
# See https://gitlab.kitware.com/cmake/cmake/issues/16228
# and https://cmake.org/pipermail/cmake/2019-May/thread.html#69496
if ( NOT ZEPHYR_BASE STREQUAL CMAKE_CURRENT_SOURCE_DIR )
message ( WARNING " ZEPHYR_BASE doesn't match CMAKE_CURRENT_SOURCE_DIR
Z E P H Y R _ B A S E = $ { Z E P H Y R _ B A S E }
P W D = $ E N V { P W D }
C M A K E _ C U R R E N T _ S O U R C E _ D I R = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
Y o u m a y b e u s i n g a m i x o f s y m b o l i c l i n k s a n d r e a l p a t h s w h i c h c a u s e s \
s u b t l e a n d h a r d t o d e b u g C M a k e i s s u e s . " )
endif ( )
# For Zephyr more specifically this breaks (at least)
# -fmacro-prefix-map=${ZEPHYR_BASE}=
2017-10-27 15:43:34 +02:00
# Verify that the toolchain can compile a dummy file, if it is not we
2019-06-18 20:45:40 +02:00
# won't be able to test for compatibility with certain C flags.
2019-08-28 13:02:51 +02:00
zephyr_check_compiler_flag ( C "" toolchain_is_ok )
2017-10-27 15:43:34 +02:00
assert ( toolchain_is_ok "The toolchain is unable to build a dummy C file. See CMakeError.log." )
2019-06-14 01:15:44 +02:00
# In some cases the "final" things are not used at all and "_prebuilt"
# is the last station. See "logical_target_for_zephyr_elf" below for
# details.
2017-10-27 15:43:34 +02:00
set ( CMAKE_EXECUTABLE_SUFFIX .elf )
2019-01-14 16:31:02 +01:00
set ( ZEPHYR_PREBUILT_EXECUTABLE zephyr_prebuilt )
2019-05-07 15:20:20 +02:00
set ( ZEPHYR_FINAL_EXECUTABLE zephyr_final )
2017-10-27 15:43:34 +02:00
2019-04-29 16:57:37 +02:00
# Set some phony targets to collect dependencies
2019-01-14 16:39:33 +01:00
set ( OFFSETS_H_TARGET offsets_h )
set ( SYSCALL_LIST_H_TARGET syscall_list_h_target )
set ( DRIVER_VALIDATION_H_TARGET driver_validation_h_target )
set ( KOBJ_TYPES_H_TARGET kobj_types_h_target )
set ( LINKER_SCRIPT_TARGET linker_script_target )
2020-03-16 20:48:00 +01:00
set ( PARSE_SYSCALLS_TARGET parse_syscalls_target )
2019-01-14 16:39:33 +01:00
2017-10-27 15:43:34 +02:00
define_property ( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT BRIEF_DOCS " " FULL_DOCS " " )
2018-12-19 10:40:57 +01:00
set_property ( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little ${ ARCH } ) # BFD format
2017-10-27 15:43:34 +02:00
2018-12-19 10:40:57 +01:00
# "zephyr_interface" is a source-less library that encapsulates all the global
2017-10-27 15:43:34 +02:00
# compiler options needed by all source files. All zephyr libraries,
# including the library named "zephyr" link with this library to
# obtain these flags.
2018-12-19 10:40:57 +01:00
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#interface-libraries
2017-10-27 15:43:34 +02:00
add_library ( zephyr_interface INTERFACE )
2018-12-19 10:40:57 +01:00
# "zephyr" is a catch-all CMake library for source files that can be
2017-10-27 15:43:34 +02:00
# built purely with the include paths, defines, and other compiler
# flags that come with zephyr_interface.
zephyr_library_named ( zephyr )
zephyr_include_directories (
i n c l u d e
$ { P R O J E C T _ B I N A R Y _ D I R } / i n c l u d e / g e n e r a t e d
$ { U S E R I N C L U D E }
$ { S T D I N C L U D E }
)
2019-01-25 10:14:13 +01:00
# Don't add non-existing include directories, it creates noise and
# warnings in some tooling
foreach ( optional_include_dir
$ { S O C _ D I R } / $ { A R C H } / $ { S O C _ P A T H }
$ { S O C _ D I R } / $ { A R C H } / $ { S O C _ P A T H } / i n c l u d e
$ { S O C _ D I R } / $ { A R C H } / $ { S O C _ F A M I L Y } / i n c l u d e
soc/xtensa/intel_adsp: Upstream updates
Significant rework of the Intel Audio DSP SoC/board layers. Includes
code from the following upstream commits:
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Thu Jun 25 16:34:36 2020 +0100
xtesna: adsp: use 50k ticks per sec for audio
Audio needs high resolution scheduling so schedule to nearest 20uS.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Wed Jun 24 13:59:01 2020 -0700
soc/xtensa/intel_adsp: Remove sof-config.h includes
This header isn't used any more, and in any case shouldn't be included
by SoC-layer Zephyr headers that need to be able to build without SOF.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Sat Jun 20 15:42:58 2020 -0700
soc/intel_adsp: Leave interrupts disabled at MP startup
This had some code that was pasted in from esp32 that was inexplicably
enabling interrupts when starting an auxiliary CPU. The original
intent was that the resulting key would be passed down to the OS, but
that's a legacy SMP mechanism and unused. What it actually did was
SET the resulting value in PS.INTLEVEL, enabling interrupts globally
before the CPU is ready to handle them.
Just remove. The system doesn't need to enable interrupts until the
entrance to the first user thread on this CPU, which will do it
automatically as part of the context switch.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 23 13:57:54 2020 +0300
dts: intel_cavs: Add required label
Add required label fixing build for CAVS15, 20, 25.
Fixes following errors:
...
devicetree error: 'label' is marked as required in 'properties:' in
bindings/interrupt-controller/intel,cavs-intc.yaml,
but does not appear in
...
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 23 15:19:56 2020 +0300
soc: cavs_v18: Remove dts_fixup and fix build
Remove unused now dts_fixup.h and fix build with the recent code base.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 23 15:12:25 2020 +0300
soc: cavs_v20: Remove dts_fixup and fix build
Remove unused now dts_fixup.h and fix build with the recent code base.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 23 14:59:23 2020 +0300
soc: cavs_v25: Remove dts_fixup fix build
Remove unused now dts_fixup and fix build with the latest code base.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri Jun 12 12:29:06 2020 +0300
soc: intel_adsp: Remove unused functions
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 17:53:58 2020 +0300
soc: intel_adsp: Clean up soc.h
Remove unused or duplicated definitions.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 17:02:23 2020 +0300
soc: intel_adsp: De-duplicate soc.h
Move soc.h to common SOC area.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 15:54:19 2020 +0300
soc: intel_adsp: Remove duplicated io.h
Move duplicated io.h to common SOC area.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri Jun 12 12:39:46 2020 +0300
cmake: Correct SOC_SERIES name for byt and bdw
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri Jun 12 12:39:02 2020 +0300
soc: intel_adsp: Build bootloader only for specific SOCs
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Thu Jun 11 13:46:25 2020 +0100
boards: xtensa: adsp: add byt and bdw boards WIP
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Wed Jun 10 10:01:29 2020 -0700
soc/intel_adsp: Make the HDA timer the default always
The CAVS_TIMER was originally written because the CCOUNT values are
skewed between SMP CPUs, so it's the default when SMP=y. But really
it should be the default always, the 19.2 MHz timer is plenty fast
enough to be the Zephyr cycle timer, and it's rate is synchronized
across the whole system (including the host CPU), making it a better
choice for timing-sensitive applications.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 15:21:43 2020 +0300
soc: cavs_v25: Enable general samples build
Enables general samples build for SOC cavs_v25.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 15:13:53 2020 +0300
soc: cavs_v20: Enable general samples build
Enable general sample build.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 14:35:13 2020 +0300
soc: cavs_v18: Fix build general samples
Fix building general samples for CAVS18.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 14:22:40 2020 +0300
soc: intel_adsp: Add support for other SOCs
Support other SOCs in the "ready" message to the Host.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 10 13:25:39 2020 +0300
soc: intel_adsp: Move adsp.c to common SOC area
Move adsp.c to common and clean makefiles.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 17:18:18 2020 +0300
boards: intel_adsp: Remove dependency on SOF
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue Jun 9 14:29:44 2020 +0100
soc: xtensa: cavs: build now good for cavs20 + 25
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 15:57:01 2020 +0300
soc: cavs_v15: Fix build for hello_world
Fix build for other then audio/sof targets.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 14:50:12 2020 +0300
sample: audio/sof: Remove old overlays
Removing old overlays used to switch logging backend.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon Jun 8 15:02:01 2020 +0300
soc: intel_adsp: Correct TEXT area
Correct HEADER_SPACE and put TEXT to:
(HP_SRAM_WIN0_BASE + HP_SRAM_WIN0_SIZE + VECTOR_TBL_SIZE)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 14:44:47 2020 +0300
soc: intel_adsp: Trivial syntax cleanup
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 14:41:07 2020 +0300
soc: intel_adsp: Fix bootloader script path
Make it possible to find linker script if build is done not inside
ZEPHYR_BASE.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue Jun 9 12:10:17 2020 +0100
soc: xtensa: cavs20/25: fix build with new headers - WIP
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 9 13:35:38 2020 +0300
soc: intel_adsp: Fix include headers
Fixes include headers
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue Jun 9 10:38:50 2020 +0100
soc: xtensa: cav18: updated headers- WIP
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Fri May 1 15:29:26 2020 -0700
soc/xtensa/intel_adsp: Clean up MP config logic
CONFIG_MP_NUM_CPUS is a platform value, indicating the number of CPUs
for which the Zephyr image is built. This is the value kernel and
device code should use to predicate questions like "is there more than
one CPU?"
CONFIG_SMP is an application tunable, controlling whether or not the
kernel schedules threads on CPUs other than the first one. This is
orthogonal to MP_NUM_CPUS: it's possible to build a "SMP" kernel on a
uniprocessor system or have a UP kernel on a MP system if the other
cores are used for non-thread application code.
CONFIG_SCHED_IPI_SUPPORTED is a platform flag telling an SMP kernel
whether or not it can synchronously signal other CPUs of scheduler
state changes. It should be inspected only inside the scheduler (or
other code that uses the API). This should be selected in kconfig by
soc layer code, or by a driver that implements the feature.
CONFIG_IPM_CAVS_IDC is a driver required to implement IPI on this
platform. This is what we should use as a predicate if we have
dependence on the IPM driver for a platform feature.
These were all being sort of borged together in code. Split them up
correctly, allowing the platform MP layer to be unit tested in the
absence of SMP (c.f. tests/kernel/mp), and SMP kernels with only one
CPU (which is pathlogical in practice, but also a very good unit test)
to be built.
Also removes some dead linker code for SMP-related sections that don't
exist in Zephyr.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Jun 8 16:41:55 2020 +0100
soc: xtensa: bootloader - use linker script
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Jun 8 16:26:18 2020 +0100
soc: xtensa: further fix headers - WIP
Simplify the directory structure, WIP for cavs20 and cavs25
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon Jun 8 12:59:30 2020 +0300
soc: cavs_v15: Remove unneeded include
Remove include fixing build.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun Jun 7 12:37:35 2020 +0100
soc:xtensa: adsp: remove sof specific code from soc headers
TODO: v1.8+
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Marc Herbert <marc.herbert@intel.com>
Date: Thu Jun 4 23:19:37 2020 -0700
intel_adsp_*/doc: fix duplicate .rst labels
Quick fix purely to make the build green again.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Author: Marc Herbert <marc.herbert@intel.com>
Date: Thu Jun 4 22:34:40 2020 -0700
samples/audio/sof: use OVERLAY_CONFIG to import apollolake_defconfig
This reverts commit 21f16b5b1d29fca83d1b62b1b75683b5a1bc2935 that
copied it here instead.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri Jun 5 12:34:48 2020 +0300
soc: intel_adsp: Move soc_mp to common
Moving soc_mp to common SOC area, it still needs fixes for taking
number of cores from Zephyr Kconfig, etc.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Jun 4 16:05:06 2020 +0300
soc: intel_adsp: Move memory.h from lib/
For those files from SOF referencing platform/lib/memory.h we have
include.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Jun 4 15:20:09 2020 +0300
soc: intel_adsp: Rename platform.h to soc.h
Rename to prevent including it from SOF.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Jun 4 11:47:55 2020 +0300
soc: intel_adsp: Move headers
Move headers to more convenient place
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Jun 4 11:21:51 2020 +0300
soc: intel_adsp: More SOC cleaning
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Marc Herbert <marc.herbert@intel.com>
Date: Mon Jun 1 15:31:34 2020 -0700
samples/audio/sof: import sof/src/arch/xtensa/ apollolake_defconfig
Import modules/audio/sof/src/arch/xtensa/configs/apollolake_defconfig
into prj.conf and new boards/up_squared_adsp.conf
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Jun 3 15:07:40 2020 +0100
soc:xtensa: adsp: let SOF configure the DSP for audio
Let SOF do this for the moment.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Jun 3 15:06:20 2020 +0100
soc: xtensa: cavs: remove headers similar to cavs15
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 3 15:58:38 2020 +0300
soc: intel_adsp: Move ipc header to common
Remove duplicated headers from CAVS to common SOC part
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Jun 3 13:02:09 2020 +0300
soc: cavs_v15: Remove unneeded headers
Remove also from CAVS15.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 2 18:34:11 2020 +0300
Remove more headers
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Jun 3 14:12:09 2020 +0100
soc: xtensa: remove cavs sod headers for drivers and trace.
Duplicate cavs15 headers.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Jun 3 14:05:12 2020 +0100
samples: move sof dai, dma and clk configs to SOF
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 2 17:38:45 2020 +0300
soc: intel_adsp: Remove more duplicated headers
Remove more headers
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue Jun 2 15:50:03 2020 +0100
samples: sof: remove pm realted files.
Use the SOF versions.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 2 16:55:40 2020 +0300
WIP: Strip lib from include path
WIP, pushed for sync
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 2 14:44:33 2020 +0300
soc: intel_adsp: Remove more headers
Remove even more common headers
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Jun 2 14:00:47 2020 +0300
soc: intel_adsp: Remove SOF headers
The headers would be used by audio/sof app directly from SOF module.
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Sat May 30 11:01:26 2020 -0700
soc/intel_adsp: Alternative log reading script
This script speaks the same protocol and works with the same firmware,
but:
* Is a single file with no dependencies outside the python3 standard
library and can be run out-of-tree (i.e. with setups where the
firmware is not built on the device under test)
* Operates in "tail" mode, where it will continue polling for more
output, making it easier to watch a running process and acting more
like a conventional console device.
* Has no dependence on the diag_driver kernel module (it reads the DSP
SRAM memory directly from the BAR mapping in the PCI device)
* Is MUCH smaller than the existing tool.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu May 28 16:17:51 2020 +0300
Decrease HEP pool size to 192000
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 29 10:27:00 2020 +0100
soc: xtensa: cavs25: complete support for cavs25
Builds, not tested on qmeu due to missing SOF ROM (TODO)
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 29 10:24:26 2020 +0100
soc: xtensa: cavs20: complete cavs20 support
Now boots on qemu.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 29 10:22:13 2020 +0100
soc: xtensa: cavs18: complete boot support
Now boots on qemu.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 29 10:19:23 2020 +0100
soc: xtensa: cavs15: use cavs15 instead of apl as linker soc name
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 29 10:16:06 2020 +0100
TODO: samples: sof: work around missing trace symbols.
Disable local trace.
Needs trace updates finished before this can be removed.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed May 27 15:57:19 2020 +0100
dts: xtensa: rename apl to cavs15 DTS
This DTS is used by more than APL SOC. i.e. all CAVS15 SOCs
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed May 27 15:52:20 2020 +0100
west: commands: sign: Add signing support for other CAVS targets
Sign for CAVS15, CAVS18, CAVS20 and CAVS25 SOCs
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed May 27 15:50:07 2020 +0100
boards: xtensa: cavs: used Zephyr mask macro
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed May 27 15:49:46 2020 +0100
soc: xtensa: move code to SOF
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue May 26 11:40:36 2020 +0100
soc: xtensa: use SOF versions of clk
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 18:38:45 2020 +0300
soc: intel_adsp: Send FW ready for non SOF configuration
Configure windows and send FW ready when used without SOF, should be
loaded with fw_loader script.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 18:02:22 2020 +0300
soc: intel_adsp: Use SOF version of the file
Use exact copy from SOF module.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 17:47:27 2020 +0300
soc: intel_adsp: Clean up include headers
Remove SOF mentions from the SOC headers.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 17:43:05 2020 +0300
soc: intel_adsp: Move SOF specific code to samples/audio/sof
Move SOF specific code to the SOF sample.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 17:39:42 2020 +0300
soc: intel_adsp: Use SOF module's version of mem_window.c
Use exact copy from SOF module.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 17:36:41 2020 +0300
soc: intel_adsp: Use exact copy from SOF module
Use SOF module verion of the clk.c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 25 14:03:35 2020 +0300
soc: xtensa: Add {SOC_FAMILY}/common/include path
Add ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/include path if exist.
Fixes issues for xtensa SOCs.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon May 25 16:18:50 2020 +0100
soc: xtensa: cavs common: fix headers for build
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon May 25 16:10:57 2020 +0100
soc: xtensa: adsp: add so_inthandlers.h for Intel platforms
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon May 25 16:08:26 2020 +0100
cmake: xtensa: select correct compiler per CAVS target.
TODO: what about XCC ?
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue May 19 14:59:26 2020 +0300
boards: up_squared_adsp: Move SOF configuration to samples
Move SOF-specific configuration to samples/audio/sof prj.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri May 15 15:29:50 2020 +0300
soc: intel_adsp: Move SOF code to modules/audio/sof
Move SOF dependent code out of SOC area.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu May 14 17:30:38 2020 +0300
Move task_main_start() to audio/sof sample
Start task_main_start() from main of audio/sof sample.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed May 13 15:37:20 2020 +0300
Rename up_xtreme_adsp to intel_adsp_cavs18
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon Apr 27 14:12:59 2020 +0300
Add sample audio/sof for SOF initialization
Add dedicated sample where we put SOF specific initialization.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 11 18:49:36 2020 +0300
WIP: soc: cavs_v18: Cleanup
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 11 15:44:06 2020 +0300
soc: cavs_v15: Move soc init to common part
Moving SOC init to the right place.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Mon May 11 15:02:28 2020 +0300
soc: intel_adsp: Move common part to special dir
Moving common part to common/adsp.c
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Fri May 8 14:37:50 2020 +0300
boards: up_xtreme_adsp: Add initial up_xtreme_adsp board
Add initial board copying existing up_squared_adsp board and using
CAVS1.8 SOC family.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu May 7 15:30:51 2020 +0300
soc: intel_adsp: Generalize bootloader
Move bootloader to soc/xtensa/intel_adsp making it available for other
boards.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue May 5 21:31:00 2020 +0100
boards: xtensa: up_squared: Add support for all CAVS
Add boot support for all CAVS versions. TODO: needs to be made common
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Tue May 5 21:25:34 2020 +0100
soc: xtensa: intel_adsp: Manage cache for DMA descriptors
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon May 4 21:10:50 2020 +0100
soc: xtensa: adsp: use 24M567 clock
Use audio clock
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon May 4 10:04:01 2020 +0100
xtensa: soc: adsp: enable system agent
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun May 3 15:03:07 2020 +0100
soc: xtensa: intel_adsp: increase mem pool to 192k
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun May 3 15:02:31 2020 +0100
soc: xtensa: intel_adsp: re-enable DMA trace
Buffer will be empty (as trace items sent to Zephyr LOG) but
logic is running.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun May 3 11:18:55 2020 +0100
soc: xtensa: intel: dont use uncache region yet.
Some code was still using this region. Use later.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun May 3 10:07:28 2020 +0100
soc: xtensa: intel_adsp: fix notifier init
Topology now loads.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 1 21:18:38 2020 +0100
boards: up2: Need to use sof config for bootloader
This will need uncoupled at some point. For testing today.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 1 21:16:38 2020 +0100
boards: up2: increase heap to 128k
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Apr 30 11:35:19 2020 +0300
boards: up_squared_adsp: Use bigger HEAP
Use HEAP from old demo.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri May 1 16:06:32 2020 +0100
soc: xtensa: intel_adsp: Fix config.h naming collisions
Rename sof version to sof-config.h
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Thu Apr 30 11:22:42 2020 +0300
Small cleanups
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Apr 29 22:00:44 2020 +0300
tests: sof/audio: Test ll scheduler
Add more tests for scheduler.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Apr 29 18:38:35 2020 +0300
tests: Add first schedule test
Add initial test for testing scheduling.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Apr 29 13:36:23 2020 +0100
soc: xtensa: rmeove build warnings
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Apr 28 18:04:33 2020 +0300
soc/intel_adsp: Register sof logging
Register sof logging for tracing
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Apr 28 14:16:55 2020 +0300
boards: up_squared_adsp: Define HEAP_MEM_POOL_SIZE
Define HEAP_MEM_POOL_SIZE when SOF enabled.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Apr 28 10:09:20 2020 +0300
tests: audio/sof: Add interrupt API for testing
Add initial interrupt API for testing.
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 27 15:54:28 2020 +0100
soc: xtensa: adsp: Update linker script for SOF sections.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 27 11:20:01 2020 +0100
soc: xtensa: adsp: send SOF FW metadata as boot message
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun Apr 26 21:47:20 2020 +0100
soc: xtensa: adsp: re-enable all SOF IP init.
Do all SOF IP init.
TODO: ATOMCTL, WFI on LX6
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sat Apr 25 15:30:40 2020 +0100
soc: xtensa: irq: Make sure IPC IRQ is registered.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Apr 22 20:56:09 2020 +0300
tests: sof: Enable console
Enable console for the test.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Apr 22 17:57:22 2020 +0300
soc: cavs_v15: Fix XTENSA_KERNEL_CPU_PTR_SR
Use correct value for XTENSA_KERNEL_CPU_PTR_SR.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Wed Apr 22 14:48:31 2020 +0300
tests: audio/sof: Add tests for alloc API testing
Add initial tests for allocation API testing. Can be extended for
other later.
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Apr 21 17:49:32 2020 +0300
logging: Enable xtensa simulator backend for ADSP
Enable xtensa simulator backend for SOC_FAMILY_INTEL_ADSP.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 20:58:30 2020 +0100
soc: xtensa: add common cpu logic
Support for additional cores.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date: Tue Apr 21 10:11:07 2020 +0300
Update west.yaml to point to the latest repo
Update west.yaml
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 16:17:01 2020 +0100
soc: xtensa: cavs: Fix build for clk.c on cavs18+
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 16:05:31 2020 +0100
soc: xtensa: cavs15: removed unused headers.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 16:05:09 2020 +0100
soc: xtensa: cavs25: align with SOF headers
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 16:03:52 2020 +0100
soc: xtensa: cavs20: align with SOF headers
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 16:03:09 2020 +0100
soc: xtensa: cavs18: Align with SOF headers.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Apr 20 11:42:39 2020 +0100
west: sof: Updated to latest version.
Now builds, links and runs SOF code (but not to FW ready).
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Sun Apr 19 13:28:53 2020 +0100
xtensa: intel adsp: build in SOF symbols if CONFIG_SOF
Code now fully links against SOF. Needs to be run tested.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Wed Apr 15 10:19:28 2020 -0700
DO NOT MERGE: temporarily add thesoftproject as remote for sof module
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Wed Apr 15 10:33:40 2020 -0700
ipm: cavs_idc: use the IPC/IDC definitions in SoC
The SoC definitions have the necessary IPC/IDC bits so there is
no need to define them separately.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Apr 15 14:30:20 2020 +0100
TODO: config: Use static config for SOF module.
TODO: needs to be generated as part of SOF kconfig
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Fri Apr 10 21:56:07 2020 +0100
HACK: Add SOF into build
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Apr 15 13:55:15 2020 +0100
west: modules: Add SOF audio module.
Add support for building SOF as a Zephyr module. This is the starting
point for add SOF audio into Zephyr. Currently builds but does not use
any symbols yet.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Apr 15 13:48:48 2020 +0100
WIP soc: adsp-cavs15: Use same include directory structure as SOF
Use the same directory structure as SOF to simplify porting and allow
SOF to build without Zephyr until porting work is complete.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Apr 15 13:43:44 2020 +0100
WIP soc: adsp-common: Use same include directory structure as SOF
Use the same directory structure as SOF to simplify porting and allow
SOF to build without Zephyr until porting work is complete.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 16 14:36:32 2020 +0000
WIP: soc: adsp-common: cache is common across all Intel ADSP platforms
De-duplicate soc.h cache definitions.
TODO: this needs done for other common functions.
TODO: need to fix include path
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 30 11:07:43 2020 -0700
WIP: soc: cavs25: Import SOF SoC support
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 30 11:07:12 2020 -0700
WIP: soc: cavs20: Import SOF SoC support
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 30 11:06:40 2020 -0700
WIP: soc: cavs18: Import SOF SoC support
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Mon Mar 30 12:37:17 2020 -0700
soc: intel_adsp: use main_entry.S in common for cavs_v15
The files are identical anyway.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Mon Mar 30 11:38:14 2020 -0700
soc: intel_adsp/cavs_v15: link common code
Let cavs_v15 link against the code compiled under common/.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 16 13:08:28 2020 +0000
WIP: soc: common: Import SOF SoC support
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 16 14:37:32 2020 +0000
WIP soc: adsp-cavs15: build power down support
Build the power down support for CAVS1.5
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 16 12:40:17 2020 +0000
WIP: soc: cavs15: Import SOF SoC support
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 16 14:30:08 2020 +0000
soc: cavs15: Add missing SHIM registers.
SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Mon Mar 9 15:43:01 2020 +0000
xtensa: intel_adsp/cavs_v15: fix usage of LP SRAM power gating
Remove LSPGCTL as it can cause confusion, use SHIM_LSPGCTL instead.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date: Wed Feb 26 15:28:48 2020 +0000
boards: up_squared_adsp: Use local xtensa HAL instead of SDK HAL
SDK HAL is deprecated for Intel ADSP SoCs so fix and use local HAL
module.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Mon Mar 30 10:45:15 2020 -0700
soc: add Intel Audio DSP SoC family
This creates a SoC family for the audio DSPs on various
Intel CPUs. The intel_apl_adsp is being moved into
this family as well, since it is part of the CAVS v1.5
series of DSPs.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Daniel Leung <daniel.leung@intel.com>
Date: Mon Mar 30 11:29:02 2020 -0700
soc: xtensa: add CMakeLists.txt
Add CMakeLists.txt under soc/xtensa so that CMakeLists.txt
inside each SoC directory will be included, similar to
what ARM and RISCV have.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Wed Jun 17 12:30:43 2020 -0700
Revert "boards: up_squared_adsp: Add flasher script"
This reverts commit 80f295a9dd259f75f201c09abee849f1780efaff.
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Wed Jun 17 12:30:32 2020 -0700
Revert "boards: up_squared_adsp: Update logtool tool"
This reverts commit 7770d182c15b8173cade5804a0889b69291354d4.
Author: Andy Ross <andrew.j.ross@intel.com>
Date: Wed Jun 17 12:30:23 2020 -0700
Revert "soc: intel_adsp: Generalize bootloader"
This reverts commit d6a33ef4677dddd7c76d4672ebec82352448c1d2.
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
soc: xtensa; intel: remove sof-config.h - SQUASH
No longer used.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-26 02:42:51 +02:00
$ { S O C _ D I R } / $ { A R C H } / $ { S O C _ F A M I L Y } / c o m m o n / i n c l u d e
2019-01-25 10:14:13 +01:00
)
if ( EXISTS ${ optional_include_dir } )
zephyr_include_directories ( ${ optional_include_dir } )
endif ( )
endforeach ( )
2017-10-27 15:43:34 +02:00
zephyr_compile_definitions (
K E R N E L
_ _ Z E P H Y R _ _ = 1
2018-01-03 18:26:19 +01:00
)
2019-01-10 12:07:51 +01:00
# @Intent: Set compiler flags to enable buffer overflow checks in libc functions
# @config in CONFIG_NO_OPTIMIZATIONS optional : Optimizations may affect security
2020-08-18 14:47:53 +02:00
zephyr_compile_definitions ( $< TARGET_PROPERTY:compiler,security_fortify > )
2019-01-10 12:07:51 +01:00
# @Intent: Set compiler flags to detect general stack overflows across all functions
if ( CONFIG_STACK_CANARIES )
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,security_canaries > )
2018-01-03 18:26:19 +01:00
endif ( )
2017-10-27 15:43:34 +02:00
2018-04-10 04:53:26 +02:00
if ( BUILD_VERSION )
zephyr_compile_definitions (
B U I L D _ V E R S I O N = $ { B U I L D _ V E R S I O N }
)
endif ( )
2019-01-30 10:12:30 +01:00
# @Intent: Obtain compiler optimizations flags and store in variables
# @details:
# Kconfig.zephyr "Optimization level" is a kconfig choice, ensuring
# only *one* of CONFIG_{NO,DEBUG,SPEED,SIZE}_OPTIMIZATIONS is set.
# Refer to Kconfig.zephyr for selection logic and description of these choices.
# toolchain_cc_optimize_*() macros must provide the mapping from these kconfigs
# to compiler flags. Each macro will store the flags in a CMake variable, whose
# name is passed as argument (somewhat like by reference).
2017-10-27 15:43:34 +02:00
#
2019-01-30 10:12:30 +01:00
# If the user wants to tweak the optimizations, there are two ways:
# 1) Using EXTRA_CFLAGS which is applied regardless of kconfig choice, or
# 2) Rely on override support being implemented by your toolchain_cc_optimize_*()
2017-10-27 15:43:34 +02:00
#
2020-08-18 14:47:53 +02:00
get_property ( OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG TARGET compiler PROPERTY no_optimization )
get_property ( OPTIMIZE_FOR_DEBUG_FLAG TARGET compiler PROPERTY optimization_debug )
get_property ( OPTIMIZE_FOR_SPEED_FLAG TARGET compiler PROPERTY optimization_speed )
get_property ( OPTIMIZE_FOR_SIZE_FLAG TARGET compiler PROPERTY optimization_size )
2018-01-24 10:40:32 +01:00
2019-01-30 10:12:30 +01:00
# From kconfig choice, pick the actual OPTIMIZATION_FLAG to use.
# Kconfig choice ensures only one of these CONFIG_*_OPTIMIZATIONS is set.
2018-01-22 15:35:54 +01:00
if ( CONFIG_NO_OPTIMIZATIONS )
2018-01-24 10:40:32 +01:00
set ( OPTIMIZATION_FLAG ${ OPTIMIZE_FOR_NO_OPTIMIZATIONS_FLAG } )
elseif ( CONFIG_DEBUG_OPTIMIZATIONS )
2017-10-27 15:43:34 +02:00
set ( OPTIMIZATION_FLAG ${ OPTIMIZE_FOR_DEBUG_FLAG } )
2018-06-16 23:40:04 +02:00
elseif ( CONFIG_SPEED_OPTIMIZATIONS )
set ( OPTIMIZATION_FLAG ${ OPTIMIZE_FOR_SPEED_FLAG } )
2018-01-24 10:40:32 +01:00
elseif ( CONFIG_SIZE_OPTIMIZATIONS )
2019-01-30 10:12:30 +01:00
set ( OPTIMIZATION_FLAG ${ OPTIMIZE_FOR_SIZE_FLAG } ) # Default in kconfig
2018-01-24 10:40:32 +01:00
else ( )
2019-01-19 01:15:19 +01:00
assert ( 0 "Unreachable code. Expected optimization level to have been chosen. See Kconfig.zephyr" )
2017-10-27 15:43:34 +02:00
endif ( )
2020-02-07 00:48:22 +01:00
if ( NOT CONFIG_ARCH_IS_SET )
message ( WARNING " \
N o n e o f t h e C O N F I G _ < a r c h > ( e . g . C O N F I G _ X 8 6 ) s y m b o l s a r e s e t . \
S e l e c t o n e o f t h e m f r o m t h e S O C _ S E R I E S _ * s y m b o l o r , l a c k i n g t h a t , f r o m t h e \
S O C _ * s y m b o l . " )
endif ( )
2019-01-30 10:12:30 +01:00
# Apply the final optimization flag(s)
zephyr_compile_options ( ${ OPTIMIZATION_FLAG } )
2019-02-18 23:54:30 +01:00
# @Intent: Obtain compiler specific flags related to C++ that are not influenced by kconfig
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,required > > )
2019-02-18 23:54:30 +01:00
# @Intent: Obtain compiler specific flags for compiling under different ISO standards of C++
2019-05-15 23:01:58 +02:00
if ( CONFIG_CPLUSPLUS )
# From kconfig choice, pick a single dialect.
# Kconfig choice ensures only one of these CONFIG_STD_CPP* is set.
if ( CONFIG_STD_CPP98 )
2020-08-18 14:47:53 +02:00
set ( STD_CPP_DIALECT_FLAGS $< TARGET_PROPERTY:compiler-cpp,dialect_cpp98 > )
2019-05-15 23:01:58 +02:00
elseif ( CONFIG_STD_CPP11 )
2020-08-18 14:47:53 +02:00
set ( STD_CPP_DIALECT_FLAGS $< TARGET_PROPERTY:compiler-cpp,dialect_cpp11 > ) # Default in kconfig
2019-05-15 23:01:58 +02:00
elseif ( CONFIG_STD_CPP14 )
2020-08-18 14:47:53 +02:00
set ( STD_CPP_DIALECT_FLAGS $< TARGET_PROPERTY:compiler-cpp,dialect_cpp14 > )
2019-05-15 23:01:58 +02:00
elseif ( CONFIG_STD_CPP17 )
2020-08-18 14:47:53 +02:00
set ( STD_CPP_DIALECT_FLAGS $< TARGET_PROPERTY:compiler-cpp,dialect_cpp17 > )
2019-05-15 23:01:58 +02:00
elseif ( CONFIG_STD_CPP2A )
2020-08-18 14:47:53 +02:00
set ( STD_CPP_DIALECT_FLAGS $< TARGET_PROPERTY:compiler-cpp,dialect_cpp2a > )
2019-05-15 23:01:58 +02:00
else ( )
assert ( 0 "Unreachable code. Expected C++ standard to have been chosen. See Kconfig.zephyr." )
endif ( )
2018-10-23 18:20:51 +02:00
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : ${ STD_CPP_DIALECT_FLAGS } > )
2019-05-15 23:01:58 +02:00
endif ( )
2019-02-18 23:54:30 +01:00
if ( NOT CONFIG_EXCEPTIONS )
# @Intent: Obtain compiler specific flags related to C++ Exceptions
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,no_exceptions > > )
2019-02-18 23:54:30 +01:00
endif ( )
if ( NOT CONFIG_RTTI )
# @Intent: Obtain compiler specific flags related to C++ Run Time Type Information
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,no_rtti > > )
2019-02-18 23:54:30 +01:00
endif ( )
2019-02-27 20:53:18 +01:00
if ( CONFIG_MISRA_SANE )
2019-05-16 12:53:58 +02:00
# @Intent: Obtain toolchain compiler flags relating to MISRA.
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_error_misra_sane > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_error_misra_sane > > )
2019-02-27 20:53:18 +01:00
endif ( )
2020-08-26 18:48:33 +02:00
# This is intend to be temporary. Once we have fixed the violations that
# prevents build Zephyr, these flags shall be part of the default flags.
if ( CONFIG_CODING_GUIDELINE_CHECK )
# @Intent: Obtain toolchain compiler flags relating to coding guideline
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_error_coding_guideline > > )
2020-08-26 18:48:33 +02:00
endif ( )
2019-06-11 13:55:53 +02:00
# @Intent: Set compiler specific macro inclusion of AUTOCONF_H
2020-08-13 15:49:46 +02:00
zephyr_compile_options ( "SHELL: $<TARGET_PROPERTY:compiler,imacros> ${AUTOCONF_H}" )
2019-06-11 13:55:53 +02:00
2019-06-11 15:56:57 +02:00
# @Intent: Set compiler specific flag for bare metal freestanding option
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,freestanding > )
2019-06-11 15:56:57 +02:00
2019-06-12 14:56:46 +02:00
# @Intent: Set compiler specific flag for tentative definitions, no-common
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,no_common > )
2019-06-12 14:56:46 +02:00
2019-07-23 09:00:55 +02:00
# @Intent: Set compiler specific flag for production of debug information
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,debug > )
2019-07-23 09:00:55 +02:00
2017-10-27 15:43:34 +02:00
zephyr_compile_options (
2017-12-12 18:59:37 +01:00
$ { T O O L C H A I N _ C _ F L A G S }
2017-10-27 15:43:34 +02:00
)
2019-01-30 21:48:25 +01:00
# @Intent: Obtain compiler specific flags related to assembly
2020-08-18 14:47:53 +02:00
# ToDo: Remember to get feedback from Oticon on this, as they might use the `ASM_BASE_FLAG` since this is done this way.
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:ASM > : $< TARGET_PROPERTY:asm,required > > )
2019-01-30 21:48:25 +01:00
2019-07-02 22:22:04 +02:00
# @Intent: Enforce standard integer type correspondance to match Zephyr usage.
# (must be after compiler specific flags)
2020-08-13 15:49:46 +02:00
zephyr_compile_options ( "SHELL: $<TARGET_PROPERTY:compiler,imacros> ${ZEPHYR_BASE}/include/toolchain/zephyr_stdint.h" )
2019-07-02 22:22:04 +02:00
2019-01-30 21:48:25 +01:00
# Common toolchain-agnostic assembly flags
2017-10-27 15:43:34 +02:00
zephyr_compile_options (
$ < $ < C O M P I L E _ L A N G U A G E : A S M > : - D _ A S M L A N G U A G E >
)
2019-04-25 15:46:11 +02:00
# @Intent: Set fundamental linker specific flags
toolchain_ld_base ( )
2018-11-26 13:48:34 +01:00
2019-05-07 16:32:36 +02:00
toolchain_ld_force_undefined_symbols (
_ O f f s e t A b s S y m s
_ C o n f i g A b s S y m s
)
2017-10-03 16:31:55 +02:00
if ( NOT CONFIG_NATIVE_APPLICATION )
2019-04-25 16:31:30 +02:00
# @Intent: Set linker specific flags for bare metal target
toolchain_ld_baremetal ( )
2017-10-03 16:31:55 +02:00
endif ( )
2017-10-27 15:43:34 +02:00
2018-10-23 18:20:51 +02:00
if ( CONFIG_LIB_CPLUSPLUS )
2019-04-26 08:43:04 +02:00
# @Intent: Set linker specific flags for C++
toolchain_ld_cpp ( )
2018-10-23 18:20:51 +02:00
endif ( )
2019-05-16 12:49:31 +02:00
# @Intent: Add the basic toolchain warning flags
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_base > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_base > > )
2019-05-06 15:19:27 +02:00
2017-10-27 15:43:34 +02:00
# ==========================================================================
#
# cmake -DW=... settings
#
# W=1 - warnings that may be relevant and does not occur too often
# W=2 - warnings that occur quite often but may still be relevant
# W=3 - the more obscure warnings, can most likely be ignored
# ==========================================================================
2019-05-16 12:49:31 +02:00
# @Intent: Add cmake -DW toolchain supported warnings, if any
2017-10-27 15:43:34 +02:00
if ( W MATCHES "1" )
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_dw_1 > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_dw_1 > > )
2017-10-27 15:43:34 +02:00
endif ( )
if ( W MATCHES "2" )
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_dw_2 > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_dw_2 > > )
2017-10-27 15:43:34 +02:00
endif ( )
if ( W MATCHES "3" )
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_dw_3 > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_dw_3 > > )
2017-10-27 15:43:34 +02:00
endif ( )
2019-05-16 12:49:31 +02:00
# @Intent: Add extended, more specific, toolchain warning flags
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,warning_extended > )
2019-01-25 13:57:03 +01:00
2019-05-16 12:58:40 +02:00
# @Intent: Trigger an error when a declaration does not specify a type
2020-08-18 14:47:53 +02:00
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:C > : $< TARGET_PROPERTY:compiler,warning_error_implicit_int > > )
zephyr_compile_options ( $< $<COMPILE_LANGUAGE:CXX > : $< TARGET_PROPERTY:compiler-cpp,warning_error_implicit_int > > )
2019-05-16 12:58:40 +02:00
2017-10-27 15:43:34 +02:00
# Allow the user to inject options when calling cmake, e.g.
# 'cmake -DEXTRA_CFLAGS="-Werror -Wno-deprecated-declarations" ..'
2017-11-10 12:22:23 +01:00
include ( cmake/extra_flags.cmake )
2017-10-27 15:43:34 +02:00
zephyr_cc_option ( -fno-asynchronous-unwind-tables )
zephyr_cc_option ( -fno-pie )
zephyr_cc_option ( -fno-pic )
zephyr_cc_option ( -fno-strict-overflow )
2020-09-28 20:27:11 +02:00
if ( CONFIG_THREAD_LOCAL_STORAGE )
# Only support local exec TLS model at this point.
zephyr_cc_option ( -ftls-model=local-exec )
endif ( )
2017-10-27 15:43:34 +02:00
if ( CONFIG_OVERRIDE_FRAME_POINTER_DEFAULT )
if ( CONFIG_OMIT_FRAME_POINTER )
zephyr_cc_option ( -fomit-frame-pointer )
else ( )
zephyr_cc_option ( -fno-omit-frame-pointer )
endif ( )
endif ( )
2019-02-27 08:28:25 +01:00
separate_arguments ( COMPILER_OPT_AS_LIST UNIX_COMMAND ${ CONFIG_COMPILER_OPT } )
zephyr_compile_options ( ${ COMPILER_OPT_AS_LIST } )
2017-10-27 15:43:34 +02:00
# TODO: Include arch compiler options at this point.
2019-05-06 15:21:58 +02:00
if ( NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" )
# GCC assumed
zephyr_cc_option ( -fno-reorder-functions )
2017-12-12 18:59:37 +01:00
2018-02-11 21:36:21 +01:00
if ( NOT ${ ZEPHYR_TOOLCHAIN_VARIANT } STREQUAL "xcc" )
2017-10-27 15:43:34 +02:00
zephyr_cc_option ( -fno-defer-pop )
endif ( )
endif ( )
zephyr_cc_option_ifdef ( CONFIG_STACK_USAGE -fstack-usage )
2019-04-12 01:34:04 +02:00
# If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
# __FILE__ macro used in __ASSERT*, in the
# .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
# application code. This saves some memory, stops leaking user locations
# in binaries, makes failure logs more deterministic and most
# importantly makes builds more deterministic
2019-06-01 00:28:38 +02:00
2019-06-12 01:57:37 +02:00
# If several match then the last one wins. This matters for instances
# like tests/ and samples/: they're inside all of them! Then let's
# strip as little as possible.
2019-06-01 00:28:38 +02:00
zephyr_cc_option ( -fmacro-prefix-map= ${ CMAKE_SOURCE_DIR } =CMAKE_SOURCE_DIR )
zephyr_cc_option ( -fmacro-prefix-map= ${ ZEPHYR_BASE } =ZEPHYR_BASE )
2019-06-12 01:57:37 +02:00
if ( WEST_TOPDIR )
zephyr_cc_option ( -fmacro-prefix-map= ${ WEST_TOPDIR } =WEST_TOPDIR )
endif ( )
2019-04-12 01:34:04 +02:00
2017-10-27 15:43:34 +02:00
# TODO: Archiver arguments
# ar_option(D)
2018-11-29 10:08:08 +01:00
# Declare MPU userspace dependencies before the linker scripts to make
# sure the order of dependencies are met
2019-02-01 00:53:24 +01:00
if ( CONFIG_USERSPACE )
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
set ( APP_SMEM_ALIGNED_DEP app_smem_aligned_linker )
set ( APP_SMEM_UNALIGNED_DEP app_smem_unaligned_linker )
2018-11-29 10:08:08 +01:00
endif ( )
2018-11-29 10:14:27 +01:00
get_property ( TOPT GLOBAL PROPERTY TOPT )
2019-03-08 10:29:33 +01:00
set_ifndef ( TOPT -Wl,-T ) # clang doesn't pick -T for some reason and complains,
# while -Wl,-T works for both, gcc and clang
2018-11-29 10:14:27 +01:00
2017-10-27 15:43:34 +02:00
if ( CONFIG_HAVE_CUSTOM_LINKER_SCRIPT )
set ( LINKER_SCRIPT ${ APPLICATION_SOURCE_DIR } / ${ CONFIG_CUSTOM_LINKER_SCRIPT } )
2018-04-12 14:48:05 +02:00
if ( NOT EXISTS ${ LINKER_SCRIPT } )
2017-10-27 15:43:34 +02:00
set ( LINKER_SCRIPT ${ CONFIG_CUSTOM_LINKER_SCRIPT } )
2018-04-12 14:48:05 +02:00
assert_exists ( CONFIG_CUSTOM_LINKER_SCRIPT )
2017-10-27 15:43:34 +02:00
endif ( )
else ( )
# Try a board specific linker file
set ( LINKER_SCRIPT ${ BOARD_DIR } /linker.ld )
if ( NOT EXISTS ${ LINKER_SCRIPT } )
# If not available, try an SoC specific linker file
2018-09-04 21:34:06 +02:00
set ( LINKER_SCRIPT ${ SOC_DIR } / ${ ARCH } / ${ SOC_PATH } /linker.ld )
2017-10-27 15:43:34 +02:00
endif ( )
endif ( )
if ( NOT EXISTS ${ LINKER_SCRIPT } )
message ( FATAL_ERROR "Could not find linker script: '${LINKER_SCRIPT}'. Corrupted configuration?" )
endif ( )
configure_file ( version.h.in ${ PROJECT_BINARY_DIR } /include/generated/version.h )
2018-10-09 16:03:29 +02:00
# Error-out when the deprecated naming convention is found (until
# after 1.14.0 has been released)
foreach ( path
2019-02-08 15:39:37 +01:00
$ { B O A R D _ D I R } / d t s . f i x u p
$ { P R O J E C T _ S O U R C E _ D I R } / s o c / $ { A R C H } / $ { S O C _ P A T H } / d t s . f i x u p
2018-10-09 16:03:29 +02:00
$ { A P P L I C A T I O N _ S O U R C E _ D I R } / d t s . f i x u p
2019-02-08 15:39:37 +01:00
)
2018-10-09 16:03:29 +02:00
if ( EXISTS ${ path } )
2019-02-08 15:39:37 +01:00
message ( FATAL_ERROR
" A d e p r e c a t e d f i l e n a m e h a s b e e n d e t e c t e d . P o r t i n g i s r e q u i r e d . "
" T h e f i l e ' $ { p a t h } ' e x i s t s , b u t i t s h o u l d b e n a m e d d t s _ f i x u p . h i n s t e a d . "
" S e e h t t p s : / / g i t h u b . c o m / z e p h y r p r o j e c t - r t o s / z e p h y r / p u l l / 1 0 3 5 2 f o r m o r e d e t a i l s "
)
2018-10-09 16:03:29 +02:00
endif ( )
endforeach ( )
set_ifndef ( DTS_BOARD_FIXUP_FILE ${ BOARD_DIR } /dts_fixup.h )
set_ifndef ( DTS_SOC_FIXUP_FILE ${ SOC_DIR } / ${ ARCH } / ${ SOC_PATH } /dts_fixup.h )
set ( DTS_APP_FIXUP_FILE ${ APPLICATION_SOURCE_DIR } /dts_fixup.h )
2020-01-16 13:29:53 +01:00
set_ifndef ( DTS_CAT_OF_FIXUP_FILES ${ ZEPHYR_BINARY_DIR } /include/generated/devicetree_fixups.h )
2018-10-09 16:03:29 +02:00
2019-01-28 13:40:50 +01:00
# Concatenate the fixups into a single header file for easy
# #include'ing
2020-01-16 13:29:53 +01:00
file ( WRITE ${ DTS_CAT_OF_FIXUP_FILES } "/* May only be included by devicetree.h */\n\n" )
2020-05-09 01:06:48 +02:00
set ( DISCOVERED_FIXUP_FILES )
2019-01-28 13:40:50 +01:00
foreach ( fixup_file
2019-02-08 15:39:37 +01:00
$ { D T S _ B O A R D _ F I X U P _ F I L E }
$ { D T S _ S O C _ F I X U P _ F I L E }
$ { D T S _ A P P _ F I X U P _ F I L E }
$ { s h i e l d _ d t s _ f i x u p s }
)
2019-01-28 13:40:50 +01:00
if ( EXISTS ${ fixup_file } )
2019-02-08 15:39:37 +01:00
file ( READ ${ fixup_file } contents )
file ( APPEND ${ DTS_CAT_OF_FIXUP_FILES } "${contents}" )
2020-05-09 01:06:48 +02:00
string ( APPEND DISCOVERED_FIXUP_FILES "- ${fixup_file}\n" )
2018-10-09 16:03:29 +02:00
endif ( )
endforeach ( )
2020-05-09 01:06:48 +02:00
if ( DISCOVERED_FIXUP_FILES )
message ( WARNING "One or more dts_fixup.h files detected:\n${DISCOVERED_FIXUP_FILES}Use of these files is deprecated; use the devicetree.h API instead." )
endif ( )
2018-01-09 10:52:57 +01:00
# Unfortunately, the order in which CMakeLists.txt code is processed
# matters so we need to be careful about how we order the processing
# of subdirectories. One example is "Compiler flags added late in the
# build are not exported to external build systems #5605"; when we
# integrate with an external build system we read out all compiler
# flags when the external project is created. So an external project
# defined in subsys or ext will not get global flags added by drivers/
# or tests/ as the subdirectories are ordered now.
#
# Another example of when the order matters is the reading and writing
# of global properties such as ZEPHYR_LIBS or
# GENERATED_KERNEL_OBJECT_FILES.
#
# Arch is placed early because it defines important compiler flags
# that must be exported to external build systems defined in
# e.g. subsys/.
add_subdirectory ( arch )
2017-10-27 15:43:34 +02:00
add_subdirectory ( lib )
# We use include instead of add_subdirectory to avoid creating a new directory scope.
# This is because source file properties are directory scoped, including the GENERATED
# property which is set implicitly for custom command outputs
include ( misc/generated/CMakeLists.txt )
2018-09-03 22:20:14 +02:00
2018-09-13 16:25:53 +02:00
if ( EXISTS ${ SOC_DIR } / ${ ARCH } /CMakeLists.txt )
2018-09-04 21:34:06 +02:00
add_subdirectory ( ${ SOC_DIR } / ${ ARCH } soc/ ${ ARCH } )
2018-09-03 22:20:14 +02:00
else ( )
2018-09-04 21:34:06 +02:00
add_subdirectory ( ${ SOC_DIR } / ${ ARCH } / ${ SOC_PATH } soc/ ${ ARCH } / ${ SOC_PATH } )
2018-09-03 22:20:14 +02:00
endif ( )
2017-10-27 15:43:34 +02:00
add_subdirectory ( boards )
add_subdirectory ( subsys )
add_subdirectory ( drivers )
2019-03-19 10:38:18 +01:00
# Include zephyr modules generated CMake file.
2020-08-24 11:01:04 +02:00
foreach ( module_name ${ ZEPHYR_MODULE_NAMES } )
# Note the second, binary_dir parameter requires the added
# subdirectory to have its own, local cmake target(s). If not then
# this binary_dir is created but stays empty. Object files land in
# the main binary dir instead.
# https://cmake.org/pipermail/cmake/2019-June/069547.html
2021-01-19 12:01:38 +01:00
zephyr_string ( SANITIZE TOUPPER MODULE_NAME_UPPER ${ module_name } )
2020-08-25 13:32:33 +02:00
if ( NOT ${ ZEPHYR_${MODULE_NAME_UPPER } _CMAKE_DIR} STREQUAL "" )
set ( ZEPHYR_CURRENT_MODULE_DIR ${ ZEPHYR_${MODULE_NAME_UPPER } _MODULE_DIR} )
set ( ZEPHYR_CURRENT_CMAKE_DIR ${ ZEPHYR_${MODULE_NAME_UPPER } _CMAKE_DIR} )
add_subdirectory ( ${ ZEPHYR_CURRENT_CMAKE_DIR } ${ CMAKE_BINARY_DIR } /modules/ ${ module_name } )
endif ( )
2020-08-24 11:01:04 +02:00
endforeach ( )
2020-08-25 13:32:33 +02:00
# Done processing modules, clear ZEPHYR_CURRENT_MODULE_DIR and ZEPHYR_CURRENT_CMAKE_DIR.
2020-08-24 11:01:04 +02:00
set ( ZEPHYR_CURRENT_MODULE_DIR )
2020-08-25 13:32:33 +02:00
set ( ZEPHYR_CURRENT_CMAKE_DIR )
2019-02-05 10:36:22 +01:00
2020-05-29 22:24:51 +02:00
set ( syscall_list_h ${ CMAKE_CURRENT_BINARY_DIR } /include/generated/syscall_list.h )
set ( syscalls_json ${ CMAKE_CURRENT_BINARY_DIR } /misc/generated/syscalls.json )
set ( struct_tags_json ${ CMAKE_CURRENT_BINARY_DIR } /misc/generated/struct_tags.json )
2017-11-20 13:03:55 +01:00
2018-06-07 15:50:31 +02:00
# The syscalls subdirs txt file is constructed by python containing a list of folders to use for
# dependency handling, including empty folders.
# Windows: The list is used to specify DIRECTORY list with CMAKE_CONFIGURE_DEPENDS attribute.
# Other OS: The list will update whenever a file is added/removed/modified and ensure a re-build.
set ( syscalls_subdirs_txt ${ CMAKE_CURRENT_BINARY_DIR } /misc/generated/syscalls_subdirs.txt )
# As syscalls_subdirs_txt is updated whenever a file is modified, this file can not be used for
# monitoring of added / removed folders. A trigger file is thus used for correct dependency
# handling. The trigger file will update when a folder is added / removed.
set ( syscalls_subdirs_trigger ${ CMAKE_CURRENT_BINARY_DIR } /misc/generated/syscalls_subdirs.trigger )
2018-06-14 22:27:17 +02:00
if ( NOT ( ${ CMAKE_HOST_SYSTEM_NAME } STREQUAL Windows ) )
set ( syscalls_links --create-links ${ CMAKE_CURRENT_BINARY_DIR } /misc/generated/syscalls_links )
endif ( )
2018-06-07 15:50:31 +02:00
# When running CMake it must be ensured that all dependencies are correctly acquired.
execute_process (
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
2018-06-14 20:21:18 +02:00
$ { Z E P H Y R _ B A S E } / s c r i p t s / s u b f o l d e r _ l i s t . p y
2018-06-14 22:27:17 +02:00
- - d i r e c t o r y $ { Z E P H Y R _ B A S E } / i n c l u d e # Walk this directory
- - o u t - f i l e $ { s y s c a l l s _ s u b d i r s _ t x t } # Write file with discovered folder
- - t r i g g e r $ { s y s c a l l s _ s u b d i r s _ t r i g g e r } # Trigger file that is used for json generation
$ { s y s c a l l s _ l i n k s } # If defined, create symlinks for dependencies
)
2019-07-18 10:38:25 +02:00
file ( STRINGS ${ syscalls_subdirs_txt } PARSE_SYSCALLS_PATHS_DEPENDS ENCODING UTF-8 )
2018-06-07 15:50:31 +02:00
if ( ${ CMAKE_HOST_SYSTEM_NAME } STREQUAL Windows )
# On windows only adding/removing files or folders will be reflected in depends.
# Hence adding a file requires CMake to re-run to add this file to the file list.
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ PARSE_SYSCALLS_PATHS_DEPENDS } )
# Also On Windows each header file must be monitored as file modifications are not reflected
# on directory level.
2018-06-14 20:21:18 +02:00
file ( GLOB_RECURSE PARSE_SYSCALLS_HEADER_DEPENDS ${ ZEPHYR_BASE } /include/*.h )
2018-06-07 15:50:31 +02:00
else ( )
# The syscall parsing depends on the folders in order to detect add/removed/modified files.
# When a folder is removed, CMake will try to find a target that creates that dependency.
# This command sets up the target for CMake to find.
2018-06-14 22:27:17 +02:00
# Without this code, CMake will fail with the following error:
2018-06-07 15:50:31 +02:00
# <folder> needed by '<target>', missing and no known rule to make it
# when a folder is removed.
add_custom_command ( OUTPUT ${ PARSE_SYSCALLS_PATHS_DEPENDS }
C O M M A N D $ { C M A K E _ C O M M A N D } - E e c h o " "
C O M M E N T " P r e p a r i n g s y s c a l l d e p e n d e n c y h a n d l i n g "
2018-06-14 22:27:17 +02:00
)
2018-06-07 15:50:31 +02:00
add_custom_command (
O U T P U T
2018-06-14 22:27:17 +02:00
$ { s y s c a l l s _ s u b d i r s _ t r i g g e r }
2018-06-07 15:50:31 +02:00
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
2018-06-14 20:21:18 +02:00
$ { Z E P H Y R _ B A S E } / s c r i p t s / s u b f o l d e r _ l i s t . p y
- - d i r e c t o r y $ { Z E P H Y R _ B A S E } / i n c l u d e # Walk this directory
2018-06-14 22:27:17 +02:00
- - o u t - f i l e $ { s y s c a l l s _ s u b d i r s _ t x t } # Write file with discovered folder
- - t r i g g e r $ { s y s c a l l s _ s u b d i r s _ t r i g g e r } # Trigger file that is used for json generation
$ { s y s c a l l s _ l i n k s } # If defined, create symlinks for dependencies
2018-06-07 15:50:31 +02:00
D E P E N D S $ { P A R S E _ S Y S C A L L S _ P A T H S _ D E P E N D S }
2018-06-14 22:27:17 +02:00
)
2018-06-07 15:50:31 +02:00
2018-06-14 22:27:17 +02:00
# Ensure subdir file always exists when specifying CMake dependency.
if ( NOT EXISTS ${ syscalls_subdirs_txt } )
file ( WRITE ${ syscalls_subdirs_txt } "" )
2018-06-07 15:50:31 +02:00
endif ( )
# On other OS'es, modifying a file is reflected on the folder timestamp and hence detected
# when using depend on directory level.
# Thus CMake only needs to re-run when sub-directories are added / removed, which is indicated
# using a trigger file.
2018-06-14 22:27:17 +02:00
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ syscalls_subdirs_txt } )
2018-06-07 15:50:31 +02:00
endif ( )
2018-04-30 15:59:16 +02:00
# syscall declarations are searched for in the SYSCALL_INCLUDE_DIRS
2018-07-02 11:29:19 +02:00
if ( CONFIG_APPLICATION_DEFINED_SYSCALL )
2018-04-30 15:59:16 +02:00
list ( APPEND SYSCALL_INCLUDE_DIRS ${ APPLICATION_SOURCE_DIR } )
2018-07-02 11:29:19 +02:00
endif ( )
2019-11-22 08:11:29 +01:00
if ( CONFIG_ZTEST )
2018-04-30 15:59:16 +02:00
list ( APPEND SYSCALL_INCLUDE_DIRS ${ ZEPHYR_BASE } /subsys/testsuite/ztest/include )
2019-11-22 08:11:29 +01:00
endif ( )
2018-04-30 15:59:16 +02:00
foreach ( d ${ SYSCALL_INCLUDE_DIRS } )
list ( APPEND parse_syscalls_include_args
- - i n c l u d e $ { d }
)
endforeach ( )
2017-11-20 13:03:55 +01:00
add_custom_command (
O U T P U T
$ { s y s c a l l s _ j s o n }
2020-05-29 22:24:51 +02:00
$ { s t r u c t _ t a g s _ j s o n }
2017-11-20 13:03:55 +01:00
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
2018-06-14 20:21:18 +02:00
$ { Z E P H Y R _ B A S E } / s c r i p t s / p a r s e _ s y s c a l l s . p y
2018-07-02 11:29:19 +02:00
- - i n c l u d e $ { Z E P H Y R _ B A S E } / i n c l u d e # Read files from this dir
2020-05-29 22:33:12 +02:00
- - i n c l u d e $ { Z E P H Y R _ B A S E } / d r i v e r s # For net sockets
- - i n c l u d e $ { Z E P H Y R _ B A S E } / s u b s y s / n e t # More net sockets
2018-04-30 15:59:16 +02:00
$ { p a r s e _ s y s c a l l s _ i n c l u d e _ a r g s } # Read files from these dirs also
2020-02-29 23:51:42 +01:00
- - j s o n - f i l e $ { s y s c a l l s _ j s o n } # Write this file
2020-05-29 22:24:51 +02:00
- - t a g - s t r u c t - f i l e $ { s t r u c t _ t a g s _ j s o n } # Write subsystem list to this file
2018-06-14 22:27:17 +02:00
D E P E N D S $ { s y s c a l l s _ s u b d i r s _ t r i g g e r } $ { P A R S E _ S Y S C A L L S _ H E A D E R _ D E P E N D S }
2017-11-20 13:03:55 +01:00
)
2020-08-04 18:26:43 +02:00
add_custom_target ( ${ SYSCALL_LIST_H_TARGET } DEPENDS ${ syscall_list_h } )
2020-03-16 20:48:00 +01:00
add_custom_target ( ${ PARSE_SYSCALLS_TARGET }
2020-08-04 18:26:43 +02:00
D E P E N D S
$ { s y s c a l l s _ j s o n }
2020-08-04 18:31:48 +02:00
$ { s t r u c t _ t a g s _ j s o n }
2020-08-04 18:26:43 +02:00
)
2019-11-05 18:39:05 +01:00
# 64-bit systems do not require special handling of 64-bit system call
# parameters or return values, indicate this to the system call boilerplate
# generation script.
if ( CONFIG_64BIT )
set ( SYSCALL_LONG_REGISTERS_ARG --long-registers )
endif ( )
2020-03-06 06:14:02 +01:00
if ( CONFIG_TIMEOUT_64BIT )
set ( SYSCALL_SPLIT_TIMEOUT_ARG --split-type k_timeout_t )
endif ( )
2017-11-20 13:03:55 +01:00
add_custom_command ( OUTPUT include/generated/syscall_dispatch.c ${ syscall_list_h }
# Also, some files are written to include/generated/syscalls/
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
2018-06-14 20:21:18 +02:00
$ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ s y s c a l l s . p y
2017-11-20 13:03:55 +01:00
- - j s o n - f i l e $ { s y s c a l l s _ j s o n } # Read this file
- - b a s e - o u t p u t i n c l u d e / g e n e r a t e d / s y s c a l l s # Write to this dir
- - s y s c a l l - d i s p a t c h i n c l u d e / g e n e r a t e d / s y s c a l l _ d i s p a t c h . c # Write this file
2018-07-24 03:10:15 +02:00
- - s y s c a l l - l i s t $ { s y s c a l l _ l i s t _ h }
2019-11-05 18:39:05 +01:00
$ { S Y S C A L L _ L O N G _ R E G I S T E R S _ A R G }
2020-03-06 06:14:02 +01:00
$ { S Y S C A L L _ S P L I T _ T I M E O U T _ A R G }
2017-11-20 13:03:55 +01:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
2020-03-16 20:48:00 +01:00
D E P E N D S $ { P A R S E _ S Y S C A L L S _ T A R G E T }
2017-11-20 13:03:55 +01:00
)
2020-02-29 23:51:42 +01:00
# This is passed into all calls to the gen_kobject_list.py script.
2020-05-29 22:24:51 +02:00
set ( gen_kobject_list_include_args --include ${ struct_tags_json } )
2020-02-29 23:51:42 +01:00
2018-04-04 22:50:32 +02:00
set ( DRV_VALIDATION ${ PROJECT_BINARY_DIR } /include/generated/driver-validation.h )
add_custom_command (
O U T P U T $ { D R V _ V A L I D A T I O N }
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
$ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ k o b j e c t _ l i s t . p y
- - v a l i d a t i o n - o u t p u t $ { D R V _ V A L I D A T I O N }
2020-02-29 23:51:42 +01:00
$ { g e n _ k o b j e c t _ l i s t _ i n c l u d e _ a r g s }
2018-04-04 22:50:32 +02:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - v e r b o s e >
2020-02-29 23:51:42 +01:00
D E P E N D S
$ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ k o b j e c t _ l i s t . p y
2020-03-16 20:48:00 +01:00
$ { P A R S E _ S Y S C A L L S _ T A R G E T }
2018-04-04 22:50:32 +02:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
2019-01-14 16:39:33 +01:00
add_custom_target ( ${ DRIVER_VALIDATION_H_TARGET } DEPENDS ${ DRV_VALIDATION } )
2018-04-04 22:50:32 +02:00
2020-02-12 15:42:09 +01:00
include ( ${ ZEPHYR_BASE } /cmake/kobj.cmake )
2018-04-05 22:59:33 +02:00
gen_kobj ( KOBJ_INCLUDE_PATH )
2018-04-04 22:50:32 +02:00
2020-01-23 15:39:17 +01:00
# Add a pseudo-target that is up-to-date when all generated headers
# are up-to-date.
add_custom_target ( zephyr_generated_headers )
add_dependencies ( zephyr_generated_headers
o f f s e t s _ h
)
2017-10-27 15:43:34 +02:00
# Generate offsets.c.obj from offsets.c
# Generate offsets.h from offsets.c.obj
2019-01-14 16:39:33 +01:00
set ( OFFSETS_LIB offsets )
2018-11-15 10:37:46 +01:00
set ( OFFSETS_C_PATH ${ ARCH_DIR } / ${ ARCH } /core/offsets/offsets.c )
2017-10-27 15:43:34 +02:00
set ( OFFSETS_H_PATH ${ PROJECT_BINARY_DIR } /include/generated/offsets.h )
2019-02-04 12:10:57 +01:00
add_library ( ${ OFFSETS_LIB } OBJECT ${ OFFSETS_C_PATH } )
2019-10-24 17:08:21 +02:00
target_include_directories ( ${ OFFSETS_LIB } PRIVATE
k e r n e l / i n c l u d e
$ { A R C H _ D I R } / $ { A R C H } / i n c l u d e
)
2019-01-14 16:39:33 +01:00
target_link_libraries ( ${ OFFSETS_LIB } zephyr_interface )
2020-08-04 18:31:48 +02:00
add_dependencies ( zephyr_interface
2019-01-14 16:39:33 +01:00
$ { S Y S C A L L _ L I S T _ H _ T A R G E T }
$ { D R I V E R _ V A L I D A T I O N _ H _ T A R G E T }
$ { K O B J _ T Y P E S _ H _ T A R G E T }
2017-11-20 13:03:55 +01:00
)
2017-10-27 15:43:34 +02:00
add_custom_command (
O U T P U T $ { O F F S E T S _ H _ P A T H }
2018-01-11 15:46:44 +01:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ o f f s e t _ h e a d e r . p y
2019-02-04 12:10:57 +01:00
- i $ < T A R G E T _ O B J E C T S : $ { O F F S E T S _ L I B } >
2017-10-27 15:43:34 +02:00
- o $ { O F F S E T S _ H _ P A T H }
2019-08-15 14:45:59 +02:00
D E P E N D S
$ { O F F S E T S _ L I B }
$ < T A R G E T _ O B J E C T S : $ { O F F S E T S _ L I B } >
2017-10-27 15:43:34 +02:00
)
2019-01-14 16:39:33 +01:00
add_custom_target ( ${ OFFSETS_H_TARGET } DEPENDS ${ OFFSETS_H_PATH } )
2017-10-27 15:43:34 +02:00
zephyr_include_directories ( ${ TOOLCHAIN_INCLUDES } )
2017-12-01 15:25:06 +01:00
zephyr_get_include_directories_for_lang ( C ZEPHYR_INCLUDES )
2017-10-27 15:43:34 +02:00
add_subdirectory ( kernel )
# Read list content
get_property ( ZEPHYR_LIBS_PROPERTY GLOBAL PROPERTY ZEPHYR_LIBS )
foreach ( zephyr_lib ${ ZEPHYR_LIBS_PROPERTY } )
# TODO: Could this become an INTERFACE property of zephyr_interface?
2020-01-23 15:39:17 +01:00
add_dependencies ( ${ zephyr_lib } zephyr_generated_headers )
2017-10-27 15:43:34 +02:00
endforeach ( )
get_property ( OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT )
2018-11-13 11:04:02 +01:00
if ( CONFIG_CODE_DATA_RELOCATION )
set ( CODE_RELOCATION_DEP code_relocation_source_lib )
endif ( ) # CONFIG_CODE_DATA_RELOCATION
2017-12-31 10:39:23 +01:00
2019-04-29 17:16:54 +02:00
configure_linker_script (
2019-04-29 20:27:23 +02:00
l i n k e r . c m d
2019-04-29 20:35:12 +02:00
" "
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
$ { A P P _ S M E M _ A L I G N E D _ D E P }
2019-02-08 15:49:57 +01:00
$ { C O D E _ R E L O C A T I O N _ D E P }
2020-01-23 15:39:17 +01:00
z e p h y r _ g e n e r a t e d _ h e a d e r s
2019-02-08 15:39:37 +01:00
)
2018-02-01 08:12:32 +01:00
2017-10-27 15:43:34 +02:00
add_custom_target (
2019-01-14 16:39:33 +01:00
$ { L I N K E R _ S C R I P T _ T A R G E T }
2017-10-27 15:43:34 +02:00
D E P E N D S
l i n k e r . c m d
2017-12-14 13:03:23 +01:00
)
2019-01-14 16:39:33 +01:00
# Give the '${LINKER_SCRIPT_TARGET}' target all of the include directories so
2017-12-14 13:03:23 +01:00
# that cmake can successfully find the linker_script's header
# dependencies.
zephyr_get_include_directories_for_lang ( C
Z E P H Y R _ I N C L U D E _ D I R S
S T R I P _ P R E F I X # Don't use a -I prefix
)
set_property ( TARGET
2019-01-14 16:39:33 +01:00
$ { L I N K E R _ S C R I P T _ T A R G E T }
2017-12-14 13:03:23 +01:00
P R O P E R T Y I N C L U D E _ D I R E C T O R I E S
$ { Z E P H Y R _ I N C L U D E _ D I R S }
)
2017-10-27 15:43:34 +02:00
if ( CONFIG_GEN_ISR_TABLES )
2017-12-12 18:59:37 +01:00
if ( CONFIG_GEN_SW_ISR_TABLE )
list ( APPEND GEN_ISR_TABLE_EXTRA_ARG --sw-isr-table )
endif ( )
if ( CONFIG_GEN_IRQ_VECTOR_TABLE )
list ( APPEND GEN_ISR_TABLE_EXTRA_ARG --vector-table )
endif ( )
2019-01-14 16:31:02 +01:00
# isr_tables.c is generated from ${ZEPHYR_PREBUILT_EXECUTABLE} by
2017-10-27 15:43:34 +02:00
# gen_isr_tables.py
add_custom_command (
O U T P U T i s r _ t a b l e s . c
2020-08-18 14:46:06 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n t a r g e t > $ { O U T P U T _ F O R M A T }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t t a r g e t > b i n a r y
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ o n l y > . i n t L i s t
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n f i l e > $ < T A R G E T _ F I L E : $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E } >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t f i l e > i s r L i s t . b i n
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ f i n a l >
2017-10-27 15:43:34 +02:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
2018-01-11 15:46:44 +01:00
$ { Z E P H Y R _ B A S E } / a r c h / c o m m o n / g e n _ i s r _ t a b l e s . p y
2017-10-27 15:43:34 +02:00
- - o u t p u t - s o u r c e i s r _ t a b l e s . c
2019-01-14 16:31:02 +01:00
- - k e r n e l $ < T A R G E T _ F I L E : $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E } >
2017-10-27 15:43:34 +02:00
- - i n t l i s t i s r L i s t . b i n
2018-10-09 11:59:16 +02:00
$ < $ < B O O L : $ { C O N F I G _ B I G _ E N D I A N } > : - - b i g - e n d i a n >
2018-01-04 14:08:39 +01:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - d e b u g >
2017-12-12 18:59:37 +01:00
$ { G E N _ I S R _ T A B L E _ E X T R A _ A R G }
2019-01-14 16:31:02 +01:00
D E P E N D S $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E }
2020-08-18 14:46:06 +02:00
C O M M A N D _ E X P A N D _ L I S T S
2017-10-27 15:43:34 +02:00
)
set_property ( GLOBAL APPEND PROPERTY GENERATED_KERNEL_SOURCE_FILES isr_tables.c )
endif ( )
2018-11-13 11:04:02 +01:00
if ( CONFIG_CODE_DATA_RELOCATION )
2019-05-03 10:33:03 +02:00
# @Intent: Linker script to relocate .text, data and .bss sections
toolchain_ld_relocation ( )
2018-11-13 11:04:02 +01:00
endif ( )
2018-11-21 10:01:56 +01:00
if ( CONFIG_USERSPACE )
2020-11-20 18:39:30 +01:00
zephyr_get_compile_options_for_lang_as_string ( C compiler_flags_priv )
2020-08-21 19:13:53 +02:00
string ( REPLACE "$<TARGET_PROPERTY:compiler,coverage>" ""
N O _ C O V E R A G E _ F L A G S " $ { c o m p i l e r _ f l a g s _ p r i v } "
)
2018-11-21 10:01:56 +01:00
get_property ( include_dir_in_interface TARGET zephyr_interface
P R O P E R T Y I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S )
get_property ( sys_include_dir_in_interface TARGET zephyr_interface
P R O P E R T Y I N T E R F A C E _ S Y S T E M _ I N C L U D E _ D I R E C T O R I E S )
get_property ( compile_definitions_interface TARGET zephyr_interface
P R O P E R T Y I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S )
2018-01-11 15:46:44 +01:00
set ( GEN_KOBJ_LIST ${ ZEPHYR_BASE } /scripts/gen_kobject_list.py )
set ( PROCESS_GPERF ${ ZEPHYR_BASE } /scripts/process_gperf.py )
2017-10-27 15:43:34 +02:00
set ( OBJ_LIST kobject_hash.gperf )
set ( OUTPUT_SRC_PRE kobject_hash_preprocessed.c )
set ( OUTPUT_SRC kobject_hash.c )
set ( OUTPUT_OBJ kobject_hash.c.obj )
set ( OUTPUT_OBJ_RENAMED kobject_hash_renamed.o )
# Essentially what we are doing here is extracting some information
# out of the nearly finished elf file, generating the source code
# for a hash table based on that information, and then compiling and
# linking the hash table back into a now even more nearly finished
2019-04-17 00:39:45 +02:00
# elf file. More information in gen_kobject_list.py --help.
2017-10-27 15:43:34 +02:00
# Use the script GEN_KOBJ_LIST to scan the kernel binary's
2019-01-14 16:31:02 +01:00
# (${ZEPHYR_PREBUILT_EXECUTABLE}) DWARF information to produce a table of kernel
2017-10-27 15:43:34 +02:00
# objects (OBJ_LIST) which we will then pass to gperf
add_custom_command (
O U T P U T $ { O B J _ L I S T }
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
$ { G E N _ K O B J _ L I S T }
2019-01-14 16:31:02 +01:00
- - k e r n e l $ < T A R G E T _ F I L E : $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E } >
2018-04-04 22:50:32 +02:00
- - g p e r f - o u t p u t $ { O B J _ L I S T }
2020-02-29 23:51:42 +01:00
$ { g e n _ k o b j e c t _ l i s t _ i n c l u d e _ a r g s }
2017-10-27 15:43:34 +02:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - v e r b o s e >
2020-02-29 23:51:42 +01:00
D E P E N D S
$ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E }
2017-10-27 15:43:34 +02:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
add_custom_target ( obj_list DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } / ${ OBJ_LIST } )
# Use gperf to generate C code (OUTPUT_SRC_PRE) which implements a
# perfect hashtable based on OBJ_LIST
add_custom_command (
O U T P U T $ { O U T P U T _ S R C _ P R E }
C O M M A N D
$ { G P E R F }
- - o u t p u t - f i l e $ { O U T P U T _ S R C _ P R E }
$ { O B J _ L I S T }
2018-01-31 10:42:46 +01:00
D E P E N D S o b j _ l i s t $ { O B J _ L I S T }
2017-10-27 15:43:34 +02:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
add_custom_target ( output_src_pre DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } / ${ OUTPUT_SRC_PRE } )
# For our purposes the code/data generated by gperf is not optimal.
#
# The script PROCESS_GPERF creates a new c file OUTPUT_SRC based on
# OUTPUT_SRC_PRE to greatly reduce the amount of code/data generated
# since we know we are always working with pointer values
add_custom_command (
O U T P U T $ { O U T P U T _ S R C }
C O M M A N D
2018-06-21 14:34:42 +02:00
$ { P Y T H O N _ E X E C U T A B L E }
2017-10-27 15:43:34 +02:00
$ { P R O C E S S _ G P E R F }
- i $ { O U T P U T _ S R C _ P R E }
- o $ { O U T P U T _ S R C }
2020-03-11 15:13:07 +01:00
- p " s t r u c t z _ o b j e c t "
2017-10-27 15:43:34 +02:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - v e r b o s e >
2018-01-31 10:42:46 +01:00
D E P E N D S o u t p u t _ s r c _ p r e $ { O U T P U T _ S R C _ P R E }
2017-10-27 15:43:34 +02:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
)
add_custom_target ( output_src DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } / ${ OUTPUT_SRC } )
# We need precise control of where generated text/data ends up in the final
# kernel image. Disable function/data sections and use objcopy to move
# generated data into special section names
add_library ( output_lib STATIC
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { O U T P U T _ S R C }
)
2018-11-21 10:01:56 +01:00
set_source_files_properties ( ${ OUTPUT_SRC } PROPERTIES COMPILE_FLAGS
2019-03-15 01:04:11 +01:00
" $ { N O _ C O V E R A G E _ F L A G S } - f n o - f u n c t i o n - s e c t i o n s - f n o - d a t a - s e c t i o n s " )
2018-11-21 10:01:56 +01:00
set_source_files_properties ( ${ OUTPUT_SRC }
P R O P E R T I E S C O M P I L E _ D E F I N I T I O N S " $ { c o m p i l e _ d e f i n i t i o n s _ i n t e r f a c e } " )
2017-10-27 15:43:34 +02:00
# Turn off -ffunction-sections, etc.
# NB: Using a library instead of target_compile_options(output_lib
# [...]) because a library's options have precedence
add_library ( output_lib_interface INTERFACE )
2018-11-21 10:01:56 +01:00
2017-10-27 15:43:34 +02:00
target_link_libraries ( output_lib output_lib_interface )
2019-03-14 17:50:08 +01:00
foreach ( incl ${ include_dir_in_interface } )
2018-11-21 10:01:56 +01:00
target_include_directories ( output_lib_interface INTERFACE ${ incl } )
endforeach ( )
2019-03-14 17:50:08 +01:00
foreach ( incl ${ sys_include_dir_in_interface } )
target_include_directories ( output_lib_interface SYSTEM INTERFACE ${ incl } )
endforeach ( )
2018-11-21 10:01:56 +01:00
2017-10-27 15:43:34 +02:00
set ( OUTPUT_OBJ_PATH ${ CMAKE_CURRENT_BINARY_DIR } /CMakeFiles/output_lib.dir/ ${ OUTPUT_OBJ } )
add_custom_command (
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { O U T P U T _ O B J _ R E N A M E D }
2020-08-18 14:46:06 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e n a m e > . d a t a = . k o b j e c t _ d a t a . d a t a
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e n a m e > . t e x t = . k o b j e c t _ d a t a . t e x t
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e n a m e > . r o d a t a = . k o b j e c t _ d a t a . r o d a t a
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n f i l e > $ { O U T P U T _ O B J _ P A T H }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t f i l e > $ { O U T P U T _ O B J _ R E N A M E D }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ f i n a l >
2017-10-27 15:43:34 +02:00
D E P E N D S o u t p u t _ l i b
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
2020-08-18 14:46:06 +02:00
C O M M A N D _ E X P A N D _ L I S T S
2017-10-27 15:43:34 +02:00
)
add_custom_target ( output_obj_renamed DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } / ${ OUTPUT_OBJ_RENAMED } )
add_library ( output_obj_renamed_lib STATIC IMPORTED GLOBAL )
set_property (
T A R G E T o u t p u t _ o b j _ r e n a m e d _ l i b
P R O P E R T Y
I M P O R T E D _ L O C A T I O N $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { O U T P U T _ O B J _ R E N A M E D }
)
add_dependencies (
o u t p u t _ o b j _ r e n a m e d _ l i b
o u t p u t _ o b j _ r e n a m e d
)
set_property ( GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES output_obj_renamed_lib )
endif ( )
# Read global variables into local variables
get_property ( GKOF GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES )
get_property ( GKSF GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES )
2017-10-03 16:31:55 +02:00
2018-07-05 10:51:03 +02:00
get_property ( CSTD GLOBAL PROPERTY CSTD )
set_ifndef ( CSTD c99 )
2019-06-13 15:33:03 +02:00
# @Intent: Obtain compiler specific flag for specifying the c standard
2018-07-05 10:51:03 +02:00
zephyr_compile_options (
2020-08-18 14:47:53 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C > : $ < T A R G E T _ P R O P E R T Y : c o m p i l e r , c s t d > $ { C S T D } >
2018-07-05 10:51:03 +02:00
)
2019-05-03 11:02:56 +02:00
# @Intent: Configure linker scripts, i.e. generate linker scripts with variables substituted
toolchain_ld_configure_files ( )
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
2019-02-23 01:08:44 +01:00
if ( CONFIG_USERSPACE )
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
set ( APP_SMEM_ALIGNED_LD "${PROJECT_BINARY_DIR}/include/generated/app_smem_aligned.ld" )
set ( APP_SMEM_UNALIGNED_LD "${PROJECT_BINARY_DIR}/include/generated/app_smem_unaligned.ld" )
2018-12-20 11:17:42 +01:00
set ( OBJ_FILE_DIR "${PROJECT_BINARY_DIR}/../" )
2018-02-01 08:12:32 +01:00
2018-12-20 11:17:42 +01:00
add_custom_target (
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
$ { A P P _ S M E M _ A L I G N E D _ D E P }
D E P E N D S
$ { A P P _ S M E M _ A L I G N E D _ L D }
)
add_custom_target (
$ { A P P _ S M E M _ U N A L I G N E D _ D E P }
2019-02-08 15:49:57 +01:00
D E P E N D S
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
$ { A P P _ S M E M _ U N A L I G N E D _ L D }
2018-12-20 11:17:42 +01:00
)
userspace: compartmentalized app memory organization
Summary: revised attempt at addressing issue 6290. The
following provides an alternative to using
CONFIG_APPLICATION_MEMORY by compartmentalizing data into
Memory Domains. Dependent on MPU limitations, supports
compartmentalized Memory Domains for 1...N logical
applications. This is considered an initial attempt at
designing flexible compartmentalized Memory Domains for
multiple logical applications and, with the provided python
script and edited CMakeLists.txt, provides support for power
of 2 aligned MPU architectures.
Overview: The current patch uses qualifiers to group data into
subsections. The qualifier usage allows for dynamic subsection
creation and affords the developer a large amount of flexibility
in the grouping, naming, and size of the resulting partitions and
domains that are built on these subsections. By additional macro
calls, functions are created that help calculate the size,
address, and permissions for the subsections and enable the
developer to control application data in specified partitions and
memory domains.
Background: Initial attempts focused on creating a single
section in the linker script that then contained internally
grouped variables/data to allow MPU/MMU alignment and protection.
This did not provide additional functionality beyond
CONFIG_APPLICATION_MEMORY as we were unable to reliably group
data or determine their grouping via exported linker symbols.
Thus, the resulting decision was made to dynamically create
subsections using the current qualifier method. An attempt to
group the data by object file was tested, but found that this
broke applications such as ztest where two object files are
created: ztest and main. This also creates an issue of grouping
the two object files together in the same memory domain while
also allowing for compartmenting other data among threads.
Because it is not possible to know a) the name of the partition
and thus the symbol in the linker, b) the size of all the data
in the subsection, nor c) the overall number of partitions
created by the developer, it was not feasible to align the
subsections at compile time without using dynamically generated
linker script for MPU architectures requiring power of 2
alignment.
In order to provide support for MPU architectures that require a
power of 2 alignment, a python script is run at build prior to
when linker_priv_stacks.cmd is generated. This script scans the
built object files for all possible partitions and the names given
to them. It then generates a linker file (app_smem.ld) that is
included in the main linker.ld file. This app_smem.ld allows the
compiler and linker to then create each subsection and align to
the next power of 2.
Usage:
- Requires: app_memory/app_memdomain.h .
- _app_dmem(id) marks a variable to be placed into a data
section for memory partition id.
- _app_bmem(id) marks a variable to be placed into a bss
section for memory partition id.
- These are seen in the linker.map as "data_smem_id" and
"data_smem_idb".
- To create a k_mem_partition, call the macro
app_mem_partition(part0) where "part0" is the name then used to
refer to that partition. This macro only creates a function and
necessary data structures for the later "initialization".
- To create a memory domain for the partition, the macro
app_mem_domain(dom0) is called where "dom0" is the name then
used for the memory domain.
- To initialize the partition (effectively adding the partition
to a linked list), init_part_part0() is called. This is followed
by init_app_memory(), which walks all partitions in the linked
list and calculates the sizes for each partition.
- Once the partition is initialized, the domain can be
initialized with init_domain_dom0(part0) which initializes the
domain with partition part0.
- After the domain has been initialized, the current thread
can be added using add_thread_dom0(k_current_get()).
- The code used in ztests ans kernel/init has been added under
a conditional #ifdef to isolate the code from other tests.
The userspace test CMakeLists.txt file has commands to insert
the CONFIG_APP_SHARED_MEM definition into the required build
targets.
Example:
/* create partition at top of file outside functions */
app_mem_partition(part0);
/* create domain */
app_mem_domain(dom0);
_app_dmem(dom0) int var1;
_app_bmem(dom0) static volatile int var2;
int main()
{
init_part_part0();
init_app_memory();
init_domain_dom0(part0);
add_thread_dom0(k_current_get());
...
}
- If multiple partitions are being created, a variadic
preprocessor macro can be used as provided in
app_macro_support.h:
FOR_EACH(app_mem_partition, part0, part1, part2);
or, for multiple domains, similarly:
FOR_EACH(app_mem_domain, dom0, dom1);
Similarly, the init_part_* can also be used in the macro:
FOR_EACH(init_part, part0, part1, part2);
Testing:
- This has been successfully tested on qemu_x86 and the
ARM frdm_k64f board. It compiles and builds power of 2
aligned subsections for the linker script on the 96b_carbon
boards. These power of 2 alignments have been checked by
hand and are viewable in the zephyr.map file that is
produced during build. However, due to a shortage of
available MPU regions on the 96b_carbon board, we are unable
to test this.
- When run on the 96b_carbon board, the test suite will
enter execution, but each individaul test will fail due to
an MPU FAULT. This is expected as the required number of
MPU regions exceeds the number allowed due to the static
allocation. As the MPU driver does not detect this issue,
the fault occurs because the data being accessed has been
placed outside the active MPU region.
- This now compiles successfully for the ARC boards
em_starterkit_em7d and em_starterkit_em7d_v22. However,
as we lack ARC hardware to run this build on, we are unable
to test this build.
Current known issues:
1) While the script and edited CMakeLists.txt creates the
ability to align to the next power of 2, this does not
address the shortage of available MPU regions on certain
devices (e.g. 96b_carbon). In testing the APB and PPB
regions were commented out.
2) checkpatch.pl lists several issues regarding the
following:
a) Complex macros. The FOR_EACH macros as defined in
app_macro_support.h are listed as complex macros needing
parentheses. Adding parentheses breaks their
functionality, and we have otherwise been unable to
resolve the reported error.
b) __aligned() preferred. The _app_dmem_pad() and
_app_bmem_pad() macros give warnings that __aligned()
is preferred. Prior iterations had this implementation,
which resulted in errors due to "complex macros".
c) Trailing semicolon. The macro init_part(name) has
a trailing semicolon as the semicolon is needed for the
inlined macro call that is generated when this macro
expands.
Update: updated to alternative CONFIG_APPLCATION_MEMORY.
Added config option CONFIG_APP_SHARED_MEM to enable a new section
app_smem to contain the shared memory component. This commit
seperates the Kconfig definition from the definition used for the
conditional code. The change is in response to changes in the
way the build system treats definitions. The python script used
to generate a linker script for app_smem was also midified to
simplify the alignment directives. A default linker script
app_smem.ld was added to remove the conditional includes dependency
on CONFIG_APP_SHARED_MEM. By addining the default linker script
the prebuild stages link properly prior to the python script running
Signed-off-by: Joshua Domagalski <jedomag@tycho.nsa.gov>
Signed-off-by: Shawn Mosley <smmosle@tycho.nsa.gov>
2018-04-26 16:14:02 +02:00
2019-02-01 21:18:31 +01:00
if ( CONFIG_NEWLIB_LIBC )
2019-02-21 22:44:54 +01:00
set ( NEWLIB_PART -l libc.a z_libc_partition )
2019-02-01 21:18:31 +01:00
endif ( )
2019-11-15 14:07:51 +01:00
if ( CONFIG_NEWLIB_LIBC_NANO )
set ( NEWLIB_PART -l libc_nano.a z_libc_partition )
endif ( )
2019-02-27 23:41:45 +01:00
2018-12-20 11:17:42 +01:00
add_custom_command (
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
O U T P U T $ { A P P _ S M E M _ U N A L I G N E D _ L D }
2018-12-20 11:17:42 +01:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
$ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ a p p _ p a r t i t i o n s . p y
- d $ { O B J _ F I L E _ D I R }
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
- o $ { A P P _ S M E M _ U N A L I G N E D _ L D }
2019-11-05 10:24:08 +01:00
$ { N E W L I B _ P A R T }
2019-11-04 14:30:24 +01:00
$ < T A R G E T _ P R O P E R T Y : z e p h y r _ p r o p e r t y _ t a r g e t , C O M P I L E _ O P T I O N S >
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - v e r b o s e >
D E P E N D S
k e r n e l
$ { Z E P H Y R _ L I B S _ P R O P E R T Y }
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R } /
2019-11-04 14:30:24 +01:00
C O M M A N D _ E X P A N D _ L I S T S
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
C O M M E N T " G e n e r a t i n g a p p _ s m e m _ u n a l i g n e d l i n k e r s e c t i o n "
)
2019-04-29 17:16:54 +02:00
configure_linker_script (
2019-04-29 20:27:23 +02:00
l i n k e r _ a p p _ s m e m _ u n a l i g n e d . c m d
2019-04-29 20:35:12 +02:00
" - D L I N K E R _ A P P _ S M E M _ U N A L I G N E D "
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
$ { C O D E _ R E L O C A T I O N _ D E P }
$ { A P P _ S M E M _ U N A L I G N E D _ D E P }
$ { A P P _ S M E M _ U N A L I G N E D _ L D }
2020-01-23 15:39:17 +01:00
z e p h y r _ g e n e r a t e d _ h e a d e r s
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
)
add_custom_target (
l i n k e r _ a p p _ s m e m _ u n a l i g n e d _ s c r i p t
D E P E N D S
l i n k e r _ a p p _ s m e m _ u n a l i g n e d . c m d
)
set_property ( TARGET
l i n k e r _ a p p _ s m e m _ u n a l i g n e d _ s c r i p t
P R O P E R T Y I N C L U D E _ D I R E C T O R I E S
$ { Z E P H Y R _ I N C L U D E _ D I R S }
)
set ( APP_SMEM_UNALIGNED_LIB app_smem_unaligned_output_obj_renamed_lib )
add_executable ( app_smem_unaligned_prebuilt misc/empty_file.c )
2019-05-07 16:32:36 +02:00
toolchain_ld_link_elf (
T A R G E T _ E L F a p p _ s m e m _ u n a l i g n e d _ p r e b u i l t
2019-06-14 01:15:44 +02:00
O U T P U T _ M A P $ { P R O J E C T _ B I N A R Y _ D I R } / a p p _ s m e m _ u n a l i g n e d _ p r e b u i l t . m a p
2019-05-07 16:32:36 +02:00
L I B R A R I E S _ P R E _ S C R I P T " "
L I N K E R _ S C R I P T $ { P R O J E C T _ B I N A R Y _ D I R } / l i n k e r _ a p p _ s m e m _ u n a l i g n e d . c m d
L I B R A R I E S _ P O S T _ S C R I P T " "
D E P E N D E N C I E S $ { C O D E _ R E L O C A T I O N _ D E P }
)
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
set_property ( TARGET app_smem_unaligned_prebuilt PROPERTY LINK_DEPENDS ${ PROJECT_BINARY_DIR } /linker_app_smem_unaligned.cmd )
2019-04-29 14:49:33 +02:00
add_dependencies ( app_smem_unaligned_prebuilt linker_app_smem_unaligned_script ${ OFFSETS_LIB } )
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
add_custom_command (
O U T P U T $ { A P P _ S M E M _ A L I G N E D _ L D }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
$ { Z E P H Y R _ B A S E } / s c r i p t s / g e n _ a p p _ p a r t i t i o n s . p y
- e $ < T A R G E T _ F I L E : a p p _ s m e m _ u n a l i g n e d _ p r e b u i l t >
- o $ { A P P _ S M E M _ A L I G N E D _ L D }
2019-11-05 10:24:08 +01:00
$ { N E W L I B _ P A R T }
2019-11-04 14:30:24 +01:00
$ < T A R G E T _ P R O P E R T Y : z e p h y r _ p r o p e r t y _ t a r g e t , C O M P I L E _ O P T I O N S >
2018-12-20 11:17:42 +01:00
$ < $ < B O O L : $ { C M A K E _ V E R B O S E _ M A K E F I L E } > : - - v e r b o s e >
2019-02-08 15:49:57 +01:00
D E P E N D S
k e r n e l
$ { Z E P H Y R _ L I B S _ P R O P E R T Y }
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
a p p _ s m e m _ u n a l i g n e d _ p r e b u i l t
2018-12-20 11:17:42 +01:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R } /
2019-11-04 14:30:24 +01:00
C O M M A N D _ E X P A N D _ L I S T S
linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes #14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-10 22:20:21 +01:00
C O M M E N T " G e n e r a t i n g a p p _ s m e m _ a l i g n e d l i n k e r s e c t i o n "
2018-12-20 11:17:42 +01:00
)
endif ( )
2017-10-27 15:43:34 +02:00
# FIXME: Is there any way to get rid of empty_file.c?
2019-01-14 16:31:02 +01:00
add_executable ( ${ ZEPHYR_PREBUILT_EXECUTABLE } misc/empty_file.c )
2019-05-07 16:32:36 +02:00
toolchain_ld_link_elf (
T A R G E T _ E L F $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E }
2019-06-14 01:15:44 +02:00
O U T P U T _ M A P $ { P R O J E C T _ B I N A R Y _ D I R } / $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E } . m a p
2019-05-07 16:32:36 +02:00
L I B R A R I E S _ P R E _ S C R I P T " "
L I N K E R _ S C R I P T $ { P R O J E C T _ B I N A R Y _ D I R } / l i n k e r . c m d
D E P E N D E N C I E S $ { C O D E _ R E L O C A T I O N _ D E P }
)
2019-01-14 16:31:02 +01:00
set_property ( TARGET ${ ZEPHYR_PREBUILT_EXECUTABLE } PROPERTY LINK_DEPENDS ${ PROJECT_BINARY_DIR } /linker.cmd )
2020-03-11 18:56:19 +01:00
add_dependencies ( ${ ZEPHYR_PREBUILT_EXECUTABLE } ${ LINKER_SCRIPT_TARGET } ${ OFFSETS_LIB } )
2017-10-27 15:43:34 +02:00
2017-10-03 16:31:55 +02:00
2019-04-17 08:30:52 +02:00
set ( generated_kernel_files ${ GKSF } ${ GKOF } )
if ( NOT generated_kernel_files )
# Use the prebuilt elf as the final elf since we don't have a
# generation stage.
set ( logical_target_for_zephyr_elf ${ ZEPHYR_PREBUILT_EXECUTABLE } )
else ( )
2017-10-27 15:43:34 +02:00
# The second linker pass uses the same source linker script of the
2017-12-31 10:39:23 +01:00
# first pass (LINKER_SCRIPT), but this time with a different output
# file and preprocessed with the define LINKER_PASS2.
2019-04-29 17:16:54 +02:00
configure_linker_script (
2019-04-29 20:27:23 +02:00
l i n k e r _ p a s s _ f i n a l . c m d
2019-04-29 20:35:12 +02:00
" - D L I N K E R _ P A S S 2 "
2019-02-08 15:49:57 +01:00
$ { C O D E _ R E L O C A T I O N _ D E P }
$ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E }
2020-01-23 15:39:17 +01:00
z e p h y r _ g e n e r a t e d _ h e a d e r s
2019-02-08 15:39:37 +01:00
)
2018-02-01 08:12:32 +01:00
2019-01-14 16:39:33 +01:00
set ( LINKER_PASS_FINAL_SCRIPT_TARGET linker_pass_final_script_target )
2017-10-27 15:43:34 +02:00
add_custom_target (
2019-01-14 16:39:33 +01:00
$ { L I N K E R _ P A S S _ F I N A L _ S C R I P T _ T A R G E T }
2017-10-27 15:43:34 +02:00
D E P E N D S
2018-01-25 18:07:03 +01:00
l i n k e r _ p a s s _ f i n a l . c m d
2017-10-27 15:43:34 +02:00
)
2017-12-14 13:03:23 +01:00
set_property ( TARGET
2019-01-14 16:39:33 +01:00
$ { L I N K E R _ P A S S _ F I N A L _ S C R I P T _ T A R G E T }
2017-12-14 13:03:23 +01:00
P R O P E R T Y I N C L U D E _ D I R E C T O R I E S
$ { Z E P H Y R _ I N C L U D E _ D I R S }
)
2017-10-27 15:43:34 +02:00
2019-05-07 15:20:20 +02:00
add_executable ( ${ ZEPHYR_FINAL_EXECUTABLE } misc/empty_file.c ${ GKSF } )
2019-05-07 16:32:36 +02:00
toolchain_ld_link_elf (
T A R G E T _ E L F $ { Z E P H Y R _ F I N A L _ E X E C U T A B L E }
2019-06-14 01:15:44 +02:00
O U T P U T _ M A P $ { P R O J E C T _ B I N A R Y _ D I R } / $ { Z E P H Y R _ F I N A L _ E X E C U T A B L E } . m a p
2019-05-07 16:32:36 +02:00
L I B R A R I E S _ P R E _ S C R I P T $ { G K O F }
L I N K E R _ S C R I P T $ { P R O J E C T _ B I N A R Y _ D I R } / l i n k e r _ p a s s _ f i n a l . c m d
L I B R A R I E S _ P O S T _ S C R I P T " "
D E P E N D E N C I E S $ { C O D E _ R E L O C A T I O N _ D E P }
)
2019-05-07 15:20:20 +02:00
set_property ( TARGET ${ ZEPHYR_FINAL_EXECUTABLE } PROPERTY LINK_DEPENDS ${ PROJECT_BINARY_DIR } /linker_pass_final.cmd )
2020-03-11 18:56:19 +01:00
add_dependencies ( ${ ZEPHYR_FINAL_EXECUTABLE } ${ LINKER_PASS_FINAL_SCRIPT_TARGET } )
2019-05-07 15:20:20 +02:00
# Use the pass2 elf as the final elf
set ( logical_target_for_zephyr_elf ${ ZEPHYR_FINAL_EXECUTABLE } )
2017-10-27 15:43:34 +02:00
endif ( )
2018-10-16 13:25:04 +02:00
# Export the variable to the application's scope to allow the
# application to know what the name of the final elf target is.
set ( logical_target_for_zephyr_elf ${ logical_target_for_zephyr_elf } PARENT_SCOPE )
2019-06-14 01:15:44 +02:00
# Override the base name of the last, "logical" .elf output (and last .map) so:
2019-04-17 08:30:52 +02:00
# 1. it doesn't depend on the number of passes above and the
# post_build_commands below can always find it no matter which is it;
# 2. it can be defined in Kconfig
2017-10-27 15:43:34 +02:00
set_target_properties ( ${ logical_target_for_zephyr_elf } PROPERTIES OUTPUT_NAME ${ KERNEL_NAME } )
2017-11-20 15:37:59 +01:00
set ( post_build_commands "" )
2019-05-10 10:06:32 +02:00
set ( post_build_byproducts "" )
2017-11-20 15:37:59 +01:00
2019-06-14 01:15:44 +02:00
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D
2020-06-11 10:48:06 +02:00
$ { C M A K E _ C O M M A N D } - E r e n a m e $ { l o g i c a l _ t a r g e t _ f o r _ z e p h y r _ e l f } . m a p $ { K E R N E L _ M A P _ N A M E }
2019-06-14 01:15:44 +02:00
)
2018-11-26 10:47:16 +01:00
if ( NOT CONFIG_BUILD_NO_GAP_FILL )
# Use ';' as separator to get proper space in resulting command.
2020-08-18 14:47:53 +02:00
set ( GAP_FILL "$<TARGET_PROPERTY:bintools,elfconvert_flag_gapfill>0xff" )
2018-11-26 10:47:16 +01:00
endif ( )
2019-07-18 15:16:39 +02:00
if ( CONFIG_OUTPUT_PRINT_MEMORY_USAGE )
2021-02-02 21:06:11 +01:00
target_link_libraries ( ${ logical_target_for_zephyr_elf } $< TARGET_PROPERTY:linker,memusage > )
2020-08-18 14:47:53 +02:00
get_property ( memusage_build_command TARGET bintools PROPERTY memusage_command )
if ( memusage_build_command )
# Note: The use of generator expressions allows downstream extensions to add/change the post build.
# Unfortunately, the BYPRODUCTS does not allow for generator expression, so question is if we
# should remove the downstream ability from start.
# Or fix the output name, by the use of `get_property`
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
2020-09-04 21:07:46 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , m e m u s a g e _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , m e m u s a g e _ f l a g >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , m e m u s a g e _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
2020-08-18 14:47:53 +02:00
)
# For now, the byproduct can only be supported upstream on byproducts name,
# cause byproduct does not support generator expressions
get_property ( memusage_byproducts TARGET bintools PROPERTY memusage_byproducts )
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { m e m u s a g e _ b y p r o d u c t s }
)
endif ( )
2019-07-18 15:16:39 +02:00
endif ( )
2019-08-13 20:44:20 +02:00
if ( CONFIG_BUILD_OUTPUT_HEX OR BOARD_FLASH_RUNNER STREQUAL openocd )
2020-08-18 14:47:53 +02:00
get_property ( elfconvert_formats TARGET bintools PROPERTY elfconvert_formats )
if ( ihex IN_LIST elfconvert_formats )
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g >
$ { G A P _ F I L L }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t t a r g e t > i h e x
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > . c o m m e n t
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > C O M M O N
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > . e h _ f r a m e
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t f i l e > $ { K E R N E L _ H E X _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ f i n a l >
2020-08-18 14:47:53 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ H E X _ N A M E }
# ${out_hex_byprod} # Is this needed ?
)
endif ( )
2019-05-10 10:06:32 +02:00
endif ( )
2017-11-23 13:54:26 +01:00
2019-05-10 10:06:32 +02:00
if ( CONFIG_BUILD_OUTPUT_BIN )
2020-08-18 14:47:53 +02:00
get_property ( elfconvert_formats TARGET bintools PROPERTY elfconvert_formats )
if ( binary IN_LIST elfconvert_formats )
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g >
$ { G A P _ F I L L }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t t a r g e t > b i n a r y
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > . c o m m e n t
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > C O M M O N
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s e c t i o n _ r e m o v e > . e h _ f r a m e
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t f i l e > $ { K E R N E L _ B I N _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ f i n a l >
2020-08-18 14:47:53 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ B I N _ N A M E }
# ${out_hex_byprod} # Is this needed ?
)
endif ( )
2019-05-10 10:06:32 +02:00
endif ( )
2017-11-20 15:37:59 +01:00
2020-10-20 20:31:56 +02:00
# Cleanup intermediate files
if ( CONFIG_CLEANUP_INTERMEDIATE_FILES )
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D
# This file can be very large in some cases, delete it as we do not need it.
$ { C M A K E _ C O M M A N D } - E r e m o v e $ { Z E P H Y R _ P R E B U I L T _ E X E C U T A B L E } . e l f
)
endif ( )
2019-05-10 10:06:32 +02:00
if ( CONFIG_BUILD_OUTPUT_S19 )
2020-08-18 14:47:53 +02:00
get_property ( elfconvert_formats TARGET bintools PROPERTY elfconvert_formats )
if ( srec IN_LIST elfconvert_formats )
# Should we print a warning if case the tools does not support converting to s19 ?
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g >
$ { G A P _ F I L L }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t t a r g e t > s r e c
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ s r e c _ l e n > 1
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ o u t f i l e > $ { K E R N E L _ S 1 9 _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , e l f c o n v e r t _ f l a g _ f i n a l >
2020-08-18 14:47:53 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ S 1 9 _ N A M E }
# ${out_S19_byprod} # Is this needed ?
)
endif ( )
2019-05-10 10:06:32 +02:00
endif ( )
2017-11-20 15:37:59 +01:00
2019-05-10 10:06:32 +02:00
if ( CONFIG_OUTPUT_DISASSEMBLY )
2020-08-18 14:47:53 +02:00
if ( CONFIG_OUTPUT_DISASSEMBLE_ALL )
set ( disassembly_type "$<TARGET_PROPERTY:bintools,disassembly_flag_all>" )
2020-05-07 06:38:37 +02:00
else ( )
2020-08-18 14:47:53 +02:00
set ( disassembly_type "$<TARGET_PROPERTY:bintools,disassembly_flag_inline_source>" )
2020-05-07 06:38:37 +02:00
endif ( )
2019-05-10 10:06:32 +02:00
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
2020-08-18 14:47:53 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , d i s a s s e m b l y _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , d i s a s s e m b l y _ f l a g >
$ { d i s a s s e m b l y _ t y p e }
2020-08-18 14:46:06 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , d i s a s s e m b l y _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , d i s a s s e m b l y _ f l a g _ o u t f i l e > $ { K E R N E L _ L S T _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , d i s a s s e m b l y _ f l a g _ f i n a l >
2019-05-10 10:06:32 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ L S T _ N A M E }
2020-08-18 14:47:53 +02:00
# ${out_disassembly_byprod} # Needed ??
2019-05-10 10:06:32 +02:00
)
endif ( )
2017-11-20 15:37:59 +01:00
2019-05-10 10:06:32 +02:00
if ( CONFIG_OUTPUT_STAT )
2020-08-18 14:46:06 +02:00
# zephyr_post_build(TOOLS bintools COMMAND readelf FLAGS headers INFILE file OUTFILE outfile)
2019-05-10 10:06:32 +02:00
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
2020-08-18 14:46:06 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ f l a g >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ f l a g _ h e a d e r s >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ f l a g _ o u t f i l e > $ { K E R N E L _ S T A T _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , r e a d e l f _ f l a g _ f i n a l >
2019-05-10 10:06:32 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ S T A T _ N A M E }
)
endif ( )
2017-11-20 15:37:59 +01:00
2019-05-10 10:06:32 +02:00
if ( CONFIG_BUILD_OUTPUT_STRIPPED )
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
2020-08-18 14:46:06 +02:00
C O M M A N D $ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ c o m m a n d >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ f l a g >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ f l a g _ a l l >
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ f l a g _ i n f i l e > $ { K E R N E L _ E L F _ N A M E }
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ f l a g _ o u t f i l e > $ { K E R N E L _ S T R I P _ N A M E }
2020-09-04 10:05:00 +02:00
$ < T A R G E T _ P R O P E R T Y : b i n t o o l s , s t r i p _ f l a g _ f i n a l >
2019-05-10 10:06:32 +02:00
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ S T R I P _ N A M E }
)
endif ( )
if ( CONFIG_BUILD_OUTPUT_EXE )
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
C O M M A N D
$ { C M A K E _ C O M M A N D } - E c o p y $ { K E R N E L _ E L F _ N A M E } $ { K E R N E L _ E X E _ N A M E }
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { K E R N E L _ E X E _ N A M E }
)
endif ( )
2017-11-23 13:54:26 +01:00
2020-08-18 20:28:04 +02:00
# Generate and use MCUboot related artifacts as needed.
if ( CONFIG_BOOTLOADER_MCUBOOT )
include ( ${ CMAKE_CURRENT_LIST_DIR } /cmake/mcuboot.cmake )
endif ( )
2019-01-25 07:23:13 +01:00
get_property ( extra_post_build_commands
G L O B A L P R O P E R T Y
e x t r a _ p o s t _ b u i l d _ c o m m a n d s
)
list ( APPEND
p o s t _ b u i l d _ c o m m a n d s
$ { e x t r a _ p o s t _ b u i l d _ c o m m a n d s }
)
2019-05-10 10:06:32 +02:00
get_property ( extra_post_build_byproducts
G L O B A L P R O P E R T Y
e x t r a _ p o s t _ b u i l d _ b y p r o d u c t s
)
list ( APPEND
p o s t _ b u i l d _ b y p r o d u c t s
$ { e x t r a _ p o s t _ b u i l d _ b y p r o d u c t s }
)
2019-04-17 08:30:52 +02:00
# Add post_build_commands to post-process the final .elf file produced by
# either the ZEPHYR_PREBUILT_EXECUTABLE or the KERNEL_ELF executable
# targets above.
2017-11-20 15:37:59 +01:00
add_custom_command (
T A R G E T $ { l o g i c a l _ t a r g e t _ f o r _ z e p h y r _ e l f }
P O S T _ B U I L D
$ { p o s t _ b u i l d _ c o m m a n d s }
2019-05-10 10:06:32 +02:00
B Y P R O D U C T S
$ { p o s t _ b u i l d _ b y p r o d u c t s }
2019-04-17 08:30:52 +02:00
C O M M E N T " G e n e r a t i n g f i l e s f r o m $ { K E R N E L _ E L F _ N A M E } f o r b o a r d : $ { B O A R D } "
2020-08-18 14:47:53 +02:00
C O M M A N D _ E X P A N D _ L I S T S
2017-10-27 15:43:34 +02:00
# NB: COMMENT only works for some CMake-Generators
2019-01-25 07:23:13 +01:00
)
2017-10-27 15:43:34 +02:00
2018-10-30 08:39:13 +01:00
# To populate with hex files to merge, do the following:
# set_property(GLOBAL APPEND PROPERTY HEX_FILES_TO_MERGE ${my_local_list})
# Note that the zephyr.hex file will not be included automatically.
get_property ( HEX_FILES_TO_MERGE GLOBAL PROPERTY HEX_FILES_TO_MERGE )
if ( HEX_FILES_TO_MERGE )
# Merge in out-of-tree hex files.
2018-12-05 09:32:32 +01:00
set ( MERGED_HEX_NAME merged.hex )
2018-10-30 08:39:13 +01:00
add_custom_command (
2018-12-05 09:32:32 +01:00
O U T P U T $ { M E R G E D _ H E X _ N A M E }
2018-10-30 08:39:13 +01:00
C O M M A N D
$ { P Y T H O N _ E X E C U T A B L E }
$ { Z E P H Y R _ B A S E } / s c r i p t s / m e r g e h e x . p y
2018-12-05 09:32:32 +01:00
- o $ { M E R G E D _ H E X _ N A M E }
2018-10-30 08:39:13 +01:00
$ { H E X _ F I L E S _ T O _ M E R G E }
D E P E N D S $ { H E X _ F I L E S _ T O _ M E R G E } $ { l o g i c a l _ t a r g e t _ f o r _ z e p h y r _ e l f }
)
2018-12-05 09:32:32 +01:00
add_custom_target ( mergehex ALL DEPENDS ${ MERGED_HEX_NAME } )
2020-06-30 09:55:54 +02:00
list ( APPEND RUNNERS_DEPS mergehex )
2020-01-03 09:25:03 +01:00
message ( VERBOSE "Merging hex files: ${HEX_FILES_TO_MERGE}" )
2018-10-30 08:39:13 +01:00
endif ( )
2017-11-22 00:54:55 +01:00
if ( EMU_PLATFORM )
2018-01-11 15:46:44 +01:00
include ( ${ ZEPHYR_BASE } /cmake/emu/ ${ EMU_PLATFORM } .cmake )
2017-12-21 22:45:45 +01:00
else ( )
add_custom_target ( run
C O M M A N D
$ { C M A K E _ C O M M A N D } - E e c h o
" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "
2018-12-19 10:40:57 +01:00
" E m u l a t i o n / S i m u l a t i o n n o t s u p p o r t e d w i t h t h i s b o a r d . "
2017-12-21 22:45:45 +01:00
" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = "
)
2017-11-22 00:54:55 +01:00
endif ( )
2017-10-27 15:43:34 +02:00
add_subdirectory ( cmake/flash )
add_subdirectory ( cmake/usage )
add_subdirectory ( cmake/reports )
2019-06-17 22:26:11 +02:00
if ( NOT CONFIG_TEST )
2018-05-24 22:18:36 +02:00
if ( CONFIG_ASSERT AND ( NOT CONFIG_FORCE_NO_ASSERT ) )
2019-12-06 12:54:53 +01:00
message ( WARNING "__ASSERT() statements are globally ENABLED" )
2017-10-27 15:43:34 +02:00
endif ( )
2019-06-17 22:26:11 +02:00
endif ( )
2017-10-27 15:43:34 +02:00
2020-01-09 23:20:44 +01:00
if ( CONFIG_BOARD_DEPRECATED_RELEASE )
2017-10-27 15:43:34 +02:00
message ( WARNING "
W A R N I N G : T h e b o a r d ' $ { B O A R D } ' i s d e p r e c a t e d a n d w i l l b e
2020-01-09 23:20:44 +01:00
r e m o v e d i n v e r s i o n $ { C O N F I G _ B O A R D _ D E P R E C A T E D _ R E L E A S E } "
2018-12-19 10:40:57 +01:00
)
2017-10-27 15:43:34 +02:00
endif ( )
2020-01-09 02:10:51 +01:00
if ( CONFIG_SOC_DEPRECATED_RELEASE )
message ( WARNING "
W A R N I N G : T h e S o C ' $ { S O C _ N A M E } ' i s d e p r e c a t e d a n d w i l l b e
r e m o v e d i n v e r s i o n $ { C O N F I G _ S O C _ D E P R E C A T E D _ R E L E A S E } "
)
endif ( )
2019-06-06 20:12:14 +02:00
2019-08-29 16:19:32 +02:00
# In CMake projects, 'CMAKE_BUILD_TYPE' usually determines the
# optimization flag, but in Zephyr it is determined through
# Kconfig. Here we give a warning when there is a mismatch between the
# two in case the user is not aware of this.
set ( build_types None Debug Release RelWithDebInfo MinSizeRel )
if ( ( CMAKE_BUILD_TYPE IN_LIST build_types ) AND ( NOT NO_BUILD_TYPE_WARNING ) )
string ( TOUPPER ${ CMAKE_BUILD_TYPE } CMAKE_BUILD_TYPE_uppercase )
2019-11-15 19:01:39 +01:00
if ( NOT ( ${ OPTIMIZATION_FLAG } IN_LIST CMAKE_C_FLAGS_ ${ CMAKE_BUILD_TYPE_uppercase } ) )
2019-08-29 16:19:32 +02:00
message ( WARNING "
T h e C M a k e b u i l d t y p e w a s s e t t o ' $ { C M A K E _ B U I L D _ T Y P E } ' , b u t t h e o p t i m i z a t i o n f l a g w a s s e t t o ' $ { O P T I M I Z A T I O N _ F L A G } ' .
T h i s m a y b e i n t e n t i o n a l a n d t h e w a r n i n g c a n b e t u r n e d o f f b y s e t t i n g t h e C M a k e v a r i a b l e ' N O _ B U I L D _ T Y P E _ W A R N I N G ' "
)
endif ( )
endif ( )
2019-06-06 20:12:14 +02:00
# @Intent: Set compiler specific flags for standard C includes
# Done at the very end, so any other system includes which may
# be added by Zephyr components were first in list.
2020-08-18 14:47:53 +02:00
# Note, the compile flags are moved, but the system include is still present here.
zephyr_compile_options ( $< TARGET_PROPERTY:compiler,nostdinc > )
target_include_directories ( zephyr_interface SYSTEM INTERFACE $< TARGET_PROPERTY:compiler,nostdinc_include > )
2020-09-09 15:42:32 +02:00
# Finally export all build flags from Zephyr
add_subdirectory_ifdef (
C O N F I G _ M A K E F I L E _ E X P O R T S
c m a k e / m a k e f i l e _ e x p o r t s
)