Skip to content

Commit 65dabbc

Browse files
committed
Added attribute to initVariant()
Try to reduce stack pushes, from which we'll never return.
1 parent 866e3af commit 65dabbc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/variantHooks.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,16 @@
7878
extern void setup(void);
7979
extern void loop(void);
8080

81-
void initVariant(void) __attribute__ ((OS_main));
82-
8381
/*-----------------------------------------------------------*/
84-
/*
85-
*/
82+
83+
void initVariant(void) __attribute__ ((flatten, OS_main));
8684
void initVariant(void)
8785
{
8886
#if defined(USBCON)
8987
USBDevice.attach();
9088
#endif
9189

92-
setup();
90+
setup(); // the normal Arduino setup() function is run here.
9391

9492
vTaskStartScheduler(); // initialise and run the freeRTOS scheduler. Execution should never return here.
9593

@@ -109,7 +107,7 @@ void initVariant(void)
109107
*/
110108
void vApplicationIdleHook( void )
111109
{
112-
loop();
110+
loop(); // the normal Arduino loop() function is run here.
113111
if (serialEventRun) serialEventRun();
114112
}
115113

0 commit comments

Comments
 (0)