ttrftech / NanoVNA

Very Tiny Palmtop Vector Network Analyzer
1.09k stars 305 forks source link

LTO causes freeze #109

Open edy555 opened 4 years ago

edy555 commented 4 years ago

Enabling the LTO option to reduce flash size causes freeze occasionally. So, unfortunately, unable to merge the autoscale feature contributed from damib.

damib commented 4 years ago

Ok, I'll keep on trying to find an alternative, thanks.

andyg24 commented 4 years ago

When linking with LTO enabled, gcc spits out the following warnings:

Linking build/ch.elf ui.c:308:13: warning: type of 'ili9341_line' does not match original declaration [-Wlto-type-mismatch] extern void ili9341_line(int, int, int, int, int); ^ ili9341.c:403:1: note: type mismatch in parameter 5 ili9341_line(int x0, int y0, int x1, int y1, uint16_t fg) ^ /usr/include/newlib/sys/_stdint.h:36:20: note: type 'uint16_t' should match type 'int' typedef __uint16_t uint16_t ; ^ ili9341.c:403:1: note: 'ili9341_line' was previously declared here ili9341_line(int x0, int y0, int x1, int y1, uint16_t fg) ^ ili9341.c:403:1: note: code may be misoptimized unless -fno-strict-aliasing is used

Perhaps this is the cause of the occasional freezes that you are seeing? The fix would be to change line 308 of ui.c to

extern void ili9341_line(int, int, int, int, uint16_t);

I haven't tested this change yet to see if the freezes disappear.

damib commented 4 years ago

Hi

Yes, I've noticed the same warning and suspected it could be a possible cause of the problem.

I'll do some testing to see it fix the problem.

Damiano

On 20/01/20 23:20, andyg24 wrote:

When linking with LTO enabled, gcc spits out the following warnings:

Linking build/ch.elf ui.c:308:13: warning: type of 'ili9341_line' does not match original declaration [-Wlto-type-mismatch] extern void ili9341_line(int, int, int, int, int); ^ ili9341.c:403:1: note: type mismatch in parameter 5 ili9341_line(int x0, int y0, int x1, int y1, uint16_t fg) ^ /usr/include/newlib/sys/_stdint.h:36:20: note: type 'uint16_t' should match type 'int' typedef __uint16_t uint16_t ; ^ ili9341.c:403:1: note: 'ili9341_line' was previously declared here ili9341_line(int x0, int y0, int x1, int y1, uint16_t fg) ^ ili9341.c:403:1: note: code may be misoptimized unless -fno-strict-aliasing is used

Perhaps this is the cause of the occasional freezes that you are seeing? The fix would be to change line 308 of ui.c to

extern void ili9341_line(int, int, int, int, uint16_t);

I haven't tested this change yet to see if the freezes disappear.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ttrftech/NanoVNA/issues/109?email_source=notifications&email_token=ACVKQ6VIRSTZ2BYFAS3QDULQ6YPTPA5CNFSM4KEZ2UB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJN6F3Y#issuecomment-576447215, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVKQ6VLPISV64HUH53WKNDQ6YPTPANCNFSM4KEZ2UBQ.

-- Damiano Bortolato INFN - Laboratori Nazionali di Legnaro Viale dell'università 2 35020 Legnaro (PD) - ITALY Tel +390498068698 Mob +393357868426

edy555 commented 4 years ago

@andyg24 thanks for the suggestion. I tested the fix you pointed out. Unfortunately, occasional freeze still happens after the fix.