This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add support for userspace with RTIO by making rtio and rtio_iodev
k_objects. As well as adding three syscalls for copying in submissions,
copying out completions, and starting tasks with submit.
For the small devices Zephyr typically runs on one of the most important
attributes tends to be low memory usage. To maintain the low footprint of
RTIO and its current executor implementations the rings are not shared with
userspace. Sharing the rings it turns out would require copying submissions
before working with them to avoid TOCTOU issues.
The API could still support shared rings in the future so that a
kernel thread could directly poll, copy, verify, and start the submitted
work. This would require a third executor implementation that maintains its
own copy of submissions similiar to how io_uring in Linux works.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds an iterable section in ROM to hold constant information, such as
vendor and model name, for all enabled sensor driver instances. This
will be used by the future sensor subsystem to enumerate all available
sensors in the system.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:
```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```
Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We have cases where some devices needs to be initialized very early and
before c_start is call, i.e. to setup very early console or to setup
memory. Traditionally this would be hardcoded as part of the soc layer
and not using device model or the init levels.
This patch adds a new level ARCH, which will be called in early
architecture code and before we jump to the kernel code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit removes the `k_mem_pool` section for the memory pool API,
which was removed in the v2.5.0 release.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
ALIGN_WITH_INPUT is an argument for zephyr_linker_section, not
zephyr_linker_section_configure. Fix the calls for section .emulators
accordingly.
Signed-off-by: Abe Levkoy <alevkoy@google.com>
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>
The linker_script generating tool needs to ensure that .tdata gets added
to the TLS data section while .tbss is added to the TLS BSS section.
Signed-off-by: Keith Packard <keithp@keithp.com>
Currently when a node has a 'zephyr,memory-region' compatible and a
'zephyr,memory-region' string property, a new memory region is created
in the linker script.
Having a memory region without a section to place variables in could be
not that useful. With this patch we extend the memory-region mechanism
to also create sections.
The user can then place variables in the sections as usual by using for
example the GCC attributes.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
As already done for the regular linker script, dinamically generates the
memory regions with the 'zephyr,memory-region' compatible also when
using the cmake linker generator.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Fixes: #41435
The use of %<symbol>% works well in Linux and MacOS but when passed
to the linker script generator in Windows the %<symbol>% is processed
by the windows shell causing the value to disappear and thus an empty
value inside the generated ld linker script or scatter file.
This is fixed by using the @ character instead of the % character.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The commit dee79d2b66 introduced a new
linker output section ztest_suite_node in linker/common-ram.ld but
without updating the corresponding linker_script/common/common-ram.cmake
linker script generator code.
This causes test cases for arm Compiler 6 to fail.
Add the same section to common-ram.ld.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Remove the `NAME` function argument from `zephyr_linker_dts_memory` as
the name is now automatically derived from the devicetree node.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit reworks the linker script generation and linking stages in
order to better support fixed section location as required by #38836.
Today we have the following generated linker scripts and the elf output
depending on the system configuration:
- linker_app_smem_unaligned.cmd --> app_smem_unaligned_prebuilt.elf
- linker_zephyr_prebuilt.cmd --> zephyr_prebuilt.elf
- linker.cmd --> zephyr.elf
as not all linker scripts may be created and as there is a need for the
possibility to move gen handles earlier then those stages has been
renamed into more generic names so that with this commit we have:
- linker_zephyr_pre0.cmd --> zephyr_pre0.elf
- linker_zephyr_pre1.cmd --> zephyr_pre1.elf
- linker.cmd --> zephyr.elf
This also means that is the stage zephyr_pre1 is not needed, then build
can go from `zephyr_pre0.elf` to `zephyr.elf`.
The gen_handles.py has been changed so it now uses `zephyr_pre0.elf` as
input. This ensures that the handles array are final when invoking the
next build and linking stages.
To keep the current behavior of generating the isr table and kobj hash
of what was `zephyr_prebuilt` stage the code blocks contolling isr
generation and kobj hash has been relocated to be located after
app_smem and device handle generation.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
To prepare for linker script creation with flexible number of linker
passes depending on system configuration then the Zephyr CMake linker
script generator has been updated to use pass names instead of pass
numbers.
This allows greater flexibility as a section can now be active based on
the settings on the pass and not the linking pass index number.
As part of this, the `PASS` processing in `linker_script_common.cmake`
has been adjusted so that it properly handles when a linking pass is
handling multiple settings, such as both `LINKER_APP_SMEM_UNALIGNED`
and `DEVICE_HANDLES_PASS1` in same linking pass.
As the number of linking passes are more flexible, then the PASS
argument in `zephyr_linker_section()` and
`zephyr_linker_section_configure()` has been updated to also support
a `NOT <name>` argument, for example: `PASS NOT LINKER_ZEPHYR_FINAL`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The root cause of #38591 was region symbols being placed before the
section description for data region.
To support both schemes with the linker generator, a new
`SYMBOL SECTION` argument has been added to the zephyr_linker_group()
function.
This commit updates the arm/linker.cmake CMake linker file to use the
new `SYMBOL SECTION` argument for the data region group and text region
group so that those two groups now behave identical to the behavior when
using the cortex_m linker.ld template.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit add devicetree memory regions added to arm/linker.cmake.
The following memory regions are now added to the generated linker
script and scatter file if they exists in the devicetree.
- chosen: zephyr,itcm
- chosen: zephyr,dtcm
- nodelabel: ti_ccfg_partition
- nodelabel: sram1
- nodelabel: sram2
- nodelabel: sram3
- nodelabel: sram4
- nodelabel: sdram1
- nodelabel: sdram2
- nodelabel: backup_sram
Also support for the itcm and dtcm section and their placement in
corresponding memory regions has been added.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This is the initial version of a Zephyr CMake linker file for the arm
architecture.
This file defines memory regions, groups, linker sections and symbols
for the arm architecture.
It also sources the common common-ram.cmake, common-rom.cmake,
debug-sections,cmake, and thread-local-storage.cmake.
It configure sections for SoC families using zephyr_linker_sources()
functions:
- nxp_imx
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Converted existing ld script templates into CMake files.
This commit takes the common-ram.ld, common-rom.ld, debug-sections.ld,
and thread-local-storage.ld and creates corresponding CMake files for
the linker script generator.
The CMake files uses the new Zephyr CMake functions:
- zephyr_linker_section()
- zephyr_linker_section_configure()
- zephyr_linker_section_obj_level()
to generate the same linker result as the existing C preprocessor based
scheme.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>