cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE-CLASSB on STM32F072, STL_StartUpCPUTest causes hard fauilt

MMedv
Associate II

Hi, we've got the class B self test library running on our F072RB, with one exception. If we include the call to STL_StartUpCPUTest() inside STL_StartUp(), then a following call specifically __CRC_CLK_ENABLE(), will cause a hard fault.

We did some debugging, and looked at what the startup test is doing, but can't nail down why this test is causing our system to hardfault before we get into main().

We did notice that the T bit in the EPSR is 0 after the call to STL_StartUpCPUTest, but have no idea if this a problem or not.

Thoughts?

2 REPLIES 2
MThib.1
Associate

Hi MMedv,

Did you get any answer to you problem?

We have the exact same issue on a F091RC.

I found something:

If you put a breakpoint at __CRC_CLK_ENABLE() with STL_StartUpCPUTest commented and copy the registers value.

Then you put a breakpoint at __CRC_CLK_ENABLE() with STL_StartUpCPUTest commented and replace the r7 register with the previous value, it looks it doesn't crash (in my case at least).

STL_StartUpCPUTest seems not to recover required r7 register.

Note that in:

stm32f0xx_STLcpustartGCC.s starts with

PUSH {R4-R6} and ends with POP {R4-R6}

and stm32f0xx_STLcpurunGCC.s starts with

PUSH {R4-R7} and ends with POP {R4-R7}

MThib.1
Associate

edited in previous comment