testsuite: ztress: First sys_rand_get32 from thread
Added a workaround to call random generator once during the initialization. It is done to handle XOSHIRO generator limitation which performs initialization in the first sys_rand32_get call. And for some entropy generators it cannot be done from an interrupt context and it happens if k_timer context is used which expires first. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
3e706376e6
commit
77617b0d98
1 changed files with 6 additions and 0 deletions
|
@ -467,6 +467,12 @@ static int ztress_cpu_clock_to_sys_clock_check(const struct device *unused)
|
|||
*/
|
||||
cpu_sys_clock_ok = t <= 12;
|
||||
|
||||
/* Read first random number. There are some generators which do not support
|
||||
* reading first random number from an interrupt context (initialization
|
||||
* is performed at the first read).
|
||||
*/
|
||||
(void)sys_rand32_get();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue