79 Commits

Author SHA1 Message Date
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
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
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
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
Arnaud Pouliquen
9fe00e0582 Remove vim editor configuration in files
Remove all remaining instances of "# vim: ..." in files.
This vim settings were part of the initial commit. But no reason
to keep them.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-17 09:02:59 +02:00
Alberto Escolar Piedras
2dc45613f1 Fix Zephyr testcase with latest Zephyr
In Zephyr PR #63351 , commit:
a35e40f410750f3205f0d87489aa0dfa4006e1d3
Support for k_mem_block was removed which was used
by this Zephyr test.

Update the tets to just use a void* (which is what should be
used instead).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-16 10:00:41 +02:00
Gerard Marull-Paretas
e9d4531300 zephyr: update include paths to use <zephyr/...>
Zephyr has prefixed all of its includes with <zephyr/...>. While the old
mode can still be used (CONFIG_LEGACY_INCLUDE_PATH) and is still enabled
by default, it's better to be prepared for its removal in the future.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-05-16 10:27:20 +02:00
Luz Paz
210b9ec37a Fix various typos
Found via `codespell -q 3 -S ./scripts/spelling.txt`

Signed-off-by: luz paz <luzpaz@users.noreply.github.com>
2022-01-04 10:05:40 +01:00
Arnaud Pouliquen
63ffcdd958 test: zephyr: fix 'errno' undeclared
The return value should be negative.
Added inclusion of errno.h to avoid an unresolved symbol
error when linking the  test.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2021-10-20 09:05:25 +02:00
Arnaud Pouliquen
a352cc678a test: Zephyr: replace k_mem_pool deprecated API
Since Zephyr2.4.0 the k_mem_pool is deprecated and replaced by k_heap

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2020-12-15 12:30:56 -08:00
Arnaud Pouliquen
75e36524f6 Update exemple and tests to include metal/errno.h
Modify all the libmetal exemples and tests file to include <metal/errno.h>
instead of <errno.h>

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-12-10 16:49:59 +01:00
Ed Mooring
b077d0d308 Xilinx: Make xilmem and xilstandalone library linkage conditional.
In v2019.1, the xilmem and xilstandalone libraries were removed from
the standalone Xilinx BSP for the R5. This change adds a CMake
variable, XILINX_PRE_V2019, to conditionally add these libraries
to the link command for use with older BSPs.

Signed-off-by: Ed Mooring <ed.mooring@linaro.org>
2020-10-21 16:10:12 +02:00
Arnaud Pouliquen
53c48a1e48 test: fix zephyr test
Fix zephyr test for zephyr V2.2 compatibility.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-10-16 11:48:32 +02:00
Ed Mooring
30af011301 FreeRTOS: fix sleep and timestamp handling
libmetal's libmetal_sleep_usec() takes a sleep time in micro-seconds.
The FreeRTOS function underlying it takes a sleep time in task ticks.
This was not properly corrected for, resulting in sleep times that
were off by an order of magnitude. The test code attempted to
correct for this as well, in the same wrong way.

Lastly, the metal_get_timestamp() function returned a value in
task ticks alone. This is a configuration dependent value.

This patch changes all three places to use microseconds for the
input and output values.

Signed-off-by: Ed Mooring <ed.mooring@linaro.org>
2020-10-15 11:26:36 +02:00
Simon Leiner
5cae751afe Use metal_asm instead of asm and __asm__
This enables GCC compilation in strict mode (-std=c11 -pedantic)

Signed-off-by: Simon Leiner <simon@leiner.me>
2020-09-07 10:25:35 +02:00
Arnaud Pouliquen
a23cd575f7 test: fix mlock allocation fail
During test we try to lock more memory than the limit
permitted.
This results in following traces:

metal: warning: failed to mlock shmem - Cannot allocate memory
metal: error: pagemap page not present, 3fd7560fd0 -> 80000000000000
metal: error: pagemap page not present, 3fd7560fd8 -> 80000000000000
metal: error: pagemap page not present, 3fd7560fe0 -> 80000000000000
metal: error: pagemap page not present, 3fd7560fe8 -> 80000000000000
[...]

This patch decreases the size of the shem to avoid to reach the limit

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-04-10 14:29:48 +02:00
Wendy Liang
f9094f1f79 zynqmp_r5: Update required xilinx libraries
Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-03-07 02:18:58 -06:00
Wendy Liang
f53c664db1 test: freertos: irq: remove dev from irq registration
Remove metal dev from irq registration

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:36 -08:00
Wendy Liang
2a5a21f3d3 test: generic: irq: remove dev from irq registration
Remove metal dev from irq registration

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:36 -08:00
Wendy Liang
2033267d24 test: linux: irq: remove dev from irq registration
Remove metal dev from irq registration

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:35 -08:00
Wendy Liang
3ec3b526e3 test: freertos: irq: remove checking irq registration for 2nd time
The API allows user to register IRQ handling after the 1st
registration.
It will be up to the user to make sure there is no double
registration.
Remove the checking from the unit test.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:35 -08:00
Wendy Liang
8841b9c99a test: generic: irq: remove checking irq registration for 2nd time
The API allows user to register IRQ handling after the 1st
registration.
It will be up to the user to make sure there is no double
registration.
Remove the checking from the unit test.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:34 -08:00
Wendy Liang
59e7e4c97c test: linux: irq: remove checking irq registration for 2nd time
The API allows user to register IRQ handling after the 1st registration.
It will be up to the user to make sure there is no double registration.
Remove the checking from the unit test.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-31 09:57:34 -08:00
Wendy Liang
d5e2182ac8 test: zephyr: remove IRQ
As Zephyr's IRQ infrastructure is not lined up with libmetal
IRQ infrastructure. And the drivers in Zephyr declare ISR
at compile time, we can have libmetal IRQ handling on top of
of Zephyr, but it will introduce unnecessary overhead.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-30 10:46:37 -08:00
Wendy Liang
b5ffad0f7d test: linux: irq: cleanup before return
Finish cleaning up before return even if the IRQ test passed.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-30 10:46:37 -08:00
Wendy Liang
7a2950098f test: update irq test for irq registration API change
The IRQ registration API has been updated to support single
handler per IRQ. The IRQ test is updated for this change.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
2019-01-30 10:46:37 -08:00
Wendy Liang
9520117eee Covert license text to use SPDX tags
Replace the license text with SPDX tags

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2018-04-09 23:51:01 -07:00
Kumar Gala
95526e280b tests: zephyr: use default params for test
Now that we have a a zephyr specific METAL_INIT_DEFAULTS we can just
use the default param passed to metal_init like all the other systems do
rather than specifying a unique metal_params to Zephyr.  This gets the
Zephyr logger used for output.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-04-09 14:22:46 -05:00
Kristian Klomsten Skordal
1114a0754a test: remove the Zephyr log handler from test
Removes the custom log handler provided by the Zephyr test application.

Signed-off-by: Kristian Klomsten Skordal <kristian.skordal@nordicsemi.no>
2018-04-05 10:19:22 -07:00
Kumar Gala
3161b1fe07 mutex: cleanup how we init mutexes
There are assumptions that one could directly assign a value to init a
mutex which shouldn't be made.  Instead we should use the
metal_mutex_init call to setup the mutex.  Also for static or global
defines of a mutex we need a way to set them up.  So we introduce
METAL_MUTEX_DEFINE(m) for that case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-03-30 05:45:33 -05:00
Wendy Liang
eb22bae5b8 Fix license text for files in lib/system/zephyr
Put Linaro to the license text in the files of libmetal
Zephyr implementation.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2018-03-27 10:44:00 -07:00
Ben Levinsky
6def9e654e test: generic: add microblaze unit tests
In microblaze unit tests also provide setup for
axi interrupt controller and self test the controller

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
2018-01-16 13:55:17 -08:00
Wendy Liang
1901f5c119 test: Add zephyr test
Add Zephyr system to libmetal test.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-12-30 22:01:44 -08:00
Wendy Liang
63f83a198c test: Add metal init params input argument
As different system may need different metal init parameters.
E.g. not every system has printf.
Add metal init params as input argument to metal_tests_run().

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-12-19 15:34:53 -08:00
Wendy Liang
9b890fb11a test: generic: zynqmp_r5: use TCM only in linker script
Use TCM only for RPU libmetal test.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-12-14 16:32:06 -08:00
Wendy Liang
a7b357357b change metal include from "metal/xxx.h" to <metal/xxx.h>
This change will save compilation time from looking into the directory
containing the current file for the header files.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-12-13 22:34:01 -08:00
Sam Sortais
492e092dc4 Linux: add irq unit tests
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-12-06 15:24:10 -08:00
Sam Sortais
28c1eab35c FreeRTOS: Update irq unit tests to use irq_unregister
Unit tests are rewritten to use metal_irq_unregister(),
and to provide better coverage of the API.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-12-06 15:24:10 -08:00
Sam Sortais
5e9b612b7a generic: Update irq unit tests to use irq_unregister
Unit tests are rewritten to use metal_irq_unregister(),
and to provide better coverage of the API.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-12-06 15:24:09 -08:00
Wendy Liang
106f5b516c Clean up license text in examples/ and test/
There were three types of license text in some files in examples/
and test/. This patch is to clean those license text and only use
BSD license text.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-11-28 15:35:24 -08:00
Ben Levinsky
d2182483fd test: generic: main.c: Remove ARM specific implementation
Replace arm-specific instruction with externally defined
function for polling.

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-11-06 11:33:49 -08:00
Sam Sortais
b4b758a489 quiet compiler warning in Release mode
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-07-14 11:08:08 -07:00
Sam Sortais
50aa8a55dd zynqmp_r5 test: use ddr to get more space
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-07-12 04:15:10 -07:00
Sam Sortais
4c5d747de2 zynqmp_a53 test freertos: initial support
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-07-12 04:09:36 -07:00
Sam Sortais
c4799911ad zynqmp_a53 test generic: initial
Add unit tests.

Signed-off-by: Sai Krishna Potthuri <lakshmis@xilinx.com>
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-07-12 04:09:36 -07:00
Wendy Liang
f7f49b5269 log: rename log levels
rename enum log levels.
some system header files have predefined LOG_XXXX
e.g. syslog.h
We add METAL_ prefix to the libmetal logging levels.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-07-07 15:20:45 -07:00
Sam Sortais
3e935be834 irq test: include missing MAX_IRQS
Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
2017-06-07 14:32:44 -07:00
Wendy Liang
591aeecd60 test: linux: threads: initialize return var
in metal_run_noblock(), error is not initialized. In the end of
the function, it will return this var. 6.2 toolchain complains
the 'error" may be used uninitialized during compilation.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
2017-01-17 15:39:42 -08:00