Part Number: CC3220
Hi,
When testing some more OTA examples and adding a some more files to my tar file, I ran into a errors during OTA upgrade.
Parts of the cmd.ota line were being misinterpreted as files:
OTALIB: [_BundleCmdFile_Parse] bundle cmd file=/cert/key.pem, sig_len=0, SHA_256_Digets=ba6fbc6cf312ed3afe103ec2d504f6d6560c351e5cab34b6ec3ed8748f82ffc5, cert=, secured=0, bundle=0
OTALIB: [_BundleCmdFile_Parse] bundle cmd file=/cert/otacert.der, sig_len=0, SHA_256_Digets=7431e5f4c3c1ce4690774f0b61e05440883ba9a01ed00ba6abd7806ed3b118cf, cert=, secured=0, bundle=0
Doing-OTA-Run
OTALIB: OtaArchive_RunParseTar: parsing archive file header
OTALIB: OtaArchive_RunParseTar: skip block align RecvBufLen=1440, SkipAlignSize=96
OTALIB: OtaArchive_RunParseTar: unsupported FileType=103, FileName= "certificate":"",
"signature_base64":"",
"secured":0,
"bundle":1,
"filename":"/sys/mcuimg.b,
Strangely enough, changing (or even lowering!) the buffer size in ota.h suddenly fixed the problem.
Turns out there is a bug in the ota library..
In OtaArchive.c in the state ARCHIVE_STATE_PARSE_CMD_FILE, the cmd file is parsed, and the function _BundleCmdFile_Parse is expected to return whether the full file is parsed or not.
The function however does not always work correctly. I just so happened to have bad luck, and my buffer just was split in the worst possible place. Trying to visualize here:
As you can see, the entire json object was accidentally cut -just- after the }, and this causes the parsing function to wrongly report being done with the entire file..
The correct way of checking whether the entire ota file is parsed, is to pass it the length stored in the tar header..
Hope this gets fixed.
Kind regards,
Arnout