Commit Graph

21 Commits

Author SHA1 Message Date
Serhiy Katsyuba 7bd1953e63 lmdk: Fix linker script
Specifying 0 address for .module section results in few GB binary file.
Instead, put .module section near .text or .rodata.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2024-08-05 18:56:56 +01:00
Serhiy Katsyuba de05d6d955 lmdk: Fix compilation of smart_amp_test example
Fixes compilation error when building smart_amp_test as loadable module
using LMDK.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2024-08-05 18:56:56 +01:00
Serhiy Katsyuba 3db25dee7c lmdk: Fix typo in README.md
Fixes typo in README.md.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2024-08-05 18:56:56 +01:00
Adrian Warecki 5acb38d889 lmdk: dummy: Remove unused api version definitions
The API version used by the module is defined in the module api version
header file. The definitions in CMakeLists.txt are no longer needed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-02-19 14:31:09 +00:00
Rander Wang 68c63571fd lmdk: add dummy loadable smart amp support
It will be built will __SOF_MODULE_SERVICE_BUILD__ enabled

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-12-15 09:46:37 +00:00
Guennadi Liakhovetski 2c450e69fa loadable module: don't define PHDR twice
Loadable modules are linked, using a linked script, built by a cmake
script. That linker script includes multiple existing linker script
fragments. Each of those fragments defines 1 or more sections and
respective PHDRs. However, some of those scripts, e.g.
common_rodata_linker_script.txt and data_linker_script.txt add
sections to the same rodata_phdr PHDR. This makes the linker
allocate sections in that PHDR twice in the resulting output file:
one copy is real and the other one is filled with zeros. Removing
one of the PHDR definitions solves the problem and removes about
60KiB of empty space from the output file.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-15 09:46:37 +00:00
Adrian Warecki 4509d7c0c0 lmdk: Update dummy module example
Updated dummy module example to use DECLARE_LOADABLE_MODULE_API_VERSION
macro.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 16:45:15 +02:00
Adrian Warecki cb1542dd51 lmdk: Fix build of module common functions
CMakeLists.txt file of common modules files use isZephyr macro which was
undefined on lmdk build scripts.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 16:45:15 +02:00
Adrian Warecki f1aaca8b85 lmdk: build: Add missing -l parameter to rimage
Added missing -l parameter in rimage command line to indicate signing of
a loadable module.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 16:45:15 +02:00
Adrian Warecki 98cc689232 module: module_adapter: lmdk: Improved module type detection
Defined API version used by a FDK modules. Created the
DECLARE_LOADABLE_MODULE_API_VERSION macro with which the loadable modules
can easily declare the version of used API. Improved module type
recognition. Now the type is recognized based on the value of the format
field instead of the API version. Added check for compatibility of API
version used by module.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 16:45:15 +02:00
Adrian Warecki 4d4421a046 lmdk: Build module common functions
Added building a static library containing common functions for modules
provided by sof. Native loadable modules are statically linked to it.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-24 16:17:46 +00:00
Adrian Warecki f3e0959472 lmdk: module: Use extracted module headers in lmdk
Use of a separated module headers when building native loadable libraries.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-24 16:17:46 +00:00
Adrian Warecki 3bd9991121 lmdk: Instruct linker to keep .buildinfo section
At the beginning of the .text section there must be a structure containing
information about the version of the api used by the library. It's absence
will cause sof to interpret a random literal as a version and incorrectly
load a library.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki 0c2069c2c3 lmdk: Remove content of the .module section from final module image
The .module section contains the module manifest read by rimage. It should
not be included in the final loadable module image. Flags of this section
are now modified using objcopy to ignore it by rimage.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki d0931d3af5 lmdk: Remove align of .rodata section
The .data and .rodata sections are placed by rimage into one segment of
a resulting firmware image. So aligning the .rodata section to the page
boundary is just a waste of memory.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki 581cfdf3cc lmdk: Enable linking with standard libraries
Changed linker options to enable linking with libgcc and libc. This change
is required to allow use compiler builtins functions (like __divdi3) and
dynamic memory allocation functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki ad2123dd42 lmdk: Add support for dynamic memory allocation by a loadable modules
This commit adds a necessary symbols in the linker script which allows use
a memory allocation functions from libc (malloc, calloc, etc.) in loadable
modules.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki 1b3403a4a9 lmdk: Update rimage include path
As rimage was moved to sof repository it is necessary to update path to
rimage include directory in lmdk build system.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Adrian Warecki 294a4b94b1 lmdk: Switch to a clang compiler
Changed the compiler used to build loadable modules to clang. It has been
used for a long time to build sof. The latest xtensa toolchain no longer
has xcc compiler.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Andrey Borisovich a675edf8e7 LMDK: fixed rimage and key paths and discovery
Path to rimage and private key had been failing to be used while
provided in form of relative path using dots.
Changed how rimage is discovered in the scripts:
* rimage is searched for using find_program with paths and hints provided
* changed RIMAGE_COMMAND to RIMAGE_INSTALL_DIR so end-user may specify
directory where rimage executable is placed. It will be used by
find_program.
* If RIMAGE_INSTALL_DIR is not provided, find_program will try to
search for rimage in the directory where SOF project installs it
(west_dir/build-rimage).
* Updated README.md with instructions on how to build:
  - simplified configure and build commands
  - updated explanations on how to use RIMAGE_INSTALL_DIR
  - added information on how to use toolchain file
* private key path was parsed incorrectly when provided windows path
style using backslashes. It was passed to rimage as is resulting in the
invalid path as the last slash was made by rimage as forward slash.
Added path normalization what fixed the problem.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-05-16 14:04:32 +03:00
Serhiy Katsyuba c00354b46d LMDK: Loadable Modules Dev Kit build scripts
Initial commit with set of cmake and linker scripts to build loadable
modules binary.

Things yet TODO:
  add all necessary Dev Kit header files to include dir,
  replace dummy example with somewhat useful module example.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-05-12 10:56:34 +02:00