Commit graph

123 commits

Author SHA1 Message Date
Yuval Peress 84dfb8edf8 ztest: allow asserts anywhere
Updates the ztest_test_fail() function to allow failures in setup.
When executed, a failed assert will fail every test in the suite owning
the setup function. This was verified by adding a suite which asserts
in the setup function and has a test that should pass. During
exeuction, ztest marks the test as failing.

In order to verify exection I also added 2 new APIs:
- ZTEST_EXPECT_FAIL(suite_name, test_name)
- ZTEST_EXPECT_SKIP(suite_name, test_name)

Signed-off-by: Yuval Peress <peress@google.com>
2022-08-09 13:30:15 -04:00
Benjamin Björnsson 2399145406 include: zephyr: Add missing guard macro
Add guard macros to header files for consistency.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-20 13:39:23 -05:00
Anas Nashif 76f990af8a intel_adsp: move attribute macros to dedicated linker header
Those belong where other attribute macros are usually defined. They are
not xtensa or ADSP specific and are used across Intel SoCs on all
architectures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-13 11:15:46 -04:00
Anas Nashif d5dcf20382 scripts: move gen_kobject_placeholders.py to scripts/build/
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Carlo Caione 8c4f98d263 linker: Fix _vector_end symbol location
The 219d5b5adb commit is breaking the STM32F0 platforms.

The problem is that the PR is changing the location the _vector_end
symbol is pointing to. These platforms require the symbol to be pointing
to a location in memory after the IRQ vector table.

Fix the issue by introducing a new _vector_end symbol when the IRQ
vector table is present that points to the correct location.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-05 15:40:55 +00:00
Krzysztof Chruscinski abe1eb6ced toolchain: Add macro for keeping a symbol in the binary
Add LINKER_KEEP macro which can be used to prevent linker garbage
collector from removing unused symbol (function or variable).

Example use case is to use it for functions which are part of a test
application which has functions which are indirectly called by the
host test tools. Since they are not called explicitely by the
application so without marking them with LINKER_KEEP they would be
removed by the linker garbage collector.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-01 11:33:30 +02:00
Carlo Caione 3a48365bab irq: Fix IRQ vector table relocation
The generation of the software ISR table and the IRQ vector table
(respectively generated by CONFIG_GEN_SW_ISR_TABLE and
CONFIG_GEN_IRQ_VECTOR_TABLE) should (in theory) go through three stages:

1. A placeholder table is generated in arch/common/isr_tables.c and
   placed in an orphaned .gnu.linkonce.{irq_vector_table, sw_isr_table}
   section

2. The real table is generated by arch/common/gen_isr_tables.py (creating
   the build/zephyr/isr_tables.c file)

3. The real table is un-orphaned by moving it in a proper section with a
   proper alignment

While all the steps are done automatically for the software ISR table,
for the IRQ vector table each architectures must take care of modiying
its own linker script to place somewhere the generated IRQ vector table
(basically step 3 is missing).

This is currently only done for 2 architectures: Cortex-M (ARMv7) and
ARC. But when another architecture tries to use the IRQ vector table,
the linker complains about that. For example:

  Linking C executable zephyr/zephyr.elf
  riscv64-zephyr-elf/bin/ld.bfd: warning: orphan section
    `.gnu.linkonce.irq_vector_table' from
    `zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj' being placed in
    section `.gnu.linkonce.irq_vector_table'

In this patch we introduce a new CONFIG_ARCH_IRQ_VECTOR_TABLE_ALIGN to
support the architectures requiring a special alignment for the IRQ
vector table and we also introduce a way to automatically place the IRQ
vector table in place in the same way it is done for the ISR software
table.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-28 12:29:42 +02:00
David Palchak b4a7f0f2ca linker: ensure global constructors only run once
Rename the symbols used to denote the locations of the global
constructor lists and modify the Zephyr start-up code accordingly.
On POSIX systems this ensures that the native libc init code won't
find any constructors to run before Zephyr loads.

Fixes #39347, #36858

Signed-off-by: David Palchak <palchak@google.com>
2022-06-09 11:33:36 +02:00
Carlo Caione 86bb739b7b reserved_memory: Remove it and cleanup
The reserved memory mechanism (sections and regions definition) has been
entirely replaced, greatly extended and made it better by the work done
on the zephyr,memory-region compatible.

Since there is are no actual users, we can remove it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-07 09:41:57 -07:00
Georgij Cernysiov 70003e8eb0 dts: bindings: mpu: add PPB and IO regions
Extends #43119 with PPB and IO values of
`memory-region-mpu`.

That allows MPU region definition with
PPB or IO attributes in the DTS.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-05 14:46: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
Evgeniy Paltsev 48301dde0f ARC: ARCv3: add HS5x support
Add HS5x CPU support - ARCv3 32bit ISA.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-05-10 14:12:25 -04:00
Gerard Marull-Paretas d342e4c4c1 linker: update files with <zephyr/...> include prefix
Linker files were not migrated with the new <zephyr/...> prefix.  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-09 12:45:29 -04:00
Gerard Marull-Paretas fb9b3bcd93 include: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all includes within
include directory to the new prefix <zephyr/...>. Note that the
conversion has been scripted, refer to zephyrproject-rtos#45388 for more
details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:03:00 +02:00
Krzysztof Chruscinski 3ee5c57934 shell: Add new way of adding subcommands
Added macro SHELL_SUBCMD_SET_CREATE which creates a set of subcommands.
SHELL_SUBCMD_ADD and SHELL_SUBCMD_COND_ADD can be used from any file to
add command to the set. This approach allows to have subcommands added
from multiple files.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-29 14:54:08 +02:00
Anas Nashif 462b13e16e Revert "ztest: Fix userspace ztests in new API"
This reverts commit 900b6723e7.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-26 18:55:32 -04:00
Yuval Peress 900b6723e7 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-04-26 14:29:18 -04:00
Daniel Leung c6f6dd0ddd linker: split common-rom.ld into smaller snippets
This splits common-rom.ld into smaller snippets so that these
chunks can be placed at different locations if so desired.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-04-26 14:26:53 -04:00
Yuval Peress 3b5c61d618 include: Update references for devicetree.h
Use zephyr/ prefix for devicetree.h includes.

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-21 07:40:54 -05:00
Flavio Ceolin 370ce60152 linker: Re-use device handle logic
Add a new file with the device handles logic that is included in both
ram and ROM

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Flavio Ceolin 0b13b44a66 pm: device: Dynamically add a device to a power domain
Add API to add devices to a power domain in runtime. The number of
devices that can be added is defined in build time.

The script gen_handles.py will check the number defined in
`CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC` to resize the handles vector,
adding empty slots in the supported sector to be used later.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Szymon Czapracki af2e781f5a Bluetooth: Immediate Alert Service
This commits adds IAS for zephyr bluetooth.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-04-12 09:59:34 +02:00
Yuval Peress 53ef68d459 include: Prefix includes to use a scope
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
  example: <irq.h> -> <zephyr/irq.h>

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-08 19:03:32 +02:00