Divide and Conquer
[Arduino] Avrdude로 Ubuntu에서 .hex 포맷의 Arduino 파일 업로드 후 실행 본문
728x90
일단 .hex와 .elf 파일을 얻기 위해 아두이노 파일이 있는 경로에서 IDE 실행
환경설정에 들어가서
컴파일을 체크한 후 OK 누르면
과정이 다 출력됨
컴파일이 끝나면 경로가 출력되는데, 여기서 /tmp/arduino_build_xxx 경로로 들어가면 됨
주황색 글씨로 출력된 경로는 arduino_build_xxx가 아니고 /tmp/arduino_cache_765023임!!!
여기에 들어가면 당근 파일이 없음
아래처럼 ~.ino.hex 파일이 있는 경로로 확인 잘 하시길...
걍 옮기면 됨
컴파일 과정이 필요 없으면 다시 해제하면 되고
.ino.hex 파일은 어차피 컴파일하면 또 생겨서 걱정 안 해도 됨...
위에서 파일 얻었으면 이제 hex 파일로 아두이노 업로드 방법을 설명함
(아래 내용을 작성하고 컴파일 파일 얻는 것을 추가해서 따로 노니까 감안하고 읽으시길)
sudo apt-get install avrdude
cd
mkdir avrdude
cd avrdude
해당 폴더에 아래처럼 파일을 옮기기
(아두이노 업로드를 꼭 위의 폴더에서 할 필요 없이 .ino.hex 파일이 있는 경로에서 하면 됨)
아래 명령어를 치면 실행이 됨
avrdude -p m2560 -c wiring -P /dev/ttyACM0 -b 115200 -D -U flash:w:Blink1.ino.hex
avrdude -p m2560 -c wiring -P /dev/ttyACM0 -b 115200 -D -U flash:w:Blink3.ino.hex
위의 명령어를 실행하면 아래의 출력이 보임
(base) skkcar@skkcar-notebook:~/avrdude$ avrdude -p m2560 -c wiring -P /dev/ttyACM0 -b 115200 -D -U flash:w:Blink1.ino.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "Blink1.ino.hex"
avrdude: input file Blink1.ino.hex auto detected as Intel Hex
avrdude: writing flash (1458 bytes):
Writing | ################################################## | 100% 0.25s
avrdude: 1458 bytes of flash written
avrdude: verifying flash memory against Blink1.ino.hex:
avrdude: load data flash data from input file Blink1.ino.hex:
avrdude: input file Blink1.ino.hex auto detected as Intel Hex
avrdude: input file Blink1.ino.hex contains 1458 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.20s
avrdude: verifying ...
avrdude: 1458 bytes of flash verified
avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)
avrdude done. Thank you.
(base) skkcar@skkcar-notebook:~/avrdude$
아~... 컴파일 파일 자동으로 옮기고 업로드 수행하는 코드는 추후에 추가할게요
반응형
'성장캐 > 기타' 카테고리의 다른 글
[에러해결] masks2segments Function ValueError: Ambiguous Truth Value of an Array (0) | 2024.03.13 |
---|---|
[에러해결] CommandNotFoundError: Your shell has not been properly configured to use 'conda activate' (0) | 2023.07.31 |
ChatGPT로 Cats vs NonCats Classifier 만들기 (0) | 2023.05.02 |
[Python] from pytube import Playlist로 유튜브 영상 정보 확인 (0) | 2023.04.28 |
[에러해결] pytube에서 KeyError: 'streamingData' (0) | 2023.04.28 |
Comments