diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/objects.h index d151abc4e5..c626bc20bc 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/objects.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/objects.h @@ -47,13 +47,6 @@ #ifdef __cplusplus extern "C" { #endif -#if DEVICE_CRYPTOCELL -#include "objects_cryptocell.h" -#else -struct trng_s { - uint32_t placeholder; -}; -#endif struct serial_s { uint32_t placeholder; // struct is unused by nRF5x API implementation @@ -92,6 +85,10 @@ struct flash_s { uint32_t placeholder; }; +struct trng_s { + uint32_t placeholder; +}; + #include "gpio_object.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c index b56e9a6910..532f18fd6d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c @@ -41,7 +41,6 @@ #include "hal/trng_api.h" #include "hal/lp_ticker_api.h" -#if !defined(DEVICE_CRYPTOCELL) #include "nrf_drv_rng.h" #define DEFAULT_TIMEOUT_US (1000*1000) @@ -180,5 +179,4 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l return (*output_length == 0) ? -1 : 0; } -#endif/* !DEVICE_CRYPTOCELL */ #endif diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h index 760674b3ce..c86f86130b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h @@ -54,6 +54,14 @@ extern "C" { #include "nrf_uart.h" +#if DEVICE_CRYPTOCELL +#include "objects_cryptocell.h" +#else +struct trng_s { + uint32_t placeholder; +}; +#endif + struct serial_s { int instance; uint32_t tx; @@ -134,10 +142,6 @@ struct flash_s { uint32_t placeholder; }; -struct trng_s { - uint32_t placeholder; -}; - #include "gpio_object.h" #ifdef __cplusplus diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/trng_api.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/trng_api.c index 747ac6aabf..6da4901b85 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/trng_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/trng_api.c @@ -37,7 +37,7 @@ */ #if defined(DEVICE_TRNG) - +#if !defined(DEVICE_CRYPTOCELL) #include "hal/trng_api.h" #include "hal/critical_section_api.h" @@ -119,5 +119,5 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l return result; } - +#endif/* !DEVICE_CRYPTOCELL */ #endif