2016年6月28日 星期二

mbed client using Raspberry Pi with IT-Pi Shield



介紹如何利用yotta 工具進行編譯 linux mbed client

what is yotta ? 

  • mbed OS applications as yotta executables 
  • yotta - to build the mbed example programs
  • yotta is a module management system for C++ and C designed to make it easier to build better software by re-using code.
  • yotta uses the CMake build system, and targets describe how the compiler should be run by providing a CMake
  • yotta is written in python, and distributed using pip, the python package manager
  • 利用yotta 可以到yotta 公開的 module registry (http://yotta.mbed.com/)下載 module (即library)來使用. 另外, yotta 目標希望可以用同一份原始碼來編譯出不同平台上的code
     (yotta target <target_name>)  

yottta 工具安裝

成功安裝完必要的dependency後 , 接著進行安裝 yotta

1.) Installing Package Dependencies

sudo apt-get install python-setuptools cmake build-essential ninja-build python-dev 
sudo apt-get install libffi-dev 
sudo apt-get install libssl-dev
sudo easy_install pip

2) Installing yotta

sudo pip install yotta     //wait and pray......


問題排除 

如果按照上面步驟,安裝yotta, 套件找不到情況, 建立virtualenv , 解決python 相依套件的問題

Installing in a Virtualenv


Virtualenv is a way of separating different python programs installed on the same system from each other. If you have a complex python environment on your system it’s recommended that you install yotta inside a virtualenv. 

  1. Ensure you have virtualenv itself installed. It can be installed with:
    pip install virtualenv
    
    Check that your installation is succesful by running virtualenv --version.
  2. Create a directory to use for the yotta virtualenv:
    mkdir yotta-venv
    virtualenv ./yotta-venv
    
  3. activate the new virtualenv:
    source ./yotta-venv/bin/activate
    
  4. install yotta in the virtualenv:
    pip install yotta
    
  5. (optional) add the binary directory of your virtualenv to your PATH: (if you omit this step, you will need to run yotta as../path/to/yotta-venv/bin/yotta instead of simply yotta.
    export PATH="/path/to/yotta-venv/bin:$PATH"
    
Now yotta should work as normal. You will need to activate the virtualenv any time you want to run yotta commands (you can deactivate it afterwards, by simply running deactivate).

Yotta 成功安裝畫面

 編譯 mbed client linux Source 

 made sure you have installed yotta and all necessary toolchains.

  1. In the command prompt, go to mbed-client-linux-example.
  2. Set up the application with correct Certificate and Domain:
    B. Go to My devices -> Security credentials.
    C. Click GET MY DEVICE SECURITY CREDENTIALS. You will get the needed certificate information as well as the endpoint name and domain.
    D. Copy the security credentials to source/security.h.
  3. In the command prompt, type yotta target arm-linux-native to set up the target device., 這裡會產生出資料匣 build/arm-linux-native
  4. In the command prompt, type yotta build. The executable file will be created in the folder build/arm-linux-native/source/.

    (yotta build -d: 可加入debug 訊息輸出)
編譯code 時會去pubic repository 下載module , 故要求驗證身份

5. In the folder mbed-client-linux-example/build/arm-linux-native/source/, run the executable from the command line, type ./mbed-client-linux-example.

         6. 若要將整個project 清空: 執行 yotta clean


The build process (what is ninja?)



---------------------
參考文件

1 則留言 :

  1. Thanks for sharing, nice post!

    Chương trình tuyển cộng tác viên bán quần áo trẻ em lương cao tại nhà và tuyển cộng tác viên bán mỹ phẩm online tphcm làm việc tại nhà hay chia sẻ kinh nghiệm mua hàng trên aliexpress về Việt Nam uy tín nhất, hướng dẫn cách mua hàng trên Taobao uy tín đảm bảo an toàn nhất hay cách mua hàng trên taobao trực tiếp tại web shop taobao com tiếng việt và dịch vụ chuyên nhận đặt mua hộ hàng trên aliexpress uy tín ở đâu tốt nhất và với Ting.vn tự hào là địa chỉ mua hàng xách tay uy tín nhất hiện nay.

    回覆刪除