Calling a function break execution, but not in debug
Some debugging lead me to the answer:
I'm using a delay function that use DWT, but a too simple initialization of it generate the problem during normal execution (I didn't investigate on the difference from debug to regular execution).
So, at least for me, the problem is not on importing the project from CubeMX, but on the code added to the project after the import.
For reference, this is the simpler init (found on internet, no credit, sorry):
DWT->CTRL |= 1 ; // enable the counter
DWT->CYCCNT = 0; // reset the counter
And this is the correct one (with credit):
// @author Tilen Majerle
// @email tilen at majerle.eu
// @website http://stm32f4-discovery.net */
uint32_t c;
/* Enable TRC */
CoreDebug->DEMCR &= ~0x01000000;
CoreDebug->DEMCR |= 0x01000000;
/* Enable counter */
DWT->CTRL &= ~0x00000001;
DWT->CTRL |= 0x00000001;
/* Reset counter */
DWT->CYCCNT = 0;
/* Check if DWT has started */
c = DWT->CYCCNT;
/* 2 dummys */
__ASM volatile ("NOP");
__ASM volatile ("NOP");
/* Return difference, if result is zero, DWT has not started */
return (DWT->CYCCNT - c);
Hope this can help someone.
Bye