| There are a number of factors which influence the speed here. Most RedBoot ports run from FLASH which is often slow. Also, the network stack used by RedBoot was designed to be as simple and small as possible, not necessarily as fast as possible. Also, GDB sends relatively small packets while downloading. This adds a lot of overhead.
The biggest problem with GDB is the size of the packets that GDB uses and the associated overhead. If you use RedBoot to download code directly (using TFTP and the 'load' command), you'll see much faster download times. I just tested it on one of our platforms here and the difference was pretty large:
GDB - 153k (bits/sec)
RedBoot via 'load' - 700k (bits/sec)
So the problem is not really with RedBoot's networking code, but the additional overheads involved with the GDB protocol.
However, there are some knobs in gdb which can be used to improve the situation.
By default, gdb will send relatively small packets during download.
(gdb) set download-write-size xxx
asks gdb to try using xxx bytes per download packet. There is interaction
with the memory-write-size knob which may limit the download size. For
my xscale toolchain, I see:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0. Packets are limited to 399 bytes.
You can force gdb to use a larger memory-write-packet-size with:
(gdb) set remote memory-write-packet-size 800
The memory-write-packet-size is 800. Packets are limited to 399 bytes.
Notice how gdb still limits it to 399. Force gdb to use the previously
entered 800:
(gdb) set remote memory-write-packet-size fixed
The target may not be able to correctly handle a memory-write-packet-size
of 800 bytes. Change the packet size? (y or n) y
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 800. Packets are fixed at 800 bytes.
Now the problem is that the target side has to be able to handle packets of
up to 800 bytes. Unfortunately, the ARM HAL cannot handle packets larger
than (NUMREGBYTES * 2)+32 bytes, where NUMREGBYTES is defined in:
hal/arm/arch/include/arm_stub.h
As an experiment, I commented out the NUMREGBYTES define in arm_stub.h
so that a default gdb stub buffer of 2k was used. I then downloaded an
app using the default gdb settings and got 155K/sec. I then used:
(gdb) set download-write-size 1000
(gdb) set remote memory-write-packet-size 1000
(gdb) set remote memory-write-packet-size fixed
The target may not be able to correctly handle a memory-write-packet-size
of 1000 bytes. Change the packet size? (y or n) y
I then reloaded the app and saw 320K/sec.
jlarmourATredhatDOTcom |