ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 117 forks source link

missing file: pretty_printer.h on example mbed-os-6.5.0 #347

Closed factoryal closed 3 years ago

factoryal commented 3 years ago

Description of defect

pretty_printer.h file missing on this 6.5.0 release. 02f839a cannot run example code since that file not found by compiler.

[Fatal Error] main.cpp@20,10: 'pretty_printer.h' file not found
[ERROR] .\source\main.cpp:20:10: fatal error: 'pretty_printer.h' file not found
#include "pretty_printer.h"
^~~~~~~~~~~~~~~~~~
1 error generated.

Target(s) affected by this defect ?

Nucleo-WB55

Toolchain(s) (name and version) displaying this defect ?

Mbed Studio 1.3.1

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.5.0 f227856

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

Mbed Studio 1.3.1

How is this defect reproduced ?

Always

Thanks.

ciarmcom commented 3 years ago

@factoryal thank you for raising this issue.Please take a look at the following comments:

What toolchain(s) are you using? We cannot automatically identify a release based on the version of Mbed OS that you have provided. Please provide either a single valid sha of the form #abcde12 or #3b8265d70af32261311a06e423ca33434d8d80de or a single valid release tag of the form mbed-os-x.y.z . E.g. 'f227856' has not been matched as a valid tag or sha. NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'. This indicates to us that at least all the fields have been considered. Please update the issue header with the missing information, the issue will not be mirrored to our internal defect tracking system or investigated until this has been fully resolved.

factoryal commented 3 years ago

problem you mentioned has fixed

paul-szczepanek-arm commented 3 years ago

Pretty printer is part of mbed-os-ble-utils. This should be checked out by running mbed deploy inside the chosen example.

factoryal commented 3 years ago

oh, so it was changed since this version? I found that there's pretty_printer.h right on the previous version but now it's not. I'll try out example once more.

thanks!

ciarmcom commented 3 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2948

paul-szczepanek-arm commented 3 years ago

Yes, it's been refactored out into a common repo as it's used by all examples. Please reopen if there's still an issue.

idea--list commented 3 years ago

@paul-szczepanek-arm

Pretty printer is part of mbed-os-ble-utils. This should be checked out by running mbed deploy inside the chosen example.

This arises some questions:

  1. How should people get informed about this?? Especially as there is not a word about that throughout the documentation neither here nor here. Not to mention this page is stated to be a getting started page, but the content is absolutely useless. I mean 100 millions use Bluetooth daily and everyone knows that it is a wireless technology to send information. There is no need telling that. Then at the very bottom of all the bull**** one can find a link to the mbed-os-example-ble repo, which again does not tell a word about the need of mbed-os-ble-utils, nor does that repo do any onboarding despite it is the only useful content on the getting started page. Going one step further in that repo it turns out, the examples are OUTDATED (yet again) and it simply does not even compile. This is very bad user experience.
  2. What if someone uses the online compiler or Mbed Studio?? How should they deploy mbed-os-ble-utils?
  3. Without any real explanations/tutorials how do you think anyone could understand how to use BLE with Mbed? For sure BLE engineers already know the ins and outs but exactly that is why they do not even need a documentation.

I hope all these make sense and there will be a tutorial that really onboards people with current and working examples.

paul-szczepanek-arm commented 3 years ago

Hi.

  1. There is no need to mention libraries by name in the readme, all you have to do is type mbed deploy in the chosen example (which the readme mentions). All libraries will be automatically checked out.

  2. The online compile automatically checks out the libraries. I can see that the online compiler versions of examples are old. Thank you for bringing this to my attention. Our friends at ST have updated one of the examples here https://os.mbed.com/teams/ST/code/mbed-os-example-ble-Advertising/ . It uses the new utils library which checks out fine.

  3. The examples are meant to teach you how to use BLE. They are the tutorial. The idea is you clone this repo, compile the examples, run them and read the heavily commented code to see how it's done.

idea--list commented 3 years ago

Now at least i know what the problem is: the mindset.

  1. There is really no need to mention important info anywhere as people who are intended to make use of BLE already know that. mbed deploy is not an option in Mbed Studio, but again people should not use that toy. Sorry for being sarcastic but i can not help after such an answer.

  2. Checked out the link you mention. That is implemented in Mbed OS V5.15.4... which is kind of outdated these days and my target is supported only since V6.3. So after importing that to Mbed Studio i updated to Mbed V6.7, compiled, flashed but it still does not run on my target.

  3. That idea works only for people who are already familiar with BLE but as i mentioned before those people do not need any documentation. Let us just remove the current documentation as even that has more sense than letting people read that in it's current state.

paul-szczepanek-arm commented 3 years ago

The utils library is not mentioned because it's an implementation detail and has nothing to do with teaching you how to use BLE.

Mbed studio will check out the missing libraries for you. Open a folder with an example and it will show you libraries that are part of the example. It shows mbed os and the utils libraries and the fact they are missing. There's a button the arrow is pointing to that lets you fix the problem by checking them out for you.

mbed1 mbed2

What is your board?

idea--list commented 3 years ago

Thanks for the explanation, i did not know Studio would check out missing libraries automatically.

My primary board is a Sparkfun Artemis Thing Plus (love it because the small form factor, the radio is also FCC and CE certified, consumes only ca 6-8 mA while transmitting, etc). Sparkfun made up the Mbed core based on Ambiq SDK (is a HAL). Interestingly there is a BLE example for this board in the SDK so i guess that works. There is also an Arduino core (actually a hybrid Mbed-Arduino core) and with Arduino BLE library even under Arduino does this feature work.

For some reason however with Mbed Cordio the BLE feature does not work and as i am new to BLE i can not even try to debug it. OS 6.7 has an issue which prohibits any code to run on the Artemis Thing Plus, but with OS 6.8 RC1 even BLE seems to work.

My secondary board is a MAX32630FTHR that has a dual-mode BT module which was once functional under Mbed, but it got broken long time ago and later Mbed ceased BT support for this target. Since yesterday however i am playing around with this on the MAX board and i achieve ~230 KB/s payload. It seems that this stack is compatible with a bunch of different chips, and for non-commercial purposes it is also free to use. With recent updates this board also seems to resurrect under Mbed.

factoryal commented 3 years ago

@paul-szczepanek-arm Hi. I followed Building and flashing examples but didn't worked since mbed deploy caused some error and did nothing. So I Just did copy-pasting the sources of one of examples. I think it caused the missing problem.

I found that from mbed-os-6.5, it needs mbed-cli v2 instead of v1. the execution command changed to mbed to mbed-tools. When I executing this command,

mbed-tools deploy

instead of

mbed deploy

the deployment worked and successfully compiled.

Please update guide. Thanks.

paul-szczepanek-arm commented 3 years ago

Old tools still work fine. Did you call mbed deploy inside a single example directory (not the root of the repo)? What error did you get?

factoryal commented 3 years ago

@paul-szczepanek-arm Yes. I called deploy inside a single example directory. The error is that there's no 'mbed' as an execution unit. It seems that the name changed mbed to mbed-tools on mbed-cli v2.

paul-szczepanek-arm commented 3 years ago

The name did not change. mbed-tools is the new tool that uses cmake to build mbed. The old ones are very much still alive and supported. Can you please give me the version of your mbed?

paul-szczepanek-arm commented 3 years ago

mbed --version

factoryal commented 3 years ago

@paul-szczepanek-arm 7.0.0 image is it right?

paul-szczepanek-arm commented 3 years ago

OK, I don't speak Korean but I'm guessing this is a windows error and not a mbed error

paul-szczepanek-arm commented 3 years ago

Are you sure you even have mbed installed? pip install -U mbed-cli

factoryal commented 3 years ago

@paul-szczepanek-arm yes image

factoryal commented 3 years ago

@paul-szczepanek-arm are mbed-tools and mbed-cli different?

paul-szczepanek-arm commented 3 years ago

Well, there's something wrong with your installation or there's a problem with powershell - the error is not coming from mbed, it's from windows. You should open an issue with https://github.com/ARMmbed/mbed-cli guys - they will know why the windows installation doesn't pick up the executable.

The new tools are different, yes. They're still an early development, they allow you to build mbed with cmake.

factoryal commented 3 years ago

@paul-szczepanek-arm https://os.mbed.com/docs/mbed-os/v6.7/build-tools/install-or-upgrade.html it says "Mbed CLI 2 is a Python package called mbed-tools, so you can install it with pip." I'm beginner in mbed programming and there's lot of things to know... um... just lot of confusion. right I'm here is very midnight. so I'll check it later

Thanks for your support.

paul-szczepanek-arm commented 3 years ago

They're both python libraries and AFAIK they use some common tools so likely mbed-tools deploy and mbed deploy does the exact same thing. It just looks like there's a problem with your installation of mbed-cli and powershell just can't find the executable although honestly I don't know how it works on windows - I'm sure the tools team can give you a hand with that.