Ameba SDK

Discuss about compilers and toolchains for the RTL8710 WiFi chip
kd8bxp
Posts: 3
Joined: Fri Oct 21, 2016 4:20 am

Re: Ameba SDK

Postby kd8bxp » Mon Nov 07, 2016 2:35 am

dpape wrote:Hi kd8bxp,

I assume you posted the video on youtube. I'm working on a guide for the PADI IoT stamp (from Pine64) and it uses the same toolchain as the Realtek Ameba. I'm going to do a write up hopefully this week on the forum. This should than answer your question.

Kind regards,
Daan


That's me - I think I was expecting something a little more "arduino"ish and think I got in over my head a little bit :-)
I look forward to your video.

LeRoy

kd8bxp
Posts: 3
Joined: Fri Oct 21, 2016 4:20 am

Re: Ameba SDK

Postby kd8bxp » Mon Nov 07, 2016 2:42 am

cjsieh wrote:Hi kd8bxp,

You need to unzip the sdk-ameba-rtl8710af-v3.5a_without_NDA_GCC_V1.0.0.zip file. Under doc/ there is documentation on using the GCC compiler . See "UM0096 Realtek Ameba-1 build environment setup - gcc.pdf" . This will get you started.


I'll re-read it, I did get the gcc version to compile finally, but I'm still lost as to what to do. I haven't been able to get openocd to run - I forget what error it's telling me, I did stop messing with it after it frustrated me.
But i could have missed something, so going back and re-reading it isn't a bad idea.
-LeRoy

cjsieh
Posts: 2
Joined: Sun Nov 06, 2016 11:49 pm

Re: Ameba SDK

Postby cjsieh » Mon Nov 07, 2016 9:38 pm

The Ameba SDK assumes you have one of the development boards listed at http://www.amebaiot.com/ameba-sdk-boards/ . These boards have a "programmer" built in. The openocd is expecting one of these boards.

boverby
Posts: 2
Joined: Wed Nov 30, 2016 7:20 pm

Re: Ameba SDK

Postby boverby » Wed Nov 30, 2016 7:49 pm

I am looking for the same source code.
Under debian on raspberry pi, you can change ARM_GCC_TOOLCHAIN in application.mk to point to /usr. This worked for building up until the "PICK" command. The included sdk binaries are Intel I386 code (windows and linux).

/component/soc/realtek/8195a/misc/iar_utility/common/tools/pick
result:
Usage: pick.exe <start addr> <end addr> <input name> <output name> <body[+offset] , head [image2_start]>

/component/soc/realtek/8195a/misc/iar_utility/common/tools/padding -- no help response
from application.mk: $(PAD) 44k 0xFF $(BIN_DIR)/ram_1.p.bin
-- I'm guessing that it will pad the filename in third parameter with character in second param to length of first param

/component/soc/realtek/8195a/misc/iar_utility/common/tools/checksum "filename"
result:
size = 922
checksum 134c6

changes that got me to here : apt-get install
binutils-arm-none-eabi - GNU assembler, linker and binary utilities for ARM Cortex-A/R/M processors
gcc-arm-none-eabi - GCC cross compiler for ARM Cortex-A/R/M processors
gdb-arm-none-eabi - GNU debugger for ARM Cortex-A/R/M processors
libstdc++-arm-none-eabi-newlib - GNU Standard C++ Library v3 for ARM Cortex-A/R/M processors (newlib)
libnewlib-arm-none-eabi - C library and math library compiled for bare metal using Cortex A/R/M

change application.mk to point ARM_GCC_TOOLCHAIN to /usr to get apt installed toolchain

kissste wrote:I have not used any IDE. Any text editor will do the job, such as Notepad++ on Windows, vi and Geany on Linux.

I have submitted a request to Platformio to integrate RTL's SDK. it's doable, given that SDK and GCC is available.

Except missing:
padding.c
picking.c and one more.

It's used to post-process binary output for flashing

Anybody has got a source?

kissste
Posts: 53
Joined: Fri Aug 12, 2016 3:43 am
Location: ON, Canada

Re: Ameba SDK

Postby kissste » Wed Nov 30, 2016 10:35 pm

I have replicated the function/ code of those three (3) .exe files, it was very simple - read a file, calculate, write a file.

I will post it on github tonight.

kissste
Posts: 53
Joined: Fri Aug 12, 2016 3:43 am
Location: ON, Canada

Re: Ameba SDK

Postby kissste » Thu Dec 01, 2016 4:51 am

