-
ARM MBED 예제 (Blinky/블링키) 빌드/컴파일/다운로드개발 팁/Embedded 2017. 10. 28. 15:44반응형
*EMBED Windows 개발 환경 셋업은 아래 참고:
http://jaydenchoe.tistory.com/manage/post/10
1) mbed os와 예제 다운로드
(필요하면 activate python27 혹은 source activate python27)
mbed import mbed-os-example-blinky (이 대목에서 시간 꽤 걸리니 화면에 아무것도 안나와도 오래 기다려본다)
(참고) git 주소는 아래와 같다.
https://github.com/ARMmbed/mbed-os-example-blinky/blob/master/main.cpp
(참고) Main 코드는 아래와 같다.
#include "mbed.h" DigitalOut led1(LED1);
// main() runs in its own thread in the OS int main() { while (true) { led1 = !led1; wait(0.5); } } 2) mbed 예제 blinky 빌드
cd mbed-os-example-blinky
mbed compile -S (mbed 전체 보드 리스트가 나오니 실제 보드에 맞는 타겟 이름을 찾아보면 된다)
mbed compile -t GCC_ARM -m UBLOX_EVK_ODIN_W2 (내 경우에는 UBLOX_EVK_ODIN_W2 보드를 사용)
# 연결되어 있는 MBED 보드를 자동으로 detection 해서 빌드하려면 아래와 같이 입력한다.
mbed compile -t GCC_ARM -m auto --source . --build BUILD/
아래와 같이 바이너리가 만들어지는 것을 확인할 수 있다.
Image: ./BUILD/UBLOX_EVK_ODIN_W2/GCC_ARM/mbed-os-example-blinky.bin
(빌드 디렉토리를 디폴트가 아니라 --build 옵션을 이용하여 별도로 지정하면 그곳에 생성된다)
3) blinky 예제 바이너리 다운로드
PC에서는:
copy BUILD/UBLOX_EVK_ODIN_W2/GCC_ARM/mbed-os-example-blinky.bin d:\MBED (바이너리를 드라이브로 잡힌 보드에 복사)
(--build 옵션으로 별도의 디렉토리에 빌드되었으면 그곳으로부터 복사한다)
MAC에서는:
cp mbed-os-example-blinky.bin /Volumes/MBED/
(보드가 마운트되어 있는 폴더로 복사한다)
4) blinky 예제 바이너리 실행
보드에 따라 다르다.
어떤 보드는 복사하자 마자 스스로 리셋하여 바이너리를 실행하는 경우도 있고(ODIN 보드),
어떤 보드는 리셋 버튼을 명시적으로 눌러줘야 되는 경우도 있다 (K64F 보드)
참고자료
서울IOT해커톤 시작 키트 2강 - LED 깜박이기
http://www.seoulhackathon.org/120
반응형'개발 팁 > Embedded' 카테고리의 다른 글
임베디드 구현을 위한 음계 주파수 옥타브 정보 (0) 2017.11.12 ARM MBED 엠베드 초음파센서 HC SR04 구동 방법 (0) 2017.11.11 ARM MBED 엠베드 압력센서 QA3040P 구동 방법 (0) 2017.11.11 ARM MBED 엠베드 FRDM-K64F 보드 PIN 핀 배치 설명 그림 (0) 2017.11.11 ARM MBED 개발 환경 설치/셋업 방법 (윈도우즈/Windows) (0) 2017.10.28