I have a very simple routine that lights up the built-in LED (pin 13) when a system tick timer fires off its interrupt.
I override the weak reference to int sysTickHook(void)
found in hooks.c
. I found that in generalfor this to work I need to use extern "C"
linkage
The part that is bewildering is that this interrupt fires off fine without extern "C"
if there are the comments above it as shown below. This is the minimal reproducible example I can find. Can someone explain this?
I'm using the plain old Arduino IDE 1.8.16.
void setup() {
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
}
void loop() {}
// { -- if you remove this line sysTickHook will not be called
// extern "C" -- if you remove this line sysTickHook will not be called
int sysTickHook()
{
digitalWrite(13,HIGH);
return 0;
}
Using board 'arduino_due_x_dbg' from platform
What other info can I provide?