Skip to content

Commit 39973c8

Browse files
Ron EldorRon Eldor
authored andcommitted
Move trng code from target_nrf5 to target_nrf5x
After rebase, the build target NRF52840_DK is using TARGET_NRF5x, instead of TARGET_NRF5. Moved Cryptocell TRNG related code from `targets/TARGET_NORDIC/TARGET_NRF5/` to `targets/TARGET_NORDIC/TARGET_NRF5x/`
1 parent ca844fd commit 39973c8

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/objects.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@
4747
#ifdef __cplusplus
4848
extern "C" {
4949
#endif
50-
#if DEVICE_CRYPTOCELL
51-
#include "objects_cryptocell.h"
52-
#else
53-
struct trng_s {
54-
uint32_t placeholder;
55-
};
56-
#endif
5750

5851
struct serial_s {
5952
uint32_t placeholder; // struct is unused by nRF5x API implementation
@@ -92,6 +85,10 @@ struct flash_s {
9285
uint32_t placeholder;
9386
};
9487

88+
struct trng_s {
89+
uint32_t placeholder;
90+
};
91+
9592
#include "gpio_object.h"
9693

9794
#ifdef __cplusplus

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/trng_api.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "hal/trng_api.h"
4242
#include "hal/lp_ticker_api.h"
4343

44-
#if !defined(DEVICE_CRYPTOCELL)
4544
#include "nrf_drv_rng.h"
4645

4746
#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
180179
return (*output_length == 0) ? -1 : 0;
181180
}
182181

183-
#endif/* !DEVICE_CRYPTOCELL */
184182
#endif

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/objects.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ extern "C" {
5454

5555
#include "nrf_uart.h"
5656

57+
#if DEVICE_CRYPTOCELL
58+
#include "objects_cryptocell.h"
59+
#else
60+
struct trng_s {
61+
uint32_t placeholder;
62+
};
63+
#endif
64+
5765
struct serial_s {
5866
int instance;
5967
uint32_t tx;
@@ -134,10 +142,6 @@ struct flash_s {
134142
uint32_t placeholder;
135143
};
136144

137-
struct trng_s {
138-
uint32_t placeholder;
139-
};
140-
141145
#include "gpio_object.h"
142146

143147
#ifdef __cplusplus

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/trng_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838

3939
#if defined(DEVICE_TRNG)
40-
40+
#if !defined(DEVICE_CRYPTOCELL)
4141
#include "hal/trng_api.h"
4242
#include "hal/critical_section_api.h"
4343

@@ -119,5 +119,5 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
119119

120120
return result;
121121
}
122-
122+
#endif/* !DEVICE_CRYPTOCELL */
123123
#endif

0 commit comments

Comments
 (0)