Commit graph

43362 commits

Author SHA1 Message Date
Andrew Boie
ddb63c404f x86_64: fix sendling locore EOI
The address was being truncated because we were using
32-bit registers. CONFIG_MMU is always enabled on 64-bit,
remove the #ifdef.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
df2fe7c1f7 x86: add build system hooks for page tables
We need to produce a binary set of page tables wired together
by physical address. Add build system logic to use the script
to produce them.

Some logic for running build scripts that produce artifacts moved
out of IA32 into common CMake code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
e9d15451b1 x86: add new page table generation script
This produces a set of page tables with system RAM
mapped for read/write/execute access by supervisor
mode, such that it may be installed in the CPU
in the earliest boot stages and mutable at runtime.

These tables optionally support a dual physical/virtual
mapping of RAM to help boot virtual memory systems.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
bcc69f944d mem_manage: add private conversion APIs
Private macros/function for converting a virtual address
to a physical address. Only works for a specific range
of virtual addresses (the permanent SRAM mappings).

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
2dcb80aa41 tests: syscalls: fix "faulty" memory address
If the MMU is enabled, use the page right after permanent RAM
mappings, it should be non-present.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
1524ef2f52 arch: Kconfig: add sub-menu for MMU options
De-clutters the main menu.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
d03c60b71b x86: force VM base to be identity mapped
The x86 ports are linked at their physical address and
the arch_mem_map() implementation currently requires
virtual = physical. This will be removed later.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
2c3523e421 mmu: add virtual memory Kconfigs
Specify the virtual address range for kernel mappings.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
88ddce652c mmu: add CONFIG_SRAM_REGION_PERMISSIONS
If CONFIG_MMU is active, choose whether to separate text,
rodata, and ram into their own page-aligned regions so that
they have have different MMU permissions applied.

If disabled, all RAM pages will have RWX permission to
supervisor mode, but some memory may be saved due to lack
of page alignment padding between these regions.

This used to always happen. This patch adds the Kconfig,
linker script changes to come in a subsequent patch.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
fd07e2557d tests: x86_mmu_api: remove
This test covers private interfaces that don't exist any more.

This will be replaced by tests of arch_mem_map() that are not
x86-specific.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Andrew Boie
9e8a1271bc tests: remove x86 boot_page_table
This test is against infrastructure that no longer exists.
It will be replaced by generic tests for the mapping APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-25 15:49:59 -04:00
Anas Nashif
d0f5253f9e Revert "compiler: gcc: Add warning option to spot poblematic switches"
This reverts commit 680f401ef2.

3rd party code in modules is failing due to this enforcment. We need a
away to exclude module code to support such options.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-25 12:57:05 -04:00
Peter Bigot
7410b9ed34 doc: guides: design: document how to handle conditional documentation
Various API involves functions and data that are conditionally
enabled.  Zephyr practice is to exclude data (always) and function
(sometimes) declarations at build time using the enabling preprocessor
macro.  This meets functional needs, but blocks generation of the API
documentation as Doxygen will not see the declarations.

Document the need to extend Doxygen's PREDEFINED setting to generate
the documentation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-25 18:09:56 +02:00
Peter Bigot
ec507d3f03 doc: guides: add design guidelines with callback expectations
Provide a location for recommended practices that are not related to
coding style.  Initialize it with information about the expected
design for callbacks.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-25 18:09:56 +02:00
Peter Bigot
e69f22be54 doc: guides: dts: document expectation for devicetree driver configuration
Gaps in Kconfig flexibility make it necessary to provide
instance-specific driver configuration through devicetree properties
in certain cases.  Because these are not hardware characteristics or
configuration they should be marked as zephyr-specific.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-25 18:09:56 +02:00
Peter Bigot
23b34323fa doc: guides: dts: update note on enabling individual instances
The Kconfig options that formerly controlled this capability have been
removed so rework the "exception" (there is no "precedence" anymore).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-25 18:09:56 +02:00
Gerson Fernando Budke
46234a0463 samples: mgmt: updatehub: Fix gen privkey inc
When try build updatehub using overlay-dtls.conf system fail with
cannot create privkey.der.inc file, permission denied.  Add missing
gen_dir cmake definition. Update updatehub sample test config to
run missing dtls build test.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-25 16:46:01 +02:00
Vinayak Kariappa Chettimada
b5dba35727 tests: Bluetooth: shell: Fix conditional compilations
Fix conditional compilations that fail when combinations
of Broadcaster, Observer, Peripheral and/or Central are
selected to build an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
2a3e86a2fd Bluetooth: controller: Fix conditional compilations
Fix conditional compilations that fail when combinations
of Broadcaster, Observer, Peripheral and/or Central are
selected to build an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
be1b634193 Bluetooth: controller: Fix BT_CTLR_SCAN_REQ_NOTIFY dependency
Fix BT_CTLR_SCAN_REQ_NOTIFY as depends on BT_BROADCASTER.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
e8e7ccb448 Bluetooth: controller: Fix Adv Set Terminated event cond. compile
Fix the conditional compilation of Advertising Set Terminated
event implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Kamil Piszczek
e86d728c58 bluetooth: conn: fix init macro for PHY params
Fixed initialization macro for PHY parameters.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-08-25 16:10:21 +03:00
Joakim Andersson
5880f3d74f Bluetooth: UUID: Use BT_UUID_16_ENCODE to set UUIDs in adv data
Use BT_UUID_16_ENCODE to set UUIDs in advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Joakim Andersson
fb757498bb Bluetooth: UUID: Add encode utility macro for 16 and 32 bit UUIDs
Add encode utility mocre for 16 and 32 bits UUIDs that can be
used to in combination with BT_DATA_BYTES to include UUIDs
in advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Joakim Andersson
9b2e9eda89 Bluetooth: UUID: Add defines for UUID values
Add defines for UUID values so that they can be used without
declaring a full bt_uuid struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Emil Gydesen
689f3b2bc8 Bluetooth: host: per_adv_sync auto scan fixed for central role
If `CONFIG_BT_CENTRAL` was enabled and the device was not scanning
or connected, then `bt_le_per_adv_sync_create` would not start
scanning for periodic advertisers.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-25 15:50:32 +03:00
Lingao Meng
a574d4c840 Bluetooth: Mesh: Enhancement prov segment received
Optimize provisioning segment package received, and
not ignore non-begin segment.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-08-25 15:48:56 +03:00
Kim Sekkelund
41842dd174 Bluetooth: host: GATT Lazyloading cleanup at disconnect
Mark the ram version of the ccc_cfg as free after ccc has been
stored when a bonded device disconnects.
If the device use lazy loading of settings then ccc_cfg was not
cleaned up properly when a bonded device disconnects. This
resulted in the ccc system ran out of ccc_cfg resources after
having disconnected CONFIG_BT_MAX_CONN times.

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
2020-08-25 15:40:31 +03:00
Kim Sekkelund
29b42c5a2f Bluetooth: host: GATT Relocate bt_gatt_disconnected
Step1: Move bt_gatt_disconnected() to avoid forward declarations which
otherwise would be needed by a fix to lazy loading cleanup on
disconnect in step 2.

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
2020-08-25 15:40:31 +03:00
Luiz Augusto von Dentz
426fb82bd8 Bluetooth: ATT: Fix not restoring buffer state when send fails
Since bt_l2cap_send_cb can fail returning its error is not enough as
the buffer has been modified to add the headers, so this save the state
before calling bt_conn_send_cb and takes a reference so it can be
restored its original state in case of error.

Fixes #27434

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-08-25 15:22:07 +03:00
Carles Cufi
65d4e177ca samples: bluetooth: hci_uart: Add a config for the nRF51 dongle
Add both .conf and .overlay files for the nRF51 dongle, which is still
used and was missing configuration files.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-08-25 15:16:11 +03:00
Henrik Brix Andersen
c64e0ce923 disk: sdhc: spi: leave SPI CS GPIO handling to the SPI controller driver
Leave the SPI CS GPIO handling to the SPI controller driver and make SPI
CS GPIO optional for SDHC disk access via SPI.

The SPI SDHC implementation relies on SPI_HOLD_ON_CS so we need to
explicitly release the SPI controller driver after ending transmissions
to force the CS line to be de-asserted.

Fixes #27444.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-25 10:07:53 +02:00
Peter A. Bigot
5c85e2c914 doc: provide guidance on recommended settings back end
Zephyr release 2.1 changed the default settings back end from FCB to
NVS in all Bluetooth samples for performance and reliability reasons.
Update the settings documentation to provide a clue to developers
trying to decide which to use.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-25 09:35:40 +02:00
Ioannis Glaropoulos
c644449df3 boards: nrf5340dk: fix .dtsi header inclusion
The nRF5340 PDK board target for nRF5340 Network MCU
needs to include the "ENG-A" .dtsi header. The
commit is fixing this.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-08-25 09:33:31 +02:00
Ioannis Glaropoulos
00a4da1d99 dts: nordic: nrf5340_cpunet: fix number of MPU regions on Network MCU
In the SoC that comes on the nRF5340 DK the number of MPU
regions in the nRF5340 Network MCU is 8, instead of 16. We
fix this in DTS by introducing different .dtsi headers for the
different SoC part variants: the nrf340 Engineering A (first
SoC revision, present in the nRF5340 PDK) and the nrf5340
(second SoC revision, present on nRF5340 DK).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-08-25 09:33:31 +02:00
Jose Alberto Meza
b46d1f3cba samples: drivers: espi: Use non-default frequency.
Use non-default frequency 25MHz and Quad mode to ensure
frequency configuration is taking effect.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-25 09:32:29 +02:00
Jose Alberto Meza
b466db116a drivers: espi: xec: Fix eSPI frequency override during IO selection
Fix incorrect register update that results in unintentionally
in default eSPI frequency (20MHz) whenver IO mode is changed.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-25 09:32:29 +02:00
Karol Lasończyk
b740d3bdd9 modules: hal_nordic: Update nrfx to version 2.3.0
This PR updates the hal_nordic module revision, to switch to nrfx 2.3.0
and adds new configuration option to enable two stage LFCLK start
sequence.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2020-08-25 09:29:38 +02:00
Martí Bolívar
bd86078376 sys/util.h: add FOR_EACH_NONEMPTY_TERM
This is an extension to the existing FOR_EACH family of macros that
has a couple of twists that make it more useful in certain contexts,
as explained in the docstring.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-24 20:29:11 -04:00
Flavio Ceolin
0aaae4a039 guideline: Make explicit fallthrough cases
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Flavio Ceolin
f0ec286759 toolchain: gcc: Add macro to fallthrough attribute
This macro is intended to be used in intentional fallthroughs on
switch / case statements.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Flavio Ceolin
680f401ef2 compiler: gcc: Add warning option to spot poblematic switches
Option -Wimplicit-fallthrough as the name suggests raises a warning when
there is an implicit fallthrough in a switch clause. This warning does
not happen when the last statement is a return or a call to a function
declared with noreturn attribute.

This flag helps to enforce two MISRA-C rules (not completely), 16.1 and
16.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Daniel Leung
86b2cbc5ea tests: add a test for coredump
This adds a simple test for coredump.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
faae15d838 sanitycheck: allow QEMU to crash without failing
Adds some code to allow QEMU to crash without failing the test.
This is required for testing coredump code as it will certainly
cause QEMU to crash.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
5b1b4a3755 sanitycheck: need to wait for harness to process QEMU outputs
There is a potential that QEMUHandler.handle() returns before
the testing harness finishes processing all the output from QEMU.
Simply wait for the harness thread to finish before returning.

Also, fix the return code in the debug message as it should be
the return code from Popen().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
181d07321f coredump: add support for ARM Cortex-M
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for ARM Cortex-M.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
8fbb14ef50 coredump: add support for x86 and x86_64
This adds the necessary bits to enable coredump for x86
and x86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
49206a86ff debug/coredump: add a primitive coredump mechanism
This adds a very primitive coredump mechanism under subsys/debug
where during fatal error, register and memory content can be
dumped to coredump backend. One such backend utilizing log
module for output is included. Once the coredump log is converted
to a binary file, it can be used with the ELF output file as
inputs to an overly simplified implementation of a GDB server.
This GDB server can be attached via the target remote command of
GDB and will be serving register and memory content. This allows
using GDB to examine stack and memory where the fatal error
occurred.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Fabio Utzig
054a9aeec9 doc: fix typo in heap.rst
typo: stanard -> standard

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-24 20:27:30 -04:00
Fabio Utzig
a83f04ee53 doc: fix typo in fifos.rst
typo: FIF -> FIFO

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-24 20:27:30 -04:00