Do not worry about messing up your system:
every component it's installed in its own subdirectory
and does not modify your system globally (no PATH modifications).
> pyrcc4.exe
PyQt resource compiler
Usage: pyrcc4 [options] <inputs>
Options:
-o file Write output to file rather than stdout
-py2 Generate code for any Python v2.x version (default)
-py3 Generate code for any Python v3.x version
-name name Create an external initialization function with name
-threshold level Threshold to consider compressing files
-compress level Compress input files by level
-root path Prefix resource access path with root path
-no-compress Disable all compression
-version Display version
-help Display this information
# Something seems to not work, on Windows, using pyrcc4 with BeRTOS Wizard
# resources. So I'm restoring the old rcc-based resource generation
# system.
#
qrc, bertos_rc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos_rc.py')
if not (hasattr(sys, "frozen") and sys.frozen) and newer(qrc, bertos_rc):
os.system("pyrcc4 \"%s\" -o \"%s\"" %(qrc, bertos_rc))
import bertos_rc#qrc, rcc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos.rcc')
#if not (hasattr(sys, "frozen") and sys.frozen) and newer(qrc, rcc):
# os.system("rcc -binary \"%s\" -o \"%s\"" %(qrc, rcc))
#QResource.registerResource(rcc)
if len(sys.argv) == 3 and sys.argv[1] == "--edit":
editProject(os.path.abspath(sys.argv[2]))
else:
newProject()
if __name__ == '__main__':
main()
上の黄色いブロックを有効(#を削除)にして、下の青いブロックをコメントにします。(#を付加)
行頭は「半角スペース4つ」、インデントも「半角スペース4つ」です。
Pythonなのでスペースの数を正確に記述します。
これで以下のようにコンフィグレータを起動できます。
> python bertos.py
初回起動時は、リソースをコンパイルするため非常に時間がかかりますが、
2回目以降はすぐ起動します。
「インデントエラー」が出た場合は、「スペースの数」を正しく修正してください。
上のようにウィザードが起動します。
★ 再コンフィグレーション
プロジェクトを再コンフィグレーションしたい時は、
IDEからどうやるか不明だったので、コマンドラインでのやり方を記します。
(1) 「ソースコードだけ版」の場合。「wizard」フォルダで、
$ python bertos.py --edit ../../foo/project.bertos
のようにプロジェクトフォルダにある「project.bertos」を「--edit」引数付きで
実行します。(フォルダ名は適当に読み替えてください)
(2)インストーラでインストールした場合
インストールフォルダを「F:\BeRTOS-SDK」とします。
同様にコマンドラインで
F:\BeRTOS-SDK\wizard\bertos.exe --edit ../../foo/project.bertos
とします。
インストーラ版の場合、再コフィグレーションがうまくいかないようです。orz
(常に新規プロジェクト作成画面になる)
★ プロジェクトをCodeLiteで開く
プロジェクトフォルダ「foo」の中の「foo.workspace」をIDE(CodeLite)から、
「Workspace」-「Switch to Workspace」で開くことができます。
★ ポーティングガイド
Bertosを他の新たなMCUやファミリーMCUに移植する方法が解説されています。
http://dev.bertos.org/wiki/PortingGuide
Porting bertos to a new CPU
http://forum.bertos.org/viewtopic.php?f=4&t=69&sid=a92c273d3db8581c6d8e813b4f93a182
New board with Atmega2560
http://forum.bertos.org/viewtopic.php?f=4&t=45★ LPC2388(CQ-FRK-NXP-ARM)ボードで実験
以下は、LPC2388(CQ-FRK-NXP-ARM)ボードでLEDブリンクさせた時のメモ。
arm-none-eabi-gcc のバージョン:(Sourcery G++ Lite 2010q1-188) 4.4.1
まず新規プロジェクトを作ります。
上述のコンフィグレータ(BeRTOS Wizard)を起動します。(Linux,Macなら「wizard/bertos.py」)
ボード選択画面で以下のボードを選びます。
サンプル・テンプレートは下の様にカーネル付きの方を選びます。
あとは、そのままでプロジェクトを生成させます。
このサンプルは、LEDブリンク・タスクとメインタスクが同時に動きます。
メインタスクはデバッグ用UARTにスタック使用状況を出力します。
デフォルトでは「Co-operativeカーネル」(=ノンプリエンプティブ)になるようです。
プリエンプティブ・カーネルにするには、
コンフィグレータで以下の様にチェックを入れます。(一番上)
このデモは簡単なので「Co-operativeカーネル」(デフォルト)のままでも問題なく動作します。
以下生成したプロジェクト名を「1st」とします。
(1)コンパイルオプションに「-std=gnu99」の追加が必要だった。
(インストーラに付属のgccなら不要かもしれません)
1st/1st/1st_user.mkの1st_USER_CPPFLAGSに追加する。
TCB SPbase SPsize SPfree Name
--------------------------------------------------------
40000BAC 0 0 0 main
40000B6C 400009BC 432 288 led_process
★ STM32 Value Line Discovery ポート
秋月で1100円のこれ。
http://akizukidenshi.com/catalog/g/gM-04276/
Bertos Ver.2.7から正式対応になったようです。
STM32のディスカバリボードへの最小ベース部分の移植。
BeRTOS support for STM32 discovery kit★ LCD グラフィックス・ライブラリ
BeRTOSの表示システムは非常に進んでいて、
以下のような完全なサブシステムを持っています。
フォント、ビットマップ、クリッピング、Textの整形、対話型メニュー
これらは、コンパクトでパワフルなGUIを作るのに適しています。
また、シンプルなグラフィック要素を使って複雑なメニューシステムを構成します。
さらにreadlineライクな、パーサ付き、ヒストリ付きのコマンド・コンソールが
利用できます。
(この項目は、原文をテキトウに訳したものです。http://www.bertos.org/use/ )
以下はロゴがバウンドするデモ。短いけど。
BeRTOS bouncing logo on Luminary Micro
http://www.youtube.com/watch?v=G7P_sEWy-kE★ CPU独立汎用ドライバ
以下はHALベースで構成されたドライバなのでCPUによらず使用可能。
新しいCPUへの実装も簡単らしい。
ADC API
Buzzer
Atmel Dataflash
I2C EEPROM
AT25Fxxx Atmel flash memories
FT245RL USB to parallel converter
Keyboard
I2C with bitbang support
Displaytech 32122A Graphic LCD
DC Motor with PID
Alphanumeric LCD
MPC41 digital potentiometer
LM75 temperature sensor
MPxx6115A pressure sensor
NTC
TRIAC phase partialization
PWM API
PCF85974 I2C port expander
RIT P14201 oled display
Secure Digital card API
Serial API
Bitbanged SPI
Stepper motor with ramps
TAS5706A digital audio DSP
Thermostat
TI TMP123 temperature sensor
System timer API
USB device API
Watchdog
★ オブジェクト指向実装: KFilehttp://www.bertos.org/use/tutorial-front-page/drivers-kfile-interface/
Drivers: KFile
KFile interface: when object oriented programming (in C!) is useful in embedded
Do not be tricked by the headline, this is not otherworldly.
But let's start with order: what problem do we want to solve?
We have the typical problem of exchanging data with a peripheral:
a RS232 serial, a SPI, an EEPROM, a flash and so on.
In our embedded operating system (http://www.bertos.org)
we often create drivers that transfer data.
We usually code in C but very often we use the object oriented approach
that is not only related to high level languages like C++,
nor necessarily to a lack of resources.
If used in the right way it elegantly solves a broad range of problems
linked with the creation of common and reusable interfaces
that allow you to save development time and precious memory space.
Bear in mind, though, that BeRTOS has 2 implementations of the serial port:
one is used for debugging purposes only,
it's slow and safe; the other can be used to transfer all types of data,
it's fast and it exposes a kfile interface.
The former is the kdebug serial port,
which is initialized with kdbg_init() and can be used with kprintf() or LOG_*() functions
(see the logging tutorial for more information).
The implementation can be found in bertos/cpu/avr/drv/kdebug_avr.h.
The latter is the proper UART port,
which is initialized with ser_init() and accessed with the KFile interface.
To implement the serial driver, you need to look at bertos/cpu/avr/drv/ser_avr.c.