mbed add --help
usage: mbed add [-h] [-I] [--depth [DEPTH]] [--protocol [PROTOCOL]]
[--insecure] [--offline] [--no-requirements] [-v] [-vv]
url [path]
Adds mbed library and its dependencies from a source control based URL
(GitHub, Bitbucket, mbed.org) into an existing program.
Use "mbed import <URL>" to import as a program
positional arguments:
url URL of the library
path Destination name or path. Default: current folder.
optional arguments:
-h, --help show this help message and exit
-I, --ignore Ignore errors related to cloning and updating.
--depth [DEPTH] Number of revisions to fetch from the remote
repository. Default: all revisions.
--protocol [PROTOCOL]
Transport protocol for the source control management.
Supported: https, http, ssh, git. Default: inferred
from URL.
--insecure Allow insecure repository URLs. By default mbed CLI
imports only "safe" URLs, e.g. based on standard ports
- 80, 443 and 22. This option enables the use of
arbitrary URLs/ports.
--offline Offline mode will force the use of locally cached
repositories and prevent requests to remote
repositories.
--no-requirements Disables checking for and installing any requirements.
-v, --verbose Verbose diagnostic output
-vv, --very_verbose Very verbose diagnostic output
Oh hi, Iâve also worked with some MATLAB/Simulink generated stuff. To import the generated code, all you need to do is drop the generated cpp and h files into your project folder. Then you can use Mbed CLI to compile like normal and things will work.
That said, make sure that youâre using MATLAB Embedded Coder, not the desktop version. The desktop code needs to link with MATLAB itself to work, while the embedded code is totally standalone. Also, donât forget to configure Embedded Coder for an ARM architecture, or it might generate code that doesnât quite compile.
For now I can import and compile the MATLAB generated cpp library.
Can you help me more with some issue
As you can see my library is a simple trajectory generation function which have 4input(double 1 * 1 ) and 2output[one is trajectory(1 * 500) and one is sampling time(1 * 500)].
But after I generate it into cpp code. from my library the function is âvoidâ which will not return output. How can I use the output(trajectory and sampling time)
That settings screen you posted looks right.
It looks to me like the C++ function that it generated uses pass-by-reference parameters to return data. This is of course required in embedded C++ if you want to want to return lots of data from a function without expensive copy operation.
You need to first declare the arrays (globally, to avoid overflowing the stack), then you can pass them as parameters. It would look like this:
coder::array<double, 2U> vel_trajectory;
coder::array<double, 2U> t;
void someFunc()
{
...
cubi2_tra_func(inputQ0, inputQ1, vel_trajectory, t);
// data is now available in vel_trajectory and t
...
}
Also Iâm assuming that 2U is defined as 500 somewhere? It has to be, right?
@MultipleMonomials
Actually I canât find variable â2Uâ anywhere??!
I have tried your suggestion but the function only accept 6 argument (4 inputs and 2 outputs)
because from the cubi2_tra_func.cpp the function is defind like this
From your suggestion I have built code look like this
So now I want to tried print out the value of âvel_trajectoryâ with below code
After compile eveything look just fine no error anywhere, But the output is like this âŠ
I am not sure why this happen. I donât think the data type is wrong. cause the element of âvel_trajectoryâ should be double, and the compiler donât have any âwarningâ or âerrorâ too.