nrf: Use MICROPY_HW_ENABLE_RNG instead of MICROPY_PY_RANDOM_HW_RNG.

The "random" module no longer uses the hardware RNG (the extmod version of
this module has a pseudo-random number generator), so the config option
MICROPY_PY_RANDOM_HW_RNG is no longer meaningful.  This commit replaces it
with MICROPY_HW_ENABLE_RNG, which controls whether the hardware RNG is
included in the build.
pull/5644/head
Damien George 2020-02-14 15:17:51 +11:00
rodzic 6ad3bb1e12
commit ac8383a95d
21 zmienionych plików z 36 dodań i 27 usunięć

Wyświetl plik

@ -39,7 +39,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (1)

Wyświetl plik

@ -39,7 +39,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (2)

Wyświetl plik

@ -37,7 +37,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_TRICOLOR (1)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (2)

Wyświetl plik

@ -39,7 +39,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (3)

Wyświetl plik

@ -39,7 +39,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)

Wyświetl plik

@ -37,7 +37,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (0)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_USB_CDC (1)

Wyświetl plik

@ -35,7 +35,8 @@
#define MICROPY_PY_MACHINE_I2C (0)
#define MICROPY_PY_MACHINE_ADC (0)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_TRICOLOR (1)

Wyświetl plik

@ -35,7 +35,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (2)

Wyświetl plik

@ -35,7 +35,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)

Wyświetl plik

@ -35,7 +35,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_TRICOLOR (1)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (4)

Wyświetl plik

@ -36,7 +36,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_USB_CDC (1)

Wyświetl plik

@ -38,7 +38,6 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (0)
#define MICROPY_PY_MACHINE_TEMP (0)
#define MICROPY_PY_RANDOM_HW_RNG (0)
#define MICROPY_MBFS (0)

Wyświetl plik

@ -37,7 +37,8 @@
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_PY_RANDOM_HW_RNG (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_HAS_LED (0)

Wyświetl plik

@ -27,7 +27,7 @@
#include "py/mpconfig.h"
#if MICROPY_PY_RANDOM_HW_RNG
#if MICROPY_HW_ENABLE_RNG
#include "nrf_rng.h"
#include "drivers/rng.h"
@ -76,4 +76,4 @@ uint32_t rng_generate_random_word(void) {
return generate_hw_random();
}
#endif // MICROPY_PY_RANDOM_HW_RNG
#endif // MICROPY_HW_ENABLE_RNG

Wyświetl plik

@ -196,9 +196,6 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_soft_reset), MP_ROM_PTR(&machine_soft_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_enable_irq), MP_ROM_PTR(&machine_enable_irq_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable_irq), MP_ROM_PTR(&machine_disable_irq_obj) },
#if MICROPY_HW_ENABLE_RNG
{ MP_ROM_QSTR(MP_QSTR_rng), MP_ROM_PTR(&random_module) },
#endif
{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&machine_lightsleep_obj) },
{ MP_ROM_QSTR(MP_QSTR_lightsleep), MP_ROM_PTR(&machine_lightsleep_obj) },
{ MP_ROM_QSTR(MP_QSTR_deepsleep), MP_ROM_PTR(&machine_deepsleep_obj) },

Wyświetl plik

@ -174,10 +174,6 @@
#define MICROPY_PY_MACHINE_RTCOUNTER (0)
#endif
#ifndef MICROPY_PY_RANDOM_HW_RNG
#define MICROPY_PY_RANDOM_HW_RNG (0)
#endif
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (0)