ExistOS-Team / ExistOS-For-HP39GII

GNU General Public License v3.0
202 stars 40 forks source link

Shutting down causes another power up; shutdown key sequence does not work in main menu; Power up crashes #52

Closed LifeEmu closed 2 years ago

LifeEmu commented 2 years ago

When using "SHIFT ON" to turn off the calculator, it sometimes immediately power up after shutting down. I cannot use "SHIFT ON" to turn off calculator when in main menu(I have to enter khiCAS to do a soft power off). Sometimes the calculator crashes on start up, and pressing "ON F5" makes it stuck in a completely white screen.

Repeerc commented 2 years ago

The bug of turning off the calculator and "ON + Fn" has been fixed in new version, (maybe). Crashes on start up probability is the memory management bugs of LvGL (or current virtual memory realization). There are two malloc method in LvGL, built-in lv_mem_alloc() and lv_mem_free() or use the system malloc() and free(). While use the built-in method, the system will randomly crash in hours. If use the system function to alloc/free memory, it just crashes on power up, but can run several days.

LifeEmu commented 2 years ago

Thanks for replying!

About start up crashes: Is that something about racing condition between MMU initialization and LvGL memory allocation? For instance, if LvGL got started before MMU gets actually initialized, will it access nonexisting virtual RAM and cause page missing interrupt? I'm not good at ARM stuff so please correct me if I am wrong. And I hope this get fixed eventually since, you know, how annoying the original HP OS is :P

Repeerc commented 2 years ago

I have tried booting delay, memset virtual memory before boot, and even memory data CRC check, the crashes on start up still appearing. But if set the CPU running at higher frequency, it seems that the crashes probability will be smaller. Maybe there are too much UI element or something else to draw lead that the threads can't execution in time? The memory should be well, I think, because I has try running games like Gameboy Emulator (load 1MB game cassettes) and DOOM(2MB program and 4MB maps) which no crashes.

LifeEmu commented 2 years ago

Hmm, will delaying creation of all other tasks help? What I mean is, if some tasks get to run before system initializer, something will definitely go wrong at some point. Or even set up all the hardware stuff before FreeRTOS core actually gets the control? I'm not familiar with it, just thoughts, and please correct me if I am wrong. Thanks!

Repeerc commented 2 years ago

In the latest I have disable some LvGL features and now it seems that doesn't happen crashes. But it need to test for a while to confirm.