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

cLvgl: add template to run lvgl widget demo #270

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

EDGEMTech-GabrielC
Copy link

Provides a template to run LVGL widget demo.

@EDGEMTech-GabrielC
Copy link
Author

Please I have a question. Right now, the template is almost ready. The only last problem I have is that I must embed in a way LVGL repository. I don't think it is a good idea to embed it in the repository and I'd like to know the best way to get this library available to build the application. Any idea ?

@andreriesco
Copy link
Collaborator

Hello @EDGEMTech-GabrielC, one way you could do this is by adding a script that downloads/prepares this repo in the workspace, and than add it's path on the installDepsScrips of the .conf/deps.json file, similar to what is done here in the Mono template

- Update templates.json so that LVGL appears as a choice
- Update tasks.json to fetch LVGL from github if needed
- Simplify + cleanup CMakeLists.txt - hardcode to /dev/fb0
- Provide default configuration lv_conf.h
- Update launch.json so that executable is debugged on the device
ports:
- ${DEBUG_SSH_PORT}:${DEBUG_SSH_PORT}
devices:
- /dev/fb0:/dev/fb0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here I think that would be better use the cgroups rules:

# Add device access rights through cgroup...
    device_cgroup_rules:
      # ... for tty
      - "c 4:* rmw"
      # ... for /dev/input devices
      - "c 13:* rmw"
      # ... for /dev/dri devices
      - "c 226:* rmw"
      - "c 199:* rmw"
      # ... for /dev/fb0
      - "c 29:* rmw"

and share the /dev:

volumes:
      - type: bind
        source: /dev
        target: /dev



# BUILD ------------------------------------------------------------------------
FROM commontorizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not use commontorizon/ images anymore, so here should be torizon/debian-croos-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG}



# BUILD ------------------------------------------------------------------------
FROM commontorizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} AS build
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too, please use torizon/ instead commontorizon/

# Deploy Step
##
FROM --platform=linux/${IMAGE_ARCH} \
commontorizon/debian:${BASE_VERSION} AS debug
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too, use torizon/ instead commontorizon/

Xwo3iUUCgYEAo/27Qkb5nOdL8sJwFggDrdB1pPrxXN20KmYCJF1P9wPDhnj1fJ7+
0Z/56XYzPA2rQx0vf5idvoGQ3KZS7QkOClLtcyevH3b38fnmAqv+dPLRHmrSd+3G
BspdMlr3rwZK8RKwXjDzLYpwSvjmf7PTGTPO3C7WTzg+m0U9RbSJKi4=
-----END RSA PRIVATE KEY-----
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file can be dropped, we stopped to use this file, this way is better to maintain different projects without need to duplication of this file.

@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqlRo5rqL9NpIrCl2wfMt8Yr3l0NwVimZgfmFSPRwGFURV2XwkAbQwQNxmyNAeIGV9SIebJTaI5YGgpTK2kyfNgXqCB1kG/mEEy/dFxOWc2KPHPGAq9uNObcuoBjy67hIX0jygNdU6fvHBliCILuzddEY4/pOjBJUQewsH5x6FazhjmKjcGeA6Vw5hm1WuH6LcDvFIdY/ufYh60kSjkLjbmho4JldQlPZ6Bq7o4Oa8Ei1mOkaY13BXCsQjYfej4ssj22J41/IVxQU80NFduS7VXSZdT1WNntYWKFlehvXVc0ISRjsGDdKnNOe1JGf2FkPuLfENT0xInP3SuefnogPX
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file can be also dropped.

@microhobby
Copy link
Collaborator

Hey @EDGEMTech-GabrielC thanks for the contribution, please take a look on the comments and suggestions. Let's us know if you have any doubt or other suggestions.

@microhobby microhobby added the new-template Adding a new template label Nov 13, 2024
"version": "2.0.0",
"tasks": [
{
"label": "get-lvgl-lib",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was smart, I liked it. I would only add the following:

            "runOptions": {
                "runOn": "folderOpen"
            },

so, the user will have the code completion from the beginning.

{
"name": "__change__",
"includePath": [
"${workspaceFolder}/includes/**",
Copy link
Collaborator

Choose a reason for hiding this comment

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

To have the code completion for the lib I need to add the following:

"${workspaceFolder}/lib/**",
"${workspaceFolder}/src/**",

This make sense?

Comment on lines +4 to +28
{
"name": "Local AMD64",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build-local/bin/main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "build-debug-local"
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would drop this one, because as this is using the framebuffer would not be good to mess up with the local desktop /dev/fb0, or there is an easy way to run it local with some "virtual display"?

@microhobby
Copy link
Collaborator

microhobby commented Nov 13, 2024

Hey @EDGEMTech-GabrielC I addressed some of the comments above on https://github.com/microhobby/vscode-torizon-templates/tree/add-cLvgl-template , so take a look if these make sense for you, if yes please add the commits on your branch, or give me the access to push it to your repo. Thanks!

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

Successfully merging this pull request may close these issues.

4 participants