Currently, this section has LOAD flag which means that it's part of
image layout. Attempt to generate binary file with --gap-fill results in
creating a very big file, because LMA of the section is RAM address
(e.g. 0x20000000 for STM32F4) instead of FLASH (e.g. 0x8000000 for
STM32F4).
This problem doesn't appear when linking using GNU LD, because it
removes the section in garbage collect process. However, LLVM LLD
doesn't garbage collect sections that define used symbols, so the
section is present in final ELF image.
There is no need to load this section (it has 0 size), so we can safely
add NOLOAD attribute to the section.
Fixes: #57727
Signed-off-by: Patryk Duda <pdk@semihalf.com>
An advertising report must not be generated unless the AUX_ADV_IND
has been received (for ADV_EXT_IND with an auxptr)
Signed-off-by: Troels Nilsson <trnn@demant.com>
Use CONFIG_BT_CTLR_PHY_CODED to flag out coded phy code
Don't schedule a scan for coded phy when it is not supported
Signed-off-by: Troels Nilsson <trnn@demant.com>
When a stream leaves the streaming state the `stopped` callback
will now be called, similar to how the `started` callback works.
This ensures that `stopped` is always called and not just when
the CIS disconnects.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Until now, linker-tool-gcc.h was used when LLD linker was chosen.
This causes linking issues because for GNU LD we use ALIGN_WITH_INPUT
attribute which is not available in LLVM LLD.
When using GNU LD we have to use ALIGN_WITH_INPUT to make sure that the
difference between VMA and LMA remains the same between output sections
that have different memory regions for VMA and LMA (RAM and FLASH).
With ALIGN_WITH_INPUT it's safe to do the memcpy of sections
that needs to be copied from flash to RAM in one function call:
(from z_data_copy() in kernel/xip.c)
```
z_early_memcpy(&__data_region_start, &__data_region_load_start,
__data_region_end - __data_region_start);
```
By default, LLVM LLD aligns both VMA and LMA to the same value, but
when --omagic (-N) option is provided then only the first output section
of given region has aligned LMA and the difference between VMA addresses
(0 is this is the first section) is added.
As a result the difference between LMA and VMA is constant for every
section, so this emulates ALIGN_WITH_INPUT option present in GNU LD
(required by XIP systems).
The --omagic flag is defined in cmake/linker/lld/target_baremetal.cmake
Example:
```
MEMORY {
ROM : ORIGIN = 0x1000, LENGTH = 1K
RAM : ORIGIN = 0x11000, LENGTH = 1K
}
SECTIONS {
.text 0x1000 : {
*(.text*)
} >ROM
.data.rel.ro : {
*(.data.rel.ro)
} >RAM AT>ROM
.data : {
*(.data*)
} >RAM AT>ROM
}
```
```
echo '.globl _start; _start: nop; .byte 1;'\
'.data.rel.ro; .balign 16; .byte 0;'\
'.data; .balign 32; .byte 0;' | \
llvm-mc -filetype=obj -triple=arm - -o test.o
armv7m-cros-eabi-ld.lld --sort-section=alignment -N -T script.ld \
test.o -o lld_out
```
```
Idx Name Size VMA LMA File off Algn
0 .text 00000005 00001000 00001000 00000094 2**2
1 .data.rel.ro 00000001 00011000 00001010 000000a0 2**4
2 .data 00000001 00011020 00001030 000000c0 2**5
```
In this example the first section has lower alignment than the following
section, but with -N option the difference between VMA and LMA is the
same for .data.rel.ro and .data sections.
For comparison, using BFD linker with --omagic option results in the
following:
```
Idx Name Size VMA LMA File off Algn
0 .text 00000005 00001000 00001000 00000094 2**2
1 .data.rel.ro 00000001 00011000 00001005 000000a0 2**4
2 .data 00000001 00011020 00001006 000000c0 2**5
```
with ALIGN_WITH_INPUT added, GNU LD adds the difference between VMA to
LMA, but doesn't align LMA of .data.rel.ro section:
```
Idx Name Size VMA LMA File off Algn
0 .text 00000005 00001000 00001000 00000074 2**2
1 .data.rel.ro 00000001 00011000 00001005 00000080 2**4
2 .data 00000001 00011020 00001025 000000a0 2**5
```
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Add a small delay between reading the transport header and reading the
HCI data. Failing to do so on a nRF9160<->nRF52832 link was reliably
resulting in the nRF9160 trying to read data before the nRF52832 had
set up the SPI transaction, resulting in the host reading a buffer full
of 0x00 and having to run the entire read result again.
Transceiving a 10 byte packet takes at least 31uS, while 100 byte
packets are around 150uS (duration of `spi_transceive` call). Waiting
1 tick to eliminate the need for most retransmissions is a valid
tradeoff.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add an option that signifies that the ESP modem may be reset at the same
time as the SoC by an external source. When this is the case, we first
wait for an unsolicited "ready" message from the modem, before
attempting to reset the device. This prevents two initialisation
sequences attempting to run at the same time.
We still want to wait for the complete initialisation sequence to
complete before returning in this case.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Don't unconditionally set the carrier to the off state in
`esp_iface_init`, as this is already done in `esp_reset` and the
function may be called after the modem has already completed the init
sequence and called `net_if_carrier_on`.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Wait for the init process to finish again, previously removed in
a8e6fc0b83. The original reasoning (deadlock with net interface locking)
no longer applies now that `esp_reset` is called in the device init
function, not in `esp_iface_init` (332a6f084a).
Without this change, if `reset-gpios` or `power-gpios` is set,
`device_is_ready` will return true even if the chip has fallen off the
board, as no communication is validated with the board.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Support device power management in spi_nor driver. Only use
SUSPEND/RESUME if `CONFIG_SPI_NOR_IDLE_IN_DPD` is not enabled to avoid
state conflicts.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add overlay configuration for native_sim, and enable it
for this platform in the test yaml filter.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Quite a few of the drivers meant for the POSIX arch
interacted with the host directly, and will not
work when we use an embedded libC.
Until we fix them, let's add the appropriate
kconfig dependencies to avoid users trying to build them.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Things have moved around so we need to update the
suppression file so the callstack and types of
leaks valgrind reports still match.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
It is possible to build with the PICOLIBC_MODULE
with the POSIX arch targets which use the native
simulator as runner.
Update filtering accordingly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Some POSIX arch targets support now the POSIX API.
Instead of filtering the architecture fully,
let's limit it to the type of build
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Update the native posix area to cover also the native simulator,
and fix the drivers include path pattern, as some do not have the
whole native_posix in their name.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This allows building with embedded libCs in the Zephyr side,
as the POSIX arch bottom is not anymore built in Zephyr context.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add the first version of the native simulator.
The simultaor is taken as is from
https://github.com/BabbleSim/native_simulator/
sha: 74986abfe088a1780e604dae65f87470b4c2a0eb
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
When building a native library there is a few options
we cannot pass to the compiler and linker,
including instructing them to genrate non PIE code
(as it is still to early to say that),
or garbage collect unused sections (as we are not yet doing
the final linking).
We also need to provide different
link options when building the elf for the DTS gen_handles
parsing (as that script requires a "final" executable elf)
than when we build the native library itself.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
It is possible to build with STDOUT_CONSOLE with
the embedded C libraries with the POSIX arch.
Narrow down the filtering accordingly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
So they depend or select on the right NATIVE_BUILD
instead of NATIVE_APPLICATION.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
To differentiate builds which will produce a native executable
as direct output from the Zephyr build,
or a library which can be used later.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Overlay adds 4 timers for testing and selects various frequencies
to select high speed (DIVN) and low-speed (LP-CLK) as sources.
Different prescalers are applied for different timers to
test wider range of conditions.
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This adds support for the TIMER1-4 counter.
Each counter has 24bits and can run on LP_CLK (15-32KHz)
or DIVN clock (32MHz) with prescaler 1-32.
Each counter can have one alarm set.
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
Enable automatic temperature measurements during charging.
Allows the PMIC to charge when the host is in low power mode.
Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
The vbus current limit is now written to the vbus startup
register. It is now applied at all times and does not need
to be updated on charger insertion.
Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
The documentation of net_if_dev was missing information how
it should be instantiated.
Fixes#59975
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
parse_number() helper function accepts long * pointer or the output,
however in several places, an address of a variable of incompatible
type was passed to the function (for example an address of a bool
variable was cast to (long *) and provided to the function). This
could cause memory overwrites or other unexpected behaviour.
Fix this, by defining a helper variable of type long, and use it with
the parse_number() function. Only after successful parsing, the value is
then assigned to the proper destination.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
When PMAX value is changed, it should update all events.
I believe there is a bug that caused the code only to update
events that are ongoing (to be send).
Now if PMAX changes, next event timestamp is recalculated.
Fixes#59397
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The enum used for connection types gets named bt_conn_type to guard
against accidental usage of generic integers with relation to it.
The added default case in several switch statements avoids warnings
against unhandled enum values.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Fail gracefully if an HCI event of one type arrives for a handle of a
different connection type. The requested types are currently based on
what fields are used, not on the usage context, in order to keep every
correct use so far still working.
A warning is logged if the connection identified by the handle does not
match the requested connection type.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
NMI_INIT() is now a no-op, so remove it from all SoC code. Also remove
the irq lock/unlock pattern as it was likely a cause of copy&paste when
NMI_INIT() was called.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Zephyr provides a default NMI handler (`z_SysNmiOnReset`), which will
basically call `wfi` endlessly. It is allowed to override such handler
when CONFIG_RUNTIME_NMI=y, via `z_arm_nmi_set_handler`. However,
enabling such option also provided `z_arm_nmi_init` (via `NMI_INIT()`),
which basically sets the handler to `DefaultHandler` (a new handler that
basically printks and reboots). This is strictly not needed, and
independent of the runtime NMI option. As a result, most SoCs were
blindly calling `NMI_INIT()`, probably because of a copy&paste effect.
In the majority of cases, this was a no-op, but most SoCs do IRQ
enable/disable, making this even more convoluted. To make things worse,
the init call is expected to run after console has been initialized (for
printk to work?), but most SoCs just called it in PRE_KERNEL_1+0.
This patch just drops this NMI initializer API, and leaves only the
handler set call when CONFIG_RUNTIME_NMI=y.
NMI_INIT() dummy definition is left in this patch to preserve
bisectability, will be dropped later.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The "virtio_" prefix is used by the open-amp library API.
Rename local functions using "ipc_virtio_" prefix to avoid
function redefinition.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
The "virtio_" prefix is used by the open-amp library API.
Rename local functions using "ipc_virtio_" prefix to avoid
function redefinition.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
The CDC ACM implementation provides a virtual UART interface
that is used by various samples and subsystems in a way that is
compatible with the real UART interface.
Commit cc1b2c70cc
("uart: doc: Add special case for virtual UART")
added a questionable comment to uart_fifo_fill() API
description in an attempt to fix issue described in
https://github.com/zephyrproject-rtos/zephyr/issues/11455
However, this did not fix the problem because the API is not
designed to be used in this way. Finally commit 0e57e4fb78
("samples: usb: cdc_acm: Update CDC ACM echo sample")
revised the sample to use the API in the correct way.
Remove incorrect comment in uart_fifo_fill(). For compatibility
reasons and due to the design of the API, such differences must not
exist.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Instead of waiting for ase_buf to be available, the read of an
ASE in IDLE state can be handled without using ase_buf.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>