Date   

Is bluetooth sample "peripheral" still working well?

Li, Jun R
 

Hi there,

I’m trying to rebase my project which is based on NRF51822 SoC from V1.13 to the latest version but found the application doesn’t work anymore. It seems the application suffers from some issues related to BT settings. To identify the issue, I tried the BLE sample “sample/Bluetooth/peripheral” with the board “nrf51_pca10028” which is the one I’m using. The build process ran well, and flashing was good. However, I found the sample application also suffers from the same issue I found on my project, as shown below:

 

***** Booting Zephyr OS zephyr-v1.13.0-2303-g55f091f *****

Bluetooth initialized

Advertising successfully started

[00:00:00.000,000] <inf> bt_hci_core.hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)

[00:00:00.000,000] <inf> bt_hci_core.hci_vs_init: HW Variant: nRF51x (0x0001)

[00:00:00.000,000] <inf> bt_hci_core.hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 1.13 Build 99

[00:00:00.000,000] <wrn> bt_hci_core.bt_init: No ID address. Expecting one to come from storage.

[00:00:00.000,000] <inf> bt_hci_core.bt_dev_show_info: Identity: <log_strdup alloc failed>

[00:00:00.000,000] <inf> bt_hci_core.bt_dev_show_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0x05f1

[00:00:00.000,000] <inf> bt_hci_core.bt_dev_show_info: LMP: version 5.0 (0x09) subver 0xffff

 

 

I found two issues:

  1. There are about 9 seconds delay between the first message “Bluetooth initialized” and the second one “Advertising successfully started” every time when the board restarts. Not sure what is blocking the booting process.
  2. I got a “No ID address” warning which is highlighted in red above. The problem never happened before. Is it a new feature? And Does any board need to be provisioned with an ID address before being used from now on?

 

Does anyone know if I’m missing something for correctly using this sample?

 

Thank you!

 

Jun Li @ Intel Corporation

 


Running rpl border and rpl node on bluetooth

Akash Naidu <akashnaiduece@...>
 

Hi All,
Currently i am working on IPV6 over BLE mesh, For that i have chosen reference of RPL Border and RPL Node of zephyr  RTOS.I have seen examples of rpl node and border router, but those were integrated with IEEE 802.15.4 network.
How to integrate RPL node and border router with Bluetooth(nrf52832) to transfer IPV6 packets?
Could you please suggest me some examples that integration of Bluetooth with rpl node or border router?
 
please provide some useful links or information about forming mesh over IPV6.

I would like to form the mesh on IPV6 over BLE, not on Bluetooth mesh profile(on/off example etc...)

Advance in thanks.

BR
Akash.


Re: [BLE Mesh] How many nodes can zephyr mesh support and how about the throughput?

cheney chen <wjchen7@...>
 

Hi Johan,

Thanks a lot for the useful reply. I noticed your reply in github as well. Thanks a lot!

Thanks,
Vincent


From: Hedberg, Johan <johan.hedberg@...>
Sent: Saturday, December 1, 2018 9:35 PM
To: cheney chen
Cc: devel@...
Subject: Re: [Zephyr-devel] [BLE Mesh] How many nodes can zephyr mesh support and how about the throughput?
 
Hi,


> On 1 Dec 2018, at 16.44, cheney chen <wjchen7@...> wrote:
>
> Recently I am investigating on adopting a possible BLE Mesh solution in my project. Just found there is BLE mesh support in zephyr now. I am wondering how many nodes can zephyr mesh support? And how about the throughout in point-to-point transfer (e.g. can it support up to 10KB/s throughput in BLE mesh OTA)?
>
> Thanks in advance for any answer to this question. It'd be better if any document or link.

