NucleoF030R8 not work

Well the code is just a hack to disable default clock code, which tries to use the the expected 8MHz clock signal output by the ST-Link with the PLL (x6 multiplier → 48MHz) in HSE bypass mode (not crystal oscillator mode).

So if that does not work, you may have an older board revision that does not feed the ST-Link clock into the F0 chip. (And likely the crystal directly under the F0 chip is not populated, so the chip has 0 access to a high speed clock crystal or signal).

That was aleady discussed in Nucleo F401RE fails to execute Clock init issue - #13 by vortex314. You should modify the solder bridges (SB…) for the clock to be forwarded correctly to the F0 chip, then remove the

code. You have a hardware problem, in summary.