Note: Test mbed OS beta on FRDM-K64F

Host : Ubuntu 12.04 LTS
tools: yotta: 0.7.0/git:2.5.2/ cmake:3.3.1/ninja:1.6.0
build toolchain: gcc-arm-none-eabi-4_9-2015q1-20150306
target board: Freescale FRDM-K64F

步驟就事先安裝 yotta, 這是個 python 寫的工具軟體, 可以透過 pip 安裝, 個人用
sudo pip install -U yotta 安裝所需的packages, 另外為了解決 urllib3 的 security warring 又裝了 pyOpenSSL, 這個要裝 0.13.0 以上的版本

準備工作是 裝好 yotta, 把 build toolchain 的bin路徑加進 $PATH 然後按下面步驟測試
另外 yotta 的別名(alias)是 yt, 所以可以直接打 yt 執行

yt search -l 50 target  # 這個命令會列出目前支援的 target 有哪些 下面就是目前執行的結果

test-target-dep 0.0.2: Test Target Test Dependencies
frdm-k64f-gcc 0.0.24: Official mbed build target for the mbed frdm-k64f development board.
frdm-k64f-armcc 0.0.16: Official mbed build target for the mbed frdm-k64f development board, using the armcc toolchain.
bbc-microbit-classic-gcc 0.1.3: Official mbed build target for the mbed nrf51822 development board, using the armgcc toolchain.
st-nucleo-f401re-gcc 0.1.0: Official mbed build target for the mbed st-nucleo-f401re development board.
bbc-microbit-classic-armcc 0.1.0: Official mbed build target for the microbit, using the armcc toolchain.
stm32f429i-disco-gcc 0.0.5: Official mbed build target for the mbed st-nucleo-f429zi development board.
nordic-nrf51822-16k-gcc 0.0.9: Official mbed build target for the mbed nrf51822 development board, using the armgcc toolchain.
nordic-nrf51822-32k-gcc 0.0.6: Official mbed build target for the nrf51822 32KB chip.
st-stm32f439zi-gcc 0.0.3: Official mbed build target for the st stm32f439zi microcontroller.
nordic-nrf51822-16k-armcc 0.0.8: Official mbed build target for the mbed nrf51822 development board, using the armcc toolchain.
bbc-microbit-classic-gcc-nosd 0.1.2: Official mbed build target for the BBC micro:bit, using the armgcc toolchain, without Softdevice.
stm32f411re-nucleo-gcc 0.0.1: Official mbed build target for the mbed st-nucleo-f411re development board.
nordic-nrf51822-32k-armcc 0.0.8: Official mbed build target for the mbed nrf51822 development board, using the armcc toolchain.
bbc-microbit-classic-armcc-nosd 0.1.0: Official mbed build target for the microbit, using the armcc toolchain, without soft device.
x86-linux-native 0.0.6: Build target for programs compiled natively for Linux
x86-osx-native 0.0.7: Build target for programs compiled natively for OS X
mbed-gcc 0.0.14: base mbed build target for gcc toolchain
mbed-armcc 0.0.16: Official mbed base target description for compiling with the ARMCC compiler
libc 0.0.3: libc shim module: pulls in the platform libc when compiling for nostdlib targets
ublox-odin-w2-gcc 0.0.3: Official mbed build target for the ublox odin-w2 module.
ublox-odin-w2-evk-gcc 0.0.0: Official mbed build target for the mbed ublox c029 evkelopment board.
seeedtinyble-gcc 0.0.2: Official mbed build target for the nrf51822 16KB chip.
mkit-gcc 0.0.1: Official mbed build target for the nrf51822 16KB chip.
ublox-c029-gcc 0.0.0: Official mbed build target for the mbed ublox c029 development board.
mkit-classic-armcc 0.0.1: mbed classic build target for nrf51822 mkit.
lex-test-gcc 0.0.1: lex’s first target to test

配合實際的狀況所以選 frdm-k64f-gcc (FRDM-K64F+ GCC Embedded for ARM), 這時下 yt target frdm-k64f-gcc
這時目錄中會出現 .yotta.json內容如下

{
“build": {
“target": “frdm-k64f-gcc,*"
}
}

接著準備進行實際測試專案, 我這採用mbed 本身提供的範例
可以用 yt search -l 100 examples

example-mbedos-blinky 0.0.0: simple example program to blink an LED on an mbed board with mbed OS
mbed-client-examples 0.2.2: mbed Client Example for mbed
mbed-client-example-6lowpan 0.0.2: 6LoWPAN networking example
mbed-example-network 0.1.8: Asynch Network Examples
example-asynch-serial 0.2.1: Asynch Serial example
example-asynch-spi 0.2.1: Asynch SPI example
example-asynch-i2c 0.2.1: Asynch I2C example
uvisor-helloworld 0.5.9: Hello world example with uVisor enabled

可以觀察到 example-mbedos-blinky, 實際上他就是 mbed 提供的 Getting Started 的專案檔案
可以透過 yt install example-mbedos-blinky 下載檔案, 下載過程如下

info: get versions for example-mbedos-blinky
info: download example-mbedos-blinky@0.0.0 from https://registry.yottabuild.org
info: get versions for frdm-k64f-gcc
info: download frdm-k64f-gcc@0.0.24 from https://registry.yottabuild.org
info: get versions for mbed-gcc
info: download mbed-gcc@0.0.14 from https://registry.yottabuild.org
info: get versions for mbed-drivers
info: download mbed-drivers@0.6.9 from https://registry.yottabuild.org
info: get versions for uvisor-lib
info: download uvisor-lib@0.7.23 from https://registry.yottabuild.org
info: get versions for mbed-hal
info: download mbed-hal@0.6.4 from https://registry.yottabuild.org
info: get versions for cmsis-core
info: download cmsis-core@0.2.6 from https://registry.yottabuild.org
info: get versions for ualloc
info: download ualloc@0.0.10 from https://registry.yottabuild.org
info: get versions for minar
info: download minar@0.6.7 from https://registry.yottabuild.org
info: get versions for core-util
info: download core-util@0.0.16 from https://registry.yottabuild.org
info: get versions for mbed-hal-freescale
info: download mbed-hal-freescale@0.5.2 from https://registry.yottabuild.org
info: get versions for mbed-hal-ksdk-mcu
info: download mbed-hal-ksdk-mcu@0.5.4 from https://registry.yottabuild.org
info: get versions for mbed-hal-k64f
info: download mbed-hal-k64f@0.3.5 from https://registry.yottabuild.org
info: get versions for mbed-hal-frdm-k64f
info: download mbed-hal-frdm-k64f@0.4.4 from https://registry.yottabuild.org
info: get versions for cmsis-core-freescale
info: download cmsis-core-freescale@0.1.4 from https://registry.yottabuild.org
info: get versions for cmsis-core-k64f
info: download cmsis-core-k64f@0.1.5 from https://registry.yottabuild.org
info: get versions for dlmalloc
info: download dlmalloc@0.0.6 from https://registry.yottabuild.org
info: get versions for compiler-polyfill
info: download compiler-polyfill@1.0.4 from https://registry.yottabuild.org
info: get versions for minar-platform
info: download minar-platform@0.3.4 from https://registry.yottabuild.org
info: get versions for minar-platform-mbed
info: download minar-platform-mbed@0.1.5 from https://registry.yottabuild.org
error: mbed-drivers does not meet specification ~0.7.0 required by minar

目前會發生 mbed-drivers 這個版本不對的情形, 但是目前不用管他!
會發現多了一個目錄 “example-mbedos-blinky" 上面下載的module 都會在此目錄下
然後 cd example-mbedos-blinky
並透過 yt target frdm-k64f-gcc 再設定一次 target
此時就剩下執行 “yt build"這個步驟了

error: mbed-drivers does not meet specification ~0.7.0 required by minar
info: generate for target: frdm-k64f-gcc 0.0.24 at /home/kunyi/mbed-test/example-mbedos-blinky/yotta_targets/frdm-k64f-gcc
GCC version is: 4.9.3
— The ASM compiler identification is GNU
— Found assembler: /home/kunyi/emgcc/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi-gcc
— Configuring done
— Generating done
— Build files have been written to: /home/kunyi/mbed-test/example-mbedos-blinky/build/frdm-k64f-gcc
[130/130] Linking CXX executable source/example-mbedos-blinky

順利的話, 可以在 example-mbedos-blinky/build/frdm-k64f-gcc/source 發現 “example-mbedos-blinky.bin" 這個下載用的檔案!

P.S.
也可以手動解決 mbed-drivers 版本不對的問題, 當透過yt install example-mbedos-blinky 抓下所有檔案後, 執行下面步驟

 cd example-mbedos-blinky  # 切換目錄
vim module.json  #去更改 “mbed-drivers" 的版本 為 ~0.7.0, 退出VIM
yt update # 更新檔案

就會出現下面訊息
info: get versions for frdm-k64f-gcc
info: get versions for mbed-gcc
info: get versions for mbed-drivers
info: download mbed-drivers@0.7.0 from https://registry.yottabuild.org
info: get versions for uvisor-lib
info: get versions for mbed-hal
info: get versions for cmsis-core
info: get versions for ualloc
info: get versions for minar
info: get versions for core-util
info: get versions for compiler-polyfill
info: get versions for mbed-hal-freescale
info: get versions for mbed-hal-ksdk-mcu
info: get versions for mbed-hal-k64f
info: get versions for mbed-hal-frdm-k64f
info: get versions for cmsis-core-freescale
info: get versions for cmsis-core-k64f
info: get versions for dlmalloc
info: get versions for minar-platform
info: get versions for minar-platform-mbed

此時在執行 yt build 即可

廣告

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

%d 位部落客按了讚: