Commit graph

41120 commits

Author SHA1 Message Date
Mark Ruvald Pedersen
cb0fd451c2 cmake: Toolchain abstraction: Assembly
Introduce toolchain_cc_asm macro to capture toolchain specific flags
related to assembly.

-D_ASMLANGUAGE is kept common for all, assuming -D as define flag is
supported by all compilers (which is almost the case).

No functional change expected.

Clang's flags are compatible with gcc, and are thus inherited.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting easier porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-23 07:41:46 -05:00
Flavio Ceolin
942d4bba94 misc: rb: Fix possible infinity loop
The macro RB_FOR_EACH_CONTAINER could run infinitely when the function
_rb_foreach_next returns NULL.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2019-02-23 07:41:18 -05:00
Piotr Mienkowski
abc394bd4d ext: silabs: rename ramfunc section to match Zephyr's
Functions which have to be located in RAM are placed by SiLabs library
code in section '.ram'. Corresponding section used by Zephyr is called
'.ramfunc'. This patch renames SiLabs naming to match Zephyr's.

This solution was chosen over adding '.ram' function to Zephyr linker
scripts not to pollute them. However, this patch needs to be reapplied
every time SiLabs library version is updated.

Fixes #13192

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-23 07:31:12 -05:00
Andrew Boie
743677d743 uart: ns16550: place header in correct spot
This is an application facing define, specific to this
driver, for the public uart_drv_cmd() API. Put it with
public headers.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 23:32:31 -05:00
Anas Nashif
e88752f5fe tests: stacks: increase STACK_LEN to 4
Test was failing on nios2 with:

../app/libapp.a(test_stack_contexts.c.obj): in function `tstack_pop':
/home/galak/git/zephyr/tests/kernel/stack/stack_api/src/test_stack_contexts.c:31:
warning: unable to reach (null) (at 0x004002f4) from the global pointer
(at 0x004082fc) because the offset (-32776) is out of the allowed range,
-32678 to 32767

Fixes #13595

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 23:10:22 -05:00
Andrew Boie
45631c30ca tests: stackprot: run in user mode
Ensure that stack canaries work properly in user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 18:50:43 -05:00
Andrew Boie
01100eadb8 kernel: add stack canary to libc partition
User mode needs to be able to read this value in
compiler generated function prologues/epilogues.

Special handling in init.c for arches that use
_data_copy. This happens before _Cstart() gets
called. We need to make sure that the compiler
stack canary checks in _data_copy itself do not
fail.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 18:50:43 -05:00
Andrew Boie
17ce822ed9 app_shmem: create generic libc partition
We need a generic name for the partition containing
essential C library globals. We're going to need to
add the stack canary guard to this area so user mode
can read it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 18:50:43 -05:00
Andrew Boie
80e3a2c246 app_shmem: include stub macro definitions
We'd like these macros to simply do nothing if the
feature isn't enabled rather than erroring out.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-22 18:50:43 -05:00
Aurelien Jarno
992f29a1bc arch: make __ramfunc support transparent
Instead of having to enable ramfunc support manually, just make it
transparently available to users, keeping the MPU region disabled if not
used to not waste a MPU region. This however wastes 24 bytes of code
area when the MPU is disabled and 48 bytes when it is enabled, and
probably a dozen of CPU cycles during boot. I believe it is something
acceptable.

Note that when XIP is used, code is already in RAM, so the __ramfunc
keyword does nothing, but does not generate an error.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-22 11:36:50 -08:00
Aurelien Jarno
eb097bd095 arch: arm: mpu: get the __ramfunc region size from the linker
The linker file defines the __ramfunc_ram_size symbols to get the size
of the __ramfunc_ram section. Use that instead of computing the value at
runtime from the start and end symbols. This saves 16 bytes of code with
CONFIG_RAM_FUNCTION=y.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-22 11:36:50 -08:00
qianfan Zhao
e1cc657941 arm: Placing the functions which holds __ramfunc into '.ramfunc'
Using __ramfunc to places a function in RAM instead of Flash.
Code that for example reprograms flash at runtime can't execute
from flash, in that case must placing code into RAM.

This commit create a new section named '.ramfunc' in link scripts,
all functions has __ramfunc keyword saved in thats sections and
will load from flash to sram after the system booted.

Fixes: #10253

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2019-02-22 11:36:50 -08:00
Jukka Rissanen
898973be8a net: ip: Add more documentation to net_ip.h
No functionality changes, just doxygen additions and some
things are hidden from document generation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 13:54:14 -05:00
Jukka Rissanen
fd6aa0a508 doc: net: Add overview chapter to IPv4/6 helper doc
Overview chapter was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 13:54:14 -05:00
Ulf Magnusson
79906fc481 scripts/dts: Document the generate_*_defines() functions
Add some short doc comments at the beginning so that people can quickly
get an idea of what they're about.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-22 12:44:16 -06:00
Ulf Magnusson
e04139f506 scripts/dts: Rename extract_property() to generate_prop_defines()
Consistent with generate_defines() and generate_node_defines().

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-22 12:44:16 -06:00
Ulf Magnusson
f5b17d4138 scripts/dts: Call /foo/bar a "path" instead of an "address"
It's confusing that "address" is often used within the same function to
refer to both node paths and e.g. address cells.

Make things easier to understand by calling /foo/bar a path instead.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-22 12:44:16 -06:00
Ulf Magnusson
5b791d1eea scripts/dts: Generate node-level #defines outside extract_property()
extract_property() is meant to generate #defines for a single property,
like 'foo = <1 2 3>'. Currently, it also generates node-level #defines
related to parent buses.

That makes the intent of the code hard to understand, and also means
that identical node-level #defines get redundantly added multiple times
(once per property).

Generate the node-level bus #defines before processing properties, in
generate_node_defines(). Use a new generate_bus_defines() helper.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-22 12:44:16 -06:00
Ulf Magnusson
edc1f6af7a scripts/dts: Move flash partition handling out of property loop
Due to the way the code was structured,
flash.extract_partition(node_path) was called multiple times for the
same 'node_path'.

That must've been a mistake to begin with (but was hard to spot before
the code was cleaned up). Move the generation of per-node #defines out
of the property loop.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-22 12:44:16 -06:00
Ioannis Glaropoulos
67aee1f1f6 tests: kernel: userspace: fix test for non-secure builds
This commit fixes a test in kernel/mem_protect/userspace,
which was attempting to read from an address that was not
necessarily within the image memory range, causing faults
in ARM TrustZone-enabled builds.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 12:32:26 -06:00
Jukka Rissanen
1d43377db9 doc: net: Move networking reference document chapters around
Group the networking chapters for reference document so that the
layout is more logical and easier to read.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 13:32:09 -05:00
Piotr Mienkowski
893a7b7af0 soc: silabs: add support for setting low power states
This commit adds sys_set_power_state() function with support for EM1
Sleep, EM2 Deep Sleep, EM3 Stop power modes on Silabs SoCs.

Tested on efr32_slwstk6061a board.

Note: No support for efm32hg, efm32wg series at this point due to the
missing possibility of placing function code in RAM, required by errata
in SiLabs library code.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-22 12:25:57 -06:00
Piotr Mienkowski
df04f7c050 soc: silabs_exx32: register 'soc' logger module
'soc' logger module may be used by any SoC related code located in soc/.
An implementation file requiring logger services should include
LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL);
to use the 'soc' logger instance.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-02-22 12:25:57 -06:00
Charles E. Youse
d3adba8379 boards/x86: scripts: build_grub.sh fix for newer GCC versions
Recent versions of GCC won't build grub-2.02 because they're more
pedantic about warnings. This has been fixed upstream but is not
yet part of any release. The build script is modified to apply the
relevant commits before building.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-02-22 12:20:07 -06:00
Kumar Gala
e96d02984c lib: posix: Fix compile issue with newer newlib
Both SDK 0.10.0-beta2 and the ARM gcc 2018q2 run into a build issue with
newlib and conflict definitions of mode_t type.

First we need to add some ifdef protection if mode_t is already defined
and set _MODE_T_DECLARED if we are the first to define it.

Secondarily, we rename include/posix/sys/types.h to
include/posix/posix_types.h so that we aren't getting a name collusion
with the system sys/types.h and that we can easily and clearily include
it (which we need to do to pull in the info from newlib).

Fixes: #12224

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-22 11:55:01 -06:00
Kumar Gala
b730fa4ccb posix_lib: Disable support on native posix arch
For now we are disabling support for POSIX lib on native posix arch.  We
need to cleanup and support POSIX lib cleanly for hardware targets.
Once that is working properly we can look to support the feature on
native posix arch.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-22 11:55:01 -06:00
Anas Nashif
eca2f0768d tests: crypto: increase timeout
Some platforms need more time to complete the tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 11:53:59 -06:00
Piotr Zierhoffer
8e0fcbfd7e m2gl025_miv: Set performance in Renode script.
This fix allows Renode to resemble the time flow of the hardware more
precisely. The performance value was established manually, there is no
indication in the docs on what is the average performance.

It allows tests/posix/common/portability.posix to pass, but fails on
tests/kernel/lifo/lifo_usage/kernel.lifo.usage.

The latter also fails on hardware.

Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2019-02-22 11:53:59 -06:00
Anas Nashif
fbe15ca7ab boards: udoo_neo_full_m4: not a default testing platform
This should not be run as a default platform in sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 11:07:25 -06:00
Jukka Rissanen
82616a62d6 net: offload: Remove CONFIG_NET_OFFLOAD from header file
The extra check for CONFIG_NET_OFFLOAD is not needed as it
prevents documentation generation for this API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 10:48:14 -05:00
Kwon Tae-young
e0a8990ea7 drivers: ssd1306: Support GPIO reset function
If dts has reset-gpios information, reset it.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2019-02-22 10:32:43 -05:00
Ioannis Glaropoulos
0122bacd2c boards: arm: nrf: explicitly set Load size for strictly Secure builds
This commit adds a patch in the Kconfig.defconfig file of
nRF9160_pca10090 board, that instructs the linker to restrict
the Secure image to the size of its code partition, if the
image is to be combined with a Non-Secure image. Secure images
without accompanying Non-Secure firmware (i.e. with symbol
TRUSTED_EXECUTION_SECURE not set) can use the entire flash.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 08:57:23 -06:00
Ioannis Glaropoulos
8506e8f912 boards: arm: nrf: do not overwrite flash0 reg property in nRF91 board
We do not need to overwrite the reg property of flash0
in nrf9160_pca10090 default partitioning. The property
reflects the flash resources of the SOC, and is passed
in the .dtsi file of nRF9160 SOC definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 08:57:23 -06:00
Ioannis Glaropoulos
32d73467d1 arch: arm: fix return reason in Secure/Non-Secure FW builds
This commit fixes a bug that was always propagating the
default error reason (_NANO_ERR_HW_EXCEPTION) to the
system fatal error handler for (strictly) Secure and
for Non-Secure FW builds on ARMv8-M.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 08:56:15 -06:00
Ioannis Glaropoulos
62100e3d41 arch: arm: define EXC_RETURN payload flag macros in non-secure FW
Include the EXC_RETURN payload flag macro definitions into
compilation when building for Non-Secure firmware, too.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-02-22 08:56:15 -06:00
Anas Nashif
ccad9d0d09 tests: move testsuite and configs into subsys/
Move test related code and the testsuite away from tests/ and make it a
proper subsystem.
The way tests were integrate in the tree was not obvious and actual
tests were intermixed with the testsuite code.

This will allow us to have trees with the testcode and without the
samples by just remove the folders tests/ and samples, needed for
isolating actual code from test/sample code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-22 08:58:40 -05:00
Michael Scott
7f4eb00f47 boards: 96b_nitrogen: standardize scratch and storage partitions
Most of the other nRF52832 boards have the following settings for
scratch and storage partitions:

scratch_partition: partition@70000 {
        label = "image-scratch";
        reg = <0x00070000 0xa000>;
};

storage_partition: partition@7a000 {
        label = "storage";
        reg = <0x0007a000 0x00006000>;
};

Let's adjust the scratch size to align with the others and add the
storage partition so that settings and FS samples will work.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-02-22 08:46:13 -05:00
Kwon Tae-young
ac7751d23a drivers: ssd1306: Fix dts read
Modified to read dts information.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2019-02-22 08:45:26 -05:00
Jukka Rissanen
c478b5bb6e can: Rename can_msg and can_msg_filter structs
In order to follow the naming from Linux, change the name of
can_msg to zcan_frame, and can_msg_filter to zcan_filter.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen
14d4023338 tests: can: Add CAN frame struct handling tests
Make sure that can_copy_*() functions work as expected.
These functions are used by SocketCAN support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen
58f3ae5334 can: Add Linux compatible frame and filter structs
Add new "struct can_frame" which is compatible with Linux so that it
is easier to port socket-can applications from Linux.
Rename existing can_filter to can_msg_filter so that the name will
not conflict with Linux compatible can_filter struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Carles Cufi
c2d5e7b01c kconfig: Don't load env var if in doc mode
Do not load the GENERATED_DTS_BOARD_CONF if in doc mode, since it will
not defined as it doesn't apply. No need to defined it to a dummy value.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-02-22 10:14:21 +01:00
Andrzej Puzdrowski
b1a7e71436 settings: fix base64 encode test
settings_line_len_calc() calculates only setting record
payload size, not record layout in flash size.

this patch remove inadequate test for this function.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Andrzej Puzdrowski
ad20d34eaa settings: fix fcb record size for unaligned sizes
settings_line_len_calc() is used to determine key-value record size.
It unnecessary aligned this size to write-block-size.

Record size in flash layout is actually adjusted independently by
fcb itself and setting settings_line_write().

Patch fixes this behavior.

fixes #12967

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Andrzej Puzdrowski
e31c77dce3 settings: get flash alignment from fcb instance
Patch remove unnecessary call chain which fetched flash write-block-size
already available in fcb instance.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Andrzej Puzdrowski
5bc3ad2a1c tests/subsys/settings: fcb unaligned value test
Added test for check whether value lenght is properly
stored for unaligned settings record size.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-21 19:09:04 -05:00
Nicholas Lowell
f288bcaf99 pwm: add set nanosecond period and pulse width function
For improved precision of high speed PWMs, the new
function will allow you to specify period and pulse
at the nanosecond resolution.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2019-02-21 18:07:40 -05:00
Tomasz Bursztyka
c6f0491606 net/shell: Switch TCP send command to new API
It simplifies things again, as it does not need to create the net_pkt by
itself anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 18:06:06 -05:00
Anas Nashif
63d330e78b doc: Rework Development Process section
- Added various contents from stale wiki pages
- Added API life cycle document
- Add pictures showing process in general
- Split the document into multiple sections.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-21 18:04:02 -05:00
Jan Van Winkel
e66cbb68e3 drivers: ssd1306: Corrected API mapping for blanking
Swapped mapping of SSD1306 display driver functions on display
blanking API.

fixes #13609

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-02-21 16:55:37 -06:00