Hi
I am using Mbed studio IDE and compiled few sample code and tested , it works fine
now i want to create new project with multiple source file , can anyone suggest me how to create new project and add multiple source files…
This doc explains it:
https://os.mbed.com/docs/mbed-studio/current/create-import/index.html
You can create a new empty project, which only adds the Mbed OS library.
Hi Ramasamy,
You can add as many source files to the program as you want using Menu->File->New File
functionality. As long as they are inside the program folder (at any level as a child) you should be able to include them in your code. C/C++ IntelliSense built-in Studio should help you with that.
Mbed Studio does not support having source files for a single program being located in multiple locations on the disk. Mbed CLI supports this functionality. We are considering adding it in the future.
I recommend also looking at the link provided by @JoeA above. It shows more on how to use workspaces in Studio (for cases when you already have a program on your disk and you want to load it into Studio).
Thanks,
Arek - Studio team
Hii,
I worked with all examples previous it was working fine but now while
compile of any examples it taking time to compile(it is compiling all the
library files but I selected only blink example project like 0.1% it is
building).
Warm Regards,
*A.Ramasamy *
Head -Technical
Mob: +919867562801
www.tracer.co.in
Hello,
First compilation take long time because all source files of MbedOS are pre-compliled for the future.
Next compilations take much less time because all source file of MbedOS are already pre-compiled and only files where were made some changes are compiled.
But when you change something important, what can affect Mbed OS , then it will be compiled again like the first time:
- Change target or its settings
- Change configuration of MbedOS, for example when you set Bare metal profile in
mbed_app.json
file - Clean build or manual delete of BUILD folder what is same like Clean build.
However, in your screen I see some chaos in projects. You have 2 projects inside another one.
I seems like you have set the workspace inside of another project.
BR, Jan
Hii sir,
how to add serial.c and serial.h file in new program Mbed studio?
Warm Regards,
A.Ramasamy
Head -Technical
Mob: +919867562801
www.tracer.co.in
I think your question is not exact.
If you already have these files, you can simply copy&paste these files in to your project folder via a file manager of your system. Or Drag&Drop into your project folder via tree in the MbedStudio.
BR, Jan
hI
we are trying to add a serial buffer function in our file but it gives an error.
below i have attached a link.
https://os.mbed.com/docs/mbed-os/v6.8/apis/serial-uart-apis.html
Ok, so you want to use BufferedSerial api, but for that you not need to add something.
All these APIs are already in MbedOS library.
Just copy&paste the content of example into your main.cpp
or import whole example into MbedStudio.
Or try to type by yourself
static BufferedSerial serial_port(USBTX, USBRX);
and so on.
BR, Jan
Yes we just copied in main.cpp along with blink program
#include “mbed.h”
// Blinking rate in milliseconds
#define BLINKING_RATE 500
static BufferedSerial serial_port(USBTX, USBRX);
int main()
{
#ifdef MBED_MAJOR_VERSION
printf(“Mbed OS version %d.%d.%d\r\n\n”, MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
#endif
// Initialise the digital pin LED1 as an output
DigitalOut led(LED2);
while (true) {
led = !led;
ThisThread::sleep_for(BLINKING_RATE);
}
}
But gives
[Error] main.cpp@4,8: unknown type name ‘BufferedSerial’
[ERROR] .\main.cpp:4:8: error: unknown type name ‘BufferedSerial’
what could be the problem
is Bufferedserial api not included in the library?
I tried to import Blinky example and copy&paste BufferedSerial example into it. The compilation is ok (Numaker, MbedOS6.9, MbedStudio 1.4).
It seems like you have MbedOS5 and not 6+
What is output of this line?
printf(“Mbed OS version %d.%d.%d\r\n\n”, MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
Yes, BufferedSerial is part of MbedOS6+
BR, Jan
My version is
mbed-os 5.15.6
That is the problem. You probably create Blinky example for MbedOS5. In the Mbed OS lower than 6 BufferedSerial not exist, it was Serial.
For older version you also need to use older documentation - Full API list - APIs | Mbed OS 5 Documentation
Or Update to MbedOS6.
BR, Jan
Thanks , I will update 6 ver only
Warm Regards,ease
A.Ramasamy
Head -Technical
Mob: +919867562801
www.tracer.co.in
In Buffered serial, i am using below api for reading bytes from serial port
if (uint32_t num = serial_port.read(buf, sizeof(buf)))
Hi
we have created multiple files and able to call the function one file to another file without prototype?
is prototype is required or not?
and also We want to use macros in our application , we declared macro in the header file and called in the function , but it is showing error
#define TESTVAL 100
if i call TESTVAL in other file , it gives error
please give us the solution…
Hello,
Macros:
You must include the header file from where this Macro come from.
For example. You can create a file, for example mymacros.h
and place all your macros inside that file.
Then just #include"mymacros.h"
in main.c or any other file from which you want to have access to those macros.
Prototypes:
I think, if you have functions definitions in a .h file then you not need prototypes because content of .h file will be copy&pase into the file where is .h file included (pre-compiling), for example main.cpp.
But probably it is not best practices.
BR, Jan
Hi
We are getting a compiler expiry message , what is to be done ?
find the details below
Warm Regards,
A.Ramasamy
Head -Technical
Mob: +919867562801
www.tracer.co.in