This is a prep work patch for adding another command. Refactor
build.py to use a new Forceable superclass and find_build_dir() helper
routine. Fix a help string while we are here.
Signed-off-by: Marti Bolivar <marti@foundries.io>
EditorConfig (https://editorconfig.org) is a widely supported
configuration tool that helps to ensure better consistency amongst
developers by auto-configuring an editor to match the original/intended
style i.e. tab-width etc.
This configuration covers many of the common file formats used in
zephyr.
The configuration was derived by looking at existing files and
ascertaining what configuration they currently use.
This is the top-most EditorConfig file meaning this is the root of all
other EditorConfigs, however sub-directories can set their own up if
they wish to override this.
This has proven especially useful when viewing uncrustified C source
code where the tab-width should be 8 to get proper alignment but many
editors use a tab-width of 4.
Lots of editors support this natively and those that do not probably
have a plugin or extension.
Tested by opening and saving various files to ensure no changes
occurred.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
SPFLAGS allows to pass additional flags supported by
spatch during transformation.
Both short notation `-f=` and `--sp-flag=` can be used
to pass the flag to the coccicheck.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Last parameter of exec_cmd function has been corrected from
structure type to pointer to structure type.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Sample application which opens a packet socket and receives
every packet on the wire and send some dummy packet over
socket. Simple demo of how to use packet sockets.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit adds packet socket support to socket api.
This version supports basic packet socket features.
Protocol family is AF_PACKET, type of socket is
SOCK_RAW and proto type is ETH_P_ALL. The user will
receive every packet (with L2 header) on the wire.
For TX, the subsystem expects that the user has set
all the protocol headers (L2 and L3) properly.
Networking subsystem doesn't verify or alter the headers while
sending or receiving the packets. This version supports packet
socket over Etherent only. Also combination of other family
and protocols doesn't work (i.e. Application can not open
packet-socket and non packet-socket together).
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
If packet family is AF_PACKET and CONFIG_NET_SOCKETS_PACKET
is enabled, just handover the packet to driver for sending.
L2 layer will not touch AF_PACKETs at the moment.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
If CONFIG_NET_SOCKETS_PACKET is enabled, then feed the packet
to net_packet_socket_input() for processing. It will search
for the net_contexts and if proper handler is found, pass
the packet to connection handler.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit adds basic packet socket support to net_context and
allows application to receive or send network packets in raw
format.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
As we are adding more protocol families and protocol types
to connection handlers, some values might be same across
different types. Current connection handler only stores
proto type to match the handler, which is not enough if
we add more types. Also combination of family and types
may vary too. So adding family to connection handler to
figure out best match.
Also changing proto variable in net_conn from u8_t to u16_t.
net_context has 16 bit proto.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Various defines and helpers for supporting packet sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
When creating net_pkt, the default value of net_pkt data_len was
set to zero. In case of RAW sockets, when family is AF_PACKET,
the data_len will be zero as there is no higher level protocol
information. So in this case, the default value of data_len
must be set to interface MTU
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Add ETH_P_xxx protocol types if they are missing. After this
we can use the protocol types when working with BSD sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The return value of net_if_get_link_addr points to a struct net_linkaddr
instead of to the raw MAC address. Without this fix the source address
will always end in 06:03 and will most likely be the same for different
boards running the same software.
Signed-off-by: Daniel Glöckner <dg@emlix.com>
Translate HCI error codes to POSIX error codes in order to be able to
distinguish reason of connectable advertising start failure.
Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
Return meaninful HCI error when it's not possible to start advertising
because of maximum number of connections already in use.
Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
Less spammy and as easy to understand ("label" seems a bit confusing
though, but it's consistent with other code).
Also simplify some surrounding code, and clean up the implementation of
str_to_label() a bit.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Pass the dictionary of definitions directly. Shorter and clearer.
Also get rid of some other temporary variables, a redundant str() call,
and some mysterious commented-out code in _extract_flash().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Maybe the code is trying to turn integers into single-element list,
but it won't work (needs to be [value] rather than list(value)).
Don't think you could ever end up with an integer either.
- extract_controller() assumes that prop_values is a list, so
reduced[...].get(prop) should be reduced[...][prop]. get() means it's
okay for the key to be missing, which makes the code confusing.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- The 'props' key is known to exist (and 'if enabled == ...:' would
crash if it ever was missing)
- 'd' is always a dictionary
- There's no need to test if d['children'] is non-empty before looping
through it
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- The 'props' key is known to exist (and 'if enabled == ...:' would
crash if it ever was missing)
- 'd' is always a dictionary
- There's no need to test if d['children'] is non-empty before looping
through it
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
dict.get(key) signals to people reading the code that you're not sure
whether the key exists. It returns None if it doesn't.
When the key is known to exist, dict[key] should be used. This also
helps catch bugs by raising an exception if the key is missing.
Similarly, whether a key in a dict should be tested with
if key in dict:
instead of with
if dict.get(key):
The second version signals that you both want to make sure that the
exists and that it's truthy (e.g., non-empty). That's confusing if a
simple existence check was meant.
There seems to be a bug in output_keyvalue_lines() where
fd.write("%s=%s\n" % (entry, defs[node].get(a)))
can end up writing '...=None'. Removing the .get() makes it throw an
exception instead. Keep the .get() for now and don't attempt to fix the
bug.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Added sample to show disk access and FS api with
Fat filesystem and SDHC driver. Tested working with
nrf52840 (blip).
Signed-off-by: Tavish Naruka <docuser@docs.electronut.in>
Add SPI_6 Kconfig symbol as this is the higher supported instance on
STM32.
This makes symbol CONFIG_SPI_6, used in stm32 driver a valid symbol.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit enforces default double-word stack alignmnet
on exception entry for Cortex-M3 and Cortex-M4 MCUs. The
patch ensures that we have consistent behavior in all
Cortex-M MCUs (double-world stack alignment on exception
entry is enforced by default in ARMv6, ARMv8, and Cortex-M7
processors).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit updates the documentation of Kconfig option:
STACK_ALIGN_DOUBLE_WORD for Cortex-M microprocessors, stating
that the option is used in ARMv7-M MCUs to enforce 8-byte
stack alignment upon exception entry.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
A few cases were missed where we weren't cleaning up the existing
connection correctly. This was easily missed because we try and
clean up the connection everywhere.
Instead, let's clean up any existing connection prior to starting
a new one in the do_bootstrap_reg() and do_registration()
functions.
Signed-off-by: Michael Scott <mike@foundries.io>
- Fix enum naming throughout
- Correct next_instance logic
- Move to registration server if no bootstrap server is found
- Fixes to logging
Signed-off-by: Michael Scott <mike@foundries.io>
use cmsis functions to avoid using direct assembly for main thread
switching.
This patch uses cmsis functions to:
- set PSP(process stack pointer) to main stack
- enable interrupts
Fixes#12878
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
After including native_posix USB controller we can perform some simple
tests on native_posix.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
There is no need to rename the POSIX types, so let's not do it to
simplify things
Also remove an unnecessary guard (POSIX_ARCH) to avoid mystifying
this any more than necessary
Related to #13054
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
If an unitialized/zeroed optional attribute was passed to osThreadNew
the priority would be osThreadNone i.e. uninitialized. This causes an
ASSERT to be hit as the priority isn't valid (it is not between
osPriorityIdle and osPriorityISR).
The fix checks the passed in priority is not osPriorityNone and assigns
osPriorityNormal. This is the correct CMSIS behaviour.
The ASSERT will still be hit if the priority is invalid (<0).
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
Fixed an issue whereby if an attribute structure was passed into a CMSIS
RTOS v2 'new' function with an invalid address i.e. NULL assigned to the
name (char*) member the memcpy at the end of each new function
would cause a segmentation fault i.e. read from an invalid
address.
This has been fixed by checking if the name is NULL and using the
default name from the init struct if it is. This is the same name
that would be used if not passing in the optional attr function
argument.
Changed the memcpy to strncpy to ensure that the copy does not read
beyond the end of the source string and changed the length from 16 to 15
(by means of a `sizeof(...)-1`) of the destination buffer to ensure that
it will always be nul-terminated.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
Added a set of tests that use the default thread stacks to ensure they
work the same as the passed in stacks. Abstracted the common
functionality into functions.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
Implemented dynamic thread stacks for CMSIS threads by declaring an
array of default sized thread stacks. Allocation cannot be done on the
heap as some architectures require strict alignment for stacks so the
macro must be used to define the stack to ensure most compatibility.
Added a Kconfig variable to limit the number of dynamic threads on the
system (they also count towards total CMSIS thread count). This is so a
developer can have fine grained control over how many dynamic threads
can be allocated because all their stacks must be allocated up front so
could use a lot of memory needlessly if oversubscribed. The default
value is 0 which effectively disabled dynamic threads but also reduces
the memory impact to almost none.
Fixed an assert bug where thread_num was being tested against the
maximum allowed CMSIS threads - it previous checked for less than or
equal which actually (due to when the increment happens) allowed there
to be one more thread. The check now correctly uses less than and only
allowed up to the defined maximum.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
Implemented a second set of memory pool tests that function on a
dynamically allocated memory pool. Abstracted some of the common
functionality to a common function.
Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>