651 Commits

Author SHA1 Message Date
Arnaud Pouliquen
ece95f0e71 lib: system: template: remove template/sys.h for generic and freeRTOS
Declare sys_irq_enable() and sys_irq_enable() directly in
lib/system/@PROJECT_SYSTEM@/sys.h.
This allows to declare the machine out of tree of the libmetal but
also to support the in-tree template.

[minor style fix by tanmay]

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2026-02-04 11:32:12 +01:00
Tanmay Shah
9c593d7a95 lib: freertos: remove xlnx vendor directory
This directory was removed and re-inroduced by mistake, and should
not exists in the libmetal.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2026-02-04 11:32:12 +01:00
Tanmay Shah
90d19dc759 libmetal: cmake: support machine less build
libmetal can be build without any machine support. It is possible that
vendors implement machine specific interfaces outside of libmetal and
link it with demos during build time. Hence, remove requirement to have
MACHINE and PROJECT_MACHINE variables from the build system. If vendor
prefer to choose 'template' machine, they can pass such option during
cmake configuration.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2026-02-04 11:32:12 +01:00
Arnaud Pouliquen
9196a664c4 CI: Update QEMU Xtensa board name
The board "qemu_xtensa" has been renamed to "qemu_xtensa/dc233c" and
deprecated in the Zephyr commit:
84c12ab5b5

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2026-01-20 08:57:28 +01:00
Bowen Wang
5bdf21a54f mutex: change the libmetal nuttx mutex to recursive mutex
To avoid the crash when lock are acquired twice, one case is in the
destory process:
we hold the rpdev->lock to iterate the rpdev->endpoints to destory all
the endpoints, but rpmsg_destroy_ept() may send the name service message,
and need acquire the rpdev->lock again to lead crash.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-13 11:26:31 +01:00
Arnaud Pouliquen
03f8145fb2 lib: Add missing file headers for doxygen generation
Add file header on missing .c and *h files to display brief
in documentation.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2026-01-13 10:33:04 +01:00
Arnaud Pouliquen
d3a27c1454 lib: fix file headers for doxygen generation
- start by "/**",
- fix file relative path,
- fix typos,

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2026-01-13 10:33:04 +01:00
Arnaud Pouliquen
f01d1bed03 CI: Update to Zephyr 4.3 and use default associated sdk
- bump to Zephyr 4.3
- use `west packages pip --install`
- use "west sdk install" command to install the expected sdk version.
- only install compilers used for CI tests.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-12-17 19:08:25 +01:00
Lefteris Ntafotis
1c3410be76 Add cross-platform tests for libmetal
To-be-expanded suite of tests for libmetal using
system-agnostic API instead of system specific tests.

Signed-off-by: Lefteris Ntafotis <lntaf@ics.forth.gr>
2025-11-04 15:13:26 +01:00
Lefteris Ntafotis
a0797a23a8 Add error message for testing API on Zephyr systems
Zephyr systems will print an error for unimplemented testing API calls

Signed-off-by: Lefteris Ntafotis <lntaf@ics.forth.gr>
2025-11-04 15:13:26 +01:00
Lefteris Ntafotis
795b1c88e4 Change to metal_test prefix for testing API
metal_run has been renamed to metal_test_run
metal_run_noblock has been renamed to metal_test_run_noblock
metal_finish_threads has been renamed to metal_test_finish_threads

Signed-off-by: Lefteris Ntafotis <lntaf@ics.forth.gr>
2025-11-04 15:13:26 +01:00
Arnaud Pouliquen
dbf9cf5286 release: libmetal 2025.10.0
Set library version to 1.9.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
v2025.10.0
2025-11-03 10:51:28 +01:00
Arnaud Pouliquen
9f749f092e lib: system: re-enable the support of the template machine
The template machine is used in:
cmake/platforms/template-generic.cmake
cmake/platforms/template-freertos.cmake

This reverts a part of:
commit 16493b179f ("lib: system: remove xlnx BSP specific code")

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-10-24 08:51:51 +02:00
Arnaud Pouliquen
2f01e7e793 lib: log: Fix documentation
Remove the related @return field from the documentation for functions
that do not return a value.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-10-21 10:43:48 +02:00
chao an
71c2fb3643 libmetal/nuttx: Update function prototype changes
clock_systime_timespec() always returns 0, so there is no need to
check the return value in the caller code, let us remove the return
value directly.

From:
        int clock_systime_timespec(FAR struct timespec *ts)
To:
        void clock_systime_timespec(FAR struct timespec *ts)

