Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lvgl v8.0 #734

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft

Lvgl v8.0 #734

wants to merge 33 commits into from

Conversation

Quantum-cross
Copy link
Contributor

@Quantum-cross Quantum-cross commented Oct 8, 2021

Here's my first pass at upgrading pinetime to lvgl 8.

Still to do:

  • Port pinetime theme (I just copied the default lvgl theme for now)
  • Test on an actual PineTIme
  • Go through with fine tooth comb fixing layout/padding/alignment differences
  • Cleaning event handlers (using event filters) (this could be deferred to another PR)
  • fix Twos (very important)
  • change pad_row+pad_col -> pad_gap
  • implemented custom lvgl screen transitions
  • improve screen transition performance

This is a WIP, I'm creating it as a draft. I'll keep yall updated here, but early feedback and testing is appreciated.

2021-10-08-174412_238x241_scrot 2021-10-08-174704_234x238_scrot 2021-10-08-174810_236x241_scrot 2021-10-08-174826_238x239_scrot 2021-10-08-174850_238x240_scrot


Ported theme!

2021-10-09-135757_240x240_scrot 2021-10-09-135953_240x240_scrot 2021-10-09-135959_240x240_scrot 2021-10-09-140005_240x240_scrot


Many fixes:

2021-10-11-104334_240x240_scrot 2021-10-11-104312_240x240_scrot 2021-10-11-104231_240x240_scrot 2021-10-11-104209_240x240_scrot 2021-10-11-104159_240x240_scrot 2021-10-11-104141_240x240_scrot


More fixes!!!

2021-10-12-215652_240x240_scrot 2021-10-12-215645_240x240_scrot 2021-10-12-215525_240x240_scrot 2021-10-12-215823_240x240_scrot 2021-10-12-215634_240x240_scrot 2021-10-12-215721_240x240_scrot 2021-10-12-215702_240x240_scrot

Resolves #616

It builds and I have gotten output using my hacks to dev on my nrf52833-DK, but it quickly crashes with memory issues.

I have traced freeRTOS stack overflows on tasks with previous `usStackDepth` values:

- "MAIN"
- "displayapp"
- "Heartrate"

I've tried tweaking the stack/heap values but have always experienced memory corruption errors.

I'm currently waiting for my pinetime devkit to arrive :)

I've also enabled `configCHECK_FOR_STACK_OVERFLOW` and put a basic implementation of `vApplicationStackOverflowHook` in `rtoshook.c`. You need to set a breakpoint to read the task name unless you put in a log statement.
…kept in an lv_indev object in the lv_indev_ll.

Store it as a member variable to keep it alive.
# Conflicts:
#	src/displayapp/screens/Alarm.h
#	src/displayapp/screens/SystemInfo.cpp
@NeroBurner
Copy link
Contributor

can't compile your branch locally getting error

