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

lmdk: How to convert and build loadable modules #488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pjdobrowolski
Copy link
Contributor

@pjdobrowolski pjdobrowolski commented Mar 5, 2024

How to tutorial how to build modules and create headers pack needed for needs of lmdk. Process is described and based on dummy module already available in the sof project.

@@ -7,10 +7,65 @@ What is LMDK
************
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a little bit of context in the commit message. 'Howto tutorial' is not really adding much value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would be easier if build and deploying step worked in CI. However I added richer description I hope that I would be more helpfull.

How to tutorial descibing process of building and creating headers pack
for needs of lmdk.

Signed-off-by: Dobrowolski, PawelX <[email protected]>
Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

This is too much of a developer cheat-sheet and not really a documentation. I wasn't able to understand any of the sections.

How to prepare MODULE to be loadable
************************************

Loadable modules are using functions provided by native_system_services which are narrowed to only neccesary and safe functions. For example all dynamic allocations are done on strict size local heap_mem
Copy link
Member

Choose a reason for hiding this comment

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

what is the definition of 'safe' in this context?


.. code-block:: c

DECLARE_LOADABLE_MODULE_API_VERSION(dummy);
Copy link
Member

Choose a reason for hiding this comment

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

avoid this term.
mockup or example?

Copy link
Contributor

Choose a reason for hiding this comment

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

Stub, placeholder, example

{
system_service = *(const struct native_system_agent**)mod_ptr;

return &up_down_mixer_interface;
Copy link
Member

Choose a reason for hiding this comment

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

haha that's interesting, I was told this component is deprecated...

Choose a reason for hiding this comment

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

@plbossart I don't understand, can you elaborate?

__attribute__((section(".module")))
const struct sof_man_module_manifest dummy_module_manifest = {
.module = {
.name = "DUMMY",
Copy link
Member

Choose a reason for hiding this comment

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

Example_module or something

How to build
************
Designers of lmdk prepared two options of building loadable modules. Using them is depend from needs.
Copy link
Member

Choose a reason for hiding this comment

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

consider rewording, this does not read well.

How to build
************
Designers of lmdk prepared two options of building loadable modules. Using them is depend from needs.
Copy link
Member

Choose a reason for hiding this comment

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

Also explain which one should be use when. You are just listing two solutions without any explanations on pros/cons.

static struct native_system_service_api* system_service;
uint32_t heap_mem[2048] __attribute__((section(".heap_mem"))) __attribute__((aligned(4096)));

Each module also has to declare as a loadable and has prepared manifest which is specific for each.
Copy link
Member

Choose a reason for hiding this comment

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

where is that manifest?

$ python scripts/lmdk/libraries_build.py -l dummy -k "/path/to/signing/key.pem"

Latest headers pack is being deployed with FW and its versioning is keept in sof\src\include\module\module\api_ver.h . Every change in headers must be marked in that header(todo: automation).
Creating deployment header pack is done by calling:
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what a 'headers pack' means.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@pjdobrowolski ping, any updates on open from @plbossart ?

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.

6 participants