Date   

Zephyr sdks builds in jenkins?

Kumar Gala
 

Are there continuous builds of the SDK in jenkins? Not seeing anything and was hoping to grab a “nightly” snapshot out of there.

- k


Daily JIRA Digest

donotreply@...
 

NEW JIRA items within last 24 hours: 0

UPDATED JIRA items within last 24 hours: 4
[ZEP-67] building a Zephyr app out of tree puts some files in wrong place
https://jira.zephyrproject.org/browse/ZEP-67

[ZEP-177] Windows build with MinGW
https://jira.zephyrproject.org/browse/ZEP-177

[ZEP-145] no 'make flash' for Arduino Due
https://jira.zephyrproject.org/browse/ZEP-145

[ZEP-303] checkpatch should be more lenient about the length of kconfig help sections
https://jira.zephyrproject.org/browse/ZEP-303


CLOSED JIRA items within last 24 hours: 1
[ZEP-85] (Fixed) build failure of public event handler defined within application MDEF file
https://jira.zephyrproject.org/browse/ZEP-85


RESOLVED JIRA items within last 24 hours: 2
[ZEP-53] (Fixed) enable kernel_event_logger on ARC
https://jira.zephyrproject.org/browse/ZEP-53

[ZEP-217] (Fixed) Galileo ADC/SPI initialization error
https://jira.zephyrproject.org/browse/ZEP-217


Daily Gerrit Digest

donotreply@...
 

NEW within last 24 hours:
- https://gerrit.zephyrproject.org/r/1994 : sensors: add driver for DHTxx sensors
- https://gerrit.zephyrproject.org/r/1993 : drivers/nble: Add timeout before Conn Param Update as Peripheral
- https://gerrit.zephyrproject.org/r/1974 : arc: Add linker command file for Harvard architecture
- https://gerrit.zephyrproject.org/r/1982 : tinycrypt: Fix discrepancy of ecc_make_key definition and declaration

UPDATED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1584 : Added profiler application and scripts
- https://gerrit.zephyrproject.org/r/1922 : tests: Add nano_work test
- https://gerrit.zephyrproject.org/r/1855 : nanokernel: Introduce workqueue API
- https://gerrit.zephyrproject.org/r/1815 : net: buf: Add tests for net_buf fragmentation
- https://gerrit.zephyrproject.org/r/1923 : sensor: Rework core to use workqueue API
- https://gerrit.zephyrproject.org/r/1880 : Bluetooth: L2CAP: Handle information response command on BR/EDR
- https://gerrit.zephyrproject.org/r/1878 : net: buf: Add net_buf_add_le32() helper API
- https://gerrit.zephyrproject.org/r/1971 : Bluetooth: L2CAP: Refactor l2cap_chan_get() in l2cap.c
- https://gerrit.zephyrproject.org/r/1879 : Bluetooth: L2CAP: Handle information request command on BR/EDR
- https://gerrit.zephyrproject.org/r/1766 : net: buf: Add net_buf_pull_le32() helper API
- https://gerrit.zephyrproject.org/r/1961 : spi: disable/enable interrupts before entering critical regions.
- https://gerrit.zephyrproject.org/r/1963 : i2c: disable/enable interrupts before entering critical regions.
- https://gerrit.zephyrproject.org/r/1903 : arm: Add support for Nordic Semiconductor's nRF52 series of ICs
- https://gerrit.zephyrproject.org/r/1907 : frdm_k64f: add flash target using openocd
- https://gerrit.zephyrproject.org/r/1962 : samples/net/loopback: Add helper functions to handle app data

MERGED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1992 : drivers/nble: Call bt_conn_security() on start pairing event
- https://gerrit.zephyrproject.org/r/1991 : drivers/nble: Implement bt_smp_auth_cancel()
- https://gerrit.zephyrproject.org/r/1990 : doc: arduino101: change kconfig option for GDB debugging
- https://gerrit.zephyrproject.org/r/1976 : add a new option for debugging quark se
- https://gerrit.zephyrproject.org/r/1978 : samples: get rid of obsolete usage of ARCH variable
- https://gerrit.zephyrproject.org/r/1988 : drivers/nble: Notify about updated connection parameters
- https://gerrit.zephyrproject.org/r/1987 : drivers/nble: Update connection parameters on_nble_gap_connect_evt
- https://gerrit.zephyrproject.org/r/1986 : drivers/nble: Add bt_conn_le_param_update implementation
- https://gerrit.zephyrproject.org/r/1989 : Bluetooth: SMP: Minor coding style fixes
- https://gerrit.zephyrproject.org/r/1984 : drivers/nble: Move bt_le_conn_params_valid function
- https://gerrit.zephyrproject.org/r/1985 : drivers/nble: Store new connection parameters
- https://gerrit.zephyrproject.org/r/1983 : drivers/nble: Fix setting connection role
- https://gerrit.zephyrproject.org/r/1981 : Bluetooth: Add comment clarifying condition check in bt_le_adv_start
- https://gerrit.zephyrproject.org/r/1980 : drivers/nble: Implement on_nble_gatts_write_exec_evt()
- https://gerrit.zephyrproject.org/r/1979 : drivers/nble: Fix passing uninitialized req parameters
- https://gerrit.zephyrproject.org/r/1977 : i2c: IC_CON_SPEED_MASK should be 2 bit mask
- https://gerrit.zephyrproject.org/r/1975 : net/ip: Fix Makefile typo
- https://gerrit.zephyrproject.org/r/1973 : checkpatch: change default kconfig help length warns
- https://gerrit.zephyrproject.org/r/1924 : grove: add temperature sensor
- https://gerrit.zephyrproject.org/r/1884 : grove: add light sensor
- https://gerrit.zephyrproject.org/r/1910 : aio: unify kconfig variables and make them consistent
- https://gerrit.zephyrproject.org/r/1911 : adc: unify kconfig variables and make them consistent
- https://gerrit.zephyrproject.org/r/1909 : rtc: unify kconfig variable names
- https://gerrit.zephyrproject.org/r/1919 : spi: consalidate and simplify
- https://gerrit.zephyrproject.org/r/1913 : spi: intel: move soc specific values to header file
- https://gerrit.zephyrproject.org/r/1901 : gpio: GPIO_DW_BOTHEDGES_SUPPORT unused
- https://gerrit.zephyrproject.org/r/1931 : eth_dw: use sys log interface for debugging
- https://gerrit.zephyrproject.org/r/1932 : device: add documentation for device_get_binding
- https://gerrit.zephyrproject.org/r/1914 : spi: remove kconfig variables that can be define in headers
- https://gerrit.zephyrproject.org/r/1900 : i2c: unify kconfig options and share them across drivers
- https://gerrit.zephyrproject.org/r/1920 : spi: use syslog infratructure for debugging
- https://gerrit.zephyrproject.org/r/1902 : gpio: use consistent names for IRQ priority variables
- https://gerrit.zephyrproject.org/r/1908 : watchdog: unify kconfig variables
- https://gerrit.zephyrproject.org/r/1570 : Bluetooth: tester: Add Kconfig for nimble stack
- https://gerrit.zephyrproject.org/r/1954 : Bluetooth: L2CAP: Enable handle BR/EDR signal channel traffic
- https://gerrit.zephyrproject.org/r/1951 : Bluetooth: L2CAP: Introduce internal BR/EDR connection L2CAP notifier API
- https://gerrit.zephyrproject.org/r/1952 : Bluetooth: L2CAP: Move bt_l2cap_br_fixed_chan_register() to l2cap_br.c
- https://gerrit.zephyrproject.org/r/1953 : Bluetooth: L2CAP: Implement bt_l2cap_br_connected() notifier
- https://gerrit.zephyrproject.org/r/1950 : Bluetooth: L2CAP: Move init BR/EDR pool signal buffers to l2cap_br.c
- https://gerrit.zephyrproject.org/r/1582 : qemu: Add possibility to redirect serial port to pseudo TTY
- https://gerrit.zephyrproject.org/r/1583 : kernel event profiler: add dynamic enable/disable/configure
- https://gerrit.zephyrproject.org/r/1578 : Add interrupt stub label for profiler (interrupt event)
- https://gerrit.zephyrproject.org/r/1577 : Set kernel event logger timestamps to HW cycles
- https://gerrit.zephyrproject.org/r/1964 : i2c: fix i2c_dw.c to have correct decl for i2c_dw_isr()
- https://gerrit.zephyrproject.org/r/1965 : quark_se_devboard: Update flash and debug openocd configuration
- https://gerrit.zephyrproject.org/r/1959 : kernel: add _IS_IDLE_TASK()
- https://gerrit.zephyrproject.org/r/1940 : galileo: set priority of ADC to 95
- https://gerrit.zephyrproject.org/r/1972 : Bluetooth: SMP: Fix ecc_make_key return code check
- https://gerrit.zephyrproject.org/r/1958 : openocd: enable cmsis-dap, jlink, stlink interfaces
- https://gerrit.zephyrproject.org/r/1957 : hosttools-tarball: Add hidapi-libusb
- https://gerrit.zephyrproject.org/r/1956 : hidapi-libusb: HIDAPI library for OpenOCD
- https://gerrit.zephyrproject.org/r/1955 : zephyr-sdk.inc: Update tested distros.
- https://gerrit.zephyrproject.org/r/1970 : Bluetooth: GATT: Remove authorization permission
- https://gerrit.zephyrproject.org/r/1969 : Bluetooth: Omit implicit permission flags
- https://gerrit.zephyrproject.org/r/1936 : doc: use table for Kconfig option reference


