STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
main.cpp File Reference

Entry point of Arduino sketches: early initialization and main loop. More...

#include "Arduino.h"

Functions

void premain ()
 Early initialization, run before static object allocation.
 
int main (void)
 Main entry point of the Arduino application.
 

Detailed Description

Entry point of Arduino sketches: early initialization and main loop.

Function Documentation

◆ main()

int main ( void  )

Main entry point of the Arduino application.

Calls initVariant() and setup() once, then runs loop() and serialEventRun() forever. When CORE_CALLBACK is defined, CoreCallback() is called before each loop().

Returns
0. Never reached in practice, the main loop never ends.

◆ premain()

void premain ( )

Early initialization, run before static object allocation.

Sets the NVIC priority grouping, enables the caches if present, then calls init().

Note
Forced to be called first (constructor priority 101), i.e. before static object allocation. Otherwise, statically allocated objects that need the HAL may fail.