Bingo600 wrote: Sun Jan 19, 2020 1:39 pm I got HW float enabled (i think) -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
Beginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:29795.44 millisec
C Converted Single Precision Whetstones:33.56 Mflops
Wonder what FCPU i'm running
Can't be all wrong , as USB is workingBeginning Whetstone benchmark at 84 MHz ...
Previous was -oS now with -o3
Loops:10000, Iterations:1, Duration:22780.49 millisec
C Converted Single Precision Whetstones:43.90 Mflops
/Bingo
try -O3

the other thing is make sure to check in your variant
https://github.com/stevstrong/Arduino_S ... f401.h#L39
Code: Select all
#define CYCLES_PER_MICROSECOND 84
it is used to select the clock initialization algorithm
https://github.com/stevstrong/Arduino_S ... cF4.c#L476
Code: Select all
void rcc_clk_init(void)
{
SystemCoreClock = CYCLES_PER_MICROSECOND * 1000000;
#if CYCLES_PER_MICROSECOND == 168
SetupClock168MHz();
#elif CYCLES_PER_MICROSECOND == 120
SetupClock120MHz();
#elif CYCLES_PER_MICROSECOND == 96
SetupClock96MHz();
#elif CYCLES_PER_MICROSECOND == 84
SetupClock84MHz();
#elif CYCLES_PER_MICROSECOND == 72
SetupClock72MHz();
#else
#error Wrong CYCLES_PER_MICROSECOND!
#endif
}
https://github.com/stevstrong/Arduino_S ... cF4.c#L214
Code: Select all
void SetupClock84MHz()
{
/******************************************************************************/
/* PLL (clocked by HSE) used as System clock source */
/******************************************************************************/
/************************* PLL Parameters *************************************/
// PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N = 25[MHz]/25 * 336 = 336
int PLL_M = 25;
int PLL_N = 336;
// SYSCLK = PLL_VCO / PLL_P = 336 / 4 = 84
int PLL_P = 4;
// USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ = 336 / 7 = 48
int PLL_Q = 7;
this is the important part, for black pill the crystal runs at 25 Mhz
if you are using a board that has a different crystal speed say 8 Mhz, it may run too slow or too fast
next thing is you can now tweak the clocks if you want, the python script to search clock settings
viewtopic.php?p=393#p393
there are more examples in this thread, i.e. the PLL prescalers and multipliers m, n, p, q
viewtopic.php?f=7&t=92
but if you tweak clocksi.e. the PLL prescalers and multipliers m, n, p, q
https://github.com/stevstrong/Arduino_S ... f401.h#L39
Code: Select all
#define CYCLES_PER_MICROSECOND 84
this matters a lot, because it is used in various places, in particular to set the pre-scaler for systick so that systick counts every milliseconds.
and the timers use that same CYCLES_PER_MICROSECOND macro as well.
and you may need to temporary edit
Code: Select all
void rcc_clk_init(void)
Code: Select all
void SetupClock84MHz()