-
Notifications
You must be signed in to change notification settings - Fork 7k
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
new simulated board: nrf52_bsim #9988
Conversation
0affa09
to
aa5822e
Compare
aa5822e
to
2387b48
Compare
|
8d90325
to
323bacc
Compare
15cb04c
to
2f42c57
Compare
@nashif : If we run coverage in both native_posix and this board, we have too many tests with coverage and they spill to the 2nd CI instance (at least in this run with 7 instances). As we only collect coverage data from the 1st instance, that would lead to the coverage reports jumping up and down. |
2f42c57
to
8f7dd43
Compare
The coverage results are here: https://codecov.io/gh/zephyrproject-rtos/zephyr/pull/9988 |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kconfig parts look fine.
5c2a5b9
to
040b090
Compare
recheck |
From my point of view this is ready to merge. So feel free to press the button. |
@@ -11,3 +11,19 @@ osource "$(SOC_DIR)/$(ARCH)/Kconfig" | |||
osource "$(SOC_DIR)/$(ARCH)/*/Kconfig" | |||
|
|||
endmenu | |||
|
|||
# The helper symbols below are put here due to an unusual setup: The simulated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a better spot for this, we should not have soc specific kconfigs in a general file such as soc/Kconfig.
Also, I would do "select SOC_COMPATIBLE_NRF" in the SOC_FAMIL_NRF config instead of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I would do "select SOC_COMPATIBLE_NRF" in the SOC_FAMIL_NRF config instead of this.
Ok.
Need a better spot for this, we should not have soc specific kconfigs in a general file such as soc/Kconfig.
Do you have a better place in mind? (please consider this comment from Ulf: #9988 (comment) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, can't think of a better solution now, will revisit.
hal/nrf5/cntr.c | ||
hal/nrf5/ecb.c | ||
hal/nrf5/radio/radio.c | ||
hal/nrf5/mayfly.c | ||
hal/nrf5/ticker.c | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra new line
.shippable.yml
Outdated
@@ -34,6 +34,16 @@ build: | |||
if [ "$IS_PULL_REQUEST" = "true" ]; then | |||
git rebase origin/${PULL_REQUEST_BASE_BRANCH}; | |||
fi | |||
- > | |||
export NRF_HW_MODELS_VERSION=`cat boards/posix/nrf52_bsim/hw_models_version`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better define this under global section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can have this guy defined before the rebase just above.
But I moved it into its own line to make it more visible.
.shippable.yml
Outdated
- > | ||
export NRF_HW_MODELS_VERSION=`cat boards/posix/nrf52_bsim/hw_models_version`; | ||
pushd . ; | ||
export BSIM_OUT_PATH=/opt/bsim/ ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
.shippable.yml
Outdated
export NRF_HW_MODELS_VERSION=`cat boards/posix/nrf52_bsim/hw_models_version`; | ||
pushd . ; | ||
export BSIM_OUT_PATH=/opt/bsim/ ; | ||
export BSIM_COMPONENTS_PATH=${BSIM_OUT_PATH}/components/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
16c1046
to
0a3be6b
Compare
recheck |
These tests rely on compiling with one of the provided C libraries which are not compiled for any of the POSIX ARCH boards => balcklist based on the arch and not on the board Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
posix_flush_stdout() must be provided by any board using CONFIG_NATIVE_POSIX_CONSOLE, not just by those using CONFIG_NATIVE_POSIX_STDOUT_CONSOLE Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Simulated NRF boards based on the POSIX ARCH cannot directly use the current SOC_*NRF options as these pull options from the ARM CPU and other peripherals. This commit adds a new set of hidden SOC_COMPATIBLE_* options to be selected both by the real SOCs and the simulated ones. In this manner we can have the common code depend on the SOC_COMPATIBLE* options instead of the current ones where neccessary. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com> (f) arm kconfig
Depend on the new SOC_COMPATIBLE_NRF symbol instead of the SOC_FAMILY_NRF symbol. This allows the driver to be used from the bsim simulated board Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Simplify the Kconfig dependency for the nrf timer driver. CLOCK_CONTROL_NRF5 depends on the SOC_FAMILY_NRF already. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
The simulator symbol was renamed. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Depend on the new SOC_COMPATIBLE_NRF symbol instead of the SOC_FAMILY_NRF symbol. This allows the driver to be used from the bsim simulated board Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
To allow the BLE stack to be used both in the real nRF platforms and simulated ones, change the used macros in the code to the COMPATIBLE ones. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Added a new simulated board, which models the NRF52832 SOC. Its main use is for workstation testing and simulation of the BLE stack and any application which relies mostly on it. It uses BabbleSim (http://Babblesim.github.io) for the radio simulation. And the NRF52 HW models hosted in that same GitHub organization: https://github.com/BabbleSim/ext_NRF52_hw_models For speed it uses the POSIX arch to (not) emulate the CPU. It uses Vanilla Zephyr, with a couple of configuration differences: * It uses (like other POSIX arch boards) the system libC * It does not use the nrfx hosted by Zehpyr in ext/, but the one provided by the HW models. Otherwise it relies in the same drivers as the real NRF52 boards. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
To ensure we can always go back in time, let's explicitly list the NRF52 HW models version which should be used with each version of the nrf52_bsim board Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
To be able to collect all coverage reports from the "native" applications in the first CI instance, let's also place the nrf52_bsim testcases first. The order now is: unit_testing native_posix *_bsim anything else Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Use the docker image which has BabbleSim precompiled Fetch the NRF52 hardware models required by the nrf52_bsim board and compile them. Collect the coverage report from the nrf52_bsim board Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
new simulated board: nrf52_bsim
Added a new simulated board, which models the NRF52832 SOC.
Its main use is for workstation testing and simulation of
the BLE stack and any application which relies mostly on it.
It uses BabbleSim (http://Babblesim.github.io) for the radio
simulation.
And the NRF52 HW models hosted in that same GitHub organization:
https://github.com/BabbleSim/ext_NRF52_hw_models
For speed it uses the POSIX arch to (not) emulate the CPU.
It uses Vanilla Zephyr, with a couple of configuration differences:
provided by the HW models.
Otherwise it relies in the same drivers as the real NRF52 boards.
Quick hands on:
Assuming you want to have BabbleSim in ${HOME}/playground/bsim
Now, you just go to Zephyr (pick this branch), and before compiling or running sanitycheck you set
You are good to go. Compile whatever you want targeting
nrf52_bsim
The resulting exe can just be run stand alone without options (and you get a warning about not connecting to the BabbleSim phy)
If you want to see BLE activity (a bit more fun) you can either build each by hand and copy it out to the
bsim/bin
directory given them a reasonable name, or use a silly Makefile I left inbsim/components/ext_zephyr_app_builder/
.Assuming the second:
And you run them:
You should get something like so:
Now you can go wild and run either (or both) in gdb, valgrind or whatever you fancy.