I have a project with a folder with sources and other with static libraries compiled by me.
I have no compilation errors but when I debug the code I have a problem, it is all fine until i reach a function inside of which there is a call to another function which jumps to 0x0 address. This functions belongs to a static library. I tested to call the destiny function and I can jump perfectly to this function, but if it is called from the other function the process crashes resulting in a jump in 0x0. I dont know either if it's a problem of the linker script or another problem.
Does Anyone have an idea on what might be going on?
I found the problem, as you said, it was the sp's init value. I solved the issue adding a symbol in the linker script like this in the beginning
_estack = ORIGIN(RAM) + LENGTH(RAM);
Then i changed in the startup file the stack pointer included in the vector table and I added before of the table:
__attribute__((section(".stack"), used)) unsigned *__stack_init = &_estack;