I'm working on stm32f469 doing some bare metal code to try to use the libtomcrypt / libtomfastmath libraries. The code I'm trying to debug has been checked by valgrind and is working on many platforms like macos, raspberrypi, ios, android.
To keep things simple, I am doing the following which is calling this function
int register_hash(const struct ltc_hash_descriptor *hash) with a const static variable by giving it's adress :
register_hash(&sha256_desc). The problem is, once I am inside the function, the
hash pointer is
NULL and I cannot figure out why.
I was thinking It would be a stack overflow so I pre-filled the stack with the constant value
0xdeadbeef and I checked if all these values were erased or not and the result is the stack is not overflowed.
When debugging, I can verify the value at the address returned by
&sha256_desc and the memory is not corrupted there either.
I am not doing dynamic allocations nor buffer filling that could be overflowing and corrupting the memory.
I'm compiling with
arm-none-eabi-gcc, version 7-2017-q4-major.
I am mainly looking for some possible sources of issue as I am running out of ideas.
Thanks to @Ctx's comment I solved the issue by compiling all the files in one place instead of compiling a static library later linked to my program.
I don't know what was the problem and because I have new issues blocking me I won't try to investigate further.
User contributions licensed under CC BY-SA 3.0