RFC: draft x86 interrupt documentation

Boie, Andrew P
 

I had a recent need to explain in detail the x86 IRQ implementation to
some colleagues working on Quark CPUs, and wrote this document.
Eventually I would like to clean this up, discuss other arches, and make
it part of the official Zephyr documentation. Comments appreciated.


##### 1. APIs

Overview of the interrupt API in Zephyr can be found here:
https://nexus.zephyrproject.org/content/sites/site/org.zephyrproject.zephyr/latest/kernel/nanokernel/nanokernel_interrupts.html

Note that Zephyr currently only officially supports static registration
of interrupts at build time. We used to also support dynamic IRQs which
are wired at runtime, but this has been deprecated. The code for
irq_connect_dynamic() still exists in the codebase but will not be
discussed here.

This document assumes you are familiar with the x86 IDT. We will mostly
discuss interrupts, exception handling is briefly described at the end
of this document.

2. High-level design

As seen in the API definitions, ISR routines in Zephyr take the
following form:

void isr(void *parameter);

And are registered with the IRQ_CONNECT() macro:

/**
* Configure a static interrupt.
*
* All arguments must be computable by the compiler at build time; if
this
* can't be done use irq_connect_dynamic() instead.
*
* @param irq_p IRQ line number
* @param priority_p Interrupt priority
* @param isr_p Interrupt service routine
* @param isr_param_p ISR parameter
* @param flags_p Arch-specific IRQ configuration flags
*
* @return The vector assigned to this interrupt
*/
#define IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
_ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p,
flags_p)

On x86, there's no place to put the parameter in the IDT, all you can
assign to a vector is a void isr(void). In Zephyr, what actually gets
installed in the IDT is an automatically generated assembly stub. For
IAMCU ABI it looks like this:

/* Push caller-saved registers onto the stack */
pushl %eax
pushl %edx
pushl %ecx
/* Put hard-coded ISR and ISR parameter into function args,
* with IAMCU these go in regs and not the stack */
movl <isr routine>, %eax
movl <isr parameter>, %edx
/* Call common interrupt handling code */
call _execute_handler
/* Restore caller-saved registers
popl %ecx
popl %edx
popl %eax
/* Return to the interrupted context */
iret

Note that the implementation of this is very different for Sys V ABI,
but the policy is the same. For purposes of this document we'll just
describe the IAMCU implementation.

We'll discuss what _execute_handler does in more detail later, and how
these stubs are created. First, let's talk about how we create the IDT
and populate it with these stubs.

###### 3. ISR_LIST

Each invocation of IRQ_CONNECT() populates an array called the ISR_LIST,
placed in a special binary section called ".intList". The build tool
gen_idt (described in more detail later) uses ISR_LIST to create a
binary IDT image. Each element of the ISR_LIST contains all the
information needed to generate the IDT entry and looks like this:

typedef struct s_isrList {
/** Address of ISR/stub */
void *fnc;
/** IRQ associated with the ISR/stub */
unsigned int irq;
/** Priority associated with the IRQ */
unsigned int priority;
/** Vector number associated with ISR/stub */
unsigned int vec;
/** Privilege level associated with ISR/stub */
unsigned int dpl;
} ISR_LIST;

Not all the members of this struct need to populated with specific
values. Use-cases as follows:

* For APIC, the typical case for an interrupt is to set the priority and
irq fields, and set vec to -1. This means gen_idt will automatically
select a free vector based on the supplied priority level, with each
priority level corresponding to a group of 16 vectors. Priority 0
corresponding to vectors 32-47, and so forth.

This makes it easy for users, as they don't have to set a specific
vector ID. Instead the vector will be of some range determined by the
priority level instead.

* For MVIC, there is a fixed relationship between IRQ lines and vectors.
The priority field is set to -1 and the vector is set to irq + 0x20.

* For CPU exceptions, the priority and irq fields are set to -1 and the
specific vector to use is provided. The handler function will simply get
put at the requested vector. CPU exceptions configured with different
macros than IRQ_CONNECT() and have different handling in the OS, briefly
described later in this document.

* Currently dpl is always zero. We don't support other DPLs at the
moment, gen_idt will throw an error if it finds something other than
zero here.

At the end of the build, but before the final link, we now have an
INT_LIST array which reflects the intended configuration for the IDT.
Before Zephyr is actually linked, the gen_idt tool runs and generates an
object file containing the IDT binary, which gets linked into the final
executable.

###### 4. gen_idt

The code for gen_idt is located in scripts/gen_idt. Broadly speaking it
consumes the ISR_LIST, validates the sanity of its contents, and creates
an object file creating the IDT and a few other data structures.

For each entry in ISR_LIST, gen_idt creates a present 32-bit i386
Interrupt gate for it with DPL 0.

In addition to creating the IDT, gen_idt populates a few other data
structures.

* For APIC, _irq_to_interrupt_vector array contains the mapping between
irq lines and the vectors assigned to them by gen_idt. We need this at
runtime so that we can program the APIC at boot:

extern unsigned char _irq_to_interrupt_vector[];
#define _IRQ_TO_INTERRUPT_VECTOR(irq) \
((unsigned int) _irq_to_interrupt_vector[irq])

For MVIC, whose mapping is fixed, this array isn't generated and the
macro is instead:

#define _IRQ_TO_INTERRUPT_VECTOR(irq) (irq + 0x20)

* _interrupt_vectors_allocated is a bitfield indicating which entries in
the IDT are in use. It is only used by the deprecated dynamic IRQ
implementation (so that it can quickly find free vectors) and will
eventually disappear.

gen_idt is run at the end of the build just before the final linking
step.

####### 5. IRQ_CONNECT()

The IRQ_CONNECT() macro is a complicated beast with build and runtime
components. It does the following:

1. Declare an assembly language ISR stub, which calls common interrupt
entry/cleanup code and calls the user-supplied ISR with parameter. The
address of this stub is what gets put in the IDT.

