Commit Graph

25 Commits

Author SHA1 Message Date
Gerard Marull-Paretas 1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Filip Kokosinski 491f27455e tests: mark testcases with `pm` where `CONFIG_PM=y` is forced
This commit marks testcases that require working Power Managament with
the appropriate `pm` tag to allow proper testcase filtering in the board
YAML file.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-04-04 13:34:45 +02:00
Kumar Gala 4f0166088c tests: move to using CONFIG_MP_MAX_NUM_CPUS
For tests that set CONFIG_MP_NUM_CPUS, switch to using
CONFIG_MP_MAX_NUM_CPUS instead as we work to phase out
CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-20 22:04:10 +09:00
Stephanos Ioannidis e846a18cae tests: benchmarks: footprint: Migrate to K_THREAD_STACK_DECLARE
This commit updates all deprecated `K_THREAD_STACK_EXTERN` macro usages
to use the `K_THREAD_STACK_DECLARE` macro instead.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:25:52 +02:00
Gerard Marull-Paretas 74ed64139c tests: remove redundant <zephyr/zephyr.h> includes
Files including <zephyr/kernel.h> do not have to include
<zephyr/zephyr.h>, a shim to <zephyr/kernel.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:13:11 +02:00
Yuval Peress 86cadf9283 ztest: Fix userspace ztests in new API
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.

Fixes #44108

Signed-off-by: Yuval Peress <peress@google.com>
2022-05-25 11:20:13 +09:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Keith Packard 6f9f8c1e32 samples, tests: Add z_libc_partition to all test domains
When a memory domain is initialized, the z_libc_partition must be
included so that critical libc-related data can be accessed.

On ARM processors without TPIDRURO when THREAD_LOCAL_STORAGE is enabled,
this includes the TLS base pointer, which is used for several
thread-local variables in the kernel.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-28 11:09:01 +09:00
Gerard Marull-Paretas ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Daniel Leung fb91ce2e21 kernel: mem_domain: init function to return error values
This changes k_mem_domain_init() to return error values
instead of asserting when errors are encountered.
This gives applications a chance to recover if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-22 12:45:22 -05:00
Gerard Marull-Paretas 39f21dc116 tests: pm: use new PM macros
Use PM_DEVICE_STATE_DEFINE to define PM state.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Gerard Marull-Paretas 18519ffe8d tests: use common PM action callback naming
The PM callback is no longer referenced as "pm_control" but
"pm_action_cb", so reflect this new naming on the callbacks.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas 1cee284a46 pm: device: runtime: use pm_device_runtime* namespace
Move all PM device runtime API calls from pm_device* to the
pm_device_runtime* namespace.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Keith Short 031ff08bc6 tests: benchmark: Add power management to footprint
Add a build-only test to track footprint when enabling device power
management.

Signed-off-by: Keith Short <keithshort@google.com>
2021-10-26 19:44:15 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Anas Nashif 80116f1413 tests: benchmarks: footprints: this is not a test
Do not configure this as a test, this will change footprint drastically
and will skew results and tracking.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-27 12:15:14 -04:00
Daniel Leung e3ca3a0930 tests: benchmarks/footprints: update to new kwork API
This updates the footprints app to use the new kwork API.

Fixes #34104

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-08 02:48:16 -04:00
Ioannis Glaropoulos a31bd1539d tests: add missing CONFIG_TEST=y in test suites
In several test suites CONFIG_TEST was missing.
Define CONFIG_TEST=y, so testing-related Kconfig
options (depending on TEST) get switched-on.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-03-17 17:48:20 -04:00
Peter Bigot 692bac22f5 tests: footprint: fix thread start races
The test granted access to the user work queue stack from the user
work thread; this was done by k_work_user_queue_start() so was
unnecessary.  Document why it's ok to grant other access after the
work thread was started.

Fix a race condition where the non-work user thread might have started
before it was given access to the resources it needs.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-08 12:09:16 -05:00
Peter Bigot 4e3b92609b kernel: provide functional equivalent to old userspace work queue API
The new API cannot be used from userspace because it is not merely a
wrapper around existing userspace-capable objects (threads and
queues), but instead requires much more complex and lower-level access
to memory that can't be touched from userspace.  The vast majority of
work queue users are operating from privileged mode, so there's little
motivation to go through the pain and complexity of converting all
functions to system calls.

Copy the necessary pieces of the existing userspace work queue API out
and expose them with new names and types:

* k_work_handler_t becomes k_work_user_handler_t
* k_work becomes k_work_user
* k_work_q becomes k_work_user_q

etc.  Because the replacement API cannot use the same types new API
names are also introduced to make it more clear that the userspace
work queue API is a separate functionality.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Krzysztof Chruscinski 7f08061f0c logging: Revamp menuconfig
Clean up logging menuconfig by grouping configuration into
sections like: mode, processing configuration, backends.

Additionlly, removed LOG_ENABLE_FANCY_OUTPUT_FORMATTING which is no
longer in use.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-01-26 06:15:42 -05:00
Maureen Helm e839458217 tests: benchmark: Fix footprint testcase.yaml to use arch_allow
Fixes the footprint testcase.yaml to use arch_allow instead of
arch_whitelist.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-09-09 15:09:54 -04:00
Anas Nashif 88611de9bd tests: footprint: remove deperecated API call
k_mem_domain_remove_thread is deprecated now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-09 15:09:54 -04:00
Daniel Leung 98fb6e5f22 benchmarks: add an app for commonly used kernel funcs footprint
This adds an app which utilizes common kernel functions as a
starting point to gauge kernel footprint.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-09 12:53:10 -04:00