Skip to main content
Associate III
March 17, 2024
Question

Need help about startup file

  • March 17, 2024
  • 2 replies
  • 829 views

I am trying to write own startup file in c++ till now everything is working but I am having issue when declaring and defining something in the global scope it's most probably related to the static constructor that cpp need but I don't know how to fix this can anyone help me with this? 
Thanks in advance 

2 replies

TDK
Super User
March 17, 2024

> I am having issue when declaring and defining something in the global scope

What issue are you having? To define something in the global scope is a straightforward task.

uint32_t global_variable = 42;

> it's most probably related to the static constructor that cpp need but I don't know how to fix this can anyone help me with this? 

Maybe, maybe not. Show the issue in more detail.

Part of the job of the startup file is to initialize global objects, so you won't be able to use them until you do this.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Super User
March 17, 2024

Please see the startup files in latest CMSIS libraries from ARM. The startup files there are written in C (not C++).