Fix build break:

libmetal/lib/system/nuttx/time.c: In function ‘metal_get_timestamp’:
libmetal/lib/system/nuttx/time.c:21:11:
  error: void value not ignored as it ought to be
   21 |         r = clock_systime_timespec(&tp);
      |           ^
make[1]: *** [Makefile:46: libmetal/lib/system/nuttx/time.o] Error 1

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-16 11:18:39 +02:00
Tanmay Shah
16493b179f lib: system: remove xlnx BSP specific code
libmetal is abstraction layer and vendor specific code should not be
maintained as part of libmetal. Instead common interfaces provided by
libmetal should be implemented by vendor BSP in downstream repos.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2025-07-29 09:58:58 +02:00
Huichun Feng
a19cfb3ff3 lib: system: linux: Remove redundant malloc'd addr release check
As the code path suggests, the pointer, ldev, at this point, can be
free'd directly w/o a check.  Remove the redundant check.

Signed-off-by: Huichun Feng <foxhoundsk.tw@gmail.com>
2025-07-15 09:30:12 +02:00
Fox Feng
fdc85ec742 lib: system: linux: Remove redundant memory validness check
In the function prologue, "ldev" has already been assigned a malloc'd
address, and a check has also been performed.  Remove this redundant
pointer validness check during each iteration. The second check was
also inherently misplaced because the it was not enclosed in the malloc
if-branch.

