Article: Inside a Smartphone Accelerometer: PinePhone with NuttX RTOS
#11
wow, you have been busy busy! Smile thanks.  So buying a PinebookPro takes time, and I am a little hesitant because it looks like they might update it soon.  So I dug out an even older MBP device (mid 2009) and installed Manjaro (xfce) 22.1.2  and it finally boots Smile  and quite impressed with it Smile  And the really good news is that I now have the nuttx build environment up and running Smile  thank you very much for you help getting this far!

So first I tried the pinephone:lvgl and writing that build artifact over the jump drive image, and booting the PP.  I see the blue/green/red bars and a circle, yay!  Smile

Somehow I was expecting the lvgl widget demo, but no problem, at least it works hehe Smile

So is there some info about where the source code is for that demo please? [edit: sorry, I missed the apps folder, so seems like a cmd line util to pick the lvgl demo]

I also tried using the 'make menuconfig' to try and switch the demo, but selecting the widget demo didnt seem to change anything, do I need to clear the previous config somehow?

'make' also seemed to do a complete rebuild after using menuconfig, is that normal?

and my main interest would be setting up my own small widget demo clone project, and gradually porting it to Zig.  Any guidelines for setting up the clone LVGL project please?  I have Zig installed and ready Smile

btw it looks like you are using vscodium on Manjaro?  maybe this MBP is not supported but I didnt find it using pamac or pacman (sorry I am new to linux). 

Apologies for lots of questions, and thanks again for helping me get this far.
  Reply
#12
What I am curious about is how a Mac user who is new to GNU/Linux ends up with a PinePhone rather than an iPhone. Smile (Is it because the Apple walled garden is so locked down that it is completely boring for software development?) Or the other way round, why someone who chooses a PinePhone has not been running GNU/Linux on their desktop/notebook computers rather than macOS for a long time already. It even runs on Apple computers (and not only on 2009 ones Wink).
  Reply
#13
That's awesome @WhiteHexagon ! And thank you so much for bearing with me :-)

(1) The Colour Bars is actually a Test Pattern that's rendered by the Display Driver in C, not in LVGL. (Source Code) (Explained here)

(2) I realise you don't have a Serial Debug Cable, so let's configure NuttX to start the LVGL Demo automatically (as explained here):

Code:
make menuconfig

In “RTOS Features > Tasks and Scheduling":
Set “Application Entry Point” to lvgldemo_main
Set “Application Entry Name” to lvgldemo_main

In “Application Configuration > NSH Library”:
Disable “Have Architecture-Specific Initialization”

(3) NuttX should now boot to the LVGL Demo App automatically (Like this)

(4) The source code for the LVGL Demo is at 
apps/graphics/lvgl/lvgl/demos/widgets/lv_demo_widgets.c
(Repo is here)

(5) To build our own LVGL Demo, edit lv_demo_widgets.c, look for the function lv_demo_widgets, and change the code inside to:
Code:
// Create a Button, set the Width and Height
void lv_demo_widgets(void) {
  lv_obj_t *btn = lv_btn_create(lv_scr_act());
  lv_obj_set_height(btn, LV_SIZE_CONTENT);
  lv_obj_set_width(btn, 120);
}

(Explained here)

(6) Yeah the LVGL code looks quite messy in C. In the next article, I'll use Zig to build a Feature Phone UI for NuttX on PinePhone. So stay tuned! :-)

UPDATE: I just remembered that I created a simple Zig LVGL App for PinePhone: pinephone-lvgl-zig

UPDATE: To fix the Arm64 / Zig toolchain on macOS, we could run a Linux Container like Rancher Desktop
  Reply
#14
(05-21-2023, 06:58 PM)Kevin Kofler Wrote: What I am curious about is how a Mac user who is new to GNU/Linux ends up with a PinePhone rather than an iPhone. Smile (Is it because the Apple walled garden is so locked down that it is completely boring for software development?) Or the other way round, why someone who chooses a PinePhone has not been running GNU/Linux on their desktop/notebook computers rather than macOS for a long time already. It even runs on Apple computers (and not only on 2009 ones Wink).

Indeed Smile just trying to do my bit to save the planet from this crazy consumerism and big tech.  I have more than enough working but manufacturer designated 'obsolete' devices here, and of course macos was mandated to play the iOS game, although it has been a perfect OS for most of my enjoyable years of Objective-C (and Java) work.  At least it has always 'just worked' unlike every experience I ever had with Linux/BSD Wink  PP has appeal because it seems more open (at least software) and more than enough hardware for what I need from a phone.
  Reply
#15
GNU/Linux has served me well on the desktop. I have been using it exclusively for almost 2 decades now (and at that point I had already been using it in dual-boot with Windows for a few years). So I am surprised by your negative experiences (but all the more positively surprised that you are not letting that stop you from trying out the PinePhone, though I see you have now found a non-Linux OS to play with on it Smile).

Looks like the NuttX port is going to have two developers now. Good luck!
  Reply
#16
Impressive! so have you developed some wayland apps during that time? I struggled to find even a simple OpenGL ES example...

