Skip to content

Zephyr port: unnecessary flash alignment check #122

Open
@sw

Description

@sw

This relates to apache/mynewt-newtmgr#185

There is a performance problem when using mcumgr CLI to upload firmware images to a Zephyr system. There is an overhead of up to 4x in the data transmitted on the serial port.

On the one hand, this is due to sub-optimal frame handling in mcumgr CLI as reported in apache/mynewt-newtmgr#185

But I suspect the MCU side could also be improved.

img_mgmt_impl_upload_inspect rounds the data length down to a multiple of the flash write block size:

rem_bytes = req->data_len % flash_area_align(fa);
flash_area_close(fa);
if (rem_bytes) {
action->write_bytes -= rem_bytes;
}

But then, buffered write is used in img_mgmt_impl_write_image_data:

rc = flash_img_buffered_write(ctx, (void *)data, num_bytes, last);

According to the documentation of flash_img_buffered_write, this function will store non-complete blocks in RAM until it is called with flush == true. So a length that is not a multiple of the flash write block size should not pose a problem.

My suggestion would be to remove the length truncation in img_mgmt_impl_upload_inspect.
Or is there some special case that this would break?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions