Commit graph

41120 commits

Author SHA1 Message Date
Adithya Baglody
a65df22525 samples: rpl_border_router: Fixed headers files.
This sample was creating objects from header file in the bss.
Fixed it by moving the objects to appropriate object files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
f6e7c8b1b5 tests: subsys: fs: Fixed headers which were creating objects.
These tests were creating objects from header file in the bss.
Fixed it by moving the objects to appropriate object files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
9f416da751 soc: ti_simplelink: cc32xx: soc.h: Incorrect enum definition.
Instead of creating an typedef enum it was creating an object.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
74296b9830 include: stats.h: Packed attribute was incorrect.
This header was actually creating a struct in the bss. Fixed it.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
ec25b7b7cb include: drivers: pci: pci_mgr.h: Create a typdef instead of obj.
This header was creating an object instead of a typdef. Fixed the
bug.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
567de65f84 drivers: ipm: ipm_quark_se: Remove object declaration from header
The header ipm_quark_se.h was creating a object. Hence removed it
and placed the same in ipm_quark_se.c

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
b6fbb30b1a tests: benchmarks: timing_info: Remove common variables
This patch ensures that there are no .common variables in the
test case.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Varun Sharma
4223e7bbcc doc: code_data_relocation: Details about code data relocation feature
Added basic working details of code/data/bss relocation feature,
how to use with examples & code sample details

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
21fa43387e samples: code_relocation: An example for code relocation feature.
This sample provides an example for using the code relocation
feature. This example will place text,data,bss from 3 files to
various parts in the SRAM. For this a custom linker file is used
which is derived from include/arch/arm/cortex_m/scripts/linker.ld.

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
aa2890e267 arch: Kconfig: Increased the text area for kobject and priv stack
When code relocation feature with userspace mode is turned on we
need a bit more memory to fit the text section for these 2
generated files.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
91c5b84cd5 kernel: init.c: Added required hooks for the relocation
This patch splits the text section into 2 parts. The first section
will have some info regarding vector tables and debug info. The
second section will have the complete text section.
This is needed to force the required functions and data variables
the correct locations.
This is due to the behavior of the linker. The linker will only link
once and hence this text section had to be split to make room
for the generated linker script.

Added a new Kconfig CODE_DATA_RELOCATION which when enabled will
invoke the script, which does the required relocation.

Added hooks inside init.c for bss zeroing and data copy operations.
Needed when we have to copy data from ROM to required memory type.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
62e152a8f0 cmake: Added rule and helper functions for code relocation.
This patch creates a rule in the cmake to trigger the generation
of linker_relocate.ld and code_relocation.c files.
The linker_relocate.ld will create appropriate sections and will
link the required functions or variables from all the selected
files.
The code_relocation.c will have code that is needed for
initializing data sections and copy of text sections(if XIP).
Also this will contain code that is needed for zeroing of bss.

The procedure to invoke this feature is:
1. Enable CONFIG_CODE_RELOCATION in the prj.conf

