浏览代码

make the linker information work... add an inline to ignore warning..

symbols defined by the linker script are all treated as addresses, so
we need to get the address, and cast it to an integer for the length
case..

The return value must be used, but as we init early on, we don't need
to check it, so just hide the error w/ an inline function..
mbed-sx1276
John-Mark Gurney 3 年前
父节点
当前提交
a070e6802b
共有 2 个文件被更改,包括 19 次插入3 次删除
  1. +9
    -3
      strobe_rng_init.c
  2. +10
    -0
      strobe_rng_init.h

+ 9
- 3
strobe_rng_init.c 查看文件

@@ -2,9 +2,15 @@

#include <strobe_rng_init.h>

extern uint8_t rng_save;
/*
* Note: rng_save is really REAL_RNG_SAVE_LEN, BUT, we want to use the
* uninitalized SRAM after it as entropy.
*/
extern uint8_t rng_save[2*1048];
extern int rng_save_len;

#define REAL_RNG_SAVE_LEN ((int)&rng_save_len)

void
strobe_rng_init(void)
{
@@ -15,11 +21,11 @@ strobe_rng_init(void)
* On first boot, SRAM is uninitialized and randomness from
* it is used. On reset, the previously saved state is used.
*/
strobe_seed_prng(&rng_save, 2*1024);
strobe_seed_prng(rng_save, 2*1024);

/*
* Save entropy for next reset.
*/
r = strobe_randomize(&rng_save, rng_save_len);
r = strobe_randomize(rng_save, REAL_RNG_SAVE_LEN);
(void)r;
}

+ 10
- 0
strobe_rng_init.h 查看文件

@@ -1,2 +1,12 @@
#include <strobe.h>

void strobe_rng_init(void);

static inline void
bare_strobe_randomize(uint8_t *ptr, ssize_t len)
{
int r;

r = strobe_randomize(ptr, len);
(void)r;
}

正在加载...
取消
保存