Generate hex file and upload to arduino uno board using terminal

Generate hex file and upload to arduino uno board using terminal
/*---------------------------------------------------
AVR Assembler, v1
************************************
#!/bin/bash
avra led.asm
avrdude -F -V -c arduino -p atmega328p -P /dev/cu.usbmodem1411 -b 115200 -U flash:w:led.hex
---------------------------------------------------*/




/*---------------------------------------------------
AVR Assembler, v2
************************************
#!/bin/bash
avr-as -mmcu=atmega328p -o led.o led.asm
avr-ld -o led.elf led.o
avr-objcopy --output-target=ihex led.elf led.hex
avrdude -F -V -c arduino -p atmega328p -P /dev/cu.usbmodem1411 -b 115200 -U flash:w:led.hex
rm led.o
rm led.elf
rm led.hex
---------------------------------------------------*/





/*---------------------------------------------------
AVR C
************************************
#!/bin/bash
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o led.o led.c
avr-gcc -mmcu=atmega328p led.o -o led
avr-objcopy -O ihex -R .eeprom led led.hex
avrdude -F -V -c arduino -p atmega328p -P /dev/cu.usbmodem1411 -b 115200 -U flash:w:led.hex
rm led.o
rm led
rm led.hex
---------------------------------------------------*/







/*---------------------------------------------------
Greate Cow BASIC
************************************
Editor
http://gcbasic.sourceforge.net/Typesetter/index.php/Home


MacOS
http://gcbasic.sourceforge.net/Typesetter/index.php/Download

#!/bin/bash
/GreatCowBasic/gcbasic blink.gcb
avra blink.asm
avrdude -F -V -c arduino -p atmega328p -P  /dev/cu.usbmodem1411 -b 115200 -U flash:w:blink.hex
---------------------------------------------------*/
  1. Arduino UNO
#include <avr/io.h> #include <util/delay.h> int main(void) { DDRB |= (1<<PB5); while (1) { PORTB ^= (1<<PINB5); _delay_ms(500); } }
.org 0x0000 rjmp start start: sbi 0x04, 5 while: sbi 0x05, 5 rcall delay cbi 0x05, 5 rcall delay rjmp while ; (rcall + 31*((ldi + ldi + (0xFFFF-1020)*(sbiw + brne)-1)+brne)*1) ; (3 + 31*((1 + 1 + (65535 -1020) *(2 + 2 )-1)+2 )-1) = 7999986 cyles ; 16MHz / 7999986 = 500ms delay: ; Cycles: 1 ldi r16, 31 lp1: ; 0xFC03 = 64515 ; Cycles: 1 ldi r30, 0x03 ; Cycles: 1 ldi r31, 0xFC lp2: ; Cycles: 2 sbiw r31:r30, 1 ; Cycles: 1 if condition is false ; 2 if condition is true brne lp2 ; Cycles: 1 dec r16 ; Cycles: 1 if condition is false ; 2 if condition is true brne lp1 ; Cycles: 4 ret
#chip mega328p, 16 #define LED portb.5 dir LED out LED = 1 start: LED = 0 wait 100 ms LED = 1 wait 100 ms goto start