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

Dynamic App Loader Helper #387

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

viswajith-g
Copy link

This PR introduces the helper app to validate the kernel's dynamic process loading functionality (tock/tock#3941). The helper app triggers the dynamic process loading with a button press.

This application is located in /examples/tests/app_loader and was tested on the nRF52840DK. A previous version of the dynamic process loader was tested with the same application on an Imix board as well.

uint32_t app_size = 0; // variable to store app size

// Tock Application Binary to be flashed.
const uint8_t app_binary[] = {0x2, 0x0, 0x34, 0x0, 0x0, 0x8, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xD7, 0x75, 0x50, 0x6E,
Copy link
Contributor

Choose a reason for hiding this comment

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

This application can build for any architecture. How does this data then work?

}

for (uint32_t offset = 0; offset < write_count; offset++) {
memcpy(write_buffer, &app_binary[FLASH_BUFFER_SIZE * offset], FLASH_BUFFER_SIZE); // copy binary to write buffer
Copy link
Contributor

Choose a reason for hiding this comment

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

What if app_binary isn't a multiple of FLASH_BUFFER_SIZE?

@ppannuto ppannuto added the blocked-on-kernel Waiting for parallel changes in the kernel to stabilize label Oct 9, 2024
viswajith-g and others added 5 commits February 1, 2025 18:40
this app sends the tab file of an app that needs to be flashed to the capsule. once the app binary is written to flash, the userland app requests kernel to load the app.
… in internal/binaries.c.

cleaned up and formatted

removed old code

removed userspace code from a previous implementation that was giving rise to confusion.

added comments to app_loader.h

added binaries headers and updated code

added binaries in external files to make the app file more readable. Added a new subscribe and callback to support the async setup

update readme
added tock-dpl-hello and tock-welcomes-dpl. The first app is a simple c_hello analog that prints a message and terminates on boot. The second app is a helper app that installs tock-dpl-hello on the board during runtime. These apps were made to test the dynamic process loading using hw-ci.
@bradjc
Copy link
Contributor

bradjc commented Feb 12, 2025

Can you rebase this on master and

  • move the syscall wrappers to their own file
  • move app_binaries and the python script to the test directory

@viswajith-g
Copy link
Author

viswajith-g commented Feb 12, 2025

Can you rebase this on master and

I believe the repo was already rebased on master last time i pushed it.

  • move the syscall wrappers to their own file

Done. I also renamed the functions to start with libtock_ to keep in line with the other the new libtock format.

  • move app_binaries and the python script to the test directory

Done

@@ -0,0 +1,1304 @@
#include <examples/tests/app_loader/button-press-loading/app_binaries.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <examples/tests/app_loader/button-press-loading/app_binaries.h>
#include "app_binaries.h"

Copy link
Contributor

Choose a reason for hiding this comment

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

Move these to libtock/kernel

Comment on lines 2 to 7
// #include "libtock/tock.h"

// bool libtock_app_loader_exists(void) {
// syscall_return_t res = command(DRIVER_NUM_APP_LOADER, 0, 0, 0);
// return tock_command_return_novalue_to_returncode(res);
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// #include "libtock/tock.h"
// bool libtock_app_loader_exists(void) {
// syscall_return_t res = command(DRIVER_NUM_APP_LOADER, 0, 0, 0);
// return tock_command_return_novalue_to_returncode(res);
// }

lvgl/lvgl Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this change.

Copy link
Author

Choose a reason for hiding this comment

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

i did not touch this though?

Copy link
Author

Choose a reason for hiding this comment

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

nvm i see it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-on-kernel Waiting for parallel changes in the kernel to stabilize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants