VOOZH about

URL: https://qiita.com/mt08/items/adc90efbbfc938be7cc4

⇱ [メモ] ERIKA様でLチカ (Arduino) #RTOS - Qiita


👁 Image
3

Go to list of users who liked

3

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

[メモ] ERIKA様でLチカ (Arduino)

3
Last updated at Posted at 2016-01-21

RTOSのERIKA Enterpriseを体験してみよう。

Erika Enterprise is the first open-source Free RTOS that has been certified OSEK/VDX compliant)

だそうです。
# 別件をしらべてる最中に、見つけて試しただけなので、詳しい使い方などわかりません。逆に教えてください。

環境

  • Windows7 64bit
  • Arduino互換機: Seeeduino v3.0 (Arduino Duemilanove w/Atmega328)

開発環境インストール

  1. C:\EERT\ フォルダを作成。=> ここにインストールします。

  2. Arduino Software - ARDUINO 1.6.7

  3. DOWNLOADページ : https://www.arduino.cc/en/Main/Software

  4. Windows ZIP file for non admin install => arduino-1.6.7-windows.zip

  5. zipを解等 => C:\EERT\ へ => ex) C:\EERT\arduino-1.6.7\arduino.exe

  6. Cygwinのインストール

  7. 解凍してすぐ使える、gnupack_devel版を使う。
    https://osdn.jp/projects/gnupack/releases/63996 から => gnupack_devel-13.06-2015.11.08.exe
    2. C:\EERT へ解凍

    👁 EERT3.png

    3. C:\EERT\gnupack_devel-13.06-2015.11.08\startup_cygwin.exe を実行、bashが開いたら、
    1. ln -sf / /cygdrive => シンボリックリンクをはる
    2. ls /cygdrive/c => 確認

  8. ERIKA Enterprise (http://erika.tuxfamily.org/drupal/ )

  9. (DOWNLOADページ)[http://erika.tuxfamily.org/drupal/download.html]より、環境にあったものダウンロード。

  10. ERIKA Enterprise and RT-Druid 2.6.0, Windows 64bit version => EE_RT-Druid-2.6.0-juno-win32-x86_64.zip

  11. C:\EERT\へ、zipを解凍

  12. C:\EERT\eclipse\eclipse.exe を起動 => WorkspaceC:\EERT\workspace , [v]Use this as the default and do no ask againにチェックを入れて [OK].
    👁 EERT1.png

  13. Welcome タブをクローズ (Welcome のとなりの xをおす。)

  14. Project => Build Automaticallyのチェックをはずす。

  15. 上のメニュバーから、

    1. Window => Preferences で、ダイアログを開いて、
    2. RT-Druidのところで、
      1. Cygwin paths
      2. Cygwin Installation C:\EERT\gnupack_devel-13.06-2015.11.08\app\cygwin\cygwin\
      3. [Apply]
      4. Oil => Avr8といって、
      5. Gcc path: C:\EERT\arduino-1.6.7\hardware\tools\avr
      6. Arduino SDK path: C:\EERT\arduino-1.6.7
      7. [Apply]
      8. [OK]
        👁 EERT2.png

libcfg.mkの編集

arduino 1.6.7のライブラリなどのPATHの変更を反映させる。とりあえず、必要なとこだけ...
C:\EERT\eclipse\plugins\com.eu.evidence.ee_2.6.0.20151106_2005\ee_files\contrib\arduino\cfg\libcfg.mkをエディタで開いて、

  1. 置換
  2. hardware/arduino/cores/arduino => hardware/arduino/avr/cores/arduino
  3. hardware/arduino/variants/standard => hardware/arduino/avr/variants/standard
  4. hardware/arduino/avr/variants/standard => hardware/avr/arduino/variants/eightanaloginputs
  5. hardware/arduino/avr/cores/arduino/HID.c => hardware/arduino/avr/libraries/HID/HID.c
  6. 行頭に #をつけてコメントアウト
  7. #EE_SRCS_ARDUINO_SDK += hardware/arduino/avr/cores/arduino/avr-libc/malloc.c
  8. #EE_SRCS_ARDUINO_SDK += hardware/arduino/avr/cores/arduino/avr-libc/realloc.c
  9. 追加 (コメントアウトした行のしたあたりにでも..)
  10. EE_SRCS_ARDUINO_SDK += hardware/arduino/avr/cores/arduino/hooks.c

プロジェクト作成・ビルド

  1. サンプルプロジェクト作成
    0. File => New => RT-Druid Oil and C/C++ Project でダイアログを開いて、
    1. Project Name: L_CHIKA (適当に。)
    2. Toolchains: Cross GCC
    3. [Next]
    4. Create a project using one of these templetesにチェックを入れて、
    5. avr8 > Arduino > Blink Demo を選んで
    6. [Finish]
  2. ビルド
    1. Project Explorerの L_CHIKAを右クリックして、 Clean Projectして、
    2. 上のメニューのとこの、とんかちアイコンを押して、Build Project
    3. ビルドが始まって、うまくいくと、C:\EERT\workspace\L_CHIKA\Debug\フォルダ内に、arduino.elf他が生成される。

書き込み・実演

生成されたarduino.hexavrdudeを使って書き込む。

  • 書き込み
コマンドラインで
C:\EERT\arduino-1.6.7\hardware\tools\avr\bin\avrdude.exe -CC:\EERT\arduino-1.6.7\hardware\tools\avr\etc\avrdude.conf -v -patmega328p -carduino -PCOM7 -b57600 -D -Uflash:w:C:\EERT\workspace\L_CHIKA\Debug\arduino.hex:i
  • -PCOM7 ってとこは、Arduinoを接続して、認識されたCOMポート番号。(Device Managerとかで確認する)
  • 書き込み後、自動でスタートして、LEDが1秒ごとにON/OFFする。

おまけ

  1. task.cを開いて、delay(1000);の1000を、500とか、250とかすると、ちかちかが早くなります。
task.c
# include "ee.h"
# include "Arduino.h"

extern int led;

TASK(TaskL1) {
 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
 delay(1000); // wait for a second
 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
 delay(1000); // wait for a second
};
  1. 書き込み時のログ
書き込み時のログ
C:\EERT>C:\EERT\arduino-1.6.7\hardware\tools\avr\bin\avrdude.exe -CC:\EERT\arduino-1.6.7\hardware\tools\avr\etc\avrdude.conf -v -patmega328p -carduino -PCOM7 -b57600 -D -Uflash:w:C:\EERT\workspace\L_CHIKA\Debug\arduino.hex:i

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
 Copyright (c) 2007-2009 Joerg Wunsch

 System wide configuration file is "C:\EERT\arduino-1.6.7\hardware\tools\avr\etc\avrdude.conf"

 Using Port : COM7
 Using Programmer : arduino
 Overriding Baud Rate : 57600
 AVR Part : ATmega328P
 Chip Erase delay : 9000 us
 PAGEL : PD7
 BS2 : PC2
 RESET disposition : dedicated
 RETRY pulse : SCK
 serial program mode : yes
 parallel program mode : yes
 Timeout : 200
 StabDelay : 100
 CmdexeDelay : 25
 SyncLoops : 32
 ByteDelay : 0
 PollIndex : 3
 PollValue : 0x53
 Memory Detail :

 Block Poll Page
 Polled
 Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
 eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
 flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
 lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

 Programmer Type : Arduino
 Description : Arduino
 Hardware Version: 2
 Firmware Version: 1.16
 Vtarget : 0.0 V
 Varef : 0.0 V
 Oscillator : Off
 SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "C:\EERT\workspace\L_CHIKA\Debug\arduino.hex"
avrdude: writing flash (1488 bytes):

Writing | ################################################## | 100% 0.76s

avrdude: 1488 bytes of flash written
avrdude: verifying flash memory against C:\EERT\workspace\L_CHIKA\Debug\arduino.hex:
avrdude: load data flash data from input file C:\EERT\workspace\L_CHIKA\Debug\arduino.hex:
avrdude: input file C:\EERT\workspace\L_CHIKA\Debug\arduino.hex contains 1488 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.64s

avrdude: verifying ...
avrdude: 1488 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (H:00, E:00, L:00)

avrdude done. Thank you.


C:\EERT>
3

Go to list of users who liked

3
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3

Go to list of users who liked

3