2. Inside CMakeList.txt in the project we need to mention
   all the files that needs to get relocated.

   zephyr_kernel_code_relocate(src/*.c SRAM2)

   Where the first argument is the file/files and the second
   argument is the memory where it has be placed.
   NOTE: The file argument supports glob expressions.

NOTE: Step 2 can be done as many times as required. And relative
paths can be given here.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Adithya Baglody
ff63101c7d scripts: gen_relocate_app.py: Script for relocating files in memory.
This script will relocate .text .data and .bss sections from
required files and places it in the required memory region. This
memory region and file are given to this python script in the form
of a string. Refer to the script for the format of this string and
the procedure to invoke it.

The main goal of this script is to provide a robust way to re-order
the memory contents without actually having to modify the code
(C source code and the linker code).
In simple terms this script will do the job of
__attribute__((section("name"))) for a bunch of files together.

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Sebastian Bøe
b0938569f4 cmake: Move libapp.a into it's own directory
Move libapp.a into it's own directory. This would make it's placement
consistent with how zephyr.elf is placed.

E.g. it might now look like:

ls b/*

b/build.ninja  b/CMakeCache.txt  b/cmake_install.cmake  b/rules.ninja

b/app:
libapp.a

b/CMakeFiles:
3.12.0   cmake.check_cache  CMakeOutput.log  TargetDirectories.txt
app.dir  CMakeError.log     CMakeTmp

b/zephyr:
arch                 kernel                       subsys
boards               lib                          tests
cmake                liboffsets.a                 zephyr.bin
CMakeFiles           libzephyr.a                  zephyr.elf
cmake_install.cmake  linker.cmd                   zephyr.hex
ext                  linker_pass_final.cmd        zephyr.map
include              linker_pass_final.cmd.dep    zephyr_prebuilt.elf
isrList.bin          misc                         zephyr.stat

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-07 10:21:16 -05:00
Diego Sueiro
b419297fed samples/display: Introduce the cfb_shell sample app
This adds the shell sample app for the Character Framebuffer testing.

cfb - Character Framebuffer shell commands
Options:
  -h, --help  :Show command help.
Subcommands:
  init        :[none]
  get_device  :[none]
  get_param   :<all, height, width, ppt, rows, cols>
  get_fonts   :[none]
  set_font    :<idx>
  invert      :[none]
  print       :<col: pos> <row: pos> <text>
  scroll      :<dir: (vertical|horizontal)> <col: pos> <row: pos> <text>
  clear       :[none]

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-12-07 10:21:02 -05:00
Diego Sueiro
20e4567bab shell: Add initial code for Character Framebuffer shell module
This adds the config option and files of the Character Framebuffer
shell module

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-12-07 10:21:02 -05:00
Diego Sueiro
72981ea31a subsys/fb/cfb: Introduce cfb_get_numof_fonts function
Adds the cfb_get_numof_fonts function to get the number of
available fonts

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-12-07 10:21:02 -05:00
Diego Sueiro
0ab9c46d86 subsys/fb/cfb: Introduce cfb_framebuffer_invert function
Adds the cfb_framebuffer_invert function to invert Pixels in the
Character Framebuffer

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-12-07 10:21:02 -05:00
Kumar Gala
a24770bd12 sensor: lsm6dsl: Update DTS support
Now that we can support the same compatible but different bus types,
update the LSM6DSL support to utilize the same compatible for either I2C
or SPI.  We rename the i2c binding file to st,lsm6dsl-i2c.yaml just to
be a bit more clear.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
471d2f3a0a scripts: extract_dts_includes: Generate device bus info define
For devices on buses like I2C or SPI its possible that a sensor might
support being on either bus type.  In the dts we can tell this by
looking at the parent bus of the device.  Its useful for a driver to
know this so can we build support into the driver accordingly.

For example if the LSM6DSL sensor ("st,lsm6dsl") is in the dts on a spi
bus we now generate:

	#define DT_ST_LPS22HB_PRESS_BUS_SPI	1

Its possible that a system exists in which multiple of the same sensor
exist but on different busses, so drivers should handle that case
accordingly.  For the LSM6DSL example we'd end up with:

	#define DT_ST_LPS22HB_PRESS_BUS_I2C	1
	#define DT_ST_LPS22HB_PRESS_BUS_SPI	1

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
2442382fac scripts: extract_dts_includes: Support same sensor on different bus
There are a number of cases in which we a sensor can be either connected
on I2C or SPI.  We've been treating these cases as different compatiable
properties, but they really should use the same compatiable and just
determine the info based on the parent bus in the device tree.  We can
now support having two different binding files for the same compatiable
to handle the case of a sensor supporting either I2C or SPI as how its
connected.

We put "sensor" nodes in a bus specific dict bus_bindings[bus] that
we can than lookup later based on the DTS and determining the bus type
that the "sensor" node is on.

Fixes #11375

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
2893be57ef scripts: extract_dts_includes: Split out yaml_list info
Have the yaml_list now have 'node', 'bus', and 'compat' information
instead of just the 'node' info.  For now we have all YAML nodes under
yaml_list['node'], however this will change to support sensors that
can be on I2C or SPI, since they will have the same compat, but
different YAML nodes.

This also introduces yaml_list['bus'] which has YAML nodes for any
compatiables on a given 'parent' bus (ie, 'i2c', or 'spi').

Finally, we also have yaml_list['compat'] with all the compatiables
that we parsed and matched to a YAML.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
f34a99532a scripts: extract_dts_includes: Pass node address to get_binding
Change get_binding to take the node address instead of the
compatiable.  This is in prep for having get_binding be able to look
at the parent of the node and determine which bus specific binding to
utilize (for cases like sensors that support both I2C & SPI).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
112b0f5eff scripts: extract_dts_includes: Add accessor function to access binding
Add accessor functions get_binding and get_binding_compats to
encapsulate access to binding database info.  Cleanup all direct access
to binding info and replace with calls to get_binding() and
get_binding_compats()

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
35afcc9c12 scripts: extract_dts_includes: remove passing yaml param to functions
Various functions like add_prop_aliases, extract_single_prop,
extract_single, reg.extract, compatible.extract, default.extract, and
flash.extract don't use the yaml argument that is passed to them.
Remove passing the argument, this is the first step in making access to
the yaml node information go through an accessor function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Kumar Gala
b7f5101e79 scripts: extract_dts_includes: Handle YAML inheritance when we load
Move the handling of 'inherits' in the YAML to right when we load.  This
allows us to remove yaml_collapse function and will allow us to look
into the yaml right after we load it for things like if the yaml is for
a child bus.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 09:08:04 -06:00
Jukka Rissanen
2b268f8d3d net: gptp: state2str() func is only available if debugging
The state2str() function should only be used if debugging
is enabled thus add some pre-processor checks there.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:43:59 +02:00
Jukka Rissanen
3af324033e net: gptp: Add more debugging when changing state
Print function and line number when changing state and when
debugging is enabled. Otherwise it is a bit difficult to follow
the program logic and locate the state change operation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:43:59 +02:00
Jukka Rissanen
83f38b5f2d net: gptp: Remove log_strdup() when printing packet info
As the msg parameter for PRINT_INFO() is always a const string
that is not coming from stack, there is no need to use
log_strdup() here. This helps to avoid the
"<log_strdup alloc failed>" messages.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:43:59 +02:00
Jukka Rissanen
ff0483c5af net: gptp: Get the gPTP header properly
If the link layer header is in the separate net_buf,
then skip that one.

Fixes #11827

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:43:59 +02:00
Peter A. Bigot
2dbecc2f2a i2c: support const correctness for write operations
Material that is being written to the device, as well as blocks of
octets used to specify the operation, are never written to by the I2C
infrastructure.  Applications should be permitted to store these objects
in immutable memory.

Update the API to add const qualifiers to object pointer arguments where
the corresponding address is used in an I2C write operation.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2018-12-07 09:24:26 -05:00
Jukka Rissanen
e812b6804a net: if: Make dst address const when selecting src addr
As the functions do not modify the destination address parameter,
it can be made const.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 16:18:24 +02:00
Flavio Ceolin
118715c62d misra: Fixes for MISRA-C rule 8.3
MISRA-C says all declarations of an object or function must use the
same name and qualifiers.

MISRA-C rule 8.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
4b35dd2628 misra: Fixes for MISRA-C rule 8.2
In C90 was introduced function prototype, that allows argument types
to be checked against parameter types, though it is not necessary
specify names for the parameters. MISRA-C requires names for function
prototype parameters, it claims that names can provide useful
information regarding the function interface.

MISRA-C rule 8.2

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
34b12d8f16 arch: x86: x86_mmu: Remove possible dead code
When __ASSERT is not enabled there is an attribution to the variable
total_partitions and it is never used.

MISRA-C rule 2.2

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
1492df3415 x86: core: thread: Avoid clash with function identifier
There is a function called _thread_entry defined in
lib/thread_entry.c. Just changing name to fix MISRA-C violation.

MISRA-C rule 5.8

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
26be3355ac kernel: sched: Fix undefined behavior
The order of evaluation of function calls in the arguments of a
function. This is undefined (32)/ unspecified(15-18) in C99.

MISRA-C rule 13.2 does not allow that a value of an expression and its
side effects happens in not deterministic order to avoid these
undefined behaviors.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
c42dc9435d arch: x86: Make tag name unique
Renaming a variable to not clash with a struct name.

MISRA-C rule 5.7

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
5304f352a7 include: misc: list_gen: Fix possible undefined behavior
The order of evaluation of function calls in the arguments of a
function. This is undefined (32)/ unspecified(15-18) in C99.

MISRA-C rule 13.2 does not allow that a value of an expression and its
side effects happens in not deterministic order to avoid these
undefined behaviors.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
d7271ec9db kernel: poll: Fix switch usage
According with MISRA-C and unconditional break statement must
terminate every switch-clause.

MISRA-C rule 16.1 and 16.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
c1eee25a98 lib: rbtree: Do not use lowercase l for literal suffix
Use suffix L to remove potential ambiguity between digit 1 and letter
l.

MISRA-C rule 7.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Flavio Ceolin
a42de6466a kernel: queue: Fix MISRA-C violation
MISRA-C requires the right-hand operand of && or || operator does not
contain persistent effect.

MISRA-C rule 13.5

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-07 09:06:34 -05:00
Kumar Gala
c9e5a27f41 samples: cmsis_rtos_v1: Disable tests on qemu_xtensa
We get an intermittent fail when running on qemu_xtensa.  Disable this
sample for now on that platform to allow sanitycheck / CI to pass for
other PRs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-12-07 08:37:07 -05:00
Anas Nashif
df3b7994d3 templates: Update issue templates
Updated templates with auto-labels.
Added enhancement/RFC templates.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-07 08:27:20 -05:00
Anas Nashif
60f7052bc4 samples: cmsis_rtos_v1: remove tracing test
This is not relevant to the test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-07 08:17:37 -05:00
Tomasz Bursztyka
8a8d4d3070 drivers/ethernet: Update RX error statistics relevantly
Update such statistic on all drivers.
Also, remove TX stats in native and stellaris drivers: such update is
done in L2 now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 14:30:06 +02:00
Tomasz Bursztyka
952e494bdd net/ethernet: Let L2 updating common rx/tx statistics
Common statistics should be updated in one centralized place and
ethernet_send is the right place for tx stats, as well as ethernet_recv
for rx stats.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 14:30:06 +02:00
Tomasz Bursztyka
538961d109 drivers/ethernet: Remove double unref from stellaris driver
It's now either L2 which unref the pkt on successful tx, or net_if on
error.

Also removing pkt->frags check, net_core.c:net_send_data() does it
already.

And using data_len in logging instead of net_pkt_get_len(), which one is
currently greedy (it goes over all net_bufs).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 14:30:06 +02:00
Tomasz Bursztyka
76fa82f7ab net/icmpv6: Optimize how chksum is verified
Just recalculate the chksum without resetting its value to 0, and test
if return value is 0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-12-07 13:50:46 +02:00
Carles Cufi
6075133bae doc: dts: Document aliases and chosen nodes
In order to clarify their use, add a brief description of the Device
Tree `aliases` and `chosen` nodes and their use in Zephyr.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-12-07 12:11:11 +01:00