avrdude: stk500_2_getsync() /avrdude: stk500_2_getsync(): not in sync:resp=0x00

hi to all
try to upload the hex file but i got following errors i tried the same using the atmel studio in which i configured arduino as programmer the avrdude gave the messahe within a fraction of second the program uploaded(sample code)
when i used the command line i tried to change the programmer type like arduino
avrdude –c arduino -P com6 -b 115200 –p mega2560 –U flash:w:speak.hex
avrdude: stk500_2_getsync(): not in sync:resp=0x00
avrdude done. thank you.

used the info from the avrdude in atmel studio regarding the programmer type wiring and programmer mode avrISP so i done te following changes and try to upload

avrdude –c avrisp -P com6 -b 115200 –p mega2560 –U flash:w:speak.hex
avrdude: stk500_2_getsync(): not in sync:resp=0x00
avrdude done. thank you.

avrdude –c arduino -P com6 -b 115200 –p mega2560 –U flash:w:speak.hex
avrdude: stk500_2_getsync(): not in sync:resp=0x00
avrdude done. thank you.

try to change the baud 115200 in device manger mega2560 com 6
when i compiled the any arduino sketch(com6,arduino as ISP,mega 2560 or mega ADK on Com6 tool setting) the code has compiled and upload also
my boot loader is also ok i check pin 13 as well as power and reset the mega 2560
tried (Ctrl+shift+m) when i typed anything the Rx led blinked no any wire connection to Rx line
already tried to disconnect the board from pc the programmer id arduino is mentioned in command line along with C location
what is going wrong i dont know as i am gcc usr(atmel studio/gnu tool) beginner to arduino board any help/suggestion will be really appreciated
thanks in advance to all

“avrdude -c …” tells avrdude how to talk to the programer. I’ve not used the mega2560 board, but it should have a bootloader that knows how to talk stk500v2.

An Uno with Optiboot talks with “avrdude -c arduino …”

https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/bootloaders/optiboot

If you connect the proper ISP and run “avrdude -c avrisp…” it will erase the bootloader.