Signed-off-by: Fox Feng <foxhoundsk.tw@gmail.com>
Signed-off-by: Huichun Feng <foxhoundsk.tw@gmail.com>
2025-07-15 09:24:07 +02:00
Adel El-Rayyes
35c65e05b9 cmake: add public header files for CMake shared and static lib targets
For consumers who don't want to install libmetal it's more convenient to use
the CMake targets metal-static or metal-shared. However, they currently don't
bring the necessary include directories (In contrast to the Zephyr version
where the include directories are already exported via
`zephyr_include_directories(...)`

Signed-off-by: Adel El-Rayyes <aelray@gmail.com>
2025-06-30 16:53:38 +02:00
Andrew Davis
a2bf06dc3e lib: Remove system specific log.h files
Most of the system specific log.h files are empty, and those that
are not are only used by the internal log handling functions.
Remove the empty ones and do not expose the contents of the
internal ones outside of the compilation unit that uses them.

Signed-off-by: Andrew Davis <afd@ti.com>
2025-06-20 10:19:01 +02:00
Andrew Davis
41c83bcffd lib: Remove system specific irq.h files
Many of the system specific irq.h files are empty, and those that
are not are only used by the internal IRQ handling functions.
Remove the empty ones and do not expose the contents of the
internal ones outside of the compilation unit that uses them.

Signed-off-by: Andrew Davis <afd@ti.com>
2025-06-20 10:19:01 +02:00
Vincenzo Calabretta
96c7cd26dc system: linux: include missing headers
Do not rely on indirect includes since they may not be present on some
systems.

Signed-off-by: Vincenzo Calabretta <vincenzo.calabretta@embedded-brains.de>
2025-06-02 09:27:57 +02:00
Sebastian Huber
dcf121ab61 lib: optionally provide ATOMIC_VAR_INIT()
The ATOMIC_VAR_INIT() macro was deprecated in C17 and removed in C23.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2025-05-28 15:54:24 +02:00
Sipke Vriend
c86f48f19a doxygen: tell doxygen to generate xml
in order to use the sphinx breathe plugin in the OpenAMP/openamp-docs
repository we need to enable xml generation

Signed-off-by: Sipke Vriend <sipke@direktembedded.com>
2025-05-19 09:24:50 +02:00
Sipke Vriend
f2990d20da doxygen: tell doxygen to generate tag file for external linking
To allow for external links to doxygen generated content, tell doxygen
to build tags, so the tag file can be used for cross referencing
doxygen generated data.

Signed-off-by: Sipke Vriend <sipke@direktembedded.com>
2025-05-19 09:24:50 +02:00
Arnaud Pouliquen
36f87f9335 release: libmetal 2025.04.0
Set library version to 1.8.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
v2025.04.0
2025-05-05 09:28:49 +02:00
Arnaud Pouliquen
1c45553b68 CI: Update Zephyr known good versions
Bump to Zephyr 4.1 and Zephyr SDK 0.17.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-04-17 18:05:22 +02:00
Arnaud Pouliquen
9a21915a5f cmake: update cmake minimum support to 3.16
We currently support an old version of CMake (3.0.2) that was released
in 2018.

This requires adding specific policies to support the evolution to the
latest versions of Zephyr.

Update the minimum version to 3.16. The reason for this version is to
support environments such as Debian Bullseye that are still in LTS state.

By updating to CMake 3.16 as the minimum version, we can also clean up
the following policy add-ons:
- CMP0048 added in CMake v3.0
- CMP0053 added in CMake v3.1
- CMP0077 added in CMake v3.13

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2025-02-24 11:11:12 +01:00
Bill Mills
51719ef1da docs: update the readthedocs integration for PRs in this repo
Upstream Read The Docs has tightened up the schema checking and this broke
what we were doing for PRs.

A good number of things were tried but the best compromise is to:
* supply a dummy sphinx config file in this repo
* override the default build command to use the openamp-docs dir

Also:
* add more documentation about what is going on
* lock to html only format.  PRs only do html anyway but make sure

Signed-off-by: Bill Mills <bill.mills@linaro.org>
2025-02-14 16:43:20 +01:00
Iuliana Prodan
961d0171a6 io: fix buffer overflow in metal_sys_io_mem_map()
In metal_sys_io_mem_map() if the I/O region size
is a multiple of (1<<page_shift) will result in a
buffer overflow in the for loop.

Therefore, adjust loop termination condition to
prevent accessing an out-of-bounds page.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2025-02-14 16:40:24 +01:00
Bowen Wang
465fcf018c lib: system: nuttx: change MUTEX_INITIALIZER to NXMUTEX_INITIALIZER
Now nuttx uses NXMUTEX_INITIALIZER to initialize the mutex, so updated.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-11-26 13:54:36 +01:00
Arnaud Pouliquen
f8a0e51aee release: libmetal 2024.10.0
Set library version to 1.7.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
v2024.10.0
2024-11-04 17:55:10 +01:00
Arnaud Pouliquen
289e4de876 lib: processor: hosted: Fix compilation warning in metal_cpu_yield
Fix cross inclusion between metal/sys.h and /processor/hosted/cpu.h

The fix consists in creating a cpu.c file to avoid inline declaration.

Issue reported by Zephyr twister CI test:

libmetal/lib/include/metal/processor/hosted/cpu.h:19:9:
error: implicit declaration of function ‘metal_wait_usec’
   19 |         metal_wait_usec(10);
      |         ^~~~~~~~~~~~~~~
libmetal/lib/include/metal/system/zephyr/sys.h:46:20:
error: conflicting types for ‘metal_wait_usec’; have ‘void(uint32_t)’
   46 | static inline void metal_wait_usec(uint32_t usec_to_wait)
      |                    ^~~~~~~~~~~~~~~
libmetal/lib/include/metal/processor/hosted/cpu.h:19:9:
note: previous implicit declaration of ‘metal_wait_usec’ with
type ‘void(uint32_t)’ {aka ‘void(unsigned int)’}
   19 |         metal_wait_usec(10);
      |         ^~~~~~~~~~~~~~~

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-10-25 23:23:01 +02:00
Yongrong Wang
7f351a5158 lib: fix compile error
lib/errno.h: defined(__ARMCC_VERSION) for use GCC compile
lib/autmoic:fix compiler error:
nuttx/include/metal/compiler/gcc/atomic.h:19:13: error: conflicting type
qualifiers for 'atomic_flag'
19 | typedef int atomic_flag;
| ^~~~~~~~~~~
In file included from nuttx/include/nuttx/net/netdev_lowerhalf.h:38,
from virtio/virtio-net.c:33:
prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/
stdatomic.h:233:3: note: previous declaration of 'atomic_flag' with
type 'atomic_flag'
233 | } atomic_flag;
| ^~~~~~~~~~~
nuttx/include/metal/compiler/gcc/atomic.h:20:14: error: conflicting
type qualifiers for 'atomic_char'
20 | typedef char atomic_char;
^~~~~~~~~~~

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-21 13:57:15 +02:00
Arnaud Pouliquen
1ed90fd967 lib: system: fix missing metal_yield API for generic systems.
The metal_yield API needs also to be declared for the baremetal systems.
This fix build issue in Open-amp for generic system:

/github/workspace/open-amp/lib/rpmsg/rpmsg_virtio.c:275:17:
error: implicit declaration of function 'metal_yield'
275 |                 metal_yield();
    |                 ^~~~~~~~~~~

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-10-21 10:50:58 +02:00
xuxin19
1112f2cdaf cmake: Don't check for stdatomic.h for NuttX platform
There is no need to use cmake include detection under NuttX platform.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-21 09:40:17 +02:00
Yongrong Wang
142c40321e lib: system: create a new libmetal API metal_yield
Define metal_yield in sys.h files is more flexible to manage this
in libmetal, metal_yield would be managed at the OS level and
dispatched to metal_cpu_yield, metal_sleep_usec, or others.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-21 09:17:06 +02:00
Yongrong Wang
e2c504f219 lib: system: nuttx: fix undeclared parameter compile error
Fix compile error:
/nuttx/openamp/libmetal/lib/system/nuttx/device.c:16:22: error:
'io' undeclared (first use in this function)
   16 |         metal_unused(io);
/nuttx/openamp/libmetal/lib/system/nuttx/device.c:14:53: error:
unused parameter 'dev' [-Werror=unused-parameter]
   14 | int metal_generic_dev_sys_open(struct metal_device *dev)
...

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-18 10:22:17 +02:00
Andrew Davis
0f0393503e lib: system: linux: Remove unneeded forward declaration
The declaration metal_linux_bus_close() is not needed, it is already
defined at this point.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Andrew Davis
6b0b1cbb1d lib: system: linux: Remove unused sysfs_path from metal_state
This is not used, remove to prevent failures related to getting a
path that is not needed.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Andrew Davis
13428794f1 lib: system: linux: Inline metal_mlock() function
This is a one-line one user internal function, just use mlock directly.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Andrew Davis
4202dd3563 lib: system: linux: Move metal_virt2phys() into shmem
This function is only used by shmem. Move it to where it is used to
reduce internal-only "API" functions.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Andrew Davis
af3a028338 lib: system: linux: Remove use of ENOSYS error code
This return code is for system calls only, and checkpatch warns about the
same. Remove the use of this return code.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Andrew Davis
efb8ade752 lib: system: linux: Remove unused internal functions
These functions are labeled METAL_INTERNAL so should have no external
users, but they are not used internally either. Remove these functions.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-18 09:12:43 +02:00
Bowen Wang
7969bed068 lib: system nuttx: include <stddef.h> in nuttx/io.c
Because nuttx/io.c use NULL and NULL is defined in <stddef.h>.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-18 09:03:16 +02:00
Rajiv Mohan
b691eee88f zynq: Remove support for Zynq-7000 SoC
Remove support for Zynq-7000 SoC, changes are
1. Remove Zynq7 tool chain support
2. Makefile changes to remove zynq7

Reasons to remove:
1. Removing redundant or unmaintained code
2. Reduce technical debt carried by OpenAMP team
3. very few customer using openamp on Zynq-7000 SoC

For using Zynq-7000 SoC support last working and tested
version is (v2023.04)
https://github.com/OpenAMP/libmetal/tree/v2023.04

Signed-off-by: Rajiv Mohan <rajiv.mohan@amd.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2024-10-14 11:51:18 +02:00
Bill Mills
a4bce35075 CI: Do Zephyr build tests on known good and latest versions
Allow Zephyr testing to either use locked known good values
or the very latest versions.

The known good versions are best for PR checking as if the build fails
it is almost always the PR itself that broke it.

The latest version is good for periodically checking compatibility with
the very latest Zephyr changes.

For now we run both on pushes and PRs.

We also run main against the latest zephyr check weekly as a look ahead.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
2024-09-20 14:15:58 +02:00
Bill Mills
64c1a16131 CI: fix zephyr build for v3.7 and later
The current CI uses the latest from main for zephyr build tests.
This has been broken sometime after v3.6 and before v3.7. Since that
time, use of GNU style constructors requires a kconfig value to be
defined.  This same kconfig value will cause an error in v3.6 or earlier.

The test framework intentionally uses GNU constructors for the base level
of its framework and version.c uses this to register its test.

The test/system/zephyr/ level overrides the default META_ADD_TEST() macro
and creates unique functions that main.c then calls explicitly in function
metal_test_add_functions().

Thus, right now the only constructor used if for version.c but it still
intentionally used.

Since we use the latest for CI, define the value so CI will complete.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
2024-08-26 18:31:00 +02:00
Ben Levinsky
5c36d6b9c1 examples: xlnx: Change machine name to be SOC agnostic
Match examples to lib CMake machine name change

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
2024-08-15 06:55:16 -04:00
Ben Levinsky
3e8be081fc cmake: platforms: xlnx: Add PROJECT_VENDOR
Add PROJECT_VENDOR to Xilinx-AMD .cmake platform files.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
2024-08-15 06:55:16 -04:00