This is a simple shell module that allows arbitrary boards with flash
driver support to explore the flash device.
- Reading, erasing, and writing by device offsets are supported in all
cases.
- If the flash page layout is available, it can be printed, and I/O
can also be done to a specified page as well.
One known issue is that writing to flash on targets that require
doubleword-sized writes (e.g STM32L4) will fail since the number of
arguments required exceeds ARGC_MAX in shell.c. Addressing that is
left to future work.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
L4 parts have a constant page size, so just rely on the HAL defines
that provide it, along with a read to the register which contains this
SoC's total size.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Add flash page layout support for STM32F4 SoCs.
This almost eliminates the need for flash_map.h, except for
STM32F4X_SECTOR_MASK, so delete the file and move the define into the
F4 implementation, to keep things simple.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This is a prep work commit for adding flash page layout support.
The internal flash APIs for STM32 on L4 and F4 are a bit
inconsistent. Some routines take a pointer to the private data, others
don't. Those that do take it as a last argument instead of a
first. Additionally, some APIs are declared in flash_stm32.h that
aren't ever used by the family-specific files.
Clean this up by making everything take a struct device*, and marking
routines static in the common driver code when possible.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Added sample code for testing and displaying the flash layout using
the recently introduced API.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Added an internal function to obtain the flash page layout in
run-length encoded format. The API is simple and allows the actual
public API implementations to be simple and maintainable.
This feature can be enabled by using the FLASH_PAGE_LAYOUT Kconfig
option. This API is required for the implementation of flash file
system.
Added a public API to get flash page information (size and start offset)
by offset within the flash and by index of the page.
Added a generic implementation of the internal flash_get_page_info API.
Added an additional public API call to get the total count of pages in
the flash memory and its generic implementation.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Added tests for the mcuboot interface module and the image
storage module.
Both tests are checking flash content produced by modules verified.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Store image in sequence of certain blocks.
Module is intended to be use by a higher-level
image management protocol module
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
read, update status
trigger flashing
erase image bank
Module is intended to be use by a higher-level
image management protocol module.
Signed-off-by: Fabio Utzig <utzig@apache.org>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Added flash-controller description and moved flash description to
it (for coherence). Added property for description of
the flash alignment required by write operations.
Thanks to that l-value FLASH_WRITE_BLOCK_SIZE macro
will be generated. It is useful for any component uses
the flash.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Do not print messages by default on console for test cases.
Use SYS_LOG_INF which provides functionality to choose print whenever
require.
Signed-off-by: Punit Vara <punit.vara@intel.com>
This patch eliminates need to add logging/sys_log.h in test
cases which required to use this header file.
Signed-off-by: Punit Vara <punit.vara@intel.com>
When new connection is accepted, the TCP context variables like
sequence number etc. were not properly set.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
spi.h and spi_legacy.h contain duplicate type and function names that
interfere with the doxygen-based API documentation.
fixes: #1425
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This was felt to be necessary at one point but actually isn't.
- When a thread is initialized to use a particular stack, calls will be
made to the MMU/MPU to restrict access to that stack to only that
thread. Once a stack is in use, it will not be generally readable even
if the buffer exists in application memory space.
- If a user thread wants to create a thread, we will need to have some
way to ensure that whatever stack buffer passed in is unused and
appropriate. Since unused stacks in application memory will be generally
accessible, we can just check that the calling thread to
k_thread_create() has access to the stack buffer passed in, it won't if
the stack is in use.
On ARM we had a linker definition for .stacks, but currently stacks are
just tagged with __noinit (which is fine).
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Remove MAINTAINERS in favor of CODEOWNERS file which is supported by
github. Also remove scripts using this file and change checkpatch to
reference CODEOWNERS instead.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
For IPv6 check_ip_addr in subsys/net/ip/net_core.c makes a
NET_DBG call to report when a net_pkt is missing a destination
address. An analogous NET_DBG call has been added to the IPv4
destination address checking.
Signed-off-by: John Andersen <john.s.andersen@intel.com>
If an event cmd is 0, NET_MGMT_GET_COMMAND() will return 0. That breaks
mgmt event core logic.
Jira: ZEP-2594
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
prepare_arp() was unreferencing original pkt (called pending there) in
case of error.
net_prepare_arp() was always unreferencing pkt, though it could have
been already unreferenced by prepare_arp() as seen previously which is
an extra bogus unref in this case.
And in case it returned NULL, ethernet_send() would return NET_DROP
which in turn would make net_if's tx code to unref again the pkt.
This patch ensures pkt is unrefed only once and at the right place.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The TCP state string is only printed if CONFIG_NET_DEBUG_TCP is
defined. If that is not the case, then the "net conn" command
should not print the "State" column name as the state will not
be printed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Helper macros to ease the usage of the MMU page table structures.
Added Macros to get Page table address and Page Table Entry
values.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Prevents overlapping region errors when enabling application memory
but there is nothing to put in application data.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The generated struct k_thread could end up in the wrong memory space
if CONFIG_APPLICATION_MEMORY is enabled.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Most x86 exceptions that don't already have their own handlers
are fairly rare, but with the introduction of userspace
people will be seeing General Protection Faults much more
often. Report it as text so that users unfamiliar with x86
internals will know what is happening.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Previously, this was only done if an essential thread self-exited,
and was a runtime check that generated a kernel panic.
Now if any thread has k_thread_abort() called on it, and that thread
is essential to the system operation, this check is made. It is now
an assertion.
_NANO_ERR_INVALID_TASK_EXIT checks and printouts removed since this
is now an assertion.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
It's now possible to instantiate a thread object, but delay its
execution indefinitely. This was already supported with K_THREAD_DEFINE.
A new API, k_thread_start(), now exists to start threads that are in
this state.
The intended use-case is to initialize a thread with K_USER, then grant
it various access permissions, and only then start it.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Garbage values here could wreak havoc on the initial switch to main
depending on how arch-specific _Swap() manages memory permissions when
switching threads.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Years of iterative development had made this function more complicated
than it needed to be. Fixed some errors in the documentation as well.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
All system calls made from userspace which involve pointers to kernel
objects (including device drivers) will need to have those pointers
validated; userspace should never be able to crash the kernel by passing
it garbage.
The actual validation with _k_object_validate() will be in the system
call receiver code, which doesn't exist yet.
- CONFIG_USERSPACE introduced. We are somewhat far away from having an
end-to-end implementation, but at least need a Kconfig symbol to
guard the incoming code with. Formal documentation doesn't exist yet
either, but will appear later down the road once the implementation is
mostly finalized.
- In the memory region for RAM, the data section has been moved last,
past bss and noinit. This ensures that inserting generated tables
with addresses of kernel objects does not change the addresses of
those objects (which would make the table invalid)
- The DWARF debug information in the generated ELF binary is parsed to
fetch the locations of all kernel objects and pass this to gperf to
create a perfect hash table of their memory addresses.
- The generated gperf code doesn't know that we are exclusively working
with memory addresses and uses memory inefficently. A post-processing
script process_gperf.py adjusts the generated code before it is
compiled to work with pointer values directly and not strings
containing them.
- _k_object_init() calls inserted into the init functions for the set of
kernel object types we are going to support so far
Issue: ZEP-2187
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>