Skip to content
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: 12 additions & 0 deletions examples/platform/nxp/mcxw71/app/support/Memconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "FreeRTOS.h"
#include "fsl_debug_console.h"
#include "task.h"
#include <cstring>
#include <stdint.h>
Expand Down Expand Up @@ -140,4 +141,15 @@ void * __wrap__calloc_r(void * REENT, size_t num, size_t size)
return __wrap_calloc(num, size);
}

int __wrap_printf(const char * fmt_s, ...)
{
int res = 0;
va_list args;

va_start(args, fmt_s);
res = DbgConsole_Vprintf(fmt_s, args);
va_end(args);
return res;
}

} // extern "C"
80 changes: 79 additions & 1 deletion src/platform/nxp/common/crypto/S200/CHIPCryptoPalS200.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ CHIP_ERROR P256PublicKey::ECDSA_validate_hash_signature(const uint8_t * hash, co
bFreeAsyncCtx = true;
VerifyOrExit(sss_sscp_asymmetric_verify_digest(&asyc, (uint8_t *) hash, hash_length, (uint8_t *) signature.ConstBytes(),
signature.Length()) == kStatus_SSS_Success,
error = CHIP_ERROR_INTERNAL);
error = CHIP_ERROR_INVALID_SIGNATURE);
exit:

if (bFreeAsyncCtx)
Expand Down Expand Up @@ -1163,5 +1163,83 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointIsValid(void * R)
return CHIP_NO_ERROR;
}

CHIP_ERROR ExtractVIDPIDFromX509Cert(const ByteSpan & certificate, AttestationCertVidPid & vidpid)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr_buf, size_t csr_length, P256PublicKey & pubkey)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractIssuerFromX509Cert(const ByteSpan & certificate, MutableByteSpan & issuer)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractSubjectFromX509Cert(const ByteSpan & certificate, MutableByteSpan & subject)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractCRLDistributionPointURIFromX509Cert(const ByteSpan & certificate, MutableCharSpan & cdpurl)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256PublicKey & pubkey)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ValidateCertificateChain(const uint8_t * rootCertificate, size_t rootCertificateLen, const uint8_t * caCertificate,
size_t caCertificateLen, const uint8_t * leafCertificate, size_t leafCertificateLen,
CertificateChainValidationResult & result)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ReplaceCertIfResignedCertFound(const ByteSpan & referenceCertificate, const ByteSpan * candidateCertificates,
size_t candidateCertificatesCount, ByteSpan & outCertificate)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractSerialNumberFromX509Cert(const ByteSpan & certificate, MutableByteSpan & serialNumber)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractCDPExtensionCRLIssuerFromX509Cert(const ByteSpan & certificate, MutableByteSpan & crlIssuer)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractAKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan & akid)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR ExtractSKIDFromX509Cert(const ByteSpan & certificate, MutableByteSpan & skid)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR IsCertificateValidAtIssuance(const mbedtls_x509_crt * candidateCertificate, const mbedtls_x509_crt * issuerCertificate)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR IsCertificateValidAtIssuance(const ByteSpan & candidateCertificate, const ByteSpan & issuerCertificate)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR VerifyAttestationCertificateFormat(const ByteSpan & cert, AttestationCertType certType)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

} // namespace Crypto
} // namespace chip
10 changes: 6 additions & 4 deletions src/platform/nxp/mcxw72/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ void PlatformManagerImpl::HardwareInit(void)

CHIP_ERROR PlatformManagerImpl::ServiceInit(void)
{
CHIP_ERROR err = CHIP_ERROR_INTERNAL;
SecLib_Init();

return CHIP_NO_ERROR;
err = chip::Crypto::add_entropy_source(plat_entropy_source, NULL, 16);
SuccessOrExit(err);

exit:
return err;
}

CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
Expand All @@ -118,9 +123,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
SuccessOrExit(err);
#endif

err = chip::Crypto::add_entropy_source(plat_entropy_source, NULL, 16);
SuccessOrExit(err);

// Call _InitChipStack() on the generic implementation base class
// to finish the initialization process.
err = Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_InitChipStack();
Expand Down
13 changes: 13 additions & 0 deletions src/test_driver/nxp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ target_sources(app
./src/main.cpp
)

# This is a temporary workaround to avoid a popular linker limitation.
# The linker is unable to replace weak symbols with their strong
# counterparts when both weak and strong symbols are hosted in a static
# library. A solution for this issue is to add the object files which
# are defining the strong symbols directly to the linker command line.
if(CONFIG_CHIP_NXP_PLATFORM_MCXW71 OR CONFIG_CHIP_NXP_PLATFORM_MCXW72)
target_sources(app
PRIVATE
${SdkRootDirPath}/middleware/multicore/mcmgr/src/mcmgr_imu_internal.c
${SdkRootDirPath}/components/gpio/fsl_adapter_gpio.c
)
endif()

set(tests_list)

if(NOT "${CONFIG_NXP_CUSTOM_UNIT_TESTS_DIR}" STREQUAL "")
Expand Down
7 changes: 7 additions & 0 deletions src/test_driver/nxp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#
mainmenu "NXP Matter Unit Test Application"

if CHIP_NXP_PLATFORM_MCXW71 || CHIP_NXP_PLATFORM_MCXW72