I’ve tried to answer your questions in the GitHub issue (#11789) that you opened before sending this email. In the future, please use either to GitHub *or* the mailing list, but not both, since otherwise we’ll end up having duplicated and unconnected discussions on the same topic.

Johan


Re: [BLE Mesh] How many nodes can zephyr mesh support and how about the throughput?

Johan Hedberg
 

Hi,


On 1 Dec 2018, at 16.44, cheney chen <wjchen7@...> wrote:

Recently I am investigating on adopting a possible BLE Mesh solution in my project. Just found there is BLE mesh support in zephyr now. I am wondering how many nodes can zephyr mesh support? And how about the throughout in point-to-point transfer (e.g. can it support up to 10KB/s throughput in BLE mesh OTA)?

Thanks in advance for any answer to this question. It'd be better if any document or link.
I’ve tried to answer your questions in the GitHub issue (#11789) that you opened before sending this email. In the future, please use either to GitHub *or* the mailing list, but not both, since otherwise we’ll end up having duplicated and unconnected discussions on the same topic.

Johan


[BLE Mesh] How many nodes can zephyr mesh support and how about the throughput?

cheney chen <wjchen7@...>
 

Hi,

Recently I am investigating on adopting a possible BLE Mesh solution in my project. Just found there is BLE mesh support in zephyr now. I am wondering how many nodes can zephyr mesh support? And how about the throughout in point-to-point transfer (e.g. can it support up to 10KB/s throughput in BLE mesh OTA)?

Thanks in advance for any answer to this question. It'd be better if any document or link.

Thanks,
Vincent.


Re: Minimum one second delay in activating board LED in Zephyr Bluetooth Mesh based on OnOff applic

vikrant8051 <vikrant8051@...>
 

Hi,
It is because of new logging sub-system.
And If you disable CONFIG_BT_DEBUG_LOG to avoid that then provisioned NODE
takes 10+ seconds to initialized the Mesh.

I've already raised issue for that ...

Regards,
vikrant

On Fri, Nov 30, 2018 at 6:42 PM frv <F.Vieren@...> wrote:
Hi Zephyr community, bluetooth Mesh fans,

I played around with the Zephyr Mesh OnOff applic running on a Nordic nRF52 board.
https://docs.zephyrproject.org/1.13.0/samples/boards/nrf52/mesh/onoff-app/README.html

I made a mesh network with 4 nRF52 boards, 1 running a generic onoff client model as client node, 2 running a generic onoff server model as peripheral node and 1 acting purely as relay node to extend BLE coverage/range.
For setting up the mesh network(provisioning) I rely on the tool meshctl.

All seems to work pretty well, although independent of placing a relay node in between the client and server node, it takes mostly roughly at least 1 second after the button is pressed on the client node to light up one of the green LEDs on the server node (regardless if it close or far (maybe 150 meters) from the client node).

Only on the relay node the relay mode is active, on the other nodes the applic is running with RELAY DISABLED define (as unmodified OnOff . All other nodes is the relay function not enabled. I must say for all the nodes the 4 elements are defined but on each node only one element is bounded and on the client node only the generic onoff client model (thus linked to the primary element) publishes to a group address. On the server nodes only one element (1 to primary element on other node to second element) is subscribed to the group address.

This minimum 1 second delay is this normal after pushing the button on the client node? If not which (time?) parameters can be further tuned, is there a cost?

BTW it is great to have these Mesh examples around in Zephyr  to speed up proto typing in a Bluetooth Mesh environment. Thanks! Keep on the good work.

Thanks in advance.

Best regards,
Frank






Minimum one second delay in activating board LED in Zephyr Bluetooth Mesh based on OnOff applic

frv
 

Hi Zephyr community, bluetooth Mesh fans,

I played around with the Zephyr Mesh OnOff applic running on a Nordic nRF52 board.
https://docs.zephyrproject.org/1.13.0/samples/boards/nrf52/mesh/onoff-app/README.html

I made a mesh network with 4 nRF52 boards, 1 running a generic onoff client model as client node, 2 running a generic onoff server model as peripheral node and 1 acting purely as relay node to extend BLE coverage/range.
For setting up the mesh network(provisioning) I rely on the tool meshctl.

All seems to work pretty well, although independent of placing a relay node in between the client and server node, it takes mostly roughly at least 1 second after the button is pressed on the client node to light up one of the green LEDs on the server node (regardless if it close or far (maybe 150 meters) from the client node).

Only on the relay node the relay mode is active, on the other nodes the applic is running with RELAY DISABLED define (as unmodified OnOff . All other nodes is the relay function not enabled. I must say for all the nodes the 4 elements are defined but on each node only one element is bounded and on the client node only the generic onoff client model (thus linked to the primary element) publishes to a group address. On the server nodes only one element (1 to primary element on other node to second element) is subscribed to the group address.

This minimum 1 second delay is this normal after pushing the button on the client node? If not which (time?) parameters can be further tuned, is there a cost?

BTW it is great to have these Mesh examples around in Zephyr to speed up proto typing in a Bluetooth Mesh environment. Thanks! Keep on the good work.

Thanks in advance.

Best regards,
Frank


Re: logging subsys questions / concerns

Boie, Andrew P
 

apboie: I think the k_sleep() call in the log thread is not ideal, the system might
be idle and have some bandwidth to dump logs, but instead the log thread can
be sitting there in a sleep() call. In addition the log thread will be waking up all
the time even when it has nothing to do.
Actually, I think I'm mistaken, the k_wakeup() calls will ensure that it doesn't sleep for the full amount each iteration. We're probably fine. It only wakes up on its own by default every 1000ms, not a big deal.

I opened bugs for the other items talked about.

Andrew


Re: logging subsys questions / concerns

Zięcik, Piotr <piotr.ziecik@...>
 

5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but
CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?
Krch: It is possible to use deferred mode and not use the thread. Most likely that would be the case when multithreading is disabled.
Still not quite following you, but I'll look at the code some more.
Hi.

Since Krzysztof already left the office, I will try to answer that.

When logs are deffered, you need to call LOG_PROCESS() periodically to format log messages and push them to the backends.
If CONFIG_LOG_PROCESS_THREAD=y, you are creating dedicated thread which does that for you and you just don't care about
that in your application. If the CONFIG_LOG_PROCESS_THREAD is set to n, then calling LOG_PROCESS() is the application responsibility.
Also, if multithreading is disabled, "manual" calling of LOG_PROCESS() becomes the only way to use deffered logs.

PIOTR ZIĘCIK | Senior Firmware Engineer
M +48 698 726 973| Kraków, Poland
nordicsemi.com | devzone.nordicsemi.com


-----Original Message-----
From: devel@... <devel@...> On Behalf Of Boie, Andrew P
Sent: Thursday, November 29, 2018 6:28 PM
To: Cufi, Carles <Carles.Cufi@...>; Chruściński, Krzysztof <Krzysztof.Chruscinski@...>; zephyr-devel <zephyr-devel@...>; Rzeszutko, Jakub <Jakub.Rzeszutko@...>
Cc: zephyr-devel <zephyr-devel@...>
Subject: Re: [Zephyr-devel] logging subsys questions / concerns

Hi Krzystof,

For some reason I did not get your email, Carles had to forward to me.

1) The default priority of the logging thread is -2. This is a very
high non preemptive priority. I don't understand why the logging
background thread doesn't run at the lowest preemptible priority on
the system, like the idle thread. If people are running out of buffer
space then they need to make their buffers bigger or switch to synchronous logging.
Krch:  Intention was to set it to the lowest possible value - K_LOWEST_APPLICATION_THREAD_PRIO. Now I've noticed that it's -2 only when CONFIG_PREEMPT_ENABLED is set. So it can be updated or fixed to K_LOWEST_APPLICATION_THREAD_PRIO in the code.

apboie: OK cool

I think we need to move the
invocation of LOG_PANIC until *much* later, when we decide we need to
hang the system instead of just aborting the faulting thread.
Krch: please suggest the better place. Note that ideally it should be as early as possible when non-recoverable error is hit since by doing that we reduce the risk of losing any logs (as before panic we keep using msg pool so there is a chance of overflow).

apboie: Good point, we don't want to deal with overflow in this situation. I think what we need is an API call to clear the panic mode state if _SysFatalErrorHandler() decides not to hang the system, immediately before the API call to k_thread_abort().

3) It does not appear that there is any support for invoking LOG()
macros from user mode, which severely limits its usability. Until
there is an answer to this, conversations about default mapping
printk() to the log subsystem really scare me. Is LOG intended to be
used by end user applications or just internally to the kernel?
Krch: currenly it is not supported, should be addded

apboie: Cool. I can help with this. I'll open a bug.

I think CONFIG_LOG_PROCESS_SLEEP_MS and
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD should be completely removed.
Krch: Speed was the purpose of not using semaphores and sticking to simple counter. Currently, it takes ~250 cycles (nrf52 - ~4us @64MHz) to log an average log message (up to 2 arguments). k_sem_give would add 1,5us so logging time would increase 4us->5,5us. Is that acceptable? I don't know. What do we gain? Solution is cleaner. Is it worth ~35% performance degradation?

apboie: I think the k_sleep() call in the log thread is not ideal, the system might be idle and have some bandwidth to dump logs, but instead the log thread can be sitting there in a sleep() call. In addition the log thread will be waking up all the time even when it has nothing to do.

As mentioned in my follow-up email, what I really think we need is instead of a semaphore, drop the custom list implementation and just use a k_queue. They are fast, are callable from IRQ context, and with the variant k_queue_alloc_append() API, also callable from user mode (when we cross that bridge). Producer-consumer problems like this are what k_queues are intended for.

If you can show using a k_queue would add a lot of overhead I could be convinced otherwise, but I really thing we should pursue this route as it will also make the code simpler and let the scheduler do its job. How are you measuring latencies btw?

5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but
CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?
Krch: It is possible to use deferred mode and not use the thread. Most likely that would be the case when multithreading is disabled.

Still not quite following you, but I'll look at the code some more.

Andrew


Re: logging subsys questions / concerns

Boie, Andrew P
 

Hi Krzystof,

For some reason I did not get your email, Carles had to forward to me.

1) The default priority of the logging thread is -2. This is a very
high non preemptive priority. I don't understand why the logging
background thread doesn't run at the lowest preemptible priority on
the system, like the idle thread. If people are running out of buffer
space then they need to make their buffers bigger or switch to synchronous logging.
Krch:  Intention was to set it to the lowest possible value - K_LOWEST_APPLICATION_THREAD_PRIO. Now I've noticed that it's -2 only when CONFIG_PREEMPT_ENABLED is set. So it can be updated or fixed to K_LOWEST_APPLICATION_THREAD_PRIO in the code.

apboie: OK cool

I think we need to move the
invocation of LOG_PANIC until *much* later, when we decide we need to
hang the system instead of just aborting the faulting thread.
Krch: please suggest the better place. Note that ideally it should be as early as possible when non-recoverable error is hit since by doing that we reduce the risk of losing any logs (as before panic we keep using msg pool so there is a chance of overflow).

apboie: Good point, we don't want to deal with overflow in this situation. I think what we need is an API call to clear the panic mode state if _SysFatalErrorHandler() decides not to hang the system, immediately before the API call to k_thread_abort().

3) It does not appear that there is any support for invoking LOG()
macros from user mode, which severely limits its usability. Until
there is an answer to this, conversations about default mapping
printk() to the log subsystem really scare me. Is LOG intended to be
used by end user applications or just internally to the kernel?
Krch: currenly it is not supported, should be addded

