forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Description
I have a folder where I gather all my specific files for my target:
The CMakeLists.txt looks like:
# Copyright (c) 2023 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_library(mbed-hmc20 INTERFACE)
target_sources(mbed-hmc20 INTERFACE
PeripheralPins.c
)
target_include_directories(mbed-hmc20 INTERFACE
.
)
target_link_libraries(mbed-hmc20 INTERFACE
mbed-stm32u575xg
)
PeripheralPins.c has:
#include "PeripheralPins.h"
#include "mbed_toolchain.h"
#include "PeripheralPinMaps.h"
In PinNames.h I define the pins and a bit further I use a MACRO:
#include "cmsis.h"
#include "PinNamesTypes.h"
...
// STDIO for console print
#ifdef MBED_CONF_TARGET_STDIO_UART_TX
CONSOLE_TX = MBED_CONF_TARGET_STDIO_UART_TX,
#else
#ifdef STDOUT_USB
CONSOLE_TX = PA_0,
#else
CONSOLE_TX = PB_6,
#endif
#endif
#ifdef MBED_CONF_TARGET_STDIO_UART_RX
CONSOLE_RX = MBED_CONF_TARGET_STDIO_UART_RX,
#else
#ifdef STDOUT_USB
CONSOLE_RX = PA_1,
#else
CONSOLE_RX = PB_7,
#endif
#endif
But I want STDOUT_USB to define in my main.h file in my source code, where other settings are.
Normally I could do something like:
target_include_directories(mbed-hmc20 PRIVATE
"${APP_SOURCE_PATH}"
)
But this is not working because mbed-hmc20 is an interface library, just to let 'mbed-stm32u575xg' know that there are some extra files to compile.
If I put #include "main.h" in PinNames.h is is not found and if I put app_source_path I get:
CMake Error at HMC20/CMakeLists.txt:14 (target_include_directories):
target_include_directories may only set INTERFACE properties on INTERFACE
targets
and with INTERFACE I get:
/home/sam/git/hmipanel/HMC20/./PinNames.h:36:10: fatal error: main.h: No such file or directory
36 | #include "main.h"
How can I avoid having to put my setting MACRO's in PinNames.h?
Metadata
Metadata
Assignees
Labels
No labels
