AgeStar nsb3ast on STR8132 chip

1,087 views
Skip to first unread message

Rostislav

unread,
May 30, 2009, 1:23:43 PM5/30/09
to DealExtreme NAS
Hi.
I bought AgeS­tar NS­B3AST (STR8132 chip) re­cent­ly and de­cid­ed to
put De­bian on it.
Link to my story:
http://tinyhack.com/2008/09/20/update-debian-on-agestar-firmware/#comment-52967

I have a lot of experimenting, and I completely bricked the device in
the end.
Then, a man named Snaker said that I can restore the device via JTAG-
interface.
I am interested in this matter, and started to collect information on
the JTAG-interface of the unit.
Here is picture of the board:
http://groups.google.com/group/dealextreme-nas-/web/agestar_str8132_board.jpg?hl=en
You can see 10-pin "jtag connector" on the left on top of the board.
I think that I will find the appropriate signals on this connector
soon, and build Unbuffered Cable, like this:
http://oldwiki.openwrt.org/OpenWrtDocs(2f)Customizing(2f)Hardware(2f)JTAG_Cable.html

But I do not know what to do next, and how to restore u-boot. I ask to
help me, please.

Douglas Gazineu

unread,
May 30, 2009, 1:52:27 PM5/30/09
to dealextr...@googlegroups.com
Rostislav:

Hi, I´m the same Snaker from tinyhack forum.

I never did this myself, but it´s the way to go.
Will research on JTAG to help you. The docs that we will need with JTAG instructions for this board are in cnusers site: http://www.cnusers.org/index.php?option=com_remository&Itemid=32&func=select&id=41

If you can see differences between our board and yours in uploaded photos, will realize that you got luck in having JTAG pins so easily.

After recovering uboot, you will need the original firmware for this board, does you have it or know someone with the same device to get MTD partitioning info and extract it?
--
Douglas Gazineu

Rostislav

unread,
May 31, 2009, 8:47:03 AM5/31/09
to DealExtreme NAS
Hi Douglas!
I have finished searching for jtag pins, and uploaded updated image of
the board:
http://groups.google.com/group/dealextreme-nas-/web/agestar_str8132_board_jtag.jpg?hl=en
I built a jtag-adapter for the lpt-port, and I am ready to restore u-
boot of my Agestar. I'm looking for a suitable software for this
purpose.
Another question - where to get u-boot itself.
I have original firmware:
http://groups.google.com/group/dealextreme-nas-/web/Agestar_STR8132_V01R03.bin?hl=en
According to posts on tinyhack forum, I can suggest that the firmware
is composed of several blocks.
I opened the firmware in Winhex, and found a few blocks at the
beginning:
0-2FFFF
30000-3FFFF
40000-....
Maybe, I can use one of them to restore u-boot?
Maybe, I can find a man with the same model, and he agrees to watch
something inside the box via telnet. But I need to know what commands
to enter and what to watch.

On May 30, 9:52 pm, Douglas Gazineu <dgazi...@gmail.com> wrote:
> Rostislav:
>
> Hi, I´m the same Snaker from tinyhack forum.
>
> I never did this myself, but it´s the way to go.
> Will research on JTAG to help you. The docs that we will need with JTAG
> instructions for this board are in cnusers site:http://www.cnusers.org/index.php?option=com_remository&Itemid=32&func...
>
> If you can see differences between our board and yours in uploaded photos,
> will realize that you got luck in having JTAG pins so easily.
>
> After recovering uboot, you will need the original firmware for this board,
> does you have it or know someone with the same device to get MTD
> partitioning info and extract it?
>
>
>
> On Sat, May 30, 2009 at 14:23, Rostislav <ros...@gmail.com> wrote:
>
> > Hi.
> > I bought AgeS­tar NS­B3AST (STR8132 chip) re­cent­ly and de­cid­ed to
> > put De­bian on it.
> > Link to my story:
>
> >http://tinyhack.com/2008/09/20/update-debian-on-agestar-firmware/#com...
>
> > I have a lot of experimenting, and I completely bricked the device in
> > the end.
> > Then, a man named Snaker said that I can restore the device via JTAG-
> > interface.
> > I am interested in this matter, and started to collect information on
> > the JTAG-interface of the unit.
> > Here is picture of the board:
>
> >http://groups.google.com/group/dealextreme-nas-/web/agestar_str8132_b...
> > You can see 10-pin "jtag connector" on the left on top of the board.
> > I think that I will find the appropriate signals on this connector
> > soon, and build Unbuffered Cable, like this:
>
> >http://oldwiki.openwrt.org/OpenWrtDocs(2f)Customizing(2f)Hardware(2f)...<http://oldwiki.openwrt.org/OpenWrtDocs%282f%29Customizing%282f%29Hard...>

Douglas Gazineu

unread,
May 31, 2009, 9:00:34 AM5/31/09
to dealextr...@googlegroups.com
The firmware blocks probably don´t contain the u-boot partition. You can use the uploaded u-boot partition here in the forum.

After this, the partitions in the original firmware must be split in the original blocks, and a custom image made to write these blocks again to memory. The kernel mtd setting need to be the same, so the mtd devices get the original offsets.I will help you with this, after you restore your u-boot.
--
Douglas Gazineu

Rostislav

unread,
May 31, 2009, 9:07:55 AM5/31/09
to DealExtreme NAS
I looked through the file archives of this group, and found these
files:
fw_def_mtd0_bootloader.bin 256.0 KB
fw_def_mtd1_config.bin 128.0 KB
....
The size of these files is very similar to the size of blocks in the
firmware.
Since I broke my mtd1, I think that I need to cut the 30000-3FFFF
(128k size) block from the original firmware, and flash it into mtd1.
How I can do it?

Rostislav

unread,
May 31, 2009, 9:20:34 AM5/31/09
to DealExtreme NAS
> The firmware blocks probably don´t contain the u-boot partition. You can use
> the uploaded u-boot partition here in the forum.
Can you post link here? I found
"My_initial_Power_UP_U_Boot_without_devices.txt" file only.
Or maybe I don't understand, what u-boot is.
Maybe fw_def_mtd0_bootloader.bin ?

bernie

unread,
May 31, 2009, 10:38:55 AM5/31/09
to DealExtreme NAS
Hi Rostislav,

I looked thru both groups, and I believe [ NO TESTING yet.. ] - that
the first block of the firmware is the U-boot loader
[ see first msg from Yohanes and contents of mergefile.c ] - there
also seems to be a 'signature' which probably is a
Checksum of some sorts plus a name [ which will stop loading non-
working stuff from different ARM/U-Boot SOC's ].

My_initial_Power_UP_UBoot_without_devices.txt contains U-Boot/kernel
messages during startup without anything
connected to the device.

fw_def_mtd0_bootloader.bin is the original U_Boot image for this SOC -
no guarantee that it will work on Your's however.

rgds,
bernie

Douglas Gazineu

unread,
May 31, 2009, 10:56:01 AM5/31/09
to dealextr...@googlegroups.com
Rostislav:

The bootloader (fw_def_mtd0_bootloader.bin) is very generic, if the ethernet board is the same, because we can see that
flash is of the same family (8MB in your board). I think that it will work. The config of the bootloader is inside the same file (fw_def_mtd0_bootloader.bin), at 0x20000 address, no need to write another.

You will have to adjust bootcmd, so the loading address match where your kernel is located in flash.

If your flash does not contain the flash, it can be extracted and their parts rewritten of the firmware you sent.
--
Douglas Gazineu

Rostislav

unread,
May 31, 2009, 3:59:46 PM5/31/09
to DealExtreme NAS
Current progress with jtag launch is not very good. :(
I have built DLC5 cable (length is <10cm) in accordance with this
scheme:
http://groups.google.com/group/dealextreme-nas-/web/JTAG_Schematic.gif?hl=en
and tried to use this software to connect:
http://urjtag.sourceforge.net/
I soldered two LEDs to TDI and TDO lines (through 1kOhm resistors), so
I can see state of these lines.
When I trying to enter "detect" command in jtag console, I can see
that data running on TDI line, but LED on TDO line stays turned on
without any changes. So, STR8132 does not produce any data output to
TDO line.
I tried to find information how to enable jtag here:
http://www.cnusers.org/index.php?option=com_remository&Itemid=32&func=select&id=41
But there are only common words related to demo board, there are no
exact information.
I will try to ask Yohanes on tinyhack forum, may be he can help me.

Rostislav

unread,
Jun 1, 2009, 7:29:56 PM6/1/09
to DealExtreme NAS
I spent sleepless night, and got some results.
To enable JTAG on this board, you need to pull up CLKOUT/ICESEL pin.
It will change mode from Faraday ICE to ARM Multi-ICE. See image:
http://groups.google.com/group/dealextreme-nas-/web/agestar_str8132_board_jtag%20%282%29.jpg?hl=en
I got some data output to jtag-console after that:
-------------------------
UrJTAG 0.10 #1502
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License,
and you are
welcome to change it and/or distribute copies of it under certain
conditions.
There is absolutely no warranty for UrJTAG.

WARNING: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable DLC5 parallel 0x378
Initializing parallel port at 0x378
jtag> detect
IR length: 4
Chain length: 1
Device Id: 00000000010100100110111110100001 (0x0000000000526FA1)
Unknown manufacturer!
chain.c(149) Part 0 without active instruction
chain.c(200) Part 0 without active instruction
chain.c(149) Part 0 without active instruction
jtag>
------------------------------------
This program does not recognize the hardware, and this is my next
problem.
Now, I think, what to do next.

Douglas Gazineu

unread,
Jun 1, 2009, 8:08:20 PM6/1/09
to dealextr...@googlegroups.com

Rostislav

unread,
Jun 3, 2009, 7:10:17 PM6/3/09
to DealExtreme NAS
Hi guys.
Seems that I'm fully debricked my brick :)
I'll tell you about it.
Douglas, this "JTAG package" contains some files for ARM debugging
software. It seemed difficult to me to use ARM software, because it's
not simple. Besides, I suspect that the ARM Multi-ICE is hardware-
software complex, which will not work through a simple parallel cable.
I spent some research there: http://nas2000.homeunix.com/index.php?page=Thread&threadID=378
and then began to search for information about the SPI serial flash
programming.
Soon, I found the "spipgm" utility and scheme of programmator on the
Czech site: http://rayer.ic.cz/elektro/spipgm.htm
I built this programmator, soldered to the appropriate pins on the
flash (you need to unsolder these pins from board for programming),
and programmed it easy.
See log:
------------------
F:\Temp\str8132\spipgm>SPIPGMW.EXE

SPI FlashROM Programmer 1.6 (C) 2008-2009 by Martin Rehak;
ra...@seznam.cz
Compiled by GCC 3.4.5 (mingw-vista special r3) at 22:49:21, Jan 21
2009
(Win9x/NT/2K/XP compatability)

SYNTAX: spipgm /i|r|d|e|p [filename] [address] [size] [/l=iobase] [/
d=delay]
/i - identify SPI FlashROM
/r address size - read & display data block (0x prefix = hexa
number)
/d filename - dump entire FlashROM to file
/p filename - program entire FlashROM from file (without
erase)
/e - erase entire FlashROM
/u - unlock write protection bits (may depend on WP# level)
/l= LPT port I/O base address (default is 378h - LPT1)
/d= additional delay for SPI clock pulse width [usec] (default
is 0)

LPT to SPI pin assignment (based on BSD AVR programmer):
pin 7 = D5 -> CS#
pin 8 = D6 -> SCK (CLK)
pin 9 = D7 -> MOSI (DIO)
pin 10 = ACK -> MISO (DO)
pin 18 = GND -> GND

F:\Temp\str8132\spipgm>SPIPGMW.EXE /i

SPI FlashROM Programmer 1.6 (C) 2008-2009 by Martin Rehak;
ra...@seznam.cz
Compiled by GCC 3.4.5 (mingw-vista special r3) at 22:49:21, Jan 21
2009
(Win9x/NT/2K/XP compatability)

SPI connected to LPT port at I/O base address: 378h, SCK pulse width: t
+0us
FlashROM JEDEC ID, type: 202017h
ST Microelectronic M25P64 (8MB)
Status = 00h (SRP, RES, TB , BP2, BP1, BP0, WEL, BSY)
0 0 0 0 0 0 0 0

F:\Temp\str8132\spipgm>SPIPGMW.EXE /u

SPI FlashROM Programmer 1.6 (C) 2008-2009 by Martin Rehak;
ra...@seznam.cz
Compiled by GCC 3.4.5 (mingw-vista special r3) at 22:49:21, Jan 21
2009
(Win9x/NT/2K/XP compatability)

SPI connected to LPT port at I/O base address: 378h, SCK pulse width: t
+0us
FlashROM JEDEC ID, type: 202017h
ST Microelectronic M25P64 (8MB)
Status = 02h, WE bit is enabled
Unlocking...
Status = 00h, device is unlocked now.

F:\Temp\str8132\spipgm>SPIPGMW.EXE /e

SPI FlashROM Programmer 1.6 (C) 2008-2009 by Martin Rehak;
ra...@seznam.cz
Compiled by GCC 3.4.5 (mingw-vista special r3) at 22:49:21, Jan 21
2009
(Win9x/NT/2K/XP compatability)

SPI connected to LPT port at I/O base address: 378h, SCK pulse width: t
+0us
FlashROM JEDEC ID, type: 202017h
ST Microelectronic M25P64 (8MB)
Status = 02h, WE bit is enabled
Please wait... done.

F:\Temp\str8132\spipgm>SPIPGMW.EXE /p age-v01r03.bin

SPI FlashROM Programmer 1.6 (C) 2008-2009 by Martin Rehak;
ra...@seznam.cz
Compiled by GCC 3.4.5 (mingw-vista special r3) at 22:49:21, Jan 21
2009
(Win9x/NT/2K/XP compatability)

SPI connected to LPT port at I/O base address: 378h, SCK pulse width: t
+0us
FlashROM JEDEC ID, type: 202017h
ST Microelectronic M25P64 (8MB)
Programming page at: 007FFF00h (100%)
------------------

First boot of my former brick (serial-console):
------------------
U-Boot 1.1.4 (Nov 27 2007 - 09:29:18)

U-Boot code: 00000000 -> 0001AF80 BSS: -> 0001FEF4
IRQ Stack: 00e6ff7c
FIQ Stack: 00e6ef7c
RAM Configuration:
Bank #0: 00000000 32 MB
Flash Manufacturer: ST
Flash: 8 MB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
PLL clock at 250MHz
CPU clock at 250MHz
AHB clock at 125MHz
APB clock at 62MHz
Check Link Status ............Down
Star Equuleus #
------------------


Now I want to go back in time. I began to modify firmware, because I
did not meet the speed of the device over the LAN (about 3 Mb/s R/W).
I thought that if I install Debian on it, the speed will increase,
because Yohanes on tinyhack forum said that he put a new network
driver to his Debian-firmware, and speed increased.
I want to ask, if it really can increase the speed, if I put Debian on
device?

Rostislav

unread,
Jun 4, 2009, 3:45:01 AM6/4/09
to DealExtreme NAS
Something wrong with u-boot now.
It works, but gives crc error on every boot.
See log:
-----------------------
U-Boot 1.1.4 (Nov 27 2007 - 09:29:18)

U-Boot code: 00000000 -> 0001AF80 BSS: -> 0001FEF4
IRQ Stack: 00e6ff7c
FIQ Stack: 00e6ef7c
RAM Configuration:
Bank #0: 00000000 32 MB
Flash Manufacturer: ST
Flash: 8 MB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
PLL clock at 250MHz
CPU clock at 250MHz
AHB clock at 125MHz
APB clock at 62MHz
Check Link Status .Up
T T T T T T T T T T
Retry count exceeded; starting again
-----------------------
It tryes to get some file on tftp, I see.
I can boot it with reset button pressed and load firmware (without
first 256k) into RAM:

-----------------------
U-Boot 1.1.4 (Nov 27 2007 - 09:29:18)

U-Boot code: 00000000 -> 0001AF80 BSS: -> 0001FEF4
IRQ Stack: 00e6ff7c
FIQ Stack: 00e6ef7c
RAM Configuration:
Bank #0: 00000000 32 MB
Flash Manufacturer: ST
Flash: 8 MB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
PLL clock at 250MHz
CPU clock at 250MHz
AHB clock at 125MHz
APB clock at 62MHz
Star Equuleus # tftpboot 0x1020000 age2.bin
Check Link Status ...Up
TFTP from server 192.168.10.3; our IP address is 192.168.10.2
Filename 'age2.bin'.
Load address: 0x1020000
Loading:
#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################

#################################################################
############################
done
Bytes transferred = 8126464 (7c0000 hex)
Star Equuleus # go 0x1020000
## Starting application at 0x01020000 ...
Uncompressing
Linux.............................................................
...................................................... done, booting
the kernel.
-----------------------
Then, I can log in to web-interface and try to reflash original
firmware through it. Device is going to reboot after flashing, and
goes to the same state (with crc error on boot).
Any ideas, what to do?
I think that I'm erased something wrong in flash. I have old bricked
dump of flash...

Douglas Gazineu

unread,
Jun 4, 2009, 7:42:48 AM6/4/09
to dealextr...@googlegroups.com
Well done, man, thanks for sharing all this info!

You have to set your bootcmd variable to start running the kernel when u-boot loads.

In u-boot prompt, try typing "printenv", and show what you got.

To set a variable, issue "setenv bootcmd go 0x600000", for example. This is the default address of kernel in our board. If you know where in your flash the kernel start, you are ready to go.

To save these variables, type "saveenv", or just "save"
--
Douglas Gazineu

Rostislav

unread,
Jun 4, 2009, 3:22:55 PM6/4/09
to DealExtreme NAS
It's my printenv output:
-----------------------------------
Star Equuleus # printenv
bootcmd=firstboot
bootdelay=0
baudrate=38400
ethaddr=00:aa:bb:cc:dd:10
ipaddr=192.168.10.2
serverip=192.168.10.3
netmask=255.255.255.0
cpu_clock=250
stdin=serial
stdout=serial
stderr=serial

Environment size: 190/65532 bytes
Star Equuleus #
-----------------------------------
I tryed simply to enter "go 0x40000", no positive effect. As I
described earlier, I can load and boot kernel, extracted from
firmware, from address 0x40000 to eof.
As I think, firmware is directly written to flash, therefore, address
of the kernel in the flash should be 0x40000, too.
Here is serial output with "setenv bootcmd go 0x40000":
-----------------------------------
U-Boot 1.1.4 (Nov 27 2007 - 09:29:18)

U-Boot code: 00000000 -> 0001AF80 BSS: -> 0001FEF4
IRQ Stack: 00e6ff7c
FIQ Stack: 00e6ef7c
RAM Configuration:
Bank #0: 00000000 32 MB
Flash Manufacturer: ST
Flash: 8 MB
In: serial
Out: serial
Err: serial
PLL clock at 250MHz
CPU clock at 250MHz
AHB clock at 125MHz
APB clock at 62MHz
## Starting application at 0x00040000 ...
****HANG****
-----------------------------------
How to know the right address?
By the way, how is shared address space of the CPU? How I can access
the RAM, and how I can access the flash?
Perhaps the first is RAM 0x0-0x1FFFFFF, second is flash
0x2000000-0x24FFFFF, or vice versa?

When I programmed the flash, then I dumped its contents to file and
compared to original. It was fully identical, so there are no
programming errors.

Douglas Gazineu

unread,
Jun 4, 2009, 3:29:39 PM6/4/09
to dealextr...@googlegroups.com
Try to add a zero in the address, worked to in my hardware

go 0x400000
--
Douglas Gazineu

Rostislav

unread,
Jun 4, 2009, 4:44:15 PM6/4/09
to DealExtreme NAS
I found the right address with "md" command, randomly.
It is 0x1000000 , lol :)
Ok, my former brick is fully functional now.
I'll repeat one question: Can I really increase the speed over LAN, if

Douglas Gazineu

unread,
Jun 4, 2009, 6:24:56 PM6/4/09
to dealextr...@googlegroups.com
Rostislav:

We are happy for you, man!
I have not tested the throughput, but I think that it's more dependent on what type of filesystem you use, because usb and network drivers should be the same in the kernel. If the network driver in the kernel is somewhat tweaked in the Debian version, it could be possible.

The file that boots to Debian here in the forum have the same kernel that I´m using to produce the new firmware, so no differences at all, besides filesystem.
--
Douglas Gazineu

bernie

unread,
Jun 5, 2009, 9:09:21 AM6/5/09
to DealExtreme NAS
In my pretty minimal testing of transfer speed [ serial error-watching
via putty and write-transfer via filezilla ftp ] I saw
a bunch of 'oom's [ see My-* log-files in file-area ]. Obviously
scanning for 'jobs to kill' when already short of memory leads to 100%
cpu-load and very low network speed. At first I thought the 6GB file
was one of the problems. Then I
re-booted and let the device just sit in 'idle' - and got after about
10 mins the first 'oom' entry.. There were patches in
the network area ..

Question to Douglas: Can You run the system [ watching only via
serial line and web-interface ] without getting
'spurious' oom's ?

rgds,
bernie

Douglas Gazineu

unread,
Jun 5, 2009, 9:38:20 AM6/5/09
to dealextr...@googlegroups.com
Short answer: In the default kernel, had the same oom kills. In the current dev version, I got rid of them.

Long answer: To overcome oom, I had changed the kernel overcommit method to always, this way the system believe that the swapfile will work, when there was one (but in my tests worked well only when in an ext2 filesystem), and instead of killing a process because of aggressive vm memory allocation, will allow it to happen and wait for it when needed.
Some realtime process that need physical RAM may become unstable, namely networking, but to loose some packets is easily recoverable, and closing a process is worse. I hope beta stage will show us what are the side effects and tune even more.

I don't like swap, but keep in mind that to provide a reliable system running good daemons, we need more memory, as 32M RAM is very very low, since the swapping need.
--
Douglas Gazineu

Reply all
Reply to author
Forward
0 new messages