//Compile syntax.c and syntax_weak with -nostartfiles -nodefaultlibs and then objdump the result. //This is a common function void normal_function(void); void normal_function(void){ asm volatile ("nop"::); } //This is a interrupt handler. What's the difference between this and the previous one ? void __vector0(void) __attribute__ ((signal)); void __vector0(void){ asm volatile ("nop"::); } //The naked attribute removes prologue and epilogue void __vector1(void) __attribute__ ((signal)) __attribute__ ((naked)); void __vector1(void){ asm volatile ("nop"::); asm volatile ("nop"::); } //The weak function can be redefined void weak_function(void) __attribute__ ((weak)); void weak_function(void){ asm volatile ("nop"::); } //use this if you want to put some assembly code in a specific section void vectors() __attribute__ ((naked)) __attribute__ ((section(".vectors"))); void vectors(){ asm volatile ("nop \n" "nop \n"::); } //The main function - does the program ever gets here ? int main(void){ normal_function(); return 0; }