view doc/Loadtools-performance @ 617:97fe41e9242a

fc-loadtool: added operation time reporting to flash program-m0
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 25 Feb 2020 07:01:28 +0000
parents 39b74c39d914
children 6824c4d55848
line wrap: on
line source

Here are the expected run times for the flash dump2bin operation of dumping the
entire flash content of a Calypso GSM device:

Dump of 4 MiB flash (e.g., Openmoko GTA01/02 or Mot C139/140) at 115200 baud:
12m53s

The same 4 MiB flash dump at 812500 baud: 1m50s

Dump of 8 MiB flash (e.g., Mot C155/156) at 812500 baud: 3m40s

Because of the architecture of fc-loadtool and its loadagent back-end, the run
time of a flash dump operation depends only on the serial baud rate and the
size of the flash area to be dumped; it should not depend on the USB-serial
adapter type or any host system properties, as long as the host system and
serial adapter combination supports the desired baud rate.  In contrast, flash
programming and fc-xram loading operations are quite different in that their
run times do depend on the host system and USB-serial adapter or other serial
port hardware - this host system dependency exists because of the way these
operations are implemented in our architecture.

Here are some examples of expected flash programming times, all obtained on the
Mother's Slackware 14.2 host system:

Flashing an Openmoko GTA02 modem (K5A3281CTM flash chip) with a new firmware
image (2376448 bytes), using a PL2303 USB-serial cable at 115200 baud: 7m35s

Flashing the same OM GTA02 modem with the same fw image, using a CP2102
USB-serial cable at 812500 baud: 1m52s

Flashing a Magnetite hybrid fw image (2378084 bytes) into an FCDEV3B board
(S71PL129N flash chip) via an FT2232D adapter at 812500 baud: 2m11s

These times are just for the flash program-bin operation, not counting the
flash erase which must be done first.  Flash erase times are determined
entirely by physical processes inside the flash chip and are not affected by
software design or the serial link: for each sector to be erased, fc-loadtool
issues the sector erase command to the flash chip and then polls the chip for
operation completion status; the polling is done over the serial link and thus
may seem very slow, but the extra bit of latency added by the finite polling
speed is still negligible compared to the time of the actual sector erase
operation inside the flash chip.  In contrast, the execution time of a flash
program-bin operation is a sum of 3 components:

* The time it takes for the bits to be transferred over the serial link;
* The time it takes for the flash programming operation to complete on the
  target (physics inside the flash chip);
* The overhead of command-response exchanges between fc-loadtool and loadagent.

XRAM loading via fc-xram is similar to flash programming in that fc-xram sends
a separate ML command to loadagent for each S-record, thus the total XRAM image
loading time is not only the serial bit transfer time, but also the overhead of
command-response exchanges between fc-xram and loadagent.  The flash programming
times listed above include flashing an FC Magnetite fw image into an FCDEV3B,
which took 2m11s; doing an fc-xram load of the same FC Magnetite fw image (built
as ramimage.srec) into the same FCDEV3B via the same FT2232D adapter at 812500
baud takes 2m54s.

Why does XRAM loading take longer than flashing?  Shouldn't it be faster because
the flash programming step on the target is replaced with a simple memcpy()?
Answer: fc-xram is currently slower than flash program-bin because the latter
sends 256 bytes at a time to loadagent, whereas fc-xram sends one S-record at a
time; the division of the image into S-records is determined by the tool that
generates the SREC image, but TI's hex470 post-linker generates images with 30
bytes of payload per S-record.  Having the operation proceed in smaller chunks
increases the overhead of command-response exchanges and thus increases the
overall time.