[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp: In member function 'void Pinetime::System::SystemTask::Work()':
[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:159:29: error: no matching function for call to 'Pinetime::Applications::DisplayApp::Start(Pinetime::System::BootErrors&)'
[build]   159 |   displayApp.Start(bootError);
[build]       |                             ^
[build] In file included from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.h:25,
[build]                  from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:1:
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note: candidate: 'void Pinetime::Applications::DisplayApp::Start()'
[build]    60 |       void Start();
[build]       |            ^~~~~
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note:   candidate expects 0 arguments, 1 provided
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-recovery.dir/build.make:664: src/CMakeFiles/pinetime-mcuboot-recovery.dir/systemtask/SystemTask.cpp.o] Error 1

do I maybe need to update a dependency (other than the lvgl submodule)?

- used basic objects instead of table
- only updates squares that are changed
- add indicator that shows which square is new
@Quantum-cross
Copy link
Contributor Author

can't compile your branch locally getting error

[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp: In member function 'void Pinetime::System::SystemTask::Work()':
[build] /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:159:29: error: no matching function for call to 'Pinetime::Applications::DisplayApp::Start(Pinetime::System::BootErrors&)'
[build]   159 |   displayApp.Start(bootError);
[build]       |                             ^
[build] In file included from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.h:25,
[build]                  from /home/nero/repos/pinetime/InfiniTime/src/systemtask/SystemTask.cpp:1:
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note: candidate: 'void Pinetime::Applications::DisplayApp::Start()'
[build]    60 |       void Start();
[build]       |            ^~~~~
[build] /home/nero/repos/pinetime/InfiniTime/src/displayapp/DisplayAppRecovery.h:60:12: note:   candidate expects 0 arguments, 1 provided
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-recovery.dir/build.make:664: src/CMakeFiles/pinetime-mcuboot-recovery.dir/systemtask/SystemTask.cpp.o] Error 1

do I maybe need to update a dependency (other than the lvgl submodule)?

Fixed that, I never tried building the recovery image.

fix arc theming

fix notification scroll animation

improved redundant drawing in steps, stopwatch
@geekbozu
Copy link
Member

geekbozu commented Oct 13, 2021

I will enabled Checks for this so it will build DFUs for testing as I see you make pushes. Good luck with this its on my to review list!

Copy link
Member

@geekbozu geekbozu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an error with JUST lvgl8 or in the mainstream repo? If its in the mainstream maybe you should consider a backport/seperate PR for it.

Move all transition animations to the new logic
@Quantum-cross
Copy link
Contributor Author

My pinetime DK is arriving tomorrow so I can finally start testing on the actual hardware soon.

Removed the notification to protect the data/cmd lcd pin, instead stuffed that logic inside the mutex of the Spi driver... This probably isn't the BEST way to do it, but it's working great for now.
@Quantum-cross
Copy link
Contributor Author

Quantum-cross commented Oct 14, 2021

screen blanking errors should be fixed on real hardware!

The ST7789 driver is a bit of a mess right now. I'd like to refactor it some time.

@Quantum-cross
Copy link
Contributor Author

This might be ready for a daily driver test.

I'm going to work on cleaning up the event handlers over the weekend but those changes shouldn't change any function.

Fix theming for basic labels.

Add short url for github address.
@JF002
Copy link
Collaborator

JF002 commented Oct 16, 2021

@Quantum-cross Thanks for your work on this PR! It looks like the port to LVGL8 is not as straightforward as for previous versions!

Have you already had the opportunity to check the memory usage (RAM and FLASH) since you've integrated LVGL8? We are already tight on memory, and I wouldn't want this updater to use too much of the remaining memory.

@NeroBurner
Copy link
Contributor

NeroBurner commented Oct 16, 2021

@Quantum-cross got a build error again

[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391208 B       480 KB     79.59%
[build]              RAM:       53368 B        64 KB     81.43%
[build] /home/nero/repos/pinetime/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/pinetime-mcuboot-app.dir/drivers/SpiNorFlash.cpp.o: in function `Pinetime::Drivers::SpiNorFlash::Sleep()':
[build] /home/nero/repos/pinetime/InfiniTime/src/drivers/SpiNorFlash.cpp:23: undefined reference to `Pinetime::Drivers::Spi::Write(unsigned char const*, unsigned int)'
[build] collect2: error: ld returned 1 exit status
[build] make[2]: *** [src/CMakeFiles/pinetime-mcuboot-app.dir/build.make:1781: src/pinetime-mcuboot-app-1.6.0.out] Error 1

broke with commit ce23767

@NeroBurner
Copy link
Contributor

@JF002 I don't know if that is what you're asking for, but the build output for ce63f51 shows the following memory usages

[build] [ 61%] Linking CXX executable pinetime-mcuboot-recovery-loader-1.6.0.out
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      165172 B       480 KB     33.60%
[build]              RAM:       19116 B        64 KB     29.17%
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391064 B       480 KB     79.56%
[build]              RAM:       53368 B        64 KB     81.43%
[build] post build steps for pinetime-mcuboot-recovery-loader-1.6.0
[build] post build steps for pinetime-app-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  165172	    120	  18996	 184288	  2cfe0	pinetime-mcuboot-recovery-loader-1.6.0.out
[build]    text	   data	    bss	    dec	    hex	filename
[build]  391064	    592	  52772	 444428	  6c80c	pinetime-app-1.6.0.out
[build] [ 78%] Built target pinetime-app
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      391064 B       480 KB     79.56%
[build]              RAM:       53368 B        64 KB     81.43%
[build] post build steps for pinetime-mcuboot-app-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  391064	    592	  52772	 444428	  6c80c	pinetime-mcuboot-app-1.6.0.out
[build] [ 79%] Linking CXX executable pinetime-recovery-loader-1.6.0.out
[build] [ 81%] Built target pinetime-mcuboot-recovery-loader
[build] [ 98%] Built target pinetime-mcuboot-app
[build] Memory region         Used Size  Region Size  %age Used
[build]            FLASH:      165172 B       480 KB     33.60%
[build]              RAM:       19116 B        64 KB     29.17%
[build] post build steps for pinetime-recovery-loader-1.6.0
[build]    text	   data	    bss	    dec	    hex	filename
[build]  165172	    120	  18996	 184288	  2cfe0	pinetime-recovery-loader-1.6.0.out
[build] [100%] Built target pinetime-recovery-loader

@NeroBurner
Copy link
Contributor

@Quantum-cross you might want to cherry-pick b13aec2 to fix the Game "Twos". On my simulator the initialization of the cell-objects ran out of memory, resulting in a segmentation fault. So I reverted to use lv_table

@Quantum-cross
Copy link
Contributor Author

@Quantum-cross you might want to cherry-pick b13aec2 to fix the Game "Twos". On my simulator the initialization of the cell-objects ran out of memory, resulting in a segmentation fault. So I reverted to use lv_table

I'm going to worry about performance optimization first right now, I'm messing with the ST driver and such.

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water.

If I can fix the speed issues then I'll look into memory.

I'm mostly just testing the pinetime-app cmake target right now.

@kieranc
Copy link
Contributor

kieranc commented Oct 21, 2021

I finally got round to testing this - I'm impressed with how much works! Yes the scrolling is a bit slow and the colors look washed out somehow? But it's huge progress!

@lman0
Copy link

lman0 commented Oct 23, 2021

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water.

If I can fix the speed issues then I'll look into memory.

i think you should look in the memory first and it may allow more speed improvement
because , when my pc have very little memory free it become very slow
so i think it's the same for an os like infintime @Quantum-cross

@Quantum-cross
Copy link
Contributor Author

I finally got round to testing this - I'm impressed with how much works! Yes the scrolling is a bit slow and the colors look washed out somehow? But it's huge progress!

Good to hear!!! Still working on the scrolling, colors may be washed out because I may not have copied the themes exactly. I'll have to go through and double check that later.

Thanks for testing!

If I can't increase the speed of scrolling then I think lvgl8 is dead in the water.
If I can fix the speed issues then I'll look into memory.

i think you should look in the memory first and it may allow more speed improvement because , when my pc have very little memory free it become very slow so i think it's the same for an os like infintime @Quantum-cross

Sure, also there was talk about maybe combining the heaps of FreeRTOS and lvgl.


Overall I have not had much time to work on this the past week. It's still near the top of my list though!

@kieranc
Copy link
Contributor

kieranc commented Oct 23, 2021

I think this is a PR which is going to need extensive testing so there's no rush, and initial progress looks very promising. I did just run a DFU to the LVGL8 build though, and the DFU screen is very broken! It completed just fine, but if you want something easier to tackle than scrolling speed, there's that :-)
I guess you've tried lv_page_set_anim_time ? Apparently the default is 400ms which is fairly slow.

@Riksu9000
Copy link
Contributor

@Quantum-cross Do you think there's any hope in updating this or is it easier to start over? As you've put a lot of effort into this and are more familiar with the changes required, do you know if there are things we could do in preparation for upgrading to make the process easier, like making some preliminary changes for example?

@pipe01
Copy link
Contributor

pipe01 commented Oct 14, 2023

Any updates on this?

@NeroBurner
Copy link
Contributor

While creating InfiniSim I've based my development on this lvgl8 port. I think I got to a working state, but the memory consumption of lvgl8 was higher than lvgl7. Crashing the PineTimeStyle watch face with then new settings menu. Maybe that was a bug in lvgl8 and it is fixed now, but I don't know, as I've not tested it since then

Anyways my work sprinkled with simulator based commits can be found here: https://github.com/NeroBurner/InfiniTime/commits/lv_simulation_lvgl8

maybe someone finds it useful

@darkdragon-001
Copy link

Any chance the remaining bugs are fixed now and the upgrade is unblocked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to LVGL 8
9 participants