cancel
Showing results for 
Search instead for 
Did you mean: 

How to merge an Mbed program onto a CubeMx generated code

Murat Tologlu
Associate
Posted on April 11, 2017 at 20:04

Hi,

Recently I am developing a project using CubeMx and uVision5 on NUCLEO-F103RB board. I try to retain CubeMx support and for this reason I write my code within the predefined user code sections so I keep CubeMx integrity active.

What I want to do is, I would like to use some mbed programs in my project.

I can easily export an mbed c++ program for Keil uVision and I can use it in uVision without problem; The code can be compiled without error and works.However, if I want to integrate the exported mbed code into an existing CubeMx/Keil uVision project the things become complicated. First of all the directory structure and location of files are different for exported mbed code and generated CubeMx code. Then, there are 2 set of option, configuration files, etc.

Is it possible to make what I want to do, or, should I forget it! I appreciate very much your help.

Regards, Murat

6 REPLIES 6
Imen.D
ST Employee
Posted on April 12, 2017 at 10:36

Hello

Tologlu.Murat

,

I transmit your feedback internally to our CubeMx team.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Alejandro Sklar
Associate
Posted on June 28, 2017 at 06:43

I would just like to add that this would be very useful.It is something developers at my company are struggling with.

Sirma Siang
ST Employee
Posted on July 17, 2017 at 15:46

Hello

Tologlu.Murat

,

I would like to thank you first for your feedback.

I looked over 10 mbed projects for nucloe boards.

All examples were written in C++ (if you have a link to any MBED C project, I will be glad to look at how to port them) .

As CubeMx only generates C code, your point becomes how import C++ code into a C project.

For this topic, I am sure the net is full of examples, and explanations, on how to do such porting/calling.

Kind regards

Sirma

Posted on March 01, 2018 at 23:42

Sirma Siang wrote:

As CubeMx only generates C code, your point becomes how import C++ code into a C project.

Well, that becomes one extra issue to consider - but it is certainly not the whole story!

Posted on March 02, 2018 at 07:18

As a beginner I was delighted when I started to program AVRs with the Wiring language but with time I accumulated experience and decided that Wiring language generate fat (read huge) code. So I decided to go C language and bare metal. For that, I started to translate in C all the libraries my applications used, or to make from scratch libraries with the same functionality (or finding on the Net the work of others), keeping as much as possible the original name of the functions (kinda 'keeping' the same API but rewritten in C). This is the first step and the most time occupying. But advantages are obvious. So

SIRY.Marc

is right.

I

Posted on March 02, 2018 at 10:52

Note that Arduino code is just C++