Re: Logging with a string via %s
pawel.dunaj@...
On Fri, May 17, 2019 at 04:24 PM, Boie, Andrew P wrote:
It has it's pros and cons. Personally I don't mind it as long as it is well understood and can be turned off. Here I totally agree. I think that formatting of strings is such a well known standard that nobody will read the fine print for a logger to see what magic may lie under its hood. I think we should either assert that %s is never used and use some other format instead (i.e. force people to check the doc at least once when they hit an error) or keep %s for in place rendering and add new format for people who want to go faster. Another thing is that assert is disabled by default so many people may never notice the problem (especially for error paths).
|
|
Re: Logging with a string via %s
Paul Sokolovsky
Hello,
On Fri, 17 May 2019 14:38:14 +0000 "lairdjm" <jamie.mccrae@lairdconnect.com> wrote: Hi,Opinions vary on that matter, some people think that the logging was actually "regressed" and not "improved". Literally, it became so advanced, smart, and sophisticated, that it goes against what most people need most of the time. Of course, we'll never know if that's true unless more people provide feedback, so thanks for posting. https://foundries.io/insights/2018/08/14/zephyr-logging-part-2/ whichI personally do conversion in that direction (printf -> LOG_x) only when I'm forced to (like, when submitting code for inclusion to Zephyr). During development, I always use printk/printf which just behave as expected. [] -- Best Regards, Paul Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
|
|
Re: Logging with a string via %s
Paul Sokolovsky
Hello,
On Fri, 17 May 2019 14:24:41 +0000 "Boie, Andrew P" <andrew.p.boie@intel.com> wrote: For an operating system that aims to support various functionalSome people think that asynchronous logging, forced on unsuspecting users, is pretty bad idea and make bets when CONFIG_LOG_IMMEDIATE will become the default behavior again.
-- Best Regards, Paul Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
|
|
Re: Logging with a string via %s
Marc Herbert
On 17 May 2019, at 07:24, Boie, Andrew P <andrew.p.boie@intel.com> wrote: Such a "sharp tool" should at least not look exactly like the slow but safe version used absolutely everywhere else. http://www.catb.org/~esr/writings/taouu/html/ch01s03.html#rule-surprise On the same "least astonishment" principle, I think most developers expect degraded performance when logging.
|
|
Re: Logging with a string via %s
lairdjm
Hi, I think what confused me is that I was reading about the ‘improved logging’ from this guide: https://foundries.io/insights/2018/08/14/zephyr-logging-part-2/ which doesn’t mention anything about it, I was changing old code from printf() to LOG_x() and that’s when the issue arose. Thanks, Jamie
THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
|
|
Re: Logging with a string via %s
Boie, Andrew P
For an operating system that aims to support various functional safety certifications, asynchronous rendering of %s is a terrible idea.
I think %s capability should be dropped from the logger’s format string processing and a separate API added specifically to log a C string, which makes an immediate copy.
Andrew
From: devel@... [mailto:devel@...]
On Behalf Of pawel.dunaj@...
Sent: Friday, May 17, 2019 1:16 AM To: devel@... Subject: Re: [Zephyr-devel] Logging with a string via %s
Hi,
|
|
Re: Logging with a string via %s
pawel.dunaj@...
Hi,
To optimize time of log processing message construction is deferred. For this reason you cannot use arrays that will not live long enough for logger thread to see them. In other words you can always use static arrays (like you do when calling `LOG_xyz("%s", "testme")`) but you must never pass anything from the stack (like in your example). You can enable `CONFIG_LOG_IMMEDIATE` but this will affect logging performance and does not actually tells you why the problem happened in the first place. If you need to print array declared on stack you must call ` log_strdup()` to duplicate it. Personally I am against this API and I indicated it will cause bugs as people do expect `%s` to simply output a string and they also don't read documentation for something that should just work. But at least it makes logger faster if you look from the bright side. Thanks,
|
|
Re: [NRF52840] GPIO 1 problem
pawel.dunaj@...
Hi,
NRF_GPIO_PIN_MAP will effectively change pin number from 6 to (32+6). This would be ok if you use nrfx but when you use Zephyr GPIO API you should use pin id as is. So you should write to CONFIG_GPIO_P1_DEV_NAME device using pin 6. I.e. do not use NRF_GPIO_PIN_MAP macro. Thanks,
|
|
Upcoming Event: Zephyr Project: Dev Meeting - Thu, 05/16/2019 8:00am-9:00am, Please RSVP
#cal-reminder
devel@lists.zephyrproject.org Calendar <devel@...>
Reminder: Zephyr Project: Dev Meeting When: Thursday, 16 May 2019, 8:00am to 9:00am, (GMT-07:00) America/Los Angeles Where:https://zoom.us/j/993312203 An RSVP is requested. Click here to RSVP Organizer: devel@... Description: Join Zoom Meeting
|
|
[NRF52840] GPIO 1 problem
Felipe Gabardo Gonçalves <felipe@...>
Hi, I'm trying to write a value to a GPIO port 1 on a custom board and to pca_10056 and I'm getting nothing on the output. On GPIO port 0 it works properly. My code has no secrets, I'm using blinky sample code from zephyr tag v1.13.0, and I just modified the folowing: #define LED_PORT CONFIG_GPIO_P1_DEV_NAME
#define LED NRF_GPIO_PIN_MAP(1, 6) Does anyone know where I'm doing something wrong? Thank you in advance,
|
|
Re: Logging with a string via %s
Hi,
toggle quoted messageShow quoted text
There’s also a log_strdup() API to deal with this issue. Johan
On 15 May 2019, at 14.27, Stefan Jaritz <stefan@kokoontech.com> wrote:
|
|
Re: Logging with a string via %s
lairdjm
Hi Stefan, Brilliant, didn’t think of that, all working now, thank you. Thanks, Jamie
From:
devel@... <devel@...> On Behalf Of
Stefan Jaritz via Lists.Zephyrproject.Org
Sent: 15 May 2019 12:27
To: devel@... Cc: devel@... Subject: Re: [Zephyr-devel] Logging with a string via %s
EXTERNAL EMAIL: Be careful with attachments and links. Hey Lairdjm,
Depending on you logging setup, the log of the string is done inside the " LOG_DBG" command or later. Later means, that your main function was already left and your local variables are gone = invalid. Try to add following lines at your proj.conf: This will force the logger "execute" the log function. Good luck! Stefan
On 15/05/2019 11:52, lairdjm wrote:
|
|
Re: Logging with a string via %s
Stefan Jaritz
Hey Lairdjm,
Depending on you logging setup, the log of the string is done inside the "LOG_DBG" command or later. Later means, that your main function was already left and your
local variables are gone = invalid. Try to add following lines at your proj.conf: This will force the logger "execute" the log function. Good luck! Stefan
On 15/05/2019 11:52, lairdjm wrote:
|
|
Re: Logging with a string via %s
lairdjm
> sprintf(baTmpBuf, "%s", "ffffffff"); ? Using that works fine, it just doesn’t like it when a variable is used.
THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
|
|
Re: Logging with a string via %s
"K.I.R.A.
sprintf(baTmpBuf, "%s", "ffffffff"); ? ---Original--- From: "lairdjm"<jamie.mccrae@...> Date: Wed, May 15, 2019 18:52 PM To: "devel@..."<devel@...>; Subject: [Zephyr-devel] Logging with a string via %s Hi, I’m seeing an issue whereby I am unable to log strings using LOG_DBG() and %s format, for a quick example I modified the hello world sample to enable logging and change the code to this: #define LOG_DOMAIN test_domain #include <logging/log.h> LOG_MODULE_REGISTER(LOG_DOMAIN);
void main(void) { char baTmpBuf[12]; sprintf(baTmpBuf, "ffffffff"); LOG_DBG("Test : %s", baTmpBuf);
printk("Hello World! %s\n", CONFIG_BOARD); } I expect to see “Test : ffffffff” but instead I am getting “Test : %*”, if I change the code to inefficiently log each character, e.g.: LOG_DBG("Test : %c%c%c%c%c%c%c%c", baTmpBuf[0], baTmpBuf[1], baTmpBuf[2], baTmpBuf[3], baTmpBuf[4], baTmpBuf[5], baTmpBuf[6], baTmpBuf[7]); Then I get the expected output: “Test : ffffffff”
So why is %s not outputting a string? If there a configuration option I have missed? I have tried toggling “Format strings with libc” option but it doesn’t change anything. I’m testing on an nRF52840 using the nrf52840_pca10056 board file. Thanks, THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
|
|
Logging with a string via %s
lairdjm
Hi, I’m seeing an issue whereby I am unable to log strings using LOG_DBG() and %s format, for a quick example I modified the hello world sample to enable logging and change the code to this: #define LOG_DOMAIN test_domain #include <logging/log.h> LOG_MODULE_REGISTER(LOG_DOMAIN);
void main(void) { char baTmpBuf[12]; sprintf(baTmpBuf, "ffffffff"); LOG_DBG("Test : %s", baTmpBuf);
printk("Hello World! %s\n", CONFIG_BOARD); } I expect to see “Test : ffffffff” but instead I am getting “Test : %*”, if I change the code to inefficiently log each character, e.g.: LOG_DBG("Test : %c%c%c%c%c%c%c%c", baTmpBuf[0], baTmpBuf[1], baTmpBuf[2], baTmpBuf[3], baTmpBuf[4], baTmpBuf[5], baTmpBuf[6], baTmpBuf[7]); Then I get the expected output: “Test : ffffffff”
So why is %s not outputting a string? If there a configuration option I have missed? I have tried toggling “Format strings with libc” option but it doesn’t change anything. I’m testing on an nRF52840 using the nrf52840_pca10056 board file. Thanks, THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, INC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, INC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, INC.
|
|
Re: #ble Refresh advertising data after disconnect
#ble
Hi Robert,
On 14 May 2019, at 18.18, robert.konc@controlmatik.eu wrote: In disconnect callback event I was try to update advertising data but function "bt_le_adv_update_data" return with -11 (error code).You could try using BT_LE_ADV_OPT_ONE_TIME with bt_le_adv_start(). That should ensure that the stack doesn’t automatically restart advertising after a disconnection event. Johan
|
|
Upcoming Event: Zephyr Project: APIs - Tue, 05/14/2019 9:00am-10:00am, Please RSVP
#cal-reminder
devel@lists.zephyrproject.org Calendar <devel@...>
Reminder: Zephyr Project: APIs When: Tuesday, 14 May 2019, 9:00am to 10:00am, (GMT-07:00) America/Los Angeles Where:https://zoom.us/j/177647878 An RSVP is requested. Click here to RSVP Organizer: devel@... Description: Join from PC, Mac, Linux, iOS or Android: https://zoom.us/j/177647878 Live meeting minutes: https://docs.google.com/
|
|
#ble Refresh advertising data after disconnect
#ble
robert.konc@...
In disconnect callback event I was try to update advertising data but function "bt_le_adv_update_data" return with -11 (error code).
As I understand BLE stack start to advwrise after disconnect automaticly. Is there and event or callback function that indicate this. I can not use disconnect event because this event is fired befor stack start to advertise. Any suggestion? Best regards
|
|
Re: [Zephyr Main] WEST File Initialization Problem
M Rizwan Ghori <rizwanghori@...>
Thank you for your help. I have successfully installed Zephyr.
Now basically i want to do project in Zephyr and will use ReNode for simulation purposes. As i am quite new in this area. I have already installed Zephyr and in my view renode as well. While going through the Re Node tutorial for Running Your First Demo i am
facing problem. I am using Ubuntu for my project. I have written following line in my Ubuntu Terminal and getting errors and unable to run the first demo.
rizwan@rizwan-virtual-machine:~/renode1/opt/renode/scripts/single-node$ include stm32f4_discovery.resc
include: command not found
rizwan@rizwan-virtual-machine:~/renode1/opt/renode/scripts/single-node$ renode
Command 'renode' not found, did you mean:
command 'recode' from deb recode
Try: sudo apt install <deb name>
rizwan@rizwan-virtual-machine:~/renode1/opt/renode/scripts/single-node$ cd /home/rizwan
rizwan@rizwan-virtual-machine:~$ renode
Command 'renode' not found, did you mean:
command 'recode' from deb recode
Try: sudo apt install <deb name>
rizwan@rizwan-virtual-machine:~$
Kindly advise.
Best Regards
Best Regards
From: Cufi, Carles <Carles.Cufi@...>
Sent: Sunday, March 31, 2019 6:07 PM To: rizwanghori@...; VanCutsem, Geoffroy; Marti Bolivar Cc: devel@... Subject: RE: [Zephyr-devel] [Zephyr Main] WEST File Initialization Problem Hi there,
This has been a bug that has popped up several times in the past with Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562
As mentioned by others, please add the following line you your ~/.bashrc:
export PATH=$PATH:~/.local/bin
Regards,
Carles
From: devel@... <devel@...>
On Behalf Of via Lists.Zephyrproject.Org
Dear,
Thank you all for the quick response. Here is the copy paste code.
runs fine, after this i have run the following command and it echos the error shown below.
Command 'west' not found, did you mean:
command 'test' from deb coreutils
Try: sudo apt install <deb name>
Name: west Version: 0.5.7 Summary: Zephyr RTOS Project meta-tool (wrapper and bootstrap) Home-page: https://github.com/zephyrproject-rtos/west Author: Zephyr Project Author-email: devel@... License: UNKNOWN Location: /home/mrg/.local/lib/python3.6/site-packages Requires: configobj, PyYAML, colorama, pykwalify Files: ../../../bin/west west-0.5.7.dist-info/DESCRIPTION.rst west-0.5.7.dist-info/INSTALLER west-0.5.7.dist-info/METADATA west-0.5.7.dist-info/RECORD west-0.5.7.dist-info/WHEEL west-0.5.7.dist-info/entry_points.txt west-0.5.7.dist-info/metadata.json west-0.5.7.dist-info/top_level.txt west/_bootstrap/__init__.py west/_bootstrap/__pycache__/__init__.cpython-36.pyc west/_bootstrap/__pycache__/main.cpython-36.pyc west/_bootstrap/__pycache__/version.cpython-36.pyc west/_bootstrap/main.py west/_bootstrap/version.py west/_bootstrap/west-schema.yml
Kindly advise
Best Regards Muhammad Rizwan Ghori USM Fellow, School of Computer Sciences,
Universiti Sains Malaysia (USM),
From: VanCutsem, Geoffroy <geoffroy.vancutsem@...>
Can you paste on this thread what the output of “pip3 show –f west” and “echo $PATH” return?
From: devel@... [mailto:devel@...]
On Behalf Of M Rizwan Ghori
Dear, I am using Ubuntu 18.04. Moreover, the path of West file is after running the command "pip3 show -f west" is home/rizwan/.local/python 3.6/packages Subsequently, i have installed all the stuff related to Zephyr including Cmake and Zephyr sdk in a path /home/rizwan/zaphyr Kindly advise.
Rizwan
From: Marti Bolivar Sent: Friday, 29 March, 12:43 pm Subject: Re: [Zephyr-devel] [Zephyr Main] WEST File Initialization Problem To: M Rizwan Ghori Cc: Brett Preston, devel@... What version of Ubuntu are you using? If you ran "pip3 install --user west" and west cannot be run afterwards, it sounds like the directory that the west binary was installed into is not on your $PATH. Older versions of Ubuntu sometimes have this issue; I forget which ones. Usually this directory is ~/.local/bin. Please ensure this directory is on your PATH environment variable and try again. If that doesn't work, you can confirm where west was installed by running "pip3 show -f west"; check both the Location: value and the [...]/bin/west relative path in the Files: list that follows. Marti On Thu, Mar 28, 2019, 10:22 PM M Rizwan Ghori <rizwanghori@...> wrote:
|
|