2022-01-30 12:12 AM
While heavy updating customized DynamicGraph after some time (from 10 minutes to more then an hour) application goes to HardFault.
Investigation shows that problem always happens inside TouchGFX library function CWRUtil::Q5 indexToScreenXQ5( const AbstractDataGraph *graph, const int16_t index const );
Failing code:
ldr r3, [r1, #0]
mov r0, r1
mov r1, r2
ldr.w r3, [r3, #212] <-- HardFault
bx r3
registers at time of HardFault:
r0 = 0x2400f124
r1 = 0x00000130
r2 = 0x00000130
r3 = 0x001c0002 <-- problem! usually it equals to 0x080924ac
So it should go this way:
r3 = &(0x2400f124) = 0x080924ac
0x080924ac + 212 = 0x8092580
&(0x8092580) = 0x0806865d
jump to 0x0806865d (indexToScreenXQ5)
But when it fails:
r3 = &(0x2400f124) = 0x001c0002
0x001c0002 + 212 = 0x001c00d6
&(0x001c00d6) = xxxx
HardFault
P.S.
0x2400f124 - correct pointer to graph class in SRAM
0x080924ac - correct graph class flash code location
0x001c0002 - incorrect (invalid address)
2022-01-30 10:47 AM
Yes. It is D-Cache not updating properly problem.
Call to SCB_CleanInvalidateDCache(); before copying quite large amount of data helps.
Uptime 9h for now and no HardFaults
2022-01-31 01:13 AM
What MCU are you using again ? What version of TouchGFX did you try it with ?
/Romain
2022-01-31 01:21 AM
MCU: STM32H743IIT6
STM32CubeIDE Version: 1.7.0
ARM CMSIS 5.7.0
Cube IDE STM32H7 MCU package 1.9.1
TouchGFX 4.17.0
"Again" - because I already had similar issues with D-Cache: https://community.st.com/s/question/0D53W00001K3F7WSAV/why-dcache-invalidation-hangs