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

Native sim 32 #4

Closed
wants to merge 7 commits into from
Closed
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
5 changes: 3 additions & 2 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ jobs:
run: |
scripts/run_in_build_env.sh 'pip3 install -r scripts/setup/requirements.nrfconnect.txt'
scripts/run_in_build_env.sh "./scripts/tools/nrfconnect/tests/test_generate_factory_data.py"
- name: Run unit tests for Zephyr native_posix_64 platform
- name: Run unit tests for Zephyr native_sim/posix/64 platform
if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true' || steps.changed_paths.outputs.nrfconnect == 'true'
run: |
scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target nrf-native-posix-64-tests build"
apt update && apt install -y gcc-multilib g++-multilib
scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target nrf-native-sim-64-tests build"
- name: Uploading Failed Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
Expand Down
4 changes: 2 additions & 2 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ if (CONFIG_CHIP_CRYPTO_PSA)
matter_add_gn_arg_bool ("chip_crypto_psa_spake2p" CONFIG_PSA_WANT_ALG_SPAKE2P_MATTER)
endif()

if (BOARD STREQUAL "native_posix")
if (BOARD STREQUAL "native_sim")
matter_add_gn_arg_string("target_cpu" "x86")
elseif (BOARD STREQUAL "native_posix_64")
elseif (BOARD STREQUAL "native_sim/native/64")
matter_add_gn_arg_string("target_cpu" "x64")
endif()

Expand Down
1 change: 0 additions & 1 deletion config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ config CHIP
imply NVS_LOOKUP_CACHE_FOR_SETTINGS if !(SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM)
imply ZMS if SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM
imply ZMS_LOOKUP_CACHE if SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM
imply ZMS_LOOKUP_CACHE_FOR_SETTINGS if SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM

if CHIP

Expand Down
4 changes: 2 additions & 2 deletions config/nxp/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ else()
endif()


# if (BOARD STREQUAL "native_posix")
# if (BOARD STREQUAL "native_sim")
# matter_add_gn_arg_string("target_cpu" "x86")
# elseif (BOARD STREQUAL "native_posix_64")
# elseif (BOARD STREQUAL "native_sim/native/64")
# matter_add_gn_arg_string("target_cpu" "x64")
# endif()

Expand Down
4 changes: 2 additions & 2 deletions config/zephyr/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ if(CONFIG_CHIP)
matter_add_gn_arg_bool("chip_inet_config_enable_tcp_endpoint" FALSE)
matter_add_gn_arg_bool("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT)

if(BOARD STREQUAL "native_posix")
if(BOARD STREQUAL "native_sim")
matter_add_gn_arg_string("target_cpu" "x86")
elseif(BOARD STREQUAL "native_posix_64")
elseif(BOARD STREQUAL "native_sim/native/64")
matter_add_gn_arg_string("target_cpu" "x64")
endif()

Expand Down
5 changes: 0 additions & 5 deletions config/zephyr/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ config HWINFO
bool
default y

# Generic networking options
config NET_SOCKETS_POSIX_NAMES
bool
default n

# Application stack size
config MAIN_STACK_SIZE
int
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def BuildNrfNativeTarget():
target = BuildTarget('nrf', NrfConnectBuilder)

target.AppendFixedTargets([
TargetPart('native-posix-64-tests',
TargetPart('native-sim-64-tests',
board=NrfBoard.NATIVE_POSIX_64, app=NrfApp.UNIT_TESTS),
])

Expand Down
4 changes: 2 additions & 2 deletions scripts/build/builders/nrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def GnArgName(self):
elif self == NrfBoard.NRF5340DK:
return 'nrf5340dk_nrf5340_cpuapp'
elif self == NrfBoard.NATIVE_POSIX_64:
return 'native_posix_64'
return 'native_sim'
else:
raise Exception('Unknown board type: %r' % self)

Expand Down Expand Up @@ -222,7 +222,7 @@ def _build(self):
# Note: running zephyr/zephyr.elf has the same result except it creates
# a flash.bin in the current directory. ctest has more options and does not
# pollute the source directory
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', self.output_dir],
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', os.path.join(self.output_dir, 'nrfconnect')],
title='Run Tests ' + self.identifier)

def _bundle(self):
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/testdata/all_targets_linux_x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ nxp-{k32w0,k32w1,rw61x,rw61x_eth,mcxw71}-{zephyr,freertos}-{lighting,contact-sen
mbed-cy8cproto_062_4343w-{lock,light,all-clusters,all-clusters-minimal,pigweed,ota-requestor,shell}[-release][-develop][-debug][-data-model-disabled][-data-model-enabled]
mw320-all-clusters-app
nrf-{nrf5340dk,nrf52840dk,nrf52840dongle}-{all-clusters,all-clusters-minimal,lock,light,light-switch,shell,pump,pump-controller,window-covering}[-rpc][-data-model-disabled][-data-model-enabled]
nrf-native-posix-64-tests
nrf-native-sim-64-tests
nuttx-x64-light
qpg-qpg6105-{lock,light,shell,persistent-storage,light-switch,thermostat}[-updateimage][-data-model-disabled][-data-model-enabled]
stm32-stm32wb5mm-dk-light
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/AppTestContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void AppContext::TearDownTestSuite()
// This can particularly be a problem when this unprocessed work involves reporting engine runs,
// since those can take a while and cause later tests to not reach their queued work before
// their timeouts hit. This is only an issue in setups where all unit tests are compiled into
// a single file (e.g. nRF CI (Zephyr native_posix)).
// a single file (e.g. nRF CI (Zephyr native_sim)).
//
// Work around this issue by doing a DrainAndServiceIO() here to attempt to flush out any queued-up work.
//
Expand Down
12 changes: 6 additions & 6 deletions src/platform/Zephyr/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PlatformManagerImpl PlatformManagerImpl::sInstance{ sChipThreadStack };

static k_timer sOperationalHoursSavingTimer;

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
static bool sChipStackEntropySourceAdded = false;
static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
{
Expand All @@ -72,7 +72,7 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s

return ret;
}
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

void PlatformManagerImpl::OperationalHoursSavingTimerEventHandler(k_timer * timer)
{
Expand Down Expand Up @@ -117,24 +117,24 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
{
CHIP_ERROR err;

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
// Minimum required from source before entropy is released ( with mbedtls_entropy_func() ) (in bytes)
const size_t kThreshold = 16;
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

// Initialize the configuration system.
err = Internal::ZephyrConfig::Init();
SuccessOrExit(err);

#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#if !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)
if (!sChipStackEntropySourceAdded)
{
// Add entropy source based on Zephyr entropy driver
err = chip::Crypto::add_entropy_source(app_entropy_source, NULL, kThreshold);
SuccessOrExit(err);
sChipStackEntropySourceAdded = true;
}
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
#endif // !defined(CONFIG_NRF_SECURITY) && !defined(CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR)

// Call _InitChipStack() on the generic implementation base class to finish the initialization process.
err = Internal::GenericPlatformManagerImpl_Zephyr<PlatformManagerImpl>::_InitChipStack();
Expand Down
6 changes: 3 additions & 3 deletions src/test_driver/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# @file
# CMake project for building and running selected CHIP unit tests using
# 'nrfconnect' platform integration layer in CHIP and Zephyr
# 'native_posix[_64]' platforms. Note that certain design decisions behind
# the native_posix platforms make them inapplicable for some unit tests,
# 'native_sim[/native/64]' platforms. Note that certain design decisions behind
# the native_sim platforms make them inapplicable for some unit tests,
# hence only a subset of CHIP unit tests is listed in the project.
# See: https://docs.zephyrproject.org/1.12.0/boards/posix/native_posix/doc/board.html
# See: https://docs.zephyrproject.org/4.0.0/boards/native/native_sim/doc/index.html
# for more details.
#

Expand Down
3 changes: 2 additions & 1 deletion src/test_driver/nrfconnect/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

# Zephyr networking configuration
CONFIG_NET_SOCKETS_POSIX_NAMES=n
CONFIG_NET_IPV4=y
CONFIG_ETH_NATIVE_POSIX=y
CONFIG_NET_PKT_RX_COUNT=16
Expand All @@ -41,9 +40,11 @@ CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=65536
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=768
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y
CONFIG_MBEDTLS_USER_CONFIG_FILE="app_mbedtls_config.h"
CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_ENTROPY_C=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_MEMORY_DEBUG=y
Expand Down
Loading