Commit graph

21 commits

Author SHA1 Message Date
Stephanos Ioannidis fb35591f1e cmake: Correct PATHS usage
`PATH` is not a valid option for `find_program`; correct all such
usages to `PATHS`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-20 12:10:20 +02:00
Torsten Rasmussen d7862cf776 cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE}
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.

This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Daniel Leung e6cf37a857 cmake: ld: use linker prefix for undefined symbols
The undefined symbol option "-u" applies to linker so prefix
it with the linker prefix (usually "-Wl"). This fixes warnings
from LLVM/Clang about unknown arguments.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-07 17:09:38 +01:00
Stephanos Ioannidis d927018282 cmake: Use zephyr_link_libraries in toolchain_ld_cpp.
The toolchain_ld_cpp macro currently uses zephyr_ld_options function
to link libstdc++, instead of zephyr_link_libraries which is actually
intended for this purpose.

This commit replaces the usage of zephyr_ld_options with
zephyr_link_libraries as the former may erroneously filter out
-lstdc++ and the latter ensures that this linker flag is
unconditionally forwarded to the linker.

For more details, refer to the issue #20406.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-07 16:37:50 +01:00
Kumar Gala 00c7ce7942 linker: move where we define _LINKER and _ASMLANGUAGE
Move _LINKER and _ASMLANGUAGE to target.cmake because of how we pick the
linker script that might be used.  This way regardless of how or where a
linker.ld gets included we will always set _LINKER & _ASMLANGUAGE (so
any header that needs check based on those defines they can,
specifically generated_dts_board.h)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-03 12:55:16 +01:00
Wentong Wu be2c937368 target_relocation.cmake: fix spell typo
fix spell typo in target_relocation.cmake.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-07-18 11:09:48 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Mark Ruvald Pedersen 4052bac93f cmake: Introduce toolchain_ld_link_elf to abstract linker invocation
Final step of linker abstraction:
 * Abstract zephyr_lnk by including it in toolchain_ld_link_elf.
 * Abstract relevant uses of target_link_libraries.
 * Introduce toolchain_ld_force_undefined_symbols.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-06-13 14:06:24 +02:00
Wentong Wu 743a184b2d scripts: mpu align for ro section of new memory region on non-XIP system
on non-XIP system, SRAM is the default region, and relocated .data
section and .bss section of SRAM shouldn't be inserted between
_image_rom_start and _image_rom_end, because the memory region between
_image_rom_start and _image_rom_end will construct the mpu ro region.
Also for the newly added memory region on non-XIP system, the
relocated .text secition and .rodata section should also be mpu aligned.

Fixes: #16090.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-05-21 15:28:59 -04:00
Mark Ruvald Pedersen 197197a579 cmake: Toolchain abstraction: Introduce toolchain_ld_configure_files
No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-12 12:50:57 -04:00
Mark Ruvald Pedersen d7ee114106 cmake: Toolchain abstraction: move PROPERTY_LINKER_SCRIPT_DEFINES
Move PROPERTY_LINKER_SCRIPT_DEFINES to toolchain_ld_base.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-07 22:17:29 -04:00
Mark Ruvald Pedersen 86a3e8ff40 cmake: Toolchain abstraction: Introduce toolchain_ld_relocation macro
No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-04 08:59:53 -04:00
Mark Ruvald Pedersen 5f347eefe6 cmake: move configure_linker_script to ld/target.cmake
While configure_linker_script() may be useful for other linkers, it
currently only aimed at GNU ld. To really be useful among different
linkers, we would need to abstract its usage of the C preprocessor.
We can do this later, if needed.

No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-02 21:54:27 +02:00
Mark Ruvald Pedersen 3db09aa610 cmake: Toolchain abstraction: introduce toolchain_ld_cpp
No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-02 15:19:02 +02:00
Mark Ruvald Pedersen b14b59c9e4 cmake: Toolchain abstraction: move symbol sorting into toolchain_ld_base
No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-02 07:47:14 -04:00
Mark Ruvald Pedersen 173c953e9c cmake: Toolchain abstraction: orphan handling in toolchain_ld_baremetal
Move GNU ld linker specific flags related to orphan handling into
toolchain_ld_baremetal().

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-02 07:47:14 -04:00
Mark Ruvald Pedersen 69928beb36 cmake: Toolchain abstraction: build-id,gc-sections to toolchain_ld_base
Move --gc-sections flag to toolchain_ld_base()
Move --build-id=none flag to toolchain_ld_base()

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-05-02 07:47:14 -04:00
Mark Ruvald Pedersen 65f02c04d5 cmake: Toolchain abstraction: introduce toolchain_ld_baremetal()
The intent of toolchain_ld_baremetal() is to collect the flags belonging
to non-hosted (i.e. POSIX-based) targets.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-04-30 10:13:41 -04:00
Mark Ruvald Pedersen 4080818300 cmake: Toolchain abstraction: move LINKERFLAGPREFIX under GNU ld
* LINKERFLAGPREFIX's value is GNU ld specific, and
* LINKERFLAGPREFIX is not a convention always honored by all linkers.

Thus we shall not set it from the common root CMakeList.txt.
So we move to linker/ld/target.cmake.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-04-30 10:13:41 -04:00
Mark Ruvald Pedersen 1f01325ee5 cmake: Toolchain abstraction: use LINKER, introduce toolchain_ld_base
toolchain_ld_base() represents flags that are fundamental to linking or
otherwise does not belong in any further specified linker flag category.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-04-28 12:52:18 -04:00
Mark Ruvald Pedersen 3419efd552 cmake: fix intent description of toolchain_cc_nostdinc macro
toolchain_cc_nostdinc does not only obtain flags (to be placed in a
variable), it obtains and applies them.

No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-04-28 12:52:18 -04:00