Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions arch/arm/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)

# Compiler detection must not try to link a full executable.
#
# CMake validates a compiler by building and linking a test program. For a bare
# metal cross toolchain that link cannot succeed on its own terms: it has no
# start files, no default linker script and no libc, and the flags NuttX
# supplies for it (CMAKE_EXE_LINKER_FLAGS_INIT below adds --specs=nosys.specs)
# assume a toolchain shipped with newlib. A perfectly usable arm-none-eabi-gcc
# without those specs then fails configuration before a single NuttX source file
# is considered:
#
# arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs'
#
# Building a static library instead exercises the compiler and stops short of
# the link, which is the documented approach for this case.

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move to a more common places? since it isn't specific to arm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is valid for x86 as well, on bare-metal only architectures I think it might not make sense.

I am ok with moving this to somewhere more generic. Where do you suggest?

I think we would need to make sure this is not included in the sim target. Right? WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or move to each arch's cmake file


set(ARCH_SUBDIR)

if(CONFIG_ARCH_ARMV7A) # ARMv7-A
Expand Down
Loading