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?
Check the access permissions, or security settings of the address of this function. You have not said which CPU you are using... perhaps for example you are trying to call a secure function from non-secure world on a Cortex-M33, or similar situation.
If it branches specifically to 0x0 that is the reset vector on Cortex-A, but the sp init value on Cortex-M. Perhaps your stack is not set up properly?
Thanks for the response.It is a cortex m3 (lpc1769) the first option is discarted, the second option could be because I'm using a linker script from internet, and the stack's part figures like a piece called dummy_stack, I'm going to try change this option and I will inform about this
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;
View all questions in Arm Compilers forum