-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib_libvsprintf.c: add Add support for %pB parameter. #13536
Conversation
[Experimental Bot, please feedback here] No, this PR does not meet the NuttX requirements. Missing Information:
Recommendations:
By addressing these points, your PR will be more informative and likely to be reviewed and merged more quickly. |
i was not aware of %pV and %pS. please don't follow the mistake. |
158e341
to
4801852
Compare
4801852
to
db50b89
Compare
Linux kernel uses the similar approach to extend the format specifier:
Could you give more info why it isn't good? |
printk is a non-standard linux-internal api, which isn't meant to conform any standards.
printf("%pS", NULL) should yield something like "0x0S". besides that, these kinds of extensions are not recognized by the compiler's |
Ok, @Otpvondoiats let's add an option in Kconfig to control this special format specifier. |
Get |
@yamt please review the new implementation which disable the extension by default. |
ac9d5ec
to
c463c58
Compare
i feel it's difficult to use a kconfig which alters the behavior of very basic things like printf. isn't it simper to provide an alternative api, say, nuttx_printf, to provide the extension? (similarly to linux printk) |
hi,This type of API is a special interface, and different systems implement it differently. If add a new API, also need to enable a similar kconfig to control the opening of the interface. |
It requires changing all kernel caller, which is a huge change. The current solution already reduces the possibility of confliction as small as possible. |
the point is that it can be done w/o affecting users of the standard printf family. |
no. you only need to use the new interface when you actually use %pB etc, which i suppose very rare. |
an alternative approach is to use a non-conflicting modifier/specifier. |
Yes, there is no problem with the new API, but the current patch is only to solve the uorblistener printing problem. The new interface plan can be added and updated later, and this work is a big project. |
c463c58
to
5eeaee8
Compare
@yamt hi, Can it be merged? |
%pB follow the current/Linux design, and the new option minimize the potential conflict, can we move the optimization to the next phase? |
what linux design are you talking about? i explained that we were not following what printk does. |
i guess the least invasive approach would be something similar to |
The strftime method is not suitable for this purpose. It is necessary to apply for space according to the output buffer. In addition, the orb info function is a public function. It will take up a lot of CPU resources to apply for buffers of different lengths. In addition, the printf function itself takes up a lot of CPU resources. Again, buffer printing has been integrated into the sprintf function. |
|
i wonder why you read my comments very selectively. |
i don't know what your png files are about. |
I don't selectively read your comments。 I first disable these extension functions in the printf related functions inside Nuttx to ensure that they are not called in the standard printf, and then consider implementing a new API for this type of extension interface (printk) |
ok.
do you mean CONFIG_LIBC_PRINT_EXTENSION? |
My previous logic was: |
@yamt |
Signed-off-by: likun17 <[email protected]>
…at specifier. Signed-off-by: likun17 <[email protected]>
5eeaee8
to
6161059
Compare
because it breaks more cases.
i agree they should be removed.
i disagree. it breaks more cases. |
At least, if you don't enable ALLSYMS or DEBUG_UORB, nothing breaks. Since both ALLSYMS and DEBUG_UORB is only for debugging, it's acceptable to lose some very vary compatibility in this case. Actually, we ship more 40 million devices which come from BLE only module, WiFi/BLE combo module, watch/band, TWS earbud, smarter speaker..., but I have not hear the incompatible report like this. |
i disagree. this should be reverted. |
why? if you revert, please ensure ALLSYMS or DEBUG_UORB still work as before. |
because it breaks printf.
why? they are misfeatures which should be removed too. |
LIBC_PRINT_EXTENSION, ALLSYMS and DEBUG_UORB aren't enable by default, how do they break printf?
So, you want removing ALLSYMS functionality from the code base? @anchao please take a look. |
if you never enable it, nothing breaks.
at least they should be implemented in a way which doesn't break printf. |
Before the perfect way implement, is it more suitable to add the warning message in ALLSYMS and DEBUG_UORB Kconfig instead removing the related code? |
See the discussion in apache#13536
do you mean something like #14378 ? |
See the discussion in #13536
@xiaoxiang781216 @Otpvondoiats after this PR |
hi, What model is the NRF52832-DK development board you are using? |
@Otpvondoiats I see that the problem is different. This PR is not guilty, but after reverting the mentioned commit, the chip resets without a visible assert, making it harder to notice the error. The culprit is here #13606 :) |
I looked at the code of NRF52832-DK, and there is no place to call %p related content. I will run a piece of this board to see if there is any error。 |
You don't have to check, this PR is not guilty. With this PR for some reason crash is visible, but the reason is different. #13606 is the problem. False alarm on my side, sorry for the confusion :) |
Summary
Impact
None. This is a new parameter parsing and does not affect existing parameters.
Testing
order:
uorb_listener -n 10 sensor_accel_uncal
out:
timestamp:57777591900,x:0.081402,y:0.689530,z:9.897630,temperature:31.253906
is B parameter output results