When calling scripts/gen_idt, if we don't have $ZEPHYR_BASE/scripts in
the path, it will fail, so we can call it with its full path to avoid
such need.
Change-Id: I47b340c9f3204ad8740c29e663e12082208bb13b
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Initial version of some document to capture the secure coding
practices used in the Zephyr project.
Signed-off-by: David Brown <david.brown@linaro.org>
Change-Id: Ic20546a7af832dc7bd193eb91ed44f1badc3ab87
This sample application uses the kernel system logger already present
in Zephyr and publishes events through the SEGGER RTT protocol, so it's
available by the SEGGER SystemView application.
[1] https://www.segger.com/systemview.html?p=1731
Jira: ZEP-1463
Change-Id: If1eba4644b95175660b3040bdc4b2717b2cfc9ad
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
These libraries allow publishing information to enable system profiling
when using the SEGGER SystemView tool. This tool provides a way to record
and visualize events such as threads scheduling, interrupts, and can help
find unintended interactions and resource conflicts. More information can
be obtained from SEGGER website at [1], including downloads for major
platforms.
[1] https://www.segger.com/systemview.html?p=1731
Jira: ZEP-1463
Origin: https://www.segger.com/systemview.html?p=1731
Change-Id: I04f5897690089dc8a8fb4ae60726fe3a022b7a30
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This adds a new event type to the kernel event logger that tracks
thread-related events: being added to the ready queue, pending a
thread, and exiting a thread.
It's the only event type that contains "subevents" and thus has a
non-void parameter in their respective _sys_k_event_logger_*()
function. Luckily, as isn't the case with other events (such as IRQs
and thread switching), these functions are called from
platform-agnostic places, so there's no need to worry about changing
the assembly guts.
This is the first patch in a series adding support for better real-time
profiling of Zephyr applications.
Jira: ZEP-1463
Change-Id: I6d63607ba347f7a9cac3d016fef8f5a0a830e267
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Document the flash latency values by copying the relevant tables
from the reference manuals for each MCU.
Change-Id: Ieb2824ffd7634d917399e3e62146d9243b527f44
Signed-off-by: Christer Weinigel <christer@weinigel.se>
Fix misspellings in Kconfig help text and made spelling of
RX and TX consistent (from reviewer comments)
Change-Id: Ie9d4c3863cd210e7a17b50a85a7e64156b6bf3d7
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
If the flash latency isn't set most STM32F4xx MCU's won't be able
to run from flash when the CPU frequency is changed. Make this a
compile time error instead of an assert at runtime.
Change-Id: Ic3421194545f8f83bd6e00f0cd011306c8d1eedd
Signed-off-by: Christer Weinigel <christer@weinigel.se>
We want to show that if a non-essential thread gets a fatal exception,
that thread gets aborted but the rest of the system works properly.
We also test that k_oops() does the same.
Issue: ZEP-2052
Change-Id: I0f88bcae865bf12bb91bb55e50e8ac9721672434
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Put the reason code in r0 and make a SVC #2 call, which will be
propagated to _fatal_error_handler as an exception.
The _is_in_isr() implementation had to be tweaked a bit. User-generated
SVC exception no longer just used for irq_offload(); just because we are
in it does not mean we are in interrupt context. Instead, have the
irq_offload code set and clear the offload_routine global; it will be
non-NULL only if it's in use. Upcoming changes to support memory
protection (which will require system calls) will need this too.
We free up some small amount of ROM deleting _default_esf struct as it's
no longer needed.
Issue: ZEP-843
Change-Id: Ie82bd708575934cffe41e64f5c128c8704ca4e48
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We reserve a specific vector in the IDT to trigger when we want to
enter a fatal exception state from software.
Disabled for drivers/build_all tests as we were up to the ROM limit
on Quark D2000.
Issue: ZEP-843
Change-Id: I4de7f025fba0691d07bcc3b3f0925973834496a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Unlike assertions, these APIs are active at all times. The kernel will
treat these errors in the same way as fatal CPU exceptions. Ultimately,
the policy of what to do with these errors is implemented in
_SysFatalErrorHandler.
If the archtecture supports it, a real CPU exception can be triggered
which will provide a complete register dump and PC value when the
problem occurs. This will provide more helpful information than a fake
exception stack frame (_default_esf) passed to the arch-specific exception
handling code.
Issue: ZEP-843
Change-Id: I8f136905c05bb84772e1c5ed53b8e920d24eb6fd
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This is needed by application code that wants to print formatted
strings, but only has a fmt and va_list, and lacks memory to spare for
"buf" and something like:
vsnprintk(buf, sizeof(buf), fmt, ap);
printk("%s", buf);
Change-Id: Ic9cc915ec7e5f8f9492c730667f39788ecae65f6
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
GCC supports __attribute__((format (printf ...))) even when the
variadic arguments are not present. In this case, the attribute
argument specifying the start of the variadic arguments should be
zero.
Use this in printk.h to add __printf_like where it's missing.
Change-Id: I7868439d5791e391aeb07356af9819524e68c771
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
The ICSR RETTOBASE bit is improperly implemented in QEMU (the polarity
is flipped) and the fix for it has not yet made it into a QEMU release,
although it is present in upstream master branch.
The symptom is that if we are not in thread mode, the system always
believes were are in a nested exception state, causing _IsInIsr() to
always return true.
Skip the nested exception check if we are building for QEMU.
This is a workaround until SDK-54 is resolved.
Issue: SDK-54
Change-Id: I06eafcc85fb76a9b23b4ba85ed6e111a08516231
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
For exceptions where we are just going to abort the current thread, we
need to exit handler mode properly so that PendSV can run and perform a
context switch. For ARM architecture this means that the fatal error
handling code path can indeed return if we were 1) in handler mode and
2) only wish to abort the current thread.
Fixes a very long-standing bug where a thread that generates an
exception, and should only abort the thread, instead takes down the
entire system.
Issue: ZEP-2052
Change-Id: Ib356a34a6fda2e0f8aff39c4b3270efceb81e54d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We do the same thing on all arch's right now for thread_monitor_init so
lets put it in a common place. This also should fix an issue on xtensa
when thread monitor can be enabled (reference to _nanokernel.threads).
Change-Id: If2f26c1578aa1f18565a530de4880ae7bd5a0da2
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We do a bit of the same stuff on all the arch's to setup a new thread.
So lets put that code in a common place so we unify it for everyone and
reduce some duplicated code.
Change-Id: Ic04121bfd6846aece16aa7ffd4382bdcdb6136e3
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There are a few places that we used an naked unsigned type, lets be
explicit and make it 'unsigned int'.
Change-Id: I33fcbdec4a6a1c0b1a2defb9a5844d282d02d80e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Only in rare cases should we allow C99 types, so lets warn about it to
catch issues.
Change-Id: I2bacdd4ba98f88482e0b7acc0567ff1139e749bf
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types. This handles the remaining includes and kernel, plus
touching up various points that we skipped because of include
dependancies. We also convert the PRI printf formatters in the arch
code over to normal formatters.
Jira: ZEP-2051
Change-Id: Iecbb12601a3ee4ea936fd7ddea37788a645b08b0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
s/uint8_t/uint32_t
For some reason gpio_pin_configure uses a uint8_t though all other
places ask for uint32_t.
Change-Id: I50c113d71fd1d1cfba231fbc98b355b69a78dbec
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Even one liner if () should have get { ... }
Change-Id: I7f9d8d74398286e97549bed050e29d4d175e1b02
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I731cc91517436685836023cbda34f894586a54bc
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I08c682bfc0b80dfa88de859e90a011bcd2db2762
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: Icbf9e542b23208890a3a32358447d44cdc274ef1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There was compiler error if CONFIG_NET_DEBUG_CONN was set.
Change-Id: Ibb6721c55dd2c56cd0097359a53563c6221859ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to set the connect_cb for the context before sending SYN packet.
This is required if we have a loopback connection in which case everything
is happening more or less synchronously and the connect_cb would not be
called in this case because its value would still be null.
For remote network connections this patch makes no difference.
Change-Id: Id7f837cd9e81cd79c4666c98cae84f6cb1a77af0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Some incompatible changes were introduced when net and bluetooth
branches were changed at the same time.
Change-Id: Ifa03f85d26a63ade0fcc029377d54850c0e92451
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types. There are few places we dont convert over to the new
types because of compatiability with ext/HALs or for ease of transition
at this point. Fixup a few of the PRI formatters so we build with newlib.
Jira: ZEP-2051
Change-Id: I7d2d3697cad04f20aaa8f6e77228f502cd9c8286
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We must not let ACK timer to run if we have already cancelled it.
So keep track that the timer is cancelled and refuse to run it
if it was indeed cancelled. The reason why the timer might be run
in this case is because the timer might be scheduled to be triggered
after which one cannot cancel it.
Change-Id: I1c8b8cee72bc7a644e02db154d9d009b8d98ade2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The local port was set to 0 for IPv6 when registering
the connection handler. For IPv4, the code was not setting
the port in local_addr struct.
Change-Id: I82f0c08641a94d75d255ac306eca7bec6c332fba
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Without this info it is a bit difficult to notice what is going
on in loopback case.
Change-Id: I8f61330c01d025e41f00d663bd26947b8cafb5c0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add support to print connection handler information in net-shell.
There exists one connection handler for each UDP/TCP port that we
are listening. These prints are only available if CONFIG_NET_DEBUG_CONN
is enabled because the net_context has the same information. Thus the
connection handler info is only printed if debugging is active in order
to verify that handler information is proper.
Change-Id: I0be39a5adb89b2cdbd85524c5d943e4a562b0fde
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If TCP debugging is enabled but if the loglevel is set to lower
than 4, then compiler prints warning about unused flags variable
in net_tcp_trace().
Change-Id: I2e663644b50fe97b75088202e21b286aa010953e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Only 2 attributes lacked this prefix, which makes sense to have, so
applying it accordingly and changing the helpers as well.
Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.
Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>