Realtek ameba (RTL8711AF, RTL8711AM, RTL8195AM)のgccの開発環境を試してみました。
バイナリが生成できること、生成したバイナリが実機で動作することを確認しました。
Realtek amebaの標準の開発環境はIAR EWARMです。
IAR EWARMは有償なので環境を用意するのが面倒だったりしますのでgccの開発環境を試してみました。
環境
- ubuntu 14.04
- arm用のgccは以下の手順でインストール
$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
$ sudo apt-get update
$ sudo apt-cache madison gcc-arm-none-eabi
gcc-arm-none-eabi | 4.9.3.2015q3-1trusty1 | http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main amd64 Packages
gcc-arm-none-eabi | 4.8.2-14ubuntu1+6 | http://jp.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
gcc-arm-none-eabi | 6 | http://jp.archive.ubuntu.com/ubuntu/ trusty/universe Sources
$ sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q3-1trusty1
ビルド環境の修正
- githubにrealtekの関係者による開発環境 https://github.com/neojou/arm-gcc-blink-example があります。
- これはcygwin用なので、スクリプトとmakefileやファイル名などを修正しました。
- make して makebin/ram_all.binができることを確認しました。
$ cd templates/ameba-example
$ sh ./setup.sh
$ cd ../../build
$ make
動作例
- 実機にram_all.binをダウンロードして動作させてみました。
ROM Version: 0.2
Build ToolChain Version: gcc version 4.8.3 (Realtek ASDK-4.8.3p1 Build 2003)
=========================================================
Check boot type form eFuse
SPI Initial
Image1 length: 0x2684, Image Addr: 0x10000bc8
Image1 Validate OK, Going jump to Image1
SPI calibration
Find the avaiable window
===== Enter Image 1 ====elay start:0; Delay end:6
SPI calibration
Find the avaiable window
Baud:1; auto_length:12; Delay start:0; Delay end:63
SDR Controller Init
IOCR: 0x0; Write: 0x0
DLY: 0x31; Write: 0x0
Test 0: No match addr 0x15f320 => 0xe1b706e != 0x706e80ff
DLY: 0x10031; Write: 0x1
Test 0: No match addr 0xeb5fc => 0x6 != 0x57969e1a
DLY: 0x20031; Write: 0x2
Test 0: No match addr 0x1f6df8 => 0x4 != 0xcf487ff
DLY: 0x30031; Write: 0x3
Test 0: No match addr 0x11f944 => 0x6181f695 != 0x8
DLY: 0x40031; Write: 0x4
Test 0: No match addr 0x13b90c => 0x3be91356 != 0x1356e388
DLY: 0x50031; Write: 0x5
Test 0: No match addr 0xd8e58 => 0xb != 0x4fb3fff
DLY: 0x60031; Write: 0x6
Test 0: No match addr 0x6d014 => 0xb != 0x4
DLY: 0x70031; Write: 0x7
Test 0: No match addr 0x1e0e00 => 0x5 != 0x7ab5aaff
DLY: 0x80031; Write: 0x8
Test 0: No match addr 0x40e30 => 0x3e2b2788 != 0x278823ff
DLY: 0x90031; Write: 0x9
Test 0: No match addr 0x6ce84 => 0x22f5d051 != 0x5
DLY: 0xa0031; Write: 0xa
Test 0: No match addr 0x1447a0 => 0x5eb4aa83 != 0xf
DLY: 0xb0031; Write: 0xb
Test 0: No match addr 0x153934 => 0xb != 0x6d2baee7
DLY: 0xc0031; Write: 0xc
Test 0: No match addr 0x3610 => 0x6d41271d != 0x271da4ff
IOCR: 0x100; Write: 0x100
DLY: 0x31; Write: 0x0
0 Time Pass
Verify Pass => RdPipe:1; TapCnt: 0
DLY: 0x10031; Write: 0x1
Verify Pass => RdPipe:1; TapCnt: 1
DLY: 0x20031; Write: 0x2
Verify Pass => RdPipe:1; TapCnt: 2
DLY: 0x30031; Write: 0x3
Verify Pass => RdPipe:1; TapCnt: 3
DLY: 0x40031; Write: 0x4
Verify Pass => RdPipe:1; TapCnt: 4
DLY: 0x50031; Write: 0x5
Verify Pass => RdPipe:1; TapCnt: 5
DLY: 0x60031; Write: 0x6
Verify Pass => RdPipe:1; TapCnt: 6
DLY: 0x70031; Write: 0x7
Verify Pass => RdPipe:1; TapCnt: 7
DLY: 0x80031; Write: 0x8
Verify Pass => RdPipe:1; TapCnt: 8
DLY: 0x90031; Write: 0x9
Verify Pass => RdPipe:1; TapCnt: 9
DLY: 0xa0031; Write: 0xa
Verify Pass => RdPipe:1; TapCnt: 10
DLY: 0xb0031; Write: 0xb
IOCR: 0x200; Write: 0x200
DLY: 0x31; Write: 0x0
Test 0: No match addr 0x53d54 => 0x234debeb != 0x234d234d
IOCR: 0x300; Write: 0x300
DLY: 0x31; Write: 0x0
Test 0: No match addr 0x1003ac => 0x5331468c != 0x53315331
The Finial RdPipe: 1; TpCnt: 0x6
Image2 @ 0x000026a4
Image2 length: 564, Image Addr: 0x1000324c
No Image3
Img2 Sign: RTKWin, InfaStart @ 0x10003261
===== Enter Image 2 ====
Hello World : 0
Hello World : 1
Hello World : 2
Hello World : 3
Hello World : 4
Hello World : 5
Hello World : 6
Hello World : 7
メモリ確保
SRAM上の変数
- SRAMに変数がどれくらいの量確保できるか試してみました
- 下記のコード410KBの配列が確保できました。
#include "rtl8195a.h"
static unsigned char buf_size_test[1024*420] = {0x11, 012};
int main(void)
{
int i=0;
while (1) {
DiagPrintf("Hello World : %d %d\r\n", i++, buf_size_test[i%256]);
HalDelayUs(1000000);
}
}
- その時のマップファイル
10002e28 t __HalPinCtrlRtl8195A_veneer
10002e38 t buf_size_test
1006bf48 t __func__.7235
SDRAM上の変数
- SDRAMに変数がどれくらいの量確保できるか試してみました
- 下記のコードで2MBの配列が確保できました。
#include "rtl8195a.h"
#include "section_config.h"
SECTION(".sdram.data")
static unsigned char buf_size_test[1024*1024*2];
int main(void)
{
int i=0;
while (1) {
DiagPrintf("Hello World : %d %d\r\n", i++, buf_size_test[i%256]);
HalDelayUs(1000000);
}
}
* その時のマップファイル
30000000 D __sdram_data_start__
30000000 d buf_size_test
30200000 D __sdram_data_end__
ソースコード
- ソースコードはgithubに置きました。
- https://github.com/eggman/arm-gcc-blink-example