Migrating projects without any MBED OS

I have two projects which have been running successfully for many years on MBED LPC 1768 boards. They are “bare metal” in that they do not use any features from the MBED OS, indeed attempting to add any MBED OS will result in the compiler complaining since I have duplicated some declarations.
After migration they are not highlighted as projects and so wont compile.
Is there a way to allow them to compile even without an MBED OS?


yes, check Mbed OS bare metal profile

BR, Jan

Thanks, but I did try that a few months ago and while the project was then recognised as being a project it wouldn’t compile. I will try again and report back the errors.

Do these projects use the mbed 2 library?

No, they don’t use mbed 2 or any later mbed os.

This does not make sense

MbedOS versions are

  • MbedOS 2 - odest from 2010 and marked as deprecate maybe more than 3 years ago
  • MbedOS 5 - First release in 2016 and latest version is MbedOS 5.15.9
  • MbedOS 6 - First release in 2020 and latest version is MbedOS 6.16

Please bne so kind and look what MbedOS you use in your project

As an alternative you can use content below at the beginning of your Main function. You will see the result in Serial terminal application.


BR, Jan

I defined my own startup.sct and vector.S files amongst others.
No MbedOS is needed, indeed adding one would probably confuse the build.

I suspect that the answer is going to be that if I didn’t want to use the MBED OSs I should have chosen a non MBED board.

Ah, sorry I got it wrong, because you place it into Keil Studio-Migrating from Online Compiler. That is why your text did not make sense to me.

Now I understand, you really use just Mbed LPC1768 board, but without MbedOS and other things connected to Mbed.

Maybe NXP forum can be correct place for that question - Re: lpc1768 mbed & MCUxpresso - NXP Community

BR, Jan

Thank you for your help.
I put the question in the Keil Studio-Migrating from Online Compiler because I was using the Online compiler and, as it is being switched off in a month, hoped to migrate to its replacement.
I have never succeeded in getting an offline build system to work so, if I can’t migrate the projects, I will be stuck.

I’m starting to get lost.

If you used Online Compiler, then you used also Mbed library. Probably Mbed2 and that is the reason why you had problem with of new tools.
However Mbed 2 projects can be compiled with Keil Studio Cloud because a support was added for it few months ago.
When you open Keil Studio (arm.com) then go to File->import from Mbed Online Compiler... choose your project and try it in KSC.

I am pretty sure Mbed Studio desktop and also Keil Studio Cloud (new Online Compiler) is working well with LPC1768. But there is recommended to use the latest MbedOS where is the Lpc1768 still supported and also with bare metal profile.

BR, Jan

Thank you Jan.
Your comment provided a clue - that Mbed2 support was added a few months ago.
That, together with the fact that File->import from Mbed online compiler could only see the two projects I had that included the mbed library meant I could…

  • Add the mbed library to one of my projects in the Mbed online compiler ( it wouldn’t then compile but I wouldn’t expect it to) to make it visible for import
  • Use File-> import from Mbed online compiler to import it into the Keil Studio cloud compiler
  • Remove the mbed library from the project in the Mbed online compiler (it now compiles again)
  • Remove the mbed library from the project in the Keil Studio cloud compiler
    It now attempts to compile in the Keil Studio cloud compiler even without the Mbed library which it wouldn’t when I last tried a few months ago.

There are still errors ( for example it cannot find <arm_compat.h> which I use for the __[en/dis]able_irq intrinsic), but there is significant progress, so thank you again.


Just to close this off as I have found a workaround to successfully compile my projects.
The problem is to persuade the cloud compiler to recognise my project as valid even without an mbed-os.
From within Keil Studio Cloud what I do is:

  1. Add any mbed-os to the project using ‘right click Add Mbed library…’
    URL git@github.com:ARMmbed/mbed-os.git
    Library name mbed-os
    Click Next then select the latest version in the select down box
    Click Finish
  2. Right click and ‘Set active project’
  3. Reload the page so that the compile button is lit blue
  4. Remove the mbed os again by deleting any folder, library or file named mbed-os from the project
  5. Do not reload the page or wait too long otherwise you will lose the blue light!
  6. Compile and… it works!

At least I now know there is no fundamental difference between the Mbed cloud compiler and the Keil Studio cloud compiler: both work if you can get around the Keil Studio check for a valid mbed os.

Hopefully there will be a better way: maybe a CMSIS project but, if so, I haven’t yet found how to target an LPC1768.

Maybe if you showed your library at the beginning it would be easier to understand - lpc1768 - Things that remain constant whichever Mbed LPC176… | Mbed

I understand the point about fun and so on, but I do not understand why chose Mbed and its compiler when you do not want use its benefits. Maybe you can do same with VsCode or its Online version.

However interesting option.

BR, Jan

This link sums it up:

With hindsight I absolutely should have started from a different point.

Unfortunately at the time, I knew what was wanted but had no idea how to get there. The mbed LPC1768 board was on special offer and seemed to tick all the boxes, especially when you go to the mbed cloud web site and it has the user manual for the Cortex M3, circuit diagram, etc, so I bought it and here I am.