https://github.com/kissste/RTL8710_SDK_ ... g_Checksum

1st cut, basic testing, it needs more time to verify and tweak

boverby
Posts: 2
Joined: Wed Nov 30, 2016 7:20 pm

Re: Ameba SDK

Postby boverby » Thu Dec 01, 2016 2:02 pm

Thank you for the interest. I tried the code by compiling on raspberry pi , then replacing the i386 versions in tree.

for reference, these are the make file results:

Code: Select all

================ I386 ====================
body+reset_offset+sig
b:268460032 s:268460032 e:268759452
size 299420
copy size 299420

ram_2.ns.bin body+reset_offset
b:268460032 s:268460032 e:268759452
size 299420
copy size 299420

ram_3.p.bin body+reset_offset
b:805306368 s:805306368 e:805306368
size 0
copy size 0

application/Debug/bin/ram_1.p.bin
Original size 15032
Padding  size 45056

application/Debug/bin/ota.bin    || true
size = 299436
checksum 1ce5df6


================= armhf  ==================
body+reset_offset+sig
b:268460032 s:268460032 e:268759444
size 299412
copy size 299412

ram_2.ns.bin body+reset_offset
b:268460032 s:268460032 e:268759444
size 299412
copy size 299412

ram_3.p.bin body+reset_offset
b:805306368 s:805306368 e:805306368
size 0
copy size 0

 application/Debug/bin/ram_1.p.bin
Original size 15032
Padding  size 45056

checksum application/Debug/bin/ota.bin || true
size = 299428
Segmentation fault


The segfault in checksum is repeatable outside of the make environment

Code: Select all

~/RTL8710_SDK_Pick_Padding_Checksum/checksum application/Debug/bin/ota.bin
size = 299428
Segmentation fault


using strace, it dies right after printing the file size

Code: Select all

open("application/Debug/bin/ota.bin", O_RDWR) = 3
lseek(3, 0, SEEK_SET)                   = 0
lseek(3, 0, SEEK_END)                   = 299428
lseek(3, 0, SEEK_SET)                   = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76fe4000
write(1, "size = 299428 \n", 15size = 299428
)        = 15
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7ecf8000} ---
+++ killed by SIGSEGV +++
Segmentation fault

This appears to be on line 32 of your code, maybe the alloca is overflowing the stack. Maybe malloc instead?


confirmed by compiling on i386 also, same results

Code: Select all

 ~/RTL8710_SDK_Pick_Padding_Checksum/checksum ota.bin
size = 299444
Segmentation fault



this compiled cleanly for me

Code: Select all

 diff checksum.c.dist checksum.c
32,34c32
<       sizeOfBuffer = 16 * ((size + 115) / 0x10);
<       buffer = alloca(sizeOfBuffer);
<       memset(&buffer, 0, size + 100);
---
>       buffer = malloc(size);


Thanks again for tackling this so quickly, I hope the testing/verification keeps it moving.

kissste wrote:https://github.com/kissste/RTL8710_SDK_Pick_Padding_Checksum

1st cut, basic testing, it needs more time to verify and tweak

kissste
Posts: 53
Joined: Fri Aug 12, 2016 3:43 am
Location: ON, Canada

Re: Ameba SDK

Postby kissste » Fri Dec 02, 2016 1:17 am

malloc should do, I will take a look and update/ test

jeroen79
Posts: 2
Joined: Mon Dec 19, 2016 6:00 pm

Re: Ameba SDK

Postby jeroen79 » Sun Jan 15, 2017 12:07 pm

mhzz this sdk seems to be made by monkeys, the wifi save functions are in webserver.c etc.
pretty hard to make a clean project with this stuff

kissste
Posts: 53
Joined: Fri Aug 12, 2016 3:43 am
Location: ON, Canada

Re: Ameba SDK

Postby kissste » Mon Feb 13, 2017 1:48 pm

jeroen79 wrote:mhzz this sdk seems to be made by monkeys, the wifi save functions are in webserver.c etc.
pretty hard to make a clean project with this stuff


Regarding the monkey code... I share the same flustration. When working on the VGA driver, had to dig deeper and have found a web of functions callitiong another functions to call another function V02, V04, _patch, and etc. where the whole thing was just a a simple update to a register!

Tak a look here:
https://esp8266.ru/forum/threads/rtl871x-rom-bios.2146/

use google translate...


Return to “Compilers and toolchains”

Who is online

Users browsing this forum: No registered users and 1 guest