apboie: Cool. I can help with this. I'll open a bug.

I think CONFIG_LOG_PROCESS_SLEEP_MS and
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD should be completely removed.
Krch: Speed was the purpose of not using semaphores and sticking to simple counter. Currently, it takes ~250 cycles (nrf52 - ~4us @64MHz) to log an average log message (up to 2 arguments). k_sem_give would add 1,5us so logging time would increase 4us->5,5us. Is that acceptable? I don't know. What do we gain? Solution is cleaner. Is it worth ~35% performance degradation?

apboie: I think the k_sleep() call in the log thread is not ideal, the system might be idle and have some bandwidth to dump logs, but instead the log thread can be sitting there in a sleep() call. In addition the log thread will be waking up all the time even when it has nothing to do.

As mentioned in my follow-up email, what I really think we need is instead of a semaphore, drop the custom list implementation and just use a k_queue. They are fast, are callable from IRQ context, and with the variant k_queue_alloc_append() API, also callable from user mode (when we cross that bridge). Producer-consumer problems like this are what k_queues are intended for.

If you can show using a k_queue would add a lot of overhead I could be convinced otherwise, but I really thing we should pursue this route as it will also make the code simpler and let the scheduler do its job. How are you measuring latencies btw?

5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but
CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?
Krch: It is possible to use deferred mode and not use the thread. Most likely that would be the case when multithreading is disabled.

Still not quite following you, but I'll look at the code some more.

Andrew


Re: logging subsys questions / concerns

Carles Cufi
 

Re-sending since apparently this email never reached its destination.

 

From: Chruściński, Krzysztof <Krzysztof.Chruscinski@...>
Sent: 29 November 2018 07:54
To: Cufi, Carles <Carles.Cufi@...>; Boie, Andrew P <andrew.p.boie@...>; zephyr-devel <zephyr-devel@...>; Rzeszutko, Jakub <Jakub.Rzeszutko@...>
Subject: RE: logging subsys questions / concerns

 

Hi Andrew,

 

Thanks for valid feedback. I’ve put my comments below.

 

Regards,

Krzysztof

 

-----Original Message-----
From: Cufi, Carles
Sent: Wednesday, November 28, 2018 9:40 PM
To: Boie, Andrew P <andrew.p.boie@...>; zephyr-devel <zephyr-devel@...>; Chruściński, Krzysztof <Krzysztof.Chruscinski@...>; Rzeszutko, Jakub <Jakub.Rzeszutko@...>
Subject: RE: logging subsys questions / concerns

 

Hi Andrew,

 

Thanks for all the feedback.

As agreed on Slack I am copying Krzysztof and Jakub here so that they see your comments and then, if applicable, we can create one or more issues alongside the ones that Paul has already opened.

 

Regards,

 

Carles

 

> -----Original Message-----

> From: devel@... <devel@...> On

> Behalf Of Boie, Andrew P

> Sent: 28 November 2018 21:01

> To: zephyr-devel <zephyr-devel@...>

> Subject: [Zephyr-devel] logging subsys questions / concerns

>

> I've been looking at the logging subsystem code and I wanted to bring

> up some topics.

>

> 1) The default priority of the logging thread is -2. This is a very

> high non preemptive priority. I don't understand why the logging

> background thread doesn't run at the lowest preemptible priority on

> the system, like the idle thread. If people are running out of buffer

> space then they need to make their buffers bigger or switch to synchronous logging.

Krch:  Intention was to set it to the lowest possible value - K_LOWEST_APPLICATION_THREAD_PRIO. Now I’ve noticed that it’s -2 only when CONFIG_PREEMPT_ENABLED is set. So it can be updated or fixed to K_LOWEST_APPLICATION_THREAD_PRIO in the code.

 

