printf uses z modifier to print size_t.
Also change d modifier to u, since size_t is unsigned.
(ssize_t is the signed version.)
Fixes build warning on 32-bit systems, e.g. ARMv7.
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Let the programmer search for files beyond the current folder. When --include is
used , the programmmer will first look for files in the specified folder, and it
will then fallback to looking at the current folder.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In the case that we find a "data" tag, but not a "program" or "ufs"
child node type might have been left unitialized. Fix this by
initializing type.
Also fix up the styling of the multiline blocks.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Each xmlNewDoc should have a matching xmlFreeDoc call in order to avoid
memory leaks.
Signed-off-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Some program entries has num_partition_sectors=0 but still specifies a
file, don't truncate the size of the file in this case.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Follow the behavior of the other flash tools and skip partitions with no
filename, instead of filling them with zeros. This reduces the flash
time considerably for some set of xml files.
Also clean up firehose_program() as we no longer need to support calling
this function with an invalid fd.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
When the host propose a larger payload size than the device accepts the
device will respond with a NACK, containing the maximum payload size.
Similarily the ACK will contain the supported max if the host requests a
lower value than the device supports.
In both cases we pick the largest possible value and send a second
configure message to select this payload size.
Reported-by: Kirill Kapranov <c_kkapra@qti.qualcomm.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The max payload size is negotiated through the configure and configure
response messages. Update the max payload size based on the
configuration response value, if present.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
During program it's recommended to reduce the num_sectors to only cover
the sectors containing data to be written and not write zero-block in
the rest. This reduce the time spent sending unnecessary blocks of
zeros.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reduce the number of write operations by batching up sectors in a
max_payload_size sized buffer and write them in one chunk. Using the
qcserial driver will still chop up the USB traffic in 4kB chunks, so no
measurable perfomance improvement is seen.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The MaxPayloadSizeToTargetInBytes parameter of the configure command is
supposed to set the maximum size of the transfer unit. This size is
however limited by the use of the in-kernel qcserial driver and the use
of sector-sized writes. Yet increasing it, drastically bumps the
transfer speed, so leave it high.
NB. The max payload size supported by the device is part of the
configure response, if the device supports a value less than the
requested size - which we just ignore today.
Suggested-by: Kirill Kapranov <c_kkapra@qti.qualcomm.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This bootable device is not always partition number 1. Search the
program entries for an entry that has the label xbl or sbl1 and use the
partition number to mark the boot partition bootable.
Reported-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The DONE message contains a return code denoting if the firmware is done
(1) requesting files from the host, or if there are more requests to
come (0). Unfortunately on some platforms the ROM code sends 0
regardless, so we just have to assume that we're done.
This assumes that there is only ever one image to transfer.
Reported-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Convenient file to be used with git-review to make it simpler to contribute
patches into Linaro Gerrit review.
Change-Id: Ia96d2fea0de031e67f03c4384fb20dc9d5696c28
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Rename "buf" to "path" to clarify things and increase the size to
PATH_MAX in order to silence a compile time warning the snprintf() in
find_qdl_tty() might be truncated.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Two assert incorrectly assigned the desired values rather than verify
that they where correct, fix this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Remove some left over functions from development, they can be added back
as needed in the future.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>