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
21 changes: 14 additions & 7 deletions modules/hal_nordic/nrfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@ if(NOT DEFINED CONFIG_SOC_NORDIC_BSP_NAME)
message(FATAL_ERROR "CONFIG_SOC_NORDIC_BSP_NAME has to be defined.")
endif()

set(BSP_DIR ${NRFX_DIR}/bsp)
set(INC_DIR ${NRFX_DIR}/drivers/include)
set(SRC_DIR ${NRFX_DIR}/drivers/src)
set(BSP_DIR ${NRFX_DIR}/bsp)
set(HELPERS_DIR ${NRFX_DIR}/helpers)
set(SOC_DIR ${BSP_DIR}/${CONFIG_SOC_NORDIC_BSP_NAME})

if(CONFIG_SOC_NORDIC_BSP_NAME STREQUAL "stable")
set(SOC_DIR ${BSP_DIR}/${CONFIG_SOC_NORDIC_BSP_NAME})
else()
string(TOUPPER ${CONFIG_SOC_NORDIC_BSP_NAME} BSP_MODULE_NAME)
set(SOC_DIR "${ZEPHYR_${BSP_MODULE_NAME}_MODULE_DIR}")
endif()

set(MDK_DIR ${SOC_DIR}/mdk)

if(NOT CONFIG_SOC_NORDIC_BSP_NAME STREQUAL "stable")
zephyr_compile_definitions(NRFX_BSP_NRF_PATH="${CONFIG_SOC_NORDIC_BSP_NAME}/mdk/nrf.h")
zephyr_compile_definitions(NRFX_BSP_ERRATAS_PATH="${CONFIG_SOC_NORDIC_BSP_NAME}/mdk/nrf_erratas.h")
zephyr_compile_definitions(NRFX_BSP_SOC_IRQS_PATH="${CONFIG_SOC_NORDIC_BSP_NAME}/soc/nrfx_irqs.h")
zephyr_compile_definitions(NRFX_BSP_NRFX_EXT_PATH="${CONFIG_SOC_NORDIC_BSP_NAME}/nrfx_ext.h")
zephyr_compile_definitions(NRFX_BSP_NRFX_COREDEP_PATH="${CONFIG_SOC_NORDIC_BSP_NAME}/soc/nrfx_coredep_defs.h")
zephyr_compile_definitions(NRFX_BSP_NRF_PATH="mdk/nrf.h")
zephyr_compile_definitions(NRFX_BSP_ERRATAS_PATH="mdk/nrf_erratas.h")
zephyr_compile_definitions(NRFX_BSP_SOC_IRQS_PATH="soc/nrfx_irqs.h")
zephyr_compile_definitions(NRFX_BSP_NRFX_EXT_PATH="nrfx_ext.h")
zephyr_compile_definitions(NRFX_BSP_NRFX_COREDEP_PATH="soc/nrfx_coredep_defs.h")
Comment on lines +33 to +37
Copy link
Contributor

Choose a reason for hiding this comment

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

This implicitly removes need for those compile definitions in BSP dispatcher.
Is that by design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@masz-nordic yes, it is. Chosen BSP dir is added to include path anyway above, and paths containing BSP are no longer valid since they can be placed anywhere in NCS, even in directories that are not in include path (for example, when I tested it with #3336 I set the BSP external path to modules/hal/bspexternal and building failed on those lines before I removed CONFIG_SOC_NORDIC_BSP_NAME).

Copy link
Contributor

Choose a reason for hiding this comment

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

Then a PR removing compile definitions usage in nrfx should be created too.

endif()

zephyr_include_directories(${NRFX_DIR})
Expand Down
Loading