> 2) The panic mode handling is not correct. It gets called from

> _NanoFatalErrorHandler, which flushes the log and then sets the

> panic_mode global *permanently* to true. This is not a good policy.

> NanoFatalErrorHandler getting called does not necessarily mean that

> the system has completely crashed, it's quite possible that the damage

> is limited to one thread dying, with the rest of the threads (and the

> overall system) still running just fine. I think we need to move the

> invocation of LOG_PANIC until *much* later, when we decide we need to

> hang the system instead of just aborting the faulting thread.

Krch: please suggest the better place. Note that ideally it should be as early as possible when non-recoverable error is hit since by doing that we reduce the risk of losing any logs (as before panic we keep using msg pool so there is a chance of overflow).

>

> 3) It does not appear that there is any support for invoking LOG()

> macros from user mode, which severely limits its usability. Until

> there is an answer to this, conversations about default mapping

> printk() to the log subsystem really scare me. Is LOG intended to be

> used by end user applications or just internally to the kernel?

Krch: currenly it is not supported, should be addded

>

> 4) The synchronization between threads invoking log points, and the

> background logging thread, do not make sense to me, and seem to be a

> way of dealing with making the log thread default to a very high non-

> preemptible priority, which I already complained about.

>

> I think CONFIG_LOG_PROCESS_SLEEP_MS and

> CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD should be completely removed.

> Introduce a k_sem with initial count 0 and max count UINT_MAX. Log

> points have the caller give the semaphore every time something is

> added to the log buffer, and have the background thread simply do a

> blocking k_sem_take(). So much simpler, and we rely on the scheduler

> to do its job instead of this weird setup where the log thread is high

> priority but sleeps for hard-coded intervals.

Krch: Speed was the purpose of not using semaphores and sticking to simple counter. Currently, it takes ~250 cycles (nrf52 - ~4us @64MHz) to log an average log message (up to 2 arguments). k_sem_give would add 1,5us so logging time would increase 4us->5,5us. Is that acceptable? I don’t know. What do we gain? Solution is cleaner. Is it worth ~35% performance degradation?

>

> 5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but

> CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?

Krch: It is possible to use deferred mode and not use the thread. Most likely that would be the case when multithreading is disabled.

>

>

>

 


Re: Opus codec on nrf52840

Zięcik, Piotr <piotr.ziecik@...>
 

Hello.

 

I can recommend looking into https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRFready-Smart-Remote-3-for-nRF52-Series

Unfortunately it is not based on the Zephyr, however it implements audio streaming using Opus and contains an optimized version of the codec

(with reduced memory requirements as well as using DPS extensions available on the Nordic chips).

 

If you require any further information, feel free to contact me.

Piotr ZIĘCIK | Senior Firmware Engineer
M +48 698 726 973| Kraków, Poland
nordicsemi.com | devzone.nordicsemi.com

Nordic_logo_signature

 

From: Cufi, Carles
Sent: Thursday, November 29, 2018 12:49 PM
To: nicolas lantz <nicolas.lantz@...>; devel@...; Zięcik, Piotr <Piotr.Ziecik@...>
Subject: RE: [Zephyr-devel] Opus codec on nrf52840

 

+ Piotr

 

From: devel@... <devel@...> On Behalf Of nicolas lantz
Sent: 29 November 2018 12:41
To: devel@...
Subject: [Zephyr-devel] Opus codec on nrf52840

 

Hi,

I would like to use the Opus codec with zephyr on a nrf52840 to encode or decode an audio stream.
Has anyone have a suggestion on this project?

Regards,
 
Nicolas
 


Re: Opus codec on nrf52840

Carles Cufi
 

+ Piotr

 

From: devel@... <devel@...> On Behalf Of nicolas lantz
Sent: 29 November 2018 12:41
To: devel@...
Subject: [Zephyr-devel] Opus codec on nrf52840

 

Hi,

I would like to use the Opus codec with zephyr on a nrf52840 to encode or decode an audio stream.
Has anyone have a suggestion on this project?


Regards,
 
Nicolas
 


Opus codec on nrf52840

nicolas.lantz@...
 

Hi,

I would like to use the Opus codec with zephyr on a nrf52840 to encode or decode an audio stream.
Has anyone have a suggestion on this project?


Regards,

Nicolas
 


Re: logging subsys questions / concerns

Boie, Andrew P
 

Thanks for all the feedback.
As agreed on Slack I am copying Krzysztof and Jakub here so that they see your
comments and then, if applicable, we can create one or more issues alongside
the ones that Paul has already opened.
Just to follow up after some further inspection:

