Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwmv2: Native targets covert to HW model v2 #69034

Merged
merged 6 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2506,10 +2506,10 @@ Native POSIX/Sim and POSIX arch:
- aescolar
files:
- arch/posix/
- boards/posix/common/
- boards/posix/native_*/
- boards/posix/doc/
- boards/posix/*.rst
- boards/native/common/
- boards/native/native_*/
- boards/native/doc/
- boards/native/*.rst
- drivers/*/*posix*
- drivers/*/*native*
- drivers/*/*/*posix*
Expand All @@ -2518,7 +2518,7 @@ Native POSIX/Sim and POSIX arch:
- include/zephyr/arch/posix/
- scripts/native_simulator/
- scripts/valgrind.supp
- soc/posix/
- soc/native/
- tests/boards/native_sim/
labels:
- "area: native port"
Expand Down Expand Up @@ -2778,7 +2778,7 @@ nRF BSIM:
maintainers:
- aescolar
files:
- boards/posix/nrf_bsim/
- boards/native/nrf_bsim/
- tests/boards/nrf52_bsim/
- tests/bsim/
files-exclude:
Expand Down
24 changes: 0 additions & 24 deletions boards/boards_legacy/posix/native_posix/Kconfig.board

This file was deleted.

17 changes: 0 additions & 17 deletions boards/boards_legacy/posix/native_sim/Kconfig.board

This file was deleted.

31 changes: 0 additions & 31 deletions boards/boards_legacy/posix/nrf_bsim/Kconfig.board

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(zephyr_build_path ${APPLICATION_BINARY_DIR}/zephyr)
get_property(CCACHE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)

target_link_options(native_simulator INTERFACE
"-T ${ZEPHYR_BASE}/boards/boards_legacy/posix/common/natsim_linker_script.ld")
"-T ${ZEPHYR_BASE}/boards/native/common/natsim_linker_script.ld")

set(nsi_config_content
${nsi_config_content}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ zephyr_library_include_directories(
)

if(CONFIG_HAS_SDL)
add_subdirectory(${ZEPHYR_BASE}/boards/boards_legacy/${ARCH}/common/sdl/ ${CMAKE_CURRENT_BINARY_DIR}/sdl)
add_subdirectory(${ZEPHYR_BASE}/boards/native/common/sdl/ ${CMAKE_CURRENT_BINARY_DIR}/sdl)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this using a path from zephyr base, and not relative to current folder ?
Such as:

	 add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../common/sdl/ ${CMAKE_CURRENT_BINARY_DIR}/sdl)

seems a bit safer.
However, current proposal is also ok, as I don't expect we'll be moving boards around so much more.

endif()

zephyr_ld_options(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ config BOARD_NATIVE_POSIX
imply NATIVE_POSIX_TIMER
select POSIX_ARCH_CONSOLE
select NATIVE_APPLICATION
help
Native POSIX - 32 bit version
Will produce a console Linux process which can be executed natively
as a 32-bit executable.
It provides some minimal needed models:
An interrupt controller, timer (system tick), and redirects kernel prints to
stdout.

config BOARD_NATIVE_POSIX_64
bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

This represents an issue @tejlmand

select BOARD_NATIVE_POSIX
select 64BIT
help
Native POSIX - 64 bit version
Will produce a console Linux process which can be executed natively
as a 64-bit executable.
It provides some minimal needed models:
An interrupt controller, timer (system tick), and redirects kernel prints to
stdout.

if BOARD_NATIVE_POSIX

Expand All @@ -22,6 +41,6 @@ config NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME
case the zephyr kernel and application cannot tell the difference unless they
interact with some other driver/device which runs at real time.

source "boards/boards_legacy/$(ARCH)/common/sdl/Kconfig"
source "boards/native/common/sdl/Kconfig"

endif # BOARD_NATIVE_POSIX
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ config BUILD_OUTPUT_EXE
config OUTPUT_PRINT_MEMORY_USAGE
default n

config BOARD
default "native_posix_64" if BOARD_NATIVE_POSIX_64BIT
default "native_posix"

if NETWORKING

config NET_L2_ETHERNET
Expand Down
5 changes: 5 additions & 0 deletions boards/native/native_posix/Kconfig.native_posix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NATIVE_POSIX
select SOC_POSIX
5 changes: 5 additions & 0 deletions boards/native/native_posix/Kconfig.native_posix_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NATIVE_POSIX_64
select SOC_POSIX
9 changes: 9 additions & 0 deletions boards/native/native_posix/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
boards:
- name: native_posix
vendor: Zephyr
socs:
- name: native
- name: native_posix_64
Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be the board or the soc that is considered 64bit ?

Meaning, should we instead have:

board:
  name: native_posix
  vendor: Zephyr
  socs:
  - name: native
  - name: native_64

Considering the SoC 64bit then that would also remove the need for:

config BOARD_NATIVE_POSIX_64
	 bool
	 select BOARD_NATIVE_POSIX
	 select 64BIT

as the 64bit is then selected by the soc and there is no need to select BOARD_NATIVE_POSIX.
I also think this aligns more with what is done for qemu boards.

@nordicjm thoughts ?

Copy link
Member Author

@aescolar aescolar Feb 16, 2024

Choose a reason for hiding this comment

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

should it be the board or the soc that is considered 64bit ?

I intended to do that as a follow up. In this PR I hoped to bring everything back to working order in the hwmv2 format while keeping the PR reasonably sized. The next steps were to define this and the nrf5340 as having different socs , change all tests and BT test infra accordingly, and then remove this "backwards compatible" board definitions.

@nordicjm 's pointed issue would still apply for the nrf*bsim boards, there the nrf52 will remain separate from the nrf53 anyhow.

Copy link
Collaborator

Choose a reason for hiding this comment

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

true, and it's a side-effect of allowing multiple boards being defined in board.yml.

Something which would needs to be addressed.

vendor: Zephyr
socs:
- name: native
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_POSIX=y
CONFIG_BOARD_NATIVE_POSIX_64BIT=y
CONFIG_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_POSIX=y
CONFIG_BOARD_NATIVE_POSIX_32BIT=y
CONFIG_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ zephyr_library_include_directories(
)

if(CONFIG_HAS_SDL)
add_subdirectory(${ZEPHYR_BASE}/boards/boards_legacy/${ARCH}/common/sdl/ ${CMAKE_CURRENT_BINARY_DIR}/sdl)
add_subdirectory(${ZEPHYR_BASE}/boards/native/common/sdl/ ${CMAKE_CURRENT_BINARY_DIR}/sdl)
endif()

add_subdirectory(${ZEPHYR_BASE}/boards/boards_legacy/${ARCH}/common/extra_args/
add_subdirectory(${ZEPHYR_BASE}/boards/native/common/extra_args/
${CMAKE_CURRENT_BINARY_DIR}/extra_args
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@
# SPDX-License-Identifier: Apache-2.0

config BOARD_NATIVE_SIM
bool "Native simulator (Single Core)"
bool
select POSIX_ARCH_CONSOLE
select NATIVE_LIBRARY
select NATIVE_POSIX_TIMER
depends on SOC_POSIX
imply BOARD_NATIVE_POSIX if NATIVE_SIM_NATIVE_POSIX_COMPAT
help
Native simulator (Single Core)
Will produce a console Linux process which can be executed natively
as a 32-bit executable.

config BOARD_NATIVE_SIM_64
bool
select BOARD_NATIVE_SIM
select 64BIT
help
Native simulator (Single Core) - 64 bit version
Will produce a console Linux process which can be executed natively
as a 64-bit executable.

if BOARD_NATIVE_SIM

Expand Down Expand Up @@ -45,7 +57,7 @@ config NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME
Transitional option which allows applications which targeted native_posix
to set the correct native_sim option (CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME)

source "boards/boards_legacy/$(ARCH)/common/sdl/Kconfig"
source "boards/boards_legacy/$(ARCH)/common/extra_args/Kconfig"
source "boards/native/common/sdl/Kconfig"
source "boards/native/common/extra_args/Kconfig"

endif # BOARD_NATIVE_SIM
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ config BUILD_OUTPUT_EXE
config OUTPUT_PRINT_MEMORY_USAGE
default n

config BOARD
default "native_sim_64" if BOARD_NATIVE_SIM_64BIT
default "native_sim"

if NETWORKING

config NET_L2_ETHERNET
Expand Down
5 changes: 5 additions & 0 deletions boards/native/native_sim/Kconfig.native_sim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NATIVE_SIM
select SOC_POSIX
5 changes: 5 additions & 0 deletions boards/native/native_sim/Kconfig.native_sim_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NATIVE_SIM_64
select SOC_POSIX
9 changes: 9 additions & 0 deletions boards/native/native_sim/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
boards:
- name: native_sim
vendor: Zephyr
socs:
- name: native
- name: native_sim_64
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess similar comment regarding the board or soc being 64bit applies here.

vendor: Zephyr
socs:
- name: native
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_POSIX=y
CONFIG_BOARD_NATIVE_SIM_64BIT=y
CONFIG_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_POSIX=y
CONFIG_BOARD_NATIVE_SIM_32BIT=y
CONFIG_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ set_property(TARGET native_simulator APPEND PROPERTY RUNNER_LINK_LIBRARIES
target_compile_options(native_simulator INTERFACE
"-DNSI_PRIMARY_MCU_N=${CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}")

add_subdirectory(${ZEPHYR_BASE}/boards/boards_legacy/${ARCH}/common/extra_args/
add_subdirectory(${ZEPHYR_BASE}/boards/native/common/extra_args/
${CMAKE_CURRENT_BINARY_DIR}/extra_args
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NRF52_BSIM
bool
select SOC_SERIES_BSIM_NRF52X
select SOC_COMPATIBLE_NRF52833
select NRF_RTC_TIMER
select CLOCK_CONTROL
help
NRF52 simulation model
Will produce a console Linux process which can be executed natively.
It needs the BabbleSim simulator both in compile time and to execute

config BOARD_NRF5340BSIM_NRF5340_CPUNET
bool
select SOC_SERIES_BSIM_NRF53X
select SOC_COMPATIBLE_NRF5340_CPUNET
select NRF_RTC_TIMER
select CLOCK_CONTROL
help
Simulated NRF53 Network core
Will produce a console Linux process which can be executed natively.
It needs the BabbleSim simulator both in compile time and to execute

config BOARD_NRF5340BSIM_NRF5340_CPUAPP
bool
select SOC_SERIES_BSIM_NRF53X
select SOC_COMPATIBLE_NRF5340_CPUAPP
select NRF_RTC_TIMER
select CLOCK_CONTROL
help
Simulated NRF53 Application core
Will produce a console Linux process which can be executed natively.
It needs the BabbleSim simulator both in compile time and to execute


if SOC_SERIES_BSIM_NRFXX

# The following file is normally parsed only for the ARM architecture, which is
Expand All @@ -8,7 +43,7 @@ if SOC_SERIES_BSIM_NRFXX
# must be read also from here.
source "soc/nordic_nrf/common/Kconfig.peripherals"

source "boards/boards_legacy/$(ARCH)/common/extra_args/Kconfig"
source "boards/native/common/extra_args/Kconfig"

endif # SOC_SERIES_BSIM_NRFXX

Expand Down
5 changes: 5 additions & 0 deletions boards/native/nrf_bsim/Kconfig.nrf52_bsim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NRF52_BSIM
select SOC_POSIX
5 changes: 5 additions & 0 deletions boards/native/nrf_bsim/Kconfig.nrf5340bsim_nrf5340_cpuapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NRF5340BSIM_NRF5340_CPUAPP
select SOC_POSIX
5 changes: 5 additions & 0 deletions boards/native/nrf_bsim/Kconfig.nrf5340bsim_nrf5340_cpunet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_NRF5340BSIM_NRF5340_CPUNET
select SOC_POSIX
13 changes: 13 additions & 0 deletions boards/native/nrf_bsim/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
boards:
- name: nrf52_bsim
vendor: Zephyr
socs:
- name: native
- name: nrf5340bsim_nrf5340_cpuapp
Copy link
Collaborator

Choose a reason for hiding this comment

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

this ought to be a soc with a cpucluster if the intention is to have it appear similar to a nRF530 SoC.

Doing so would also remove some other comments which I would otherwise have regarding the Kconfig.

I did notice:

Note: the nrf5340 variants remain as their own
targets, instead of being variants of the base ones
to avoid breakage in this commit

what kind of breakage are you refering to, and are you planning to make more updates to the bsim boards with regards to variants ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same answer as above
(clarification w "variants" I meant "socs" or "cpu-clusters")

vendor: Zephyr
socs:
- name: native
- name: nrf5340bsim_nrf5340_cpunet
vendor: Zephyr
socs:
- name: native
Loading
Loading