unix/variants: Enable seeding random module on import in dev, coverage.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
d2f018bff1
commit
ac3fb974bc
@ -253,6 +253,17 @@ void mp_unix_mark_exec(void);
|
||||
#define MICROPY_FORCE_PLAT_ALLOC_EXEC (1)
|
||||
#endif
|
||||
|
||||
#ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC
|
||||
// Support for seeding the random module on import.
|
||||
#include <stddef.h>
|
||||
void mp_hal_get_random(size_t n, void *buf);
|
||||
static inline unsigned long mp_urandom_seed_init(void) {
|
||||
unsigned long r;
|
||||
mp_hal_get_random(sizeof(r), &r);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
// Can access physical memory using /dev/mem
|
||||
#define MICROPY_PLAT_DEV_MEM (1)
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
|
||||
|
||||
// Disable some features that come enabled by default with the feature level.
|
||||
#define MICROPY_MODULE_BUILTIN_INIT (0)
|
||||
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
||||
#define MICROPY_PY_SYS_STDIO_BUFFER (0)
|
||||
#define MICROPY_PY_USELECT (0)
|
||||
@ -50,6 +49,7 @@
|
||||
#define MICROPY_PY_SYS_GETSIZEOF (1)
|
||||
#define MICROPY_PY_SYS_TRACEBACKLIMIT (1)
|
||||
#define MICROPY_PY_IO_BUFFEREDWRITER (1)
|
||||
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_urandom_seed_init())
|
||||
#define MICROPY_PY_URE_DEBUG (1)
|
||||
#define MICROPY_PY_URE_MATCH_GROUPS (1)
|
||||
#define MICROPY_PY_URE_MATCH_SPAN_START_END (1)
|
||||
|
@ -28,7 +28,6 @@
|
||||
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
|
||||
|
||||
// Disable some features that come enabled by default with the feature level.
|
||||
#define MICROPY_MODULE_BUILTIN_INIT (0)
|
||||
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
||||
#define MICROPY_PY_SYS_STDIO_BUFFER (0)
|
||||
#define MICROPY_PY_USELECT (0)
|
||||
@ -37,3 +36,4 @@
|
||||
#define MICROPY_REPL_EMACS_WORDS_MOVE (1)
|
||||
#define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1)
|
||||
#define MICROPY_PY_SYS_SETTRACE (1)
|
||||
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC (mp_urandom_seed_init())
|
||||
|
Loading…
Reference in New Issue
Block a user