Skip to contentSkip to conversation

xyz-modem: Select CRC16

PATCH Superseded Daniel Palmer 2 participants 2 messages Jun 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xyz-modem: Select CRC16

CONFIG_LOADB causes the xyzModem code to get built and that code depends on CONFIG_CRC16. If you don't have something else that selects CONFIG_CRC16 you can unselect it and then the final link will fail:

LD u-boot
/usr/bin/m68k-linux-gnu-ld.bfd: common/xyzModem.o: in function `xyzModem_get_hdr':
u-boot/common/xyzModem.c:388:(.text.xyzModem_get_hdr+0x17a): undefined reference to `crc16_ccitt'

Since SPL/TPL can also use the xyzModem code create a Kconfig symbol for it, select CONFIG_CRC16 there and then select the new symbol from all of the users.

---
 cmd/Kconfig            | 1 +
 common/Kconfig         | 6 ++++++
 common/Makefile        | 3 +--
 common/spl/Kconfig     | 1 +
 common/spl/Kconfig.tpl | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..7e6044bad952 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
 config CMD_LOADB
 	bool "loadb"
 	default y
+	select YMODEM
 	help
 	  Load a binary file over serial line.
 
common/Kconfig +6 -0
index 8e8c733aa295..5eafe05047dc 100644
@@ -1274,3 +1274,9 @@ config IO_TRACE
 	  confirm that the driver behaves the same way before and after a code
 	  change. To add support for your architecture, add '#include
 	  <iotrace.h>' to the bottom of arch/<arch>/include/asm/io.h and test.
+
+config YMODEM
+	bool
+	select CRC16
+	help
+	  Enable xyzModem library code
common/Makefile +1 -2
index d62ea34599ed..bd809e2f34e9 100644
@@ -99,8 +99,7 @@ obj-$(CONFIG_$(PHASE_)LOG) += log.o
 obj-$(CONFIG_$(PHASE_)LOG_CONSOLE) += log_console.o
 obj-$(CONFIG_$(PHASE_)LOG_SYSLOG) += log_syslog.o
 obj-y += s_record.o
-obj-$(CONFIG_CMD_LOADB) += xyzModem.o
-obj-$(CONFIG_$(PHASE_)YMODEM_SUPPORT) += xyzModem.o
+obj-$(CONFIG_YMODEM) += xyzModem.o
 
 obj-$(CONFIG_$(PHASE_)AVB_VERIFY) += avb_verify.o
 obj-$(CONFIG_$(PHASE_)STACKPROTECTOR) += stackprot.o
common/spl/Kconfig +1 -0
index 5fa94098e498..2bd413cbdf12 100644
@@ -1655,6 +1655,7 @@ config SPL_WATCHDOG
 config SPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on SPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable
common/spl/Kconfig.tpl +1 -0
index a535b61ecd35..7ab4666d3705 100644
@@ -336,6 +336,7 @@ config TPL_DM_SPI_FLASH
 config TPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on TPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable
Signature · 1 line
2.53.0
#1 lore raw
Quoted 78 lines · Daniel Palmer

CONFIG_LOADB causes the xyzModem code to get built and that code depends on CONFIG_CRC16. If you don't have something else that selects CONFIG_CRC16 you can unselect it and then the final link will fail:

LD u-boot
/usr/bin/m68k-linux-gnu-ld.bfd: common/xyzModem.o: in function `xyzModem_get_hdr':
u-boot/common/xyzModem.c:388:(.text.xyzModem_get_hdr+0x17a): undefined reference to `crc16_ccitt'

Since SPL/TPL can also use the xyzModem code create a Kconfig symbol for it, select CONFIG_CRC16 there and then select the new symbol from all of the users.

---
 cmd/Kconfig            | 1 +
 common/Kconfig         | 6 ++++++
 common/Makefile        | 3 +--
 common/spl/Kconfig     | 1 +
 common/spl/Kconfig.tpl | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..7e6044bad952 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
 config CMD_LOADB
 	bool "loadb"
 	default y
+	select YMODEM
 	help
 	  Load a binary file over serial line.
 
common/Kconfig +6 -0
index 8e8c733aa295..5eafe05047dc 100644
@@ -1274,3 +1274,9 @@ config IO_TRACE
 	  confirm that the driver behaves the same way before and after a code
 	  change. To add support for your architecture, add '#include
 	  <iotrace.h>' to the bottom of arch/<arch>/include/asm/io.h and test.
+
+config YMODEM
+	bool
+	select CRC16
+	help
+	  Enable xyzModem library code
common/Makefile +1 -2
index d62ea34599ed..bd809e2f34e9 100644
@@ -99,8 +99,7 @@ obj-$(CONFIG_$(PHASE_)LOG) += log.o
 obj-$(CONFIG_$(PHASE_)LOG_CONSOLE) += log_console.o
 obj-$(CONFIG_$(PHASE_)LOG_SYSLOG) += log_syslog.o
 obj-y += s_record.o
-obj-$(CONFIG_CMD_LOADB) += xyzModem.o
-obj-$(CONFIG_$(PHASE_)YMODEM_SUPPORT) += xyzModem.o
+obj-$(CONFIG_YMODEM) += xyzModem.o
 
 obj-$(CONFIG_$(PHASE_)AVB_VERIFY) += avb_verify.o
 obj-$(CONFIG_$(PHASE_)STACKPROTECTOR) += stackprot.o
common/spl/Kconfig +1 -0
index 5fa94098e498..2bd413cbdf12 100644
@@ -1655,6 +1655,7 @@ config SPL_WATCHDOG
 config SPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on SPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable
common/spl/Kconfig.tpl +0 -0
index a535b61ecd35..7ab4666d3705 100644

common/spl/Kconfig.tpl config TPL_DM_SPI_FLASH · line 342

Quoted 7 lines
common/spl/Kconfig.tpl +1 -0
@@ -336,6 +336,7 @@ config TPL_DM_SPI_FLASH
 config TPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on TPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable

Good catch. But, as the Makefile hunk shows, we should be using $(PHASE_) here for everything, so we need to add YMODEM_SUPPORT as a main U-Boot symbol (CND_LOADB should select that) and the existing xPL_YMODEM_SUPPORT should also select CRC16/xPL_CRC16 (so we're missing TPL_CRC16, but have SPL_CRC16). Thanks!

Signature · 1 line
Tom