cancel
Showing results for 
Search instead for 
Did you mean: 

C++ Startup file

AKlep.1
Associate II

I would like the interrupt handlers to be written in the C ++ style, that is, they are static classes, but there is practically no information on the Internet about where to get a C ++ startup file or how to make it yourself. Has anyone encountered such a problem?

2 REPLIES 2
TDK
Guru

> Has anyone encountered such a problem?

I'm not convinced it's a problem.

The startup file is in assembly because it needs to load the data segments into memory and other low-level things. Don't think you're going to replicate that in C++. Not sure what you mean by "static class".

Also see:

https://community.st.com/s/question/0D53W000006PEaOSAW/when-will-stm32-cmsis-device-startup-file-migrate-from-asm-to-c

If you feel a post has answered your question, please click "Accept as Solution".
Nikita91
Lead II

Cortex-M architecture is designed to allow to aesily write the startup code in C. Have a look to:

http://adastra-soft.com/design-a-generic-startup-file-and-a-linker-script/

But C++ is more complicatd.

The interrupt handlers have to be C functions, or static member of a class (and where to get the class pointer?).

See: https://community.arm.com/developer/tools-software/tools/f/keil-forum/26156/c-interrupt

It is a big work to write all in C++.

It is probably more interesting to write a C to C++ wrapper for each ISR.