Nuttx has a lot of appeal, since it should allow us to extract a lot more performance out of the device. I have been porting some of my old apps from objective-c to Zig/Wasm (with Go backends). So porting to wayland, nuttx, or just keeping them within the browser are all options at this point. I have a lot to learn switching away from Android/iOS were mostly it is just a 'click to generate template app', but that is also part of the enjoyment Smile On the other hand there is probably not much I can contribute to nuttx the speed that lupyuen is working at! Smile Hopefully this weekend I find some time to catch up a bit more and try my own project. At least I managed to get vscodium installed, and worked out why my old eyes were struggling with my old non-retina MBP display, turns out default brightness was something like 20% hehe Smile
  Reply
#17
@lupyuen good news, I got the LVGL widgets demo running just now, thank you for the extra tips! It is not quite clear how the entry point works. So I can see on the nuttx project the CONFIG_INIT_ENTRYPOINT got set with 'lvgldemo_main' vis the menuconfig. But then in the 'apps' project, there is only a comment in lvgldemo.c mentioning 'lvgldemo_main', but seems like the entry point is 'main' and the parameter is 'widgets' (CONFIG_INIT_ARGS), what am I missing please? ie what does setting that entry point do? ie. how does it map to the lvgldemo.c 'main' function?

btw I found using the PP without battery seems to be the optimal way to develop? ie constantly swapping SD cards and rebooting. And in this case the widgets demo boots up in within 2 seconds! amazing Smile
  Reply
#18
Keep in mind though that neither the modem (including GPS) nor the WiFi chip (including Bluetooth) will work without a battery plugged in, because they are connected directly to the battery, not to the main power circuit.

(05-24-2023, 03:21 AM)WhiteHexagon Wrote: Impressive! so have you developed some wayland apps during that time?  I struggled to find even a simple OpenGL ES example...
Raw Wayland? No. Why would I? That is what GUI toolkits such as Qt are for.

Heck, I run X11 on the desktop and the notebook, not Wayland. Only the PinePhone runs Wayland because Plasma Mobile supports only Wayland. But I am not writing raw X11 apps either.

(05-24-2023, 03:21 AM)WhiteHexagon Wrote: I have a lot to learn switching away from Android/iOS were mostly it is just a 'click to generate template app'
Well, you cannot compare developing using mainstream technologies with developing using niche tools (in an even more unlikely combination). It is really comparing apples to oranges.

If you write a Qt application in C++ and/or QML using KDevelop or Qt Creator, you will find templates and other convenience features.
  Reply
#19
(05-24-2023, 04:49 AM)WhiteHexagon Wrote: how does it map to the lvgldemo.c 'main' function?

Let's walk through the steps from NuttX Startup to our LVGL Demo (lvgldemo_main)...

NuttX Boot Sequence: Part 1

NuttX Boot Sequence: Part 2

Then nx_bringup calls...

nx_create_initthread, which calls...

- nx_start_application, which calls...

CONFIG_INIT_ENTRYNAME, which maps to...

- lvgldemo_main

Which starts our LVGL Demo App. Yeah sorry for the long call chain :-)

(05-24-2023, 04:49 AM)WhiteHexagon Wrote: btw I found using the PP without battery seems to be the optimal way to develop?

Yep it probably works fine for LVGL Apps. But later when we test the LTE Modem, it won't work because the LTE Modem is powered directly by the battery :-)
  Reply
#20
@lupyuen Thanks! and now I see that there is a '_main' appended to the demo name, which explains how 'lvgldemo_main' is used, rather than just 'lvgldemo' . And because vscodium was confused, or not setup correctly by me Smile it was not showing me the link between the 'widgets' parameter, and the function prototype and implementation. ie. the search for 'lv_demo_widgets' was only showing me the mapping. Step-by-step I start to follow Smile Next I will take a look at the Zig demo you mentioned, thanks again! and sorry I am so slow with it all, it has been many years since I last worked on a large C code base, so thank you for your patience and explanations.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 33 24,398 04-09-2024, 01:17 PM
Last Post: donchurch
Wink PINEPHONE not booting Touchwood 2 403 02-23-2024, 07:27 AM
Last Post: Touchwood
  Slack on PinePhone Adam Seline 5 5,327 12-20-2023, 07:20 AM
Last Post: nickolas
  Struggle to install LibreOffice on the PinePhone Peter Gamma 48 24,023 11-24-2023, 07:02 AM
Last Post: Peter Gamma
  Which word processor to choose for the Pinephone? Peter Gamma 8 1,923 11-23-2023, 01:06 AM
Last Post: Peter Gamma
  openSUSE for Pinephone Alefnode 75 101,182 11-17-2023, 08:37 AM
Last Post: Uturn
  Using Signal on PinePhone in mid-2023? dante404 45 12,852 11-17-2023, 04:23 AM
Last Post: Kevin Kofler
  Genode- Sculpt OS for the PinePhone (non Linux) Surehand53 1 947 11-04-2023, 07:23 PM
Last Post: tllim
  Abiword as a office mobile word processor for the Pinephone? Peter Gamma 11 2,121 10-24-2023, 08:57 AM
Last Post: Peter Gamma
  What File Manager Options Are There For The Pinephone? pinephoneuser22 7 2,338 10-18-2023, 08:37 AM
Last Post: luppivega

Forum Jump:


Users browsing this thread: 1 Guest(s)