Thank you so much posting the link. That's exactly what I was trying to do. But unfortunately I'm getting a lot of error.
So currently I have a folder called blink with the two files blink.ino and blink.S in it.
When I try compiling them I get these errors :
Is it due to some header file that I should have included?
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\pc-admin\Documents\Arduino\codes\blink\blink\blink.S.ino:1:0: warning: "__SFR_OFFSET" redefined
#define __SFR_OFFSET 0
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from sketch\blink.ino.cpp:1:
c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\sfr_defs.h:172:0: note: this is the location of the previous definition
define __SFR_OFFSET 0x20
^
blink.S:4: error: expected unqualified-id before '.' token
.global start
^
blink.S:9: error: 'ret' does not name a type
ret
^
blink.S:13: error: 'call' does not name a type
call delay_n_ms
^
blink.S:15: error: 'ldi' does not name a type
ldi r20,250
^
blink.S:18: error: 'ret' does not name a type
ret
^
blink.S:21: error: expected constructor, destructor, or type conversion before '(' token
ldi 31, 3000>>8 ; high(3000)
^
blink.S:22: error: expected constructor, destructor, or type conversion before '(' token
ldi 30, 3000&255 ; low(3000)
^
exit status 1
expected unqualified-id before '.' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.