help me program microcontroller which can run c++ application

MrChips

Joined Oct 2, 2009
27,112
how can i program microcontroller which can run c++ application on it when user want
Welcome to AAC!

A thread title "help me" is of no help to readers. Please try to be more specific and creative in choosing a title, something such as "How to program microcontroller to run c++ application".

A broader scenario would also help, such as the type of platform, MCU, IDE, application, and your level of expertise.
 

Papabravo

Joined Feb 24, 2006
19,262
Sure, but you really have not given us much in the way of requirements
  1. Do you have a microcontroller in mind?
  2. Do you have a C++ compiler in mind?
  3. What peripheral devices will this microcontroller have?
 

BobTPH

Joined Jun 5, 2013
5,743
Are you saying the microcontroller should be able to read a C++ source program and execute it? That would require a wee bit of work.
 

Papabravo

Joined Feb 24, 2006
19,262
Are you saying the microcontroller should be able to read a C++ source program and execute it? That would require a wee bit of work.
I suppose you could start with a loader that could read a C++ executable for a given processor e.g. ".axf" ARM Executable Format, and implement an emulator for that particular ARM processor, and that would fit my definition of a "wee bit 'o work". I say GO FOR IT -- WOOT! WOOT!
 

BobTPH

Joined Jun 5, 2013
5,743
I was thinking of a complier / loader hosted on the micro.

Don't laugh, I have done it. Though it is a simple compiler to virtual machine and a very simplified language. A far cry from C++, though it does have classes.

Edited to add: I think some of the larger STM32 or ARM based microcontrollers could support a C++ compiler.
 

Papabravo

Joined Feb 24, 2006
19,262
I was thinking of a complier / loader hosted on the micro.

Don't laugh, I have done it. Though it is a simple compiler to virtual machine and a very simplified language. A far cry from C++, though it does have classes.

Edited to add: I think some of the larger STM32 or ARM based microcontrollers could support a C++ compiler.
I'm with you on that, but I think we may have lost the TS. This apparently happens with considerable regularity especially from first time posters.
 

RayB

Joined Apr 3, 2011
31
how can i program microcontroller which can run c++ application on it when user want
One may approach the project in much the same way as uPython:

The compilation process in MicroPython involves the following steps:

  • The lexer converts the stream of text that makes up a MicroPython program into tokens.
  • The parser then converts the tokens into an abstract syntax (parse tree).
  • Then bytecode or native code is emitted based on the parse tree.
There are other approaches but most would follow similar thinking with some exceptions.
 
Top