more documentation for the first packet
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/f544ec6f Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/f544ec6f Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/f544ec6f Branch: refs/heads/develop Commit: f544ec6fb3d45e0a685541952c70eabf949c26ff Parents: dba476c Author: paulfdietrich <paulfdietr...@yahoo.com> Authored: Tue Oct 18 15:48:35 2016 -0700 Committer: paulfdietrich <paulfdietr...@yahoo.com> Committed: Tue Oct 18 15:48:35 2016 -0700 ---------------------------------------------------------------------- newtmgr/cli/image.go | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f544ec6f/newtmgr/cli/image.go ---------------------------------------------------------------------- diff --git a/newtmgr/cli/image.go b/newtmgr/cli/image.go index c2e94ed..7bcb879 100644 --- a/newtmgr/cli/image.go +++ b/newtmgr/cli/image.go @@ -295,6 +295,17 @@ func imageUploadCmd(cmd *cobra.Command, args []string) { if currOff == 0 { /* we need extra space to encode the image size */ if blockSz > (mtu - 8) { + /* + * to encode the image size, we write clen=val in CBOR. + * From below (for up to 2G images, you can see that it + * will take up to 9 bytes. (starts at 63.. ends at e8) + * 00000040 7d c4 00 00 7d c4 00 00 63 6c 65 6e 1a 00 01 5d |}...}...clen...]| + * 00000050 e8 63 6f 66 66 00 |.coff.| + * However, since the offset is zero, we will use less + * bytes (we budgeted for 5 bytes but will only use 1 + */ + + /* to make these powers of 2, just go with 8 bytes */ blockSz = mtu - 8 } }