Introduce a k_sem with initial count 0 and max count UINT_MAX. Log
points have the caller give the semaphore every time something is
added to the log buffer, and have the background thread simply do a
blocking k_sem_take().
On further inspection, we don't even need a semaphore. It appears some wheels were re-invented, we can simply delete all the code subsys/logging/log_list.c and use either a k_queue or k_pipe instead, which the log thread can then sleep on until there's data to write.

Andrew


Re: logging subsys questions / concerns

Carles Cufi
 

Hi Andrew,

Thanks for all the feedback.
As agreed on Slack I am copying Krzysztof and Jakub here so that they see your comments and then, if applicable, we can create one or more issues alongside the ones that Paul has already opened.

Regards,

Carles

-----Original Message-----
From: devel@... <devel@...> On
Behalf Of Boie, Andrew P
Sent: 28 November 2018 21:01
To: zephyr-devel <zephyr-devel@...>
Subject: [Zephyr-devel] logging subsys questions / concerns

I've been looking at the logging subsystem code and I wanted to bring up
some topics.

1) The default priority of the logging thread is -2. This is a very high
non preemptive priority. I don't understand why the logging background
thread doesn't run at the lowest preemptible priority on the system,
like the idle thread. If people are running out of buffer space then
they need to make their buffers bigger or switch to synchronous logging.

2) The panic mode handling is not correct. It gets called from
_NanoFatalErrorHandler, which flushes the log and then sets the
panic_mode global *permanently* to true. This is not a good policy.
NanoFatalErrorHandler getting called does not necessarily mean that the
system has completely crashed, it's quite possible that the damage is
limited to one thread dying, with the rest of the threads (and the
overall system) still running just fine. I think we need to move the
invocation of LOG_PANIC until *much* later, when we decide we need to
hang the system instead of just aborting the faulting thread.

3) It does not appear that there is any support for invoking LOG()
macros from user mode, which severely limits its usability. Until there
is an answer to this, conversations about default mapping printk() to
the log subsystem really scare me. Is LOG intended to be used by end
user applications or just internally to the kernel?

4) The synchronization between threads invoking log points, and the
background logging thread, do not make sense to me, and seem to be a way
of dealing with making the log thread default to a very high non-
preemptible priority, which I already complained about.

I think CONFIG_LOG_PROCESS_SLEEP_MS and
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD should be completely removed.
Introduce a k_sem with initial count 0 and max count UINT_MAX. Log
points have the caller give the semaphore every time something is added
to the log buffer, and have the background thread simply do a blocking
k_sem_take(). So much simpler, and we rely on the scheduler to do its
job instead of this weird setup where the log thread is high priority
but sleeps for hard-coded intervals.

5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but
CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?



logging subsys questions / concerns

Boie, Andrew P
 

I've been looking at the logging subsystem code and I wanted to bring up some topics.
 
1) The default priority of the logging thread is -2. This is a very high non preemptive priority. I don't understand why the logging background thread doesn't run at the lowest preemptible priority on the system, like the idle thread. If people are running out of buffer space then they need to make their buffers bigger or switch to synchronous logging.
 
2) The panic mode handling is not correct. It gets called from _NanoFatalErrorHandler, which flushes the log and then sets the panic_mode global *permanently* to true. This is not a good policy. NanoFatalErrorHandler getting called does not necessarily mean that the system has completely crashed, it's quite possible that the damage is limited to one thread dying, with the rest of the threads (and the overall system) still running just fine. I think we need to move the invocation of LOG_PANIC until *much* later, when we decide we need to hang the system instead of just aborting the faulting thread.
 
3) It does not appear that there is any support for invoking LOG() macros from user mode, which severely limits its usability. Until there is an answer to this, conversations about default mapping printk() to the log subsystem really scare me. Is LOG intended to be used by end user applications or just internally to the kernel?
 
4) The synchronization between threads invoking log points, and the background logging thread, do not make sense to me, and seem to be a way of dealing with making the log thread default to a very high non-preemptible priority, which I already complained about.
 
I think CONFIG_LOG_PROCESS_SLEEP_MS and CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD should be completely removed. Introduce a k_sem with initial count 0 and max count UINT_MAX. Log points have the caller give the semaphore every time something is added to the log buffer, and have the background thread simply do a blocking k_sem_take(). So much simpler, and we rely on the scheduler to do its job instead of this weird setup where the log thread is high priority but sleeps for hard-coded intervals.
 
5) What does it mean if CONFIG_LOG_INPLACE_PROCESS=n, but CONFIG_LOG_PROCESS_THREAD=n? Can we simplify our Kconfigs?


Re: cmake application project architecture

Florian Fouillet <Florian.Fouillet@...>
 

I understand, thank you very much.

-----Original Message-----
From: Bøe, Sebastian [mailto:Sebastian.Boe@...]
Sent: Wednesday, November 28, 2018 9:53 AM
To: Florian Fouillet <Florian.Fouillet@...>; Hovland, Sigvart <@siho>; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

[External email: Use caution with links and attachments]

________________________________



It adds a dependency between DL and offsets_h.

offsets_h is a target that happens to depend on various kernel headers, including syscall_list.h, which evidently was used by the application library.

I'm not aware of any such example.

________________________________________
From: Florian Fouillet <Florian.Fouillet@...>
Sent: Wednesday, November 28, 2018 3:49:43 PM
To: Bøe, Sebastian; Hovland, Sigvart; devel@...
Subject: RE: [Zephyr-devel] cmake application project architecture

Hi,

Thank you for your reply. It's working.

What does add_dependencies(DL offsets_h) do?

Is there any zephyr cmake example using multiple CMakeLists I can read?

Thanks for your help!



-----Original Message-----
From: Bøe, Sebastian [mailto:Sebastian.Boe@...]
Sent: Wednesday, November 28, 2018 9:45 AM
To: Florian Fouillet <Florian.Fouillet@...>; Hovland, Sigvart <@siho>; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

[External email: Use caution with links and attachments]

________________________________



You also need

add_dependencies(DL offsets_h)

________________________________________
From: devel@... <devel@...> on behalf of Florian Fouillet <Florian.Fouillet@...>
Sent: Wednesday, November 28, 2018 3:42:54 PM
To: Hovland, Sigvart; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

Hi,

By adding target_link_libraries(DL PRIVATE zephyr_interface)

I still have the following issue

fatal error: syscall_list.h: No such file or directory

From: Hovland, Sigvart [mailto:@siho]
Sent: Wednesday, November 28, 2018 4:26 AM
To: Florian Fouillet <Florian.Fouillet@...>; devel@...
Subject: RE: cmake application project architecture


[External email: Use caution with links and attachments]

________________________________


Maybe adding

target_link_libraries(DL PRIVATE zephyr_interface)


To your 2nd CMake file could help?

From: devel@...<mailto:devel@...> [mailto:devel@...] On Behalf Of Florian Fouillet
Sent: Tuesday, November 27, 2018 9:53 PM
To: devel@...<mailto:devel@...>
Subject: [Zephyr-devel] cmake application project architecture

Hi everyone,

I am currently working on the Zephyr OS with a FDRM_K64f board from NXP.

I want to create my own application using cmake as recommended by the documentation.

However I don't want to put everything in one CMakeLists.txt. I want to break down my project into libraries (multiple CMakeLists.txt).

Do you know if there is any documentation talking about that?

My top CMakeLists looks like that:

cmake_minimum_required(VERSION 3.8.2)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)


add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/DataLinkLayer
${CMAKE_CURRENT_SOURCE_DIR}/build/${BOARD}/DataLinkLayer)

target_sources(app PRIVATE src/main.c)

target_link_libraries(app
PRIVATE DL
)


And my second CMakeLists (under the folder DataLinkLayer) looks like that:

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_library(DL src/DataLinkInterface.c)

target_include_directories(DL
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Interface)



The issue is I can include the boilerplate.cmake in only one CMakeLists.txt otherwise It's not working, But, the second CmakeLists doesn't know the zephyr library..

I tried to add: include_directories(/home/user/zephyr/include) in the second CMakeLists but it is not enough. Do you know what should I do?


Thank you,


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________


Re: cmake application project architecture

Sebastian Boe
 

It adds a dependency between DL and offsets_h.

offsets_h is a target that happens to depend on various kernel headers,
including syscall_list.h, which evidently was used by the application
library.

I'm not aware of any such example.

________________________________________
From: Florian Fouillet <Florian.Fouillet@...>
Sent: Wednesday, November 28, 2018 3:49:43 PM
To: Bøe, Sebastian; Hovland, Sigvart; devel@...
Subject: RE: [Zephyr-devel] cmake application project architecture

Hi,

Thank you for your reply. It's working.

What does add_dependencies(DL offsets_h) do?

Is there any zephyr cmake example using multiple CMakeLists I can read?

Thanks for your help!



-----Original Message-----
From: Bøe, Sebastian [mailto:Sebastian.Boe@...]
Sent: Wednesday, November 28, 2018 9:45 AM
To: Florian Fouillet <Florian.Fouillet@...>; Hovland, Sigvart <@siho>; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

[External email: Use caution with links and attachments]

________________________________



You also need

add_dependencies(DL offsets_h)

________________________________________
From: devel@... <devel@...> on behalf of Florian Fouillet <Florian.Fouillet@...>
Sent: Wednesday, November 28, 2018 3:42:54 PM
To: Hovland, Sigvart; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

Hi,

By adding target_link_libraries(DL PRIVATE zephyr_interface)

