Hi, Using Keil uVision 5.11 with Cortex M4 target.
I wrote a program with printf() calls. I added a fputc() & output to UART. I have now created another project with the same fputc(). If in the second program I add a printf() then I get an exception before main(). If I remove the printf() then all is OK.
I suspect that something is missing & that the exception is down to late linking (scatter?).
I would like to understand what changes I need to make to the second project such that I know how to create a project from start. What am I missing? If this is a late link issue then how do I force a full link?
Under the CMSIS model SystemInit() is typically called prior to your main() function, and BEFORE the statics are initialized, so be very conscious about what's in system_arch.c, what it's calling, and perhaps what stack size you have.
You could always analyze the Hard Fault, or implement a half useful one (Joseph Yiu) to display the details.
Thanks. Using NXP, my understanding is that CMSIS may not be applicable.
Turns out that I had not included retarget.h. Would like to know how to get the linker to tell me that it will insert a breakpoint for next WEAK disaster! Still new with the debugger/assembler & suppose that the breakpoint is just close to an exception vector.