Hi Vincenzo,
which KL04 exactly? And are you using Kinetis Design Studio V1.1.1?
I think the problem could be your startup code. Below is my KL04Z32 linker file:
/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x0400; /* required amount of heap */
__stack_size = 0x0100; /* required amount of stack */
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000C0
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00007BF0
m_data (RW) : ORIGIN = 0x1FFFFC00, LENGTH = 0x00001000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
Increase the heap size to see if this helps. I think the problem on your side is that the ANSI library code crashes because the library in KDS uses too much heap space.
Otherwise, I have a Processor Expert component which helps to identify the hard fault, see:
A Processor Expert Component to Help with Hard Faults | MCU on Eclipse
The component is available from SourceForge (see McuOnEclipse Releases on SourceForge | MCU on Eclipse)
I hope this helps,
Erich