Commit b9192a4c authored by Carles Cufi's avatar Carles Cufi Committed by Fabio Utzig
Browse files

boot: serial: Adapt to Zephyr's new CRC APIs

As part of,
Zephyr recently changed its CRC APIs. The commit below
adapted the use of mcumgr in-tree, but MCUboot was missing the change:

Note that although on other platforms the function called is
crc_ccitt(), the CRC16 actually used by MCUboot/mcumgr is:

Signed-off-by: default avatarCarles Cufi <>
parent e3822f81
......@@ -589,9 +589,8 @@ boot_serial_output(void)
bs_hdr->nh_group = htons(bs_hdr->nh_group);
#ifdef __ZEPHYR__
crc = crc16((uint8_t *)bs_hdr, sizeof(*bs_hdr), CRC_CITT_POLYMINAL,
CRC16_INITIAL_CRC, false);
crc = crc16(data, len, CRC_CITT_POLYMINAL, crc, true);
crc = crc16_itu_t(CRC16_INITIAL_CRC, (uint8_t *)bs_hdr, sizeof(*bs_hdr));
crc = crc16_itu_t(crc, data, len);
crc = crc16_ccitt(CRC16_INITIAL_CRC, bs_hdr, sizeof(*bs_hdr));
crc = crc16_ccitt(crc, data, len);
......@@ -665,7 +664,7 @@ boot_serial_in_dec(char *in, int inlen, char *out, int *out_off, int maxout)
out += sizeof(uint16_t);
#ifdef __ZEPHYR__
crc = crc16(out, len, CRC_CITT_POLYMINAL, CRC16_INITIAL_CRC, true);
crc = crc16_itu_t(CRC16_INITIAL_CRC, out, len);
crc = crc16_ccitt(CRC16_INITIAL_CRC, out, len);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment