<div dir="ltr">I've managed to get the change in behaviour down to a single file now and have started to sprinkle 'volatiles' about the place.<div><br></div><div>Question - if an element of a structure is defined as volatile, does the instantiation of the structure need to be also or does the whole struct effectively become volatile.</div><div><br></div><div>Cheers</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 2, 2021 at 12:23 PM Charles Manning <<a href="mailto:cdhmanning@gmail.com">cdhmanning@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>If you want optimisations that are still debuggable then try -Og. That will optimise as far as it can without killing debuggability.</div><div><br></div><div>If your optimised code is running differently to non-optimised, then the first thing to check is that you're using volatile where you need it.<br></div><div><br></div><div>A trick I've pulled in the past is to split my makefile to build two types of object file:  *.o and, say, *.og with *.o built with -O2 or whatever and -Og or -O0 for the *.og files.</div><div>They will still link fine.</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 2, 2021 at 12:12 PM Robin Gilks <<a href="mailto:gb7ipd@gmail.com" target="_blank">gb7ipd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Does anyone have any tips on how to debug an issue that only arises when GCC optimisation is increased from -O0 to -O1 (or above).<div><br></div><div>I have an issue with the hardware jpeg encoder on an stm32f7 MCU when I crank up the optimise (the first time I've tried it as I prefer -O0 for debugging). I've tried putting:<br>     #pragma GCC optimize("O0")<br></div><div>at the start of the 3 files that directly implement the jpeg stuff to turn off optimise on them as it looks like the conversion functions that generate the YCbCr 4:2:0 data from the ARGB8888 ready for the hardware engine have bits optimised away!</div><div><br></div><div>I would expect the lookup tables generated by the code for these conversions would be the same irrespective of optimisation level but that's the only place I can think to look (the '.lst' files output from the compiler are way too different to make any sensible comparisons between optimisation levels)</div><div><br></div><div>Ideas? Cheers</div><div><br></div><div>-- <br><div dir="ltr"><div dir="ltr">Robin Gilks<div><br></div></div></div></div></div>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>