2 years, 2 months ago.

How to create a project with full source code of Mbed platform based on KEIL IDE

Frankly, I need the whole source code of Mbed OS under the KEIL ide enviroment. It's convenient for me to debug. Please tell me the feasible solution. Thanks

1 Answer

2 years, 2 months ago.

Hi Qingfeng,

The easiest method is to generate a small project with the Online compiler and then export it. This tutorial will walk you through the steps of making a project (you can just use the "Import into Mbed IDE" button) and adding a board to your Mbed account: https://os.mbed.com/docs/v5.6/tutorials/blinky-on-the-arm-mbed-online-compiler.html

Then once you've created your project, you can export to the Keil IDE as shown here: https://os.mbed.com/docs/v5.8/tools/exporting.html#exporting-from-the-arm-mbed-online-compiler

Let us know if you encounter any difficulties exporting your project.

-Ralph, Team Mbed

Updated answer: Adding screen captures.

/media/uploads/RalphF/onlinecompiler-keilexport.png /media/uploads/RalphF/uv5-importedproject.png

Hi Ralph, Very glad to hear from you. Thanks. Following your steps proposed, according to my experience, can not get the source code of Mbed RTOS in the project, yet. I want to kown how to create project with source codes of Mbed sytem including RTOS based on Keil IDE. Thanks in advance!

Best regards, Qingfeng, Yuan

posted by Qingfeng Yuan 23 May 2018

Hi Qingfeng,

Perhaps something has gone wrong with your export or import. We've updated our answer to include two screen captures. On the export you will get a zip file that you need to unzip. That will have all the Mbed OS files along with a uv5 project file. Open the project file in uVision (you may get prompted to add a device pack) and then you'll readily see all the Mbed files in the mbed-os folder. Please check the screen captures above. -Ralph, Team Mbed

posted by Ralph Fulchiero 23 May 2018

Hi Ralph, First of all, thanks for your efforts. As to screen captures updated from you, I still can not find source code of RTOS. No matter what, I will follow your steps provided to further confirm. Any question will follow this topic ,and need your helps again, thanks.

-Qingfeng,Yuan

posted by Qingfeng Yuan 29 May 2018

Hi Ralph, Following the steps provided from you, I can get the project based on KEIL IDE. The files list under the folder of 'mbed-os' doesn't contain the files related to RTOS kernel, which is same as screen captures you posted before. I need the full source code, especillay related to RTOS kernel. Do you have any solution to this question? Thanks in advance!

Best regards, Vine

posted by Qingfeng Yuan 21 Jun 2018

Hi Vine,

If you aren't seeing the proper directory structure we suspect you didn't start with a proper Mbed project or the export didn't work. Is your exported project building in uVision? What project are you exporting and what target have you selected?

We double-checked that the "Import into MBED IDE" link from this page will work:

Once the project is in the Online Compiler you right-click on the project and select "Export Program". The zip file you get from the export will be over 20MB in size. The Mbed directory structure consists of several sub-folders with kernel files located in the "mbed-os\rtos" folder.

posted by Ralph Fulchiero 21 Jun 2018

Hi Ralph, Maybe, there is a misunderstanding between us. I mean I can get the project with some files, which is same as screen captures you posted before. But I cannot find the files RTOS kernel located in the "mbed-os\rtos" folder. Are you sure that you can get the full souce code following your steps? It includes RTOS kernel files, such as Rtx_thread.c, Mbed_boot.c and so. Thanks again! Looking forward to your suggestion! Best regards, Vine

posted by Qingfeng Yuan 22 Jun 2018

Hi Vine,

We would like to get to the root cause of your issue but you are not providing any beneficial/concrete information about the problem! Please answer the questions that we have asked you in our previous comment.

In our exported project we are finding rtx_thread.c and mbed_boot.c right where they should be - under mbed-os\rtos\TARGET-CORTEX\rtx5\RTX\Source and mbed-os\rtos\TARGET-CORTEX respectively.

posted by Ralph Fulchiero 22 Jun 2018

Hi Ralph, Following steps you provided absolutely, including the same hardware selection: lpc1768. Exported project based on KEIL includes the RTOS kernel files, as you descripted before. But exporting project based on another hardware selection: nucleo_f030r8, that's different. No kernel source code of RTOS is included in project. That's werid. Do you have suggestion??

posted by Qingfeng Yuan 24 Jun 2018

Hi Vine,

The Nucleo F030R8 doesn't support Mbed OS5 - likely because the available Flash/RAM is too small. So you are getting an Mbed OS2 project that is packaged differently. You will probably have to use the CLI (command line interface). The Markdown documentation for CLI is here:

To get the full Mbed OS2 source code you can import an OS2 project like this one:

Then you can export it to uVision with:

  • mbed export -i uvision5 -m nucleo_f030r8

I've moved on to Python3 so can't test this myself as OS2 only supports Python2.

posted by Ralph Fulchiero 27 Jun 2018