vouch-opensource / mcumgr-client Goto Github PK
View Code? Open in Web Editor NEWclient for mcumgr commands
License: Apache License 2.0
client for mcumgr commands
License: Apache License 2.0
The old Go program allows to use the Nordic BLE mcumgr interface to update images. This should be implemented for this program as well.
When the device file is not found, it just says "Error: No such file or directory", but it should say that the device file is not found, and show the filename of the device file.
I'm using nRF52840 with nRF Connect SDK 2.3.0 and MCUBoot 1.9.99 on windows 11.
GO version of mcumgr works fine.
But if I use the rust client I get the following error:
mcumgr-client 0.0.2, Copyright © 2023 Vouch.io LLC
09:30:58 [INFO] send image list request
09:30:58 [DEBUG] (1) mcumgr_client::transfer: request header: NmpHdr { op: Read, flags: 0, len: 1, group: Image, seq: 116, id: 0 }
09:30:58 [DEBUG] (1) mcumgr_client::transfer: serialized: 0000000100017400a0
09:30:58 [DEBUG] (1) mcumgr_client::transfer: encoded with packet length and checksum: 000b0000000100017400a08236
09:30:58 [DEBUG] (1) mcumgr_client::transfer: encoded: AAsAAAABAAF0AKCCNg==
09:30:58 [DEBUG] (1) mcumgr_client::transfer: result string: AP4BAAD0AAF0AL9maW1hZ2Vzn79kc2xvdABndmVyc2lvbmUwLjAuMGRoYXNoWCAhMl1cs2VM49NtItcmo6HjtOgK+MAPNpaS8dDcfOGC6Ghib290YWJsZfVncGVu
09:30:58 [ERROR] Error: wrong chunk length
For my setup with macOS 12.6.5, I get a hang if I try the -m 4096 -l 8192
increased buffer settings:
$ mcumgr-client -t 60 -m 4096 -l 8192 upload ext-flash-slot3.bin
mcumgr-client 0.0.2, Copyright © 2023 Vouch.io LLC
19:30:54 [INFO] One bootloader device found, setting device to: /dev/cu.usbmodem14301
19:30:54 [INFO] upload file: ext-flash-slot3.bin
19:30:54 [INFO] flashing to slot 3
19:30:54 [INFO] 22003712 bytes to transfer
with the above it just sits there.
$ uname -a
Darwin Mike-MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Thu Mar 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64 x86_64
With the 0.0.3 release on an x86 Mac:
$ ./mcumgr-client
-bash: ./mcumgr-client: Bad CPU type in executable
$ file mcumgr-client
mcumgr-client: Mach-O 64-bit executable arm64
Currently when uploading an image, it shows lots of lines which scrolls:
06:42:40 [INFO] 17% uploaded
06:42:40 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
06:42:41 [INFO] 17% uploaded
...
This should be improved with ANSI escape sequences, e.g. move cursor one line up so that it is all displayed in one line, as usual for such progress messages. Probably also a good idea to not print it with the logging crate. And would be nice to have a used time and transfer rate (x kB/s) at the end, and maybe during the process, estimated remaining time.
The go mcumgr client has some commands for image test
and image confirm <hash>
to test and confirm the uploaded image,
I don't seem to see how it is done using this client.
I am able to upload the image and can also reset ,the functionality that was just added I think.
But I am not able to switch to the newly uploaded image.
Here is what I mean :
mcumgr-client -d /dev/ttyACM0 list
mcumgr-client 0.0.3, Copyright © 2023 Vouch.io LLC
13:44:25 [INFO] send image list request
13:44:25 [INFO] response: {
"images": [
{
"hash": [
143,
216,
200,
104,
234,
205,
70,
55,
185,
70,
196,
253,
228,
109,
99,
197,
203,
58,
234,
157,
155,
58,
127,
29,
239,
106,
149,
143,
234,
36,
12,
252
],
"slot": 0,
"active": true,
"pending": false,
"version": "1.1.1",
"bootable": true,
"confirmed": true,
"permanent": false
},
{
"hash": [
143,
216,
200,
104,
234,
205,
70,
55,
185,
70,
196,
253,
228,
109,
99,
197,
203,
58,
234,
157,
155,
58,
127,
29,
239,
106,
149,
143,
234,
36,
12,
252
],
"slot": 1,
"active": false,
"pending": false,
"version": "1.1.1",
"bootable": true,
"confirmed": false,
"permanent": false
}
],
"splitStatus": 0
}
now when I upload the image
mcumgr-client -m 256 -d /dev/ttyACM0 upload build-dongle-update/zephyr/app_update.bin
mcumgr-client 0.0.3, Copyright © 2023 Vouch.io LLC
13:54:05 [INFO] upload file: build-dongle-update/zephyr/app_update.bin
13:54:05 [INFO] flashing to slot 1
13:54:05 [INFO] 226567 bytes to transfer
[00:00:12] [=================================================================================================================================] 221.26 KiB/221.26 KiB (0s)13:54:18 [INFO] upload took 13s
NOTE:
(see I had to reduce the MTU to 256, default does not work I don't know why, any way that's another issue)
I can see it being uploaded correctly
mcumgr-client -d /dev/ttyACM0 list
mcumgr-client 0.0.3, Copyright © 2023 Vouch.io LLC
13:55:05 [INFO] send image list request
13:55:05 [INFO] response: {
"images": [
{
"hash": [
143,
216,
200,
104,
234,
205,
70,
55,
185,
70,
196,
253,
228,
109,
99,
197,
203,
58,
234,
157,
155,
58,
127,
29,
239,
106,
149,
143,
234,
36,
12,
252
],
"slot": 0,
"active": true,
"pending": false,
"version": "1.1.1",
"bootable": true,
"confirmed": true,
"permanent": false
},
{
"hash": [
255,
148,
49,
169,
189,
101,
39,
214,
71,
242,
38,
40,
206,
34,
22,
7,
108,
39,
191,
13,
228,
192,
129,
55,
25,
71,
61,
45,
111,
40,
111,
188
],
"slot": 1,
"active": false,
"pending": false,
"version": "1.0.2",
"bootable": true,
"confirmed": false,
"permanent": false
}
],
"splitStatus": 0
}
Even after resetting the device it does not move it to slot 0 and nor can I test or confirm the image.
Hello @Frank-Buss and thank you for this implementation! I'd like to contribute to this work. Some ideas I have:
LMK where you see priorities.
Cheers,
J.P.
When using the "-v" option for verbose output, the received and transmitted bytes should be displayed.
See the TODO here:
Line 131 in 2feec7e
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.