Open ned-pcs opened 2 years ago
Hi The flow (for Kinetis parts that don't have RNG):
unsigned short *ptrSeed; This is a global variable that is initailised to 0 (which is what you are seeing)
Immediately after main() is called fnInitHW() is executed and in this function there is (line 793 of kinetis.c) static unsigned short usRandomSeed = 0; ptrSeed = &usRandomSeed;
which means that ptrSeed is set to point to the address of usRandomSeed and is no longer 0.
Therefore I don't see that it fail due to a null pointer at line 603 of kinetis.c.
I didn't experience this issue and also haven't heard of it being a problem. Which compiler is used? (IAR has a slightly different startup flow but the same is essentially true). Can you see whether ptrSeed is being initialised before it hard faults? If it is does it get overwritten back to 0 again?
The dereference of
ptrSeed
in line 603 ofHardware/Kinetis/kinetis.c
causes a hard fault when built for the FRDM_KL25Z (which does not have RNG hardware), becauseptrSeed
is 0.In
Hardware/STM32/STM32.c
,ptrSeed
is initialized to point toRANDOM_SEED_LOCATION
, but it isn't initialized that way inHardware/Kinetis/kinetis.c
.