2. Declare appropriate ISR_LIST entry to be put in .isrList section, for
gen_idt to use to create the actual IDT.

3. Perform any runtime initialization. For APIC, this establishes the
irq line to vector mapping, and set triggering options. Depending on the
irq line this will be accomplished by poking either LOAPIC or IOAPIC
registers. For MVIC we just set triggering options.

This stuff is all found in include/arch/x86/arch.h. There are detailed
comments, I've omitted them since I'm just going to re-explain
everything.

First, the _ARCH_IRQ_CONNECT macro itself:

/*
* @param irq_p IRQ line number
* @param priority_p Interrupt priority
* @param isr_p Interrupt service routine
* @param isr_param_p ISR parameter
* @param flags_p IRQ triggering options
*
* @return The vector assigned to this interrupt
*/
#define _ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p,
flags_p) \
({ \
__asm__ __volatile__( \
"jmp 2f\n\t" \
".pushsection .intList\n\t" \
".long 1f\n\t" /* ISR_LIST.fnc */ \
".long %P[irq]\n\t" /* ISR_LIST.irq */ \
".long %P[priority]\n\t" /* ISR_LIST.priority */\
".long %P[vector]\n\t" /* ISR_LIST.vec */ \
".long 0\n\t" /* ISR_LIST.dpl */ \
".popsection\n\t" \
"1:\n\t" \
_IRQ_STUB_ASM \
"2:\n\t" \
: \
: [isr] "i" (isr_p), \
[isr_param] "i" (isr_param_p), \
[priority] "i" _PRIORITY_ARG(irq_p, priority_p), \
[vector] "i" _VECTOR_ARG(irq_p), \
[irq] "i" (irq_p)); \
_SysIntVecProgram(_IRQ_TO_INTERRUPT_VECTOR(irq_p), (irq_p),
(flags_p));
\
_IRQ_TO_INTERRUPT_VECTOR(irq_p); \
})

First we see a complex inline assembly. This does two things:

1. It creates the assembly language stub. The details of this are in
_IRQ_STUB_ASM. This takes two forms depending on whether we are using
Sys V or IAMCU ABI. Here's the IAMCU template:

#define _IRQ_STUB_ASM \
"pushl %%eax\n\t" \
"pushl %%edx\n\t" \
"pushl %%ecx\n\t" \
"movl %[isr], %%eax\n\t" \
"movl %[isr_param], %%edx\n\t" \
"call _execute_handler\n\t" \
"popl %%ecx\n\t" \
"popl %%edx\n\t" \
"popl %%eax\n\t" \
"iret\n\t"

You'll notice at the top of the main __asm__ statement is a 'jmp 2f'. In
assembly syntax '2f' refers to the first subsequent occurrence of the
non-unique label 2, which is immediately after the stub declaration.
This prevents the generated stub from actually being executed in the
context of the IRQ_CONNECT() call, execution just jumps immediately
after it.

2. An entry in INT_LIST is declared. The .fnc member is populated with
'.long 1f' which is the memory address of the stub, since the next '1'
label is immediately before it. We use pushsection/popsection to ensure
that this INT_LIST entry goes in the desired ".intList" section.

After the assembly stub is a runtime call to _SysIntVecProgram to tell
the interrupt controller what the irq -> vector mapping is, and the
triggering flags. This is where the _irq_to_interrupt_vector array gets
used, see the _IRQ_TO_INTERRUPT_VECTOR call.

Finally there is another instance of _IRQ_TO_INTERRUPT_VECTOR to serve
as the return value for this macro; the macro is a GCC compound
expression ({ }) so whatever expression is last is the value "returned".
In practice this is rarely needed.

##### 6. _execute_handler

The code for this is in arch/x86/core/iamcu_abi/intstub.c. It takes the
ISR and ISR parameter as parameters. When this is called, the assembly
stub has already taken care of saving the thread's caller-saved
registers onto the stack:

void _execute_handler(int_handler_t function, int context);

This function does the following:

1. If we are not already on the IRQ stack (such as with nested IRQs),
switch to the IRQ stack. The old thread stack pointer is pushed onto the
IRQ stack so we can get back to it.

2. If nested interrupts are enabled in the kernel configuration,
re-enable interrupts.

3. The handler function is called with the supplied context as its
parameter.

4. Disable interrupts again if we had re-enabled them in step 3.

5. EOI is performed by poking the LOAPIC. LMT CPUs have a bug where this
is not propagated correctly to the IOAPIC, there is some workaround code
for this situation to also poke the IOAPIC.

6. If we are not in a nested interrupt, switch back to he thread stack.
The kernel now decides whether a scheduling decision is needed. If the
interrupted context was a preemptible thread and there are any pending
fibers, _Swap is called. This will push the callee-saved registers onto
the stack and do a context switch.

7. Control goes back to the stub, which restores caller-saved registers
that were pushed onto the stack and returns control to the interrupted
context with 'iret'. If a context switch was performed, this might not
be the same context we were in when the interrupt happened.

For Sys V ABI, both the generated stubs and the common interrupt
handling code are completely different, but the policy is exactly the
same.

##### 7. Exceptions

Exceptions are not configured with IRQ_CONNECT. Handlers for exceptions
are set up in arch/x86/core/excstub.S with the EXC_HANDLER() and
EXC_HANDLER_CODE() macros, depending on whether the particular exception
pushes an error code onto the stack or not. These boil down to the
NANO_CPU_EXC_CONNECT() macro which also registers an entry into the
INT_LIST and creates an assembly stub.

Unlike interrupts, exceptions do not have any user parameters (except
for some cases where the CPU pushes an error code), the exception is
processed without switching stacks, and there are no scheduling
decisions at the end.



--
Andrew Boie
Staff Engineer - EOS Zephyr
Intel Open Source Technology Center


Daily Gerrit Digest

donotreply@...
 

NEW within last 24 hours:
- https://gerrit.zephyrproject.org/r/1971 : Bluetooth: L2CAP: Refactor l2cap_chan_get() in l2cap.c
- https://gerrit.zephyrproject.org/r/1951 : Bluetooth: L2CAP: Introduce internal BR/EDR connection L2CAP notifier API
- https://gerrit.zephyrproject.org/r/1954 : Bluetooth: L2CAP: Enable handle BR/EDR signal channel traffic
- https://gerrit.zephyrproject.org/r/1953 : Bluetooth: L2CAP: Implement bt_l2cap_br_connected() notifier
- https://gerrit.zephyrproject.org/r/1972 : Bluetooth: SMP: Fix ecc_make_key return code check
- https://gerrit.zephyrproject.org/r/1950 : Bluetooth: L2CAP: Move init BR/EDR pool signal buffers to l2cap_br.c
- https://gerrit.zephyrproject.org/r/1952 : Bluetooth: L2CAP: Move bt_l2cap_br_fixed_chan_register() to l2cap_br.c
- https://gerrit.zephyrproject.org/r/1969 : Bluetooth: Omit implicit permission flags
- https://gerrit.zephyrproject.org/r/1970 : Bluetooth: GATT: Remove authorization permission
- https://gerrit.zephyrproject.org/r/1959 : kernel: add _IS_IDLE_TASK()
- https://gerrit.zephyrproject.org/r/1964 : i2c: fix i2c_dw.c to have correct decl for i2c_dw_isr()
- https://gerrit.zephyrproject.org/r/1965 : quark_se_devboard: Update flash and debug openocd configuration
- https://gerrit.zephyrproject.org/r/1967 : net: 6lowpan: Fix include header files path in null_compression
- https://gerrit.zephyrproject.org/r/1962 : samples/net/loopback: Add helper functions to handle app data
- https://gerrit.zephyrproject.org/r/1963 : i2c: disable/enable interrupts before entering critical regions.
- https://gerrit.zephyrproject.org/r/1961 : spi: disable/enable interrupts before entering critical regions.
- https://gerrit.zephyrproject.org/r/1960 : gpio: For ARC EM Starterkit, a 4-port GPIO implementation is being added
- https://gerrit.zephyrproject.org/r/1958 : openocd: enable cmsis-dap, jlink, stlink interfaces
- https://gerrit.zephyrproject.org/r/1957 : hosttools-tarball: Add hidapi-libusb
- https://gerrit.zephyrproject.org/r/1956 : hidapi-libusb: HIDAPI library for OpenOCD
- https://gerrit.zephyrproject.org/r/1955 : zephyr-sdk.inc: Update tested distros.

UPDATED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1936 : doc: use table for Kconfig option reference
- https://gerrit.zephyrproject.org/r/1583 : kernel event profiler: add dynamic enable/disable/configure
- https://gerrit.zephyrproject.org/r/1855 : nanokernel: Introduce workqueue API
- https://gerrit.zephyrproject.org/r/1879 : Bluetooth: L2CAP: Handle information request command on BR/EDR
- https://gerrit.zephyrproject.org/r/1766 : net: buf: Add net_buf_pull_le32() helper API
- https://gerrit.zephyrproject.org/r/1940 : galileo: set priority of ADC to 100
- https://gerrit.zephyrproject.org/r/1878 : net: buf: Add net_buf_add_le32() helper API
- https://gerrit.zephyrproject.org/r/1880 : Bluetooth: L2CAP: Handle information response command on BR/EDR
- https://gerrit.zephyrproject.org/r/1932 : device: add documentation for device_get_binding
- https://gerrit.zephyrproject.org/r/1903 : arm: Add support for Nordic Semiconductor's nRF52 series of ICs
- https://gerrit.zephyrproject.org/r/1904 : arm: Add CMSIS-CORE v4.30 (20. October 2015) include header files
- https://gerrit.zephyrproject.org/r/1899 : pm/loapic: suspend/resume support for LOAPIC
- https://gerrit.zephyrproject.org/r/1897 : pm/apic: Keep irq to vector table in RAM when needed by PM
- https://gerrit.zephyrproject.org/r/1898 : pm/ioapic: Add suspend/resume support for IOAPIC
- https://gerrit.zephyrproject.org/r/1924 : grove: add temperature sensor
- https://gerrit.zephyrproject.org/r/1884 : grove: add light sensor
- https://gerrit.zephyrproject.org/r/1722 : build: Add MinGW dependencies in makefile

MERGED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1966 : Bluetooth: tester: Fix setting nonconn advertising type
- https://gerrit.zephyrproject.org/r/1854 : nanokernel: Add fiber_config structure and wrapper
- https://gerrit.zephyrproject.org/r/1939 : arc: early init should invalidate d-cache and set vector table
- https://gerrit.zephyrproject.org/r/1938 : arc: initialize the i-cache ONLY if it is present
- https://gerrit.zephyrproject.org/r/1947 : drivers/nble: Make sure gatt_private is reset properly
- https://gerrit.zephyrproject.org/r/1943 : mailmap: Fix a couple of incorrect git author names
- https://gerrit.zephyrproject.org/r/1946 : Bluetooth: GATT: Make bt_gatt_write take a struct
- https://gerrit.zephyrproject.org/r/1948 : Bluetooth: SMP: Reduce stack usage when generating ECDH keys
- https://gerrit.zephyrproject.org/r/1949 : Bluetooth: Use tinycrypt for ecc in LE SC only sample
- https://gerrit.zephyrproject.org/r/1918 : zephyr-qemu: Fix benign warning messages
- https://gerrit.zephyrproject.org/r/1917 : openocd: Various fixes
- https://gerrit.zephyrproject.org/r/1916 : hosttools-tarball: Add openocd-legacy
- https://gerrit.zephyrproject.org/r/1915 : openocd-legacy: Initial commit


Re: zephyr cc2520

Jukka Rissanen
 

Hi David,

On Wed, 2016-05-11 at 16:54 +0800, David.Dai(a)alitech.com wrote:
Hi sir,

I am porting cc2520 driver to arduino_due board, when sending udp
packet over cc2520. the packet is never transmitted by cc2520 driver.

I don't know if cc2520 driver has run correctly on any zephyr
platform? to debug, where should I focus on, cc2520 driver or zephyr
ip stack?
Try to activate some debugging in the cc2520 driver first.
Set CONFIG_TI_CC2520_DEBUG=y in your projects conf file.

If that shows that network packets are not sent, then you can start to
activate debugging options in the lower MAC stack and IP stack. See
various IP stack debugging options in net/ip/Kconfig.debug file for
details.


Cheers,
Jukka


zephyr cc2520

david.dai@...
 

Hi sir,

I am porting cc2520 driver to arduino_due board, when sending udp packet
over cc2520. the packet is never transmitted by cc2520 driver.

I don't know if cc2520 driver has run correctly on any zephyr platform? to
debug, where should I focus on, cc2520 driver or zephyr ip stack?

Thank you!




Best Regards
David Dai(戴卫彬)
Position:上海
*********************************************************
This message contains information that may be confidential and/or privileged and is intended only for the individual or entity named in the body of email above. If this message has been received in error, your receipt of this message is not intended to waive any applicable privilege. No one else may disclose, copy, distribute or use the contents of this message. Unauthorized use, dissemination and duplication is strictly prohibited, and may be unlawful.


Re: [PATCH v2 1/4] nanokernel: Add fiber_config structure and wrapper

Luiz Augusto von Dentz
 

Hi Vlad,

On Tue, May 10, 2016 at 1:46 PM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
On Mon, May 09, 2016 at 04:30:16PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 1:28 PM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
On Mon, May 09, 2016 at 01:16:21PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 11:29 AM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
Many drivers need to start fibers whose parameters are based on user
configuration. Make it easier to specify such parameters by creating a
fiber_config structure and a wrapper to use it.

Change-Id: I26917ada71acbc676c0f32b6ee081aff7bb1d6d8
Signed-off-by: Vlad Dogaru <vlad.dogaru(a)intel.com>
---
include/nanokernel.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)

diff --git a/include/nanokernel.h b/include/nanokernel.h
index 8d7a864..d79bde6 100644
--- a/include/nanokernel.h
+++ b/include/nanokernel.h
@@ -230,6 +230,45 @@ extern void fiber_yield(void);
*/
extern void fiber_abort(void);

+/**
+ * @brief Fiber configuration structure.
+ *
+ * Parameters such as stack size and fiber priority are often
+ * user configurable. This structure makes it simple to specify such a
+ * configuration.
+ */
+struct fiber_config {
+ char *stack;
+ unsigned stack_size;
+ unsigned prio;
+};
You can embedded the stack on the struct making it the last field with size 0:

char stack[0];
How would one allocate a stack in this case? Normally it might be
something like:

struct fiber_config *conf = malloc(sizeof(*conf) + STACK_SIZE);

But I fail to see how it could be done easily without dynamic
allocation.
Just have it in a super struct:

struct config {
struct fiber_config fg;
char __stack[STACK_SIZE];
}
I'm not sure that helps in the bigger picture (although I admit I had
overlooked this possibility when I first asked you the question :]).

Consider the case where we have multiple instances of the same device.
Each instance has its own config structure. If we use the method you
describe above, all config structures would grow by one stack,
regardless if they need their own workqueue.

The following is, I believe, better:

/* Sensor 1 */
static char __stack dev_1_own_stack[1024];

static const struct my_dev_config dev_1_conf = {
/* ... */
.fiber_config = {
.stack = dev_1_own_stack,
.size = 1024,
},
/*... */
};

/* Sensor 2 -- same type, different chip */
static const struct my_dev_config dev_2_conf = {
/* ... */
.fiber_config = {
.stack = NULL, /* Use the global workqueue */
},
/* ... */
};
Not sure in what context you are taking this, the workqueue and work
should be 2 different objects, the workqueue object may or may not
carry its fiber_config depending if you want to share perhaps it needs
to be a separate variable, but for sure it wouldn't be part of the
work object for the reason you just pointed above so this design is
perhaps sub-optimal and should not be used in practice.

--
Luiz Augusto von Dentz


Daily JIRA Digest

donotreply@...
 

NEW JIRA items within last 24 hours: 6
[ZEP-295] Consolidate and simplify GPIO driver configuration options
https://jira.zephyrproject.org/browse/ZEP-295

[ZEP-294] Consolidate and simplify SPI driver configuration options
https://jira.zephyrproject.org/browse/ZEP-294

[ZEP-293] Reduce Kconfig variables in sensor drivers
https://jira.zephyrproject.org/browse/ZEP-293

[ZEP-296] Consolidate and simplify Serial driver configuration options
https://jira.zephyrproject.org/browse/ZEP-296

[ZEP-297] Consolidate and simplify I2C driver configuration options
https://jira.zephyrproject.org/browse/ZEP-297

[ZEP-300] nios2: enable stack canaries
https://jira.zephyrproject.org/browse/ZEP-300


UPDATED JIRA items within last 24 hours: 2
[ZEP-163] AIO doesn't work on QUARK_D2000_CRB
https://jira.zephyrproject.org/browse/ZEP-163

[ZEP-149] Online documentation for kconfig variables overlaps
https://jira.zephyrproject.org/browse/ZEP-149


CLOSED JIRA items within last 24 hours: 1
[ZEP-176] (Won't Do) [regression] profiler sleep event not received
https://jira.zephyrproject.org/browse/ZEP-176


RESOLVED JIRA items within last 24 hours: 0


Daily Gerrit Digest

donotreply@...
 

NEW within last 24 hours:
- https://gerrit.zephyrproject.org/r/1949 : Bluetooth: Use tinycrypt for ecc in LE SC only sample
- https://gerrit.zephyrproject.org/r/1948 : Bluetooth: SMP: Reduce stack usage when generating ECDH keys
- https://gerrit.zephyrproject.org/r/1947 : drivers/nble: Make sure gatt_private is reset properly
- https://gerrit.zephyrproject.org/r/1946 : Bluetooth: GATT: Make bt_gatt_write take a struct
- https://gerrit.zephyrproject.org/r/1940 : galileo: reset priority of SPI to 70
- https://gerrit.zephyrproject.org/r/1943 : mailmap: Fix a couple of incorrect git author names
- https://gerrit.zephyrproject.org/r/1939 : arc: early init should invalidate d-cache and set vector table
- https://gerrit.zephyrproject.org/r/1938 : arc: initialize the i-cache ONLY if it is present

UPDATED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1884 : grove: add light sensor
- https://gerrit.zephyrproject.org/r/1922 : tests: Add nano_work test
- https://gerrit.zephyrproject.org/r/1924 : grove: add temperature sensor
- https://gerrit.zephyrproject.org/r/1855 : nanokernel: Introduce workqueue API
- https://gerrit.zephyrproject.org/r/1854 : nanokernel: Add fiber_config structure and wrapper
- https://gerrit.zephyrproject.org/r/1923 : sensor: Rework core to use workqueue API
- https://gerrit.zephyrproject.org/r/1584 : Added profiler application and scripts
- https://gerrit.zephyrproject.org/r/1904 : arm: Add CMSIS-CORE v4.30 (20. October 2015) include header files
- https://gerrit.zephyrproject.org/r/1868 : sensor: remove unnecessary return variables
- https://gerrit.zephyrproject.org/r/1867 : sensor: add support for *_ANY get channel
- https://gerrit.zephyrproject.org/r/1880 : Bluetooth: L2CAP: Handle information response on BR/EDR
- https://gerrit.zephyrproject.org/r/1871 : Bluetooth: Get the included service 128bit UUID
- https://gerrit.zephyrproject.org/r/1784 : nanokernel: Add callback to _nano_timeout
- https://gerrit.zephyrproject.org/r/1879 : Bluetooth: L2CAP: Handle information request on BR/EDR
- https://gerrit.zephyrproject.org/r/1583 : kernel event profiler: add dynamic enable/disable/configure
- https://gerrit.zephyrproject.org/r/1898 : pm/ioapic: Add suspend/resume support for IOAPIC
- https://gerrit.zephyrproject.org/r/1896 : apic : Refactor some macros into a header
- https://gerrit.zephyrproject.org/r/1899 : pm/loapic: suspend/resume support for LOAPIC
- https://gerrit.zephyrproject.org/r/1909 : rtc: unify kconfig variable names
- https://gerrit.zephyrproject.org/r/1932 : device: add documentation for device_get_binding
- https://gerrit.zephyrproject.org/r/1908 : watchdog: unify kconfig variables
- https://gerrit.zephyrproject.org/r/1897 : pm/apic: Keep irq to vector table in RAM when needed by PM
- https://gerrit.zephyrproject.org/r/1935 : Bluetooth: Fix NULL dereference

MERGED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1945 : Bluetooth: GATT: Fix coding style
- https://gerrit.zephyrproject.org/r/1944 : drivers/nble: Update RPC version to 0510
- https://gerrit.zephyrproject.org/r/1942 : drivers/nble: Fix NULL pointer dereference
- https://gerrit.zephyrproject.org/r/1941 : Revert "drivers/nble: Update RPC to Nordic BLE to 0509"
- https://gerrit.zephyrproject.org/r/1937 : gpio: For EM Starterkit, some additional GPIO register defines are needed
- https://gerrit.zephyrproject.org/r/1651 : net/loopback: add missing license
- https://gerrit.zephyrproject.org/r/1825 : net: configure TCP receive window size
- https://gerrit.zephyrproject.org/r/1889 : arc: more improvements to use isa-16 instructions
- https://gerrit.zephyrproject.org/r/1888 : arc: Add defines for many more useful auxiliary registers
- https://gerrit.zephyrproject.org/r/1890 : console: fix spelling error in comment
- https://gerrit.zephyrproject.org/r/1891 : arc: clarify in comment that ARC must have timer0
- https://gerrit.zephyrproject.org/r/1894 : arc: Add CONFIG_HARVARD since some ARC CPU Architectures are Harvard.
- https://gerrit.zephyrproject.org/r/1895 : arc: do lr and sr instructions together, avoid instruction pipeline bubble
- https://gerrit.zephyrproject.org/r/1832 : nios2: add minimal crt0.S
- https://gerrit.zephyrproject.org/r/1833 : nios2: fatal: add _SysFatalErrorHandler and _Fault stub
- https://gerrit.zephyrproject.org/r/1886 : kernel_event_logger: disable on nios2
- https://gerrit.zephyrproject.org/r/1834 : nios2: add missing linker script
- https://gerrit.zephyrproject.org/r/1831 : build: rename non-generated linker scripts to .ld extension
- https://gerrit.zephyrproject.org/r/1873 : nios2: add config-independent CPU defines
- https://gerrit.zephyrproject.org/r/1892 : nios2: implement asm_inline_gcc functions for sys_io.h
- https://gerrit.zephyrproject.org/r/1893 : nios2: implement _arch_irq_lock / unlock
- https://gerrit.zephyrproject.org/r/1872 : nios2: provide and include soc-specific headers
- https://gerrit.zephyrproject.org/r/1885 : newlib: treat x86 as the special case
- https://gerrit.zephyrproject.org/r/1874 : nios2: update _new_thread prototype to latest changes
- https://gerrit.zephyrproject.org/r/1929 : drivers/nble: Increase RX buffer pool
- https://gerrit.zephyrproject.org/r/1933 : drivers/nble: Fix passing uninitialized scan parameters
- https://gerrit.zephyrproject.org/r/1713 : Bluetooth: BR/EDR: Reset pairing context when needed
- https://gerrit.zephyrproject.org/r/1934 : drivers/nble: Fix passing uninitialized write request structure
- https://gerrit.zephyrproject.org/r/1883 : drivers/nble: Fix memory leak with double connection create


Re: [PATCH 2/4] nanokernel: Introduce workqueue API

Benjamin Walsh <benjamin.walsh@...>
 

On Mon, May 9, 2016 at 6:31 PM, Benjamin Walsh
<benjamin.walsh(a)windriver.com> wrote:
In the current patchset there is a global workqueue, but it's labeled as
sensor-specific. I don't see a problem with making it generic. If I
do, sensors could use it, as well as any other subsystem that needs to.
Using the same fiber for both callout and workqueue is probably a good
idea for saving memory.

I'll also take a stab at implementing delayed work, let's see what the
results look like.
That's what the proposed callout API is doing though. Take a look at it
before duplicating work...
Lets get the workqueues merged asap then I can add the delayed version
on top of it. I believe this shows that we need to be a little more
proactive about features such as this, merging things quickly and fix
comments with other patches should give us a bit more agility.
OK, but I don't think the two implementations will share much except the
system fiber that the callbacks will run in. There is not much that is
similar between your callout implementation and the workqueue
implementation. I was pointing Vlad to your implementation to show him
what were the ramifications for adding a delayed work framework.
Actually submitting work with a fifo is pretty similar, the delayed
version will probably only need a _nano_timeout and the workqueue
pointer so we can submit once it timed out.
I'll wait for your implementation before commenting more, but yes, the
only thing that I saw was similar between the two was that the fiber
could be shared, and of course, that means that both the work queue and
the callout systems schedule work by adding it to the fifo the fiber is
waiting on.


Re: [PATCH v2 0/4] Introduce workqueue API

Vlad Dogaru <vlad.dogaru@...>
 

On Mon, May 09, 2016 at 11:29:41AM +0300, Vlad Dogaru wrote:
Patches are also available on Gerrit:
https://gerrit.zephyrproject.org/r/#/q/topic:workqueue
I have posted another version of the patches on Gerrit. The only major
change is that I've added another test, as Luiz suggested.

I see architectural comments are rather favorable so I won't post future
iterations to the list.

Thanks,
Vlad


Re: [PATCH v2 1/4] nanokernel: Add fiber_config structure and wrapper

Vlad Dogaru <vlad.dogaru@...>
 

On Mon, May 09, 2016 at 04:30:16PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 1:28 PM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
On Mon, May 09, 2016 at 01:16:21PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 11:29 AM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
Many drivers need to start fibers whose parameters are based on user
configuration. Make it easier to specify such parameters by creating a
fiber_config structure and a wrapper to use it.

Change-Id: I26917ada71acbc676c0f32b6ee081aff7bb1d6d8
Signed-off-by: Vlad Dogaru <vlad.dogaru(a)intel.com>
---
include/nanokernel.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)

diff --git a/include/nanokernel.h b/include/nanokernel.h
index 8d7a864..d79bde6 100644
--- a/include/nanokernel.h
+++ b/include/nanokernel.h
@@ -230,6 +230,45 @@ extern void fiber_yield(void);
*/
extern void fiber_abort(void);

+/**
+ * @brief Fiber configuration structure.
+ *
+ * Parameters such as stack size and fiber priority are often
+ * user configurable. This structure makes it simple to specify such a
+ * configuration.
+ */
+struct fiber_config {
+ char *stack;
+ unsigned stack_size;
+ unsigned prio;
+};
You can embedded the stack on the struct making it the last field with size 0:

char stack[0];
How would one allocate a stack in this case? Normally it might be
something like:

struct fiber_config *conf = malloc(sizeof(*conf) + STACK_SIZE);

But I fail to see how it could be done easily without dynamic
allocation.
Just have it in a super struct:

struct config {
struct fiber_config fg;
char __stack[STACK_SIZE];
}
I'm not sure that helps in the bigger picture (although I admit I had
overlooked this possibility when I first asked you the question :]).

Consider the case where we have multiple instances of the same device.
Each instance has its own config structure. If we use the method you
describe above, all config structures would grow by one stack,
regardless if they need their own workqueue.

The following is, I believe, better:

/* Sensor 1 */
static char __stack dev_1_own_stack[1024];

static const struct my_dev_config dev_1_conf = {
/* ... */
.fiber_config = {
.stack = dev_1_own_stack,
.size = 1024,
},
/*... */
};

/* Sensor 2 -- same type, different chip */
static const struct my_dev_config dev_2_conf = {
/* ... */
.fiber_config = {
.stack = NULL, /* Use the global workqueue */
},
/* ... */
};

Thanks,
Vlad


Re: [PATCH 2/4] nanokernel: Introduce workqueue API

Luiz Augusto von Dentz
 

Hi Ben,

On Mon, May 9, 2016 at 6:31 PM, Benjamin Walsh
<benjamin.walsh(a)windriver.com> wrote:
In the current patchset there is a global workqueue, but it's labeled as
sensor-specific. I don't see a problem with making it generic. If I
do, sensors could use it, as well as any other subsystem that needs to.
Using the same fiber for both callout and workqueue is probably a good
idea for saving memory.

I'll also take a stab at implementing delayed work, let's see what the
results look like.
That's what the proposed callout API is doing though. Take a look at it
before duplicating work...
Lets get the workqueues merged asap then I can add the delayed version
on top of it. I believe this shows that we need to be a little more
proactive about features such as this, merging things quickly and fix
comments with other patches should give us a bit more agility.
OK, but I don't think the two implementations will share much except the
system fiber that the callbacks will run in. There is not much that is
similar between your callout implementation and the workqueue
implementation. I was pointing Vlad to your implementation to show him
what were the ramifications for adding a delayed work framework.
Actually submitting work with a fifo is pretty similar, the delayed
version will probably only need a _nano_timeout and the workqueue
pointer so we can submit once it timed out.



--
Luiz Augusto von Dentz


Daily JIRA Digest

donotreply@...
 

NEW JIRA items within last 24 hours: 1
[ZEP-291] Driver for the ENC28J60 ethernet device
https://jira.zephyrproject.org/browse/ZEP-291


UPDATED JIRA items within last 24 hours: 0

CLOSED JIRA items within last 24 hours: 0

RESOLVED JIRA items within last 24 hours: 0


Re: [PATCH 2/4] nanokernel: Introduce workqueue API

Benjamin Walsh <benjamin.walsh@...>
 

In the current patchset there is a global workqueue, but it's labeled as
sensor-specific. I don't see a problem with making it generic. If I
do, sensors could use it, as well as any other subsystem that needs to.
Using the same fiber for both callout and workqueue is probably a good
idea for saving memory.

I'll also take a stab at implementing delayed work, let's see what the
results look like.
That's what the proposed callout API is doing though. Take a look at it
before duplicating work...
Lets get the workqueues merged asap then I can add the delayed version
on top of it. I believe this shows that we need to be a little more
proactive about features such as this, merging things quickly and fix
comments with other patches should give us a bit more agility.
OK, but I don't think the two implementations will share much except the
system fiber that the callbacks will run in. There is not much that is
similar between your callout implementation and the workqueue
implementation. I was pointing Vlad to your implementation to show him
what were the ramifications for adding a delayed work framework.


Daily Gerrit Digest

donotreply@...
 

NEW within last 24 hours:
- https://gerrit.zephyrproject.org/r/1936 : doc: use table for Kconfig option reference
- https://gerrit.zephyrproject.org/r/1935 : Bluetooth: Fix NULL dereference
- https://gerrit.zephyrproject.org/r/1933 : drivers/nble: Fix passing uninitialized scan parameters
- https://gerrit.zephyrproject.org/r/1934 : drivers/nble: Fix passing uninitialized write request structure
- https://gerrit.zephyrproject.org/r/1931 : eth_dw: use sys log interface for debugging
- https://gerrit.zephyrproject.org/r/1932 : device: add documentation for device_get_binding
- https://gerrit.zephyrproject.org/r/1929 : drivers/nble: Increase RX buffer pool
- https://gerrit.zephyrproject.org/r/1922 : tests: Add nano_work test
- https://gerrit.zephyrproject.org/r/1923 : sensor: Rework core to use workqueue API
- https://gerrit.zephyrproject.org/r/1928 : drivers/nble: Return NULL on NULL peer BD address
- https://gerrit.zephyrproject.org/r/1924 : grove: add temperature sensor

UPDATED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1919 : spi: consalidate and simplify
- https://gerrit.zephyrproject.org/r/1909 : rtc: unify kconfig variable names
- https://gerrit.zephyrproject.org/r/1900 : i2c: unify kconfig options and share them across drivers
- https://gerrit.zephyrproject.org/r/1901 : gpio: GPIO_DW_BOTHEDGES_SUPPORT unused
- https://gerrit.zephyrproject.org/r/1914 : spi: remove kconfig variables that can be define in headers
- https://gerrit.zephyrproject.org/r/1911 : adc: unify kconfig variables and make them consistent
- https://gerrit.zephyrproject.org/r/1910 : aio: unify kconfig variables and make them consistent
- https://gerrit.zephyrproject.org/r/1902 : gpio: use consistent names for IRQ priority variables
- https://gerrit.zephyrproject.org/r/1674 : Bluetooth: L2CAP: Move BREDR signalling management to l2cap_br.c
- https://gerrit.zephyrproject.org/r/1766 : net: buf: Add net_buf_pull_le32() helper API
- https://gerrit.zephyrproject.org/r/1878 : net: buf: Add net_buf_add_le32() helper API
- https://gerrit.zephyrproject.org/r/1879 : Bluetooth: L2CAP: Handle information request on BR/EDR
- https://gerrit.zephyrproject.org/r/1880 : Bluetooth: L2CAP: Handle information response on BR/EDR
- https://gerrit.zephyrproject.org/r/1920 : spi: use syslog infratructure for debugging
- https://gerrit.zephyrproject.org/r/1913 : spi: intel: move soc specific values to header file
- https://gerrit.zephyrproject.org/r/1883 : drivers/nble: Fix memory leak with double connection create
- https://gerrit.zephyrproject.org/r/1903 : arm: Add support for Nordic Semiconductor's nRF52 series of ICs
- https://gerrit.zephyrproject.org/r/1855 : nanokernel: Introduce workqueue API
- https://gerrit.zephyrproject.org/r/1583 : kernel event profiler: add dynamic enable/disable/configure
- https://gerrit.zephyrproject.org/r/1884 : grove: add light sensor
- https://gerrit.zephyrproject.org/r/1854 : nanokernel: Add fiber_config structure and wrapper
- https://gerrit.zephyrproject.org/r/1873 : nios2: add config-independent CPU defines
- https://gerrit.zephyrproject.org/r/1892 : nios2: implement asm_inline_gcc functions for sys_io.h
- https://gerrit.zephyrproject.org/r/1893 : nios2: implement _arch_irq_lock / unlock
- https://gerrit.zephyrproject.org/r/1651 : net/loopback: add missing license

MERGED within last 24 hours:
- https://gerrit.zephyrproject.org/r/1930 : Bluetooth: Use bt_hci_cmd_send_sync in set_ad to catch errors
- https://gerrit.zephyrproject.org/r/1927 : Bluetooht: Don't mix ssize_t and int error codes
- https://gerrit.zephyrproject.org/r/1926 : Bluetooth: Use set_random_address for setting Static Random address
- https://gerrit.zephyrproject.org/r/1925 : Bluetooth: Fix using NRPA for creating connection


Re: [PATCH v2 1/4] nanokernel: Add fiber_config structure and wrapper

Luiz Augusto von Dentz
 

Hi Vlad,

On Mon, May 9, 2016 at 1:28 PM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
On Mon, May 09, 2016 at 01:16:21PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 11:29 AM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
Many drivers need to start fibers whose parameters are based on user
configuration. Make it easier to specify such parameters by creating a
fiber_config structure and a wrapper to use it.

Change-Id: I26917ada71acbc676c0f32b6ee081aff7bb1d6d8
Signed-off-by: Vlad Dogaru <vlad.dogaru(a)intel.com>
---
include/nanokernel.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)

diff --git a/include/nanokernel.h b/include/nanokernel.h
index 8d7a864..d79bde6 100644
--- a/include/nanokernel.h
+++ b/include/nanokernel.h
@@ -230,6 +230,45 @@ extern void fiber_yield(void);
*/
extern void fiber_abort(void);

+/**
+ * @brief Fiber configuration structure.
+ *
+ * Parameters such as stack size and fiber priority are often
+ * user configurable. This structure makes it simple to specify such a
+ * configuration.
+ */
+struct fiber_config {
+ char *stack;
+ unsigned stack_size;
+ unsigned prio;
+};
You can embedded the stack on the struct making it the last field with size 0:

char stack[0];
How would one allocate a stack in this case? Normally it might be
something like:

struct fiber_config *conf = malloc(sizeof(*conf) + STACK_SIZE);

But I fail to see how it could be done easily without dynamic
allocation.
Just have it in a super struct:

struct config {
struct fiber_config fg;
char __stack[STACK_SIZE];
}

For size I think size_t should be used.
I've used unsigned to match the fiber creation API. I can change to
size_t in the fiber_config structure, but I'm reluctant to also change
the core fiber creation code.
I didn't say you have to change there, but it seems this is wrong
there as well since unsigned may not be big enough to be used with
sizeof, since we are quite limited in number of architectures this is
probably fine but I would add new APIs with that limitation.

--
Luiz Augusto von Dentz


Re: [PATCH v2 3/4] tests: Add nano_work test

Luiz Augusto von Dentz
 

Hi Vlad,

On Mon, May 9, 2016 at 11:29 AM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
Change-Id: I78359bdd75aa2aa5e2f4b34347d838747d60015f
Signed-off-by: Vlad Dogaru <vlad.dogaru(a)intel.com>
---
tests/kernel/test_nano_work/Makefile | 5 ++
tests/kernel/test_nano_work/README.txt | 51 ++++++++++++++
tests/kernel/test_nano_work/prj.conf | 1 +
tests/kernel/test_nano_work/src/Makefile | 3 +
tests/kernel/test_nano_work/src/main.c | 114 +++++++++++++++++++++++++++++++
tests/kernel/test_nano_work/testcase.ini | 2 +
6 files changed, 176 insertions(+)
create mode 100644 tests/kernel/test_nano_work/Makefile
create mode 100644 tests/kernel/test_nano_work/README.txt
create mode 100644 tests/kernel/test_nano_work/prj.conf
create mode 100644 tests/kernel/test_nano_work/src/Makefile
create mode 100644 tests/kernel/test_nano_work/src/main.c
create mode 100644 tests/kernel/test_nano_work/testcase.ini

diff --git a/tests/kernel/test_nano_work/Makefile b/tests/kernel/test_nano_work/Makefile
new file mode 100644
index 0000000..f2e25a1
--- /dev/null
+++ b/tests/kernel/test_nano_work/Makefile
@@ -0,0 +1,5 @@
+KERNEL_TYPE = nano
+BOARD ?= qemu_x86
+CONF_FILE = prj.conf
+
+include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/tests/kernel/test_nano_work/README.txt b/tests/kernel/test_nano_work/README.txt
new file mode 100644
index 0000000..d8c42de
--- /dev/null
+++ b/tests/kernel/test_nano_work/README.txt
@@ -0,0 +1,51 @@
+Title: Test nano_work
+
+Description:
+
+A simple application verifying the workqueue API
+
+The test submits a few work items and checks that they are executed in order.
+
+--------------------------------------------------------------------------------
+
+Building and Running Project:
+
+This nanokernel project outputs to the console. It can be built and executed
+on QEMU as follows:
+
+ make qemu
+
+--------------------------------------------------------------------------------
+
+Troubleshooting:
+
+Problems caused by out-dated project information can be addressed by
+issuing one of the following commands then rebuilding the project:
+
+ make clean # discard results of previous builds
+ # but keep existing configuration info
+or
+ make pristine # discard results of previous builds
+ # and restore pre-defined configuration info
+
+--------------------------------------------------------------------------------
+
+Sample Output:
+
+Starting nano_work test
+ - Initializing test items
+ - Submitting test items
+ - Running test item 1
+ - Waiting for work to finish
+ - Done running test item 1
+ - Running test item 2
+ - Done running test item 2
+ - Running test item 3
+ - Done running test item 3
+ - Running test item 4
+ - Done running test item 4
+ - Checking results
I guess it would be wise to add tests for submitting work from both
fiber and task, it appear this is only done for a task. Also it is
super important that submitting work from the handler should also be
tested.

+===================================================================
+PASS - main.
+===================================================================
+PROJECT EXECUTION SUCCESSFUL
diff --git a/tests/kernel/test_nano_work/prj.conf b/tests/kernel/test_nano_work/prj.conf
new file mode 100644
index 0000000..3f9e6db
--- /dev/null
+++ b/tests/kernel/test_nano_work/prj.conf
@@ -0,0 +1 @@
+CONFIG_NANO_TIMEOUTS=y
diff --git a/tests/kernel/test_nano_work/src/Makefile b/tests/kernel/test_nano_work/src/Makefile
new file mode 100644
index 0000000..e04d7c6
--- /dev/null
+++ b/tests/kernel/test_nano_work/src/Makefile
@@ -0,0 +1,3 @@
+ccflags-y += -I${srctree}/tests/include
+
+obj-y = main.o
diff --git a/tests/kernel/test_nano_work/src/main.c b/tests/kernel/test_nano_work/src/main.c
new file mode 100644
index 0000000..3e3d8ee
--- /dev/null
+++ b/tests/kernel/test_nano_work/src/main.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdbool.h>
+
+#include <zephyr.h>
+#include <nanokernel.h>
+#include <tc_util.h>
+#include <misc/util.h>
+#include <misc/nano_work.h>
+
+#define NUM_TEST_ITEMS 4
+#define WORK_ITEM_WAIT sys_clock_ticks_per_sec
+
+struct test_item {
+ int key;
+ struct nano_work work;
+};
+
+static struct test_item tests[NUM_TEST_ITEMS];
+
+static int results[NUM_TEST_ITEMS];
+static int num_results = 0;
+
+static void work_handler(struct nano_work *work)
+{
+ struct test_item *ti = CONTAINER_OF(work, struct test_item, work);
+
+ TC_PRINT(" - Running test item %d\n", ti->key);
+ fiber_sleep(WORK_ITEM_WAIT);
+
+ TC_PRINT(" - Done running test item %d\n", ti->key);
+ results[num_results++] = ti->key;
+}
+
+static void test_items_init(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_TEST_ITEMS; i++) {
+ tests[i].key = i + 1;
+ tests[i].work.handler = work_handler;
+ }
+}
+
+static void test_items_submit(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_TEST_ITEMS; i++) {
+ submit_work(&tests[i].work);
+ }
+}
+
+static bool check_results(void)
+{
+ int i;
+
+ if (num_results != NUM_TEST_ITEMS) {
+ TC_ERROR("*** work items finished: %d (expected: %d)\n",
+ num_results, NUM_TEST_ITEMS);
+ return false;
+ }
+
+ for (i = 0; i < NUM_TEST_ITEMS; i++) {
+ if (results[i] != tests[i].key) {
+ TC_ERROR("*** got result %d in position %d (expected %d)\n",
+ results[i], i, tests[i].key);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void main(void)
+{
+ int status = TC_FAIL;
+
+ TC_PRINT("Starting nano_work test\n");
+
+ TC_PRINT(" - Initializing test items\n");
+ test_items_init();
+
+ TC_PRINT(" - Submitting test items\n");
+ test_items_submit();
+
+ TC_PRINT(" - Waiting for work to finish\n");
+ task_sleep((NUM_TEST_ITEMS + 1) * WORK_ITEM_WAIT);
+
+ TC_PRINT(" - Checking results\n");
+ if (!check_results()) {
+ goto end;
+ }
+
+ status = TC_PASS;
+
+end:
+ TC_END_RESULT(status);
+ TC_END_REPORT(status);
+}
diff --git a/tests/kernel/test_nano_work/testcase.ini b/tests/kernel/test_nano_work/testcase.ini
new file mode 100644
index 0000000..c75e11b
--- /dev/null
+++ b/tests/kernel/test_nano_work/testcase.ini
@@ -0,0 +1,2 @@
+[test]
+tags = core
\ No newline at end of file
--
1.9.1


--
Luiz Augusto von Dentz


Re: [PATCH v2 1/4] nanokernel: Add fiber_config structure and wrapper

Vlad Dogaru <vlad.dogaru@...>
 

On Mon, May 09, 2016 at 01:16:21PM +0300, Luiz Augusto von Dentz wrote:
Hi Vlad,

On Mon, May 9, 2016 at 11:29 AM, Vlad Dogaru <vlad.dogaru(a)intel.com> wrote:
Many drivers need to start fibers whose parameters are based on user
configuration. Make it easier to specify such parameters by creating a
fiber_config structure and a wrapper to use it.

Change-Id: I26917ada71acbc676c0f32b6ee081aff7bb1d6d8
Signed-off-by: Vlad Dogaru <vlad.dogaru(a)intel.com>
---
include/nanokernel.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)

diff --git a/include/nanokernel.h b/include/nanokernel.h
index 8d7a864..d79bde6 100644
--- a/include/nanokernel.h
+++ b/include/nanokernel.h
@@ -230,6 +230,45 @@ extern void fiber_yield(void);
*/
extern void fiber_abort(void);

+/**
+ * @brief Fiber configuration structure.
+ *
+ * Parameters such as stack size and fiber priority are often
+ * user configurable. This structure makes it simple to specify such a
+ * configuration.
+ */
+struct fiber_config {
+ char *stack;
+ unsigned stack_size;
+ unsigned prio;
+};
You can embedded the stack on the struct making it the last field with size 0:

char stack[0];
How would one allocate a stack in this case? Normally it might be
something like:

struct fiber_config *conf = malloc(sizeof(*conf) + STACK_SIZE);

But I fail to see how it could be done easily without dynamic
allocation.

For size I think size_t should be used.
I've used unsigned to match the fiber creation API. I can change to
size_t in the fiber_config structure, but I'm reluctant to also change
the core fiber creation code.

7621 - 7640 of 8331