I still have the following issue

fatal error: syscall_list.h: No such file or directory

From: Hovland, Sigvart [mailto:@siho]
Sent: Wednesday, November 28, 2018 4:26 AM
To: Florian Fouillet <Florian.Fouillet@...>; devel@...
Subject: RE: cmake application project architecture


[External email: Use caution with links and attachments]

________________________________


Maybe adding

target_link_libraries(DL PRIVATE zephyr_interface)


To your 2nd CMake file could help?

From: devel@...<mailto:devel@...> [mailto:devel@...] On Behalf Of Florian Fouillet
Sent: Tuesday, November 27, 2018 9:53 PM
To: devel@...<mailto:devel@...>
Subject: [Zephyr-devel] cmake application project architecture

Hi everyone,

I am currently working on the Zephyr OS with a FDRM_K64f board from NXP.

I want to create my own application using cmake as recommended by the documentation.

However I don't want to put everything in one CMakeLists.txt. I want to break down my project into libraries (multiple CMakeLists.txt).

Do you know if there is any documentation talking about that?

My top CMakeLists looks like that:

cmake_minimum_required(VERSION 3.8.2)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)


add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/DataLinkLayer
${CMAKE_CURRENT_SOURCE_DIR}/build/${BOARD}/DataLinkLayer)

target_sources(app PRIVATE src/main.c)

target_link_libraries(app
PRIVATE DL
)


And my second CMakeLists (under the folder DataLinkLayer) looks like that:

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_library(DL src/DataLinkInterface.c)

target_include_directories(DL
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Interface)



The issue is I can include the boilerplate.cmake in only one CMakeLists.txt otherwise It's not working, But, the second CmakeLists doesn't know the zephyr library..

I tried to add: include_directories(/home/user/zephyr/include) in the second CMakeLists but it is not enough. Do you know what should I do?


Thank you,


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________


Re: cmake application project architecture

Florian Fouillet <Florian.Fouillet@...>
 

Hi,

Thank you for your reply. It's working.

What does add_dependencies(DL offsets_h) do?

Is there any zephyr cmake example using multiple CMakeLists I can read?

Thanks for your help!

-----Original Message-----
From: Bøe, Sebastian [mailto:Sebastian.Boe@...]
Sent: Wednesday, November 28, 2018 9:45 AM
To: Florian Fouillet <Florian.Fouillet@...>; Hovland, Sigvart <@siho>; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

[External email: Use caution with links and attachments]

________________________________



You also need

add_dependencies(DL offsets_h)

________________________________________
From: devel@... <devel@...> on behalf of Florian Fouillet <Florian.Fouillet@...>
Sent: Wednesday, November 28, 2018 3:42:54 PM
To: Hovland, Sigvart; devel@...
Subject: Re: [Zephyr-devel] cmake application project architecture

Hi,

By adding target_link_libraries(DL PRIVATE zephyr_interface)

I still have the following issue

fatal error: syscall_list.h: No such file or directory

From: Hovland, Sigvart [mailto:@siho]
Sent: Wednesday, November 28, 2018 4:26 AM
To: Florian Fouillet <Florian.Fouillet@...>; devel@...
Subject: RE: cmake application project architecture


[External email: Use caution with links and attachments]

________________________________


Maybe adding

target_link_libraries(DL PRIVATE zephyr_interface)


To your 2nd CMake file could help?

From: devel@...<mailto:devel@...> [mailto:devel@...] On Behalf Of Florian Fouillet
Sent: Tuesday, November 27, 2018 9:53 PM
To: devel@...<mailto:devel@...>
Subject: [Zephyr-devel] cmake application project architecture

Hi everyone,

I am currently working on the Zephyr OS with a FDRM_K64f board from NXP.

I want to create my own application using cmake as recommended by the documentation.

However I don't want to put everything in one CMakeLists.txt. I want to break down my project into libraries (multiple CMakeLists.txt).

Do you know if there is any documentation talking about that?

My top CMakeLists looks like that:

cmake_minimum_required(VERSION 3.8.2)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)


add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/DataLinkLayer
${CMAKE_CURRENT_SOURCE_DIR}/build/${BOARD}/DataLinkLayer)

target_sources(app PRIVATE src/main.c)

target_link_libraries(app
PRIVATE DL
)


And my second CMakeLists (under the folder DataLinkLayer) looks like that:

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_library(DL src/DataLinkInterface.c)

target_include_directories(DL
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/Interface)



The issue is I can include the boilerplate.cmake in only one CMakeLists.txt otherwise It's not working, But, the second CmakeLists doesn't know the zephyr library..

I tried to add: include_directories(/home/user/zephyr/include) in the second CMakeLists but it is not enough. Do you know what should I do?


Thank you,


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________