In the following context: RZA1H microprocessor, custom board, bare metal running FreeRTOS + OpenVG API. I have experimented that after a long time, it can be hours or some days, my program crashes in two ways: stopping in an infinite loop due to it doesn´t change a necessary condition to exit or reaching the abort_handler/prefetch_handler. This happens after migrating from a previous version calling directly to the graphic drivers of Renesas (VDC5) for rendering without using hardware acceleration.
As the program runs on an industrial equipment, it has to be running forever and I can´t restart the processor when I see that problem, it would be a serious fault. To recover this two ways the actual workaround is:
1. From infinite loop: I have tried to finish graphic context and then restart it again but it enters in the same infinite loop because state remains equal. This was done in debug mode and manualy once the error occurs. In normal state, when everything is working fine, the program passes through this loop and spend only some microseconds but always exit. Maybe with a timeout I could detect if it spends more time and take actions like restart the graphics but I have not achieved that yet.
2. From abort_handler/prefetch_handler: this is the worst case. It can be recovered using the internal watchdog timer of RZA1H to produce a reset but the thing is that the program has to be running forever like I said before, and this solution is not valid, the situation has to be avoided.
Instead of recovering from this situation and trying to avoid it, like has been discussed in several forums, I have changed the way in which graphics are processed. In main loop, in charge of drawing over the display, I clear back buffer, create objects (like paths, rectangles...), apply transformations, then draw, destroy the objects and finally swap back buffer to front. Now I´m trying to do what is suggested and instead of creating and destroying objects each time that they are going to be drawn, I create all paths related with fonts and SVG images (around 100 plus 50 objects) at the beginning and then only change their position, scale and fill color when I want to draw the object.
These are the discussion links to forums. It´s no the same context because they talk about implementations of OpenVG running in a rapsberrypi but symptoms seems to be similar:
https://www.raspberrypi.org/forums/viewtopic.php?f=69&t=96899
Re: OpenVG program crashes randoml, code or faulty unit? -- Wed Mar 04, 2015 11:13 pm
(About creating paths and images outside the main loop)
https://github.com/ajstarks/openvg/issues/22
pawelduda commented on 3 Feb 2015
(About reuse paths created at the beginning)
https://www.raspberrypi.org/forums/viewtopic.php?f=69&t=144790
Call for review: fixing OpenVG wrapper library reliability -- Sun Apr 17, 2016 12:18 am
(Reopens an issuse about creating graphics repeatedly in the main loop)
https://github.com/raspberrypi/linux/issues/943
gitbf commented on 14 Jul 2016
(About creating static vector fonts at the beginning and doing it in runtime)
One of the issues is that it happens few times and after hours, it´s not repeatable and takes time to reproduce the error. If someone has seen a situation like that it would be good to share the knowledge.
Thanks in advance.