config gMainThreadStackSize_c
default 6144

endif # if CHIP_NXP_PLATFORM_MCXW71 || CHIP_NXP_PLATFORM_MCXW72

source "$(CHIP_ROOT)/config/nxp/chip-cmake-freertos/Kconfig.defaults"
source "$(CHIP_ROOT)/examples/platform/nxp/common/Kconfig"
source "Kconfig.mcuxpresso"
84 changes: 58 additions & 26 deletions src/test_driver/nxp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,69 @@ with adding/removing test component library names.
Available Matter test component libraries:

```
libAppDataModelTests
libAppClusterBuildingBlockTests
libIMInterfaceTests
libICDServerTests
libChipCryptoTests
libInetLayerTests
libPlatformTests
libBleLayerTests
libFormatTests
libPWTestsWrapper
libVerhoeffTest
libSupportTests
libCoreTests
libAddressResolveTests
libASN1Tests
libCoreTests
libFormatTests
libMessagingTestHelpers
libMdnsFakePlatformTests
libMdnsTests
libMinimalMdnsCoreTests
libMinimalMdnsRecordsTests
libMinimalMdnsRespondersTests
libTestShell
libUserDirectedCommissioningTests
libBDXTests
libInteractionModelTests
libSecureChannelTests
libUserDirectedCommissioningTests
libRetransmitTests
libInteractionModelTests
libTestDACRevocationDelegate
libCertTestVectors
libCredentialsTest
libIncludePlatformTests
libChipCryptoTests
libInetTestHelpers
libInetLayerTests
libTracingTests
libNetworkTestHelpers
libRawTransportTests
libTransportLayerTests
libMinimalMdnsCoreTests
libMinimalMdnsRespondersTests
libMinimalMdnstests
libMdnsTests
libMinimalMdnsRecordsTests
libCodegenDataModelProviderTests
libRetransmitTests
libSRPTests
libSystemLayerTests
libSetupPayloadTests
libRawTransportTests
libAppTests
libCertTestVectors
libSupportTests
libPlatformTests
libBleLayerTests
libControllerDataModelTests
libCodeDrivenDataModelProviderTests
libEndpointTests
libCodegenDataModelProviderTests
libCHIPForTestController
libControllerTests
libTestShell
libControllerDataModelTests
libMessagingTestHelpers
libMessagingLayerTests
libEnergyTest
libTestPushAVStreamTransport
libTestNetworkCommissioningCluster
libTestAdministratorCommissioningCluster
libTestWebRTCTransportRequestorCluster
libTestBooleanStateCluster
libTestSoilMeasurementCluster
libTestSoftwareDiangosticsCluster
libTestOtaProviderCluster
libTestBasicInformationCluster
libTestGroupKeyManagementCluster
libTestGeneralDiangosticsCluster
libTestEthernetDiagnosticsCluster
libTestWiFiNetworkDiagnosticsCluster
libAppTestHelpers
libAppTests
libICDServerTests
libAppClusterBuildingBlockTests
libIMInterfaceTests
libServerClusterInterfaceTests
libAppDataModelTests
libCHIPTest
libServerClusterShimTests
```
1 change: 1 addition & 0 deletions src/test_driver/nxp/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ CONFIG_MCUX_PRJSEG_module.board.boardfile=n

CONFIG_CHIP=y
CONFIG_CHIP_BUILD_TESTS=y
CONFIG_CHIP_LIB_SHELL=n
23 changes: 20 additions & 3 deletions src/test_driver/nxp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,46 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE];
using namespace ::chip;
using namespace ::chip::DeviceLayer;

void main_task(void * pvParameters)
void test_task(void * pvParameters)
{
chip::Platform::MemoryInit();
chip::DeviceLayer::PlatformManagerImpl().ServiceInit();

int status = chip::test::RunAllTests();
}

#if FSL_OSA_MAIN_FUNC_ENABLE
extern "C" void main_task(void const * argument)
{
TaskHandle_t taskHandle;
#if CONFIG_ENABLE_PW_RPC
chip::NXP::App::Rpc::Init();
#endif

PlatformMgrImpl().HardwareInit();

test_task(nullptr);
// do not exit this task function to prevent logging issue
while (1)
;
}
#else
extern "C" int main(int argc, char * argv[])
{
TaskHandle_t taskHandle;

PlatformMgrImpl().HardwareInit();

if (xTaskCreate(&main_task, "main_task", MAIN_TASK_SIZE, NULL, configMAX_PRIORITIES - 4, &taskHandle) != pdPASS)
if (xTaskCreate(&test_task, "test_task", MAIN_TASK_SIZE, NULL, configMAX_PRIORITIES - 4, &taskHandle) != pdPASS)
{
ChipLogError(DeviceLayer, "Failed to start main task");
ChipLogError(DeviceLayer, "Failed to start test task");
assert(false);
}

ChipLogProgress(DeviceLayer, "Starting FreeRTOS scheduler");
vTaskStartScheduler();
}
#endif

#if (defined(configCHECK_FOR_STACK_OVERFLOW) && (configCHECK_FOR_STACK_OVERFLOW > 0))
void vApplicationStackOverflowHook(TaskHandle_t xTask, char * pcTaskName)
Expand Down
Loading