Skip to contentSkip to conversation

xyz-modem: Select CRC16

PATCH In review Daniel Palmer 3 participants 10 messages Jun 8 – Jun 10

lore
Share & tools
lore
#0 lore raw

PATCH v2 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'

- Add CONFIG_YMODEM_SUPPORT, make that select CONFIG_CRC16 and make CONFIG_LOADB select CONFIG_YMODEM_SUPPORT.

- SPL/TPL already have Kconfig symbols for ymodem support but the spl ymodem code has issues building in the TPL phase and doesn't seem to be used:

/usr/bin/aarch64-linux-gnu-ld.bfd: common/spl/spl_ymodem.o: in function `spl_ymodem_load_image':
u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): undefined reference to spl_load_simple_fit' u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol spl_load_simple_fit' make[1]: *** [scripts/Makefile.xpl:546: tpl/u-boot-tpl] Error 1

- Remove the ymodem symbol entirely for TPL.

- Select CONFIG_SPL_CRC16 for SPL.

- Finally, since everyone is now using the ymodem support symbols remove the special rule for loadb in the makefile.

---

v2: Fix the SPL/TPL stuff as brought up by Tom. This opened a can of
worms when I tested if the TPL builds or not so I decided to just remove the TPL ymodem stuff. It didn't seem to be used in any defconfig and there isn't a CONFIG_TPL_CRC16 to enable the needed crc16 code anyhow so maybe it hasn't been used for a while?

 cmd/Kconfig            |  1 +
 common/Kconfig         |  4 ++++
 common/Makefile        |  1 -
 common/spl/Kconfig     |  1 +
 common/spl/Kconfig.tpl | 11 +----------
 5 files changed, 7 insertions(+), 11 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..503fc51f6bb4 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
 config CMD_LOADB
 	bool "loadb"
 	default y
+	select YMODEM_SUPPORT
 	help
 	  Load a binary file over serial line.
 
common/Kconfig +4 -0
index 8e8c733aa295..0db74aa580e4 100644
@@ -1274,3 +1274,7 @@ 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_SUPPORT
+	bool
+	select CRC16
common/Makefile +0 -1
index d62ea34599ed..6c39c422f980 100644
@@ -99,7 +99,6 @@ 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_$(PHASE_)AVB_VERIFY) += avb_verify.o
common/spl/Kconfig +1 -0
index 5fa94098e498..25f3867f991c 100644
@@ -1655,6 +1655,7 @@ config SPL_WATCHDOG
 config SPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on SPL_SERIAL
+	select SPL_CRC16
 	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 -10
index a535b61ecd35..ea238afbf188 100644
@@ -38,7 +38,7 @@ config TPL_FRAMEWORK
 	default y if SPL_FRAMEWORK
 	help
 	  Enable the SPL framework under common/spl/ for TPL builds.
-	  This framework supports MMC, NAND and YMODEM and other methods
+	  This framework supports MMC, NAND and other methods
 	  loading of U-Boot's SPL stage. If unsure, say Y.
 
 config TPL_BANNER_PRINT
@@ -333,13 +333,4 @@ config TPL_DM_SPI_FLASH
 	help
 	  Enable support for SPI DM flash drivers in TPL.
 
-config TPL_YMODEM_SUPPORT
-	bool "Support loading using Ymodem"
-	depends on TPL_SERIAL
-	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
-	  means of transmitting U-Boot over a serial line for using in TPL,
-	  with a checksum to ensure correctness.
-
 endmenu
Signature · 1 line
2.53.0
#1 lore raw

Hi Daniel,

Quoted 20 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'

- Add CONFIG_YMODEM_SUPPORT, make that select CONFIG_CRC16 and make CONFIG_LOADB select CONFIG_YMODEM_SUPPORT.

- SPL/TPL already have Kconfig symbols for ymodem support but the spl ymodem code has issues building in the TPL phase and doesn't seem to be used:

/usr/bin/aarch64-linux-gnu-ld.bfd: common/spl/spl_ymodem.o: in function `spl_ymodem_load_image':
u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): undefined reference to spl_load_simple_fit' u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol spl_load_simple_fit' make[1]: *** [scripts/Makefile.xpl:546: tpl/u-boot-tpl] Error 1

Quoted 7 lines

- Remove the ymodem symbol entirely for TPL.

- Select CONFIG_SPL_CRC16 for SPL.

- Finally, since everyone is now using the ymodem support symbols remove the special rule for loadb in the makefile.

When you need to list what you're doing in a commit log, it usually means you should be splitting the content into multiple separate patches (in a single series is usually fine/recommended).

What I could identify (slightly reworked, which better match how *I* would write the patches):

- changes made to common/spl/Kconfig.tpl with the justification given above,
- adding the missing CRC16 dependency to CMD_LOADB,
- adding missing SPL_CRC16 dependency to SPL_YMODEM_SUPPORT (possibly squashed with the CMD_LOADB+CRC16 patch above, I'm undecided on what's best here),
- create new YMODEM_SUPPORT symbol and migrate CMD_LOADB + common/Makefile to use that,

This makes it clearer what the purpose of each individual commit is:
- remove dead code
- fix existing support for CMD_LOADB,
- fix existing support for SPL_YMODEM_SUPPORT,
- quality of life improvement by migrating the CRC16 dependency from CMD_LOADB into a new symbol + making use of that new symbol in common/Makefile instead of "hardlinking" CMD_LOADB with building xyzModem.o (which is quite honestly confusing, so good to see this fixed!),

What do you think?

Quoted 33 lines

---

v2: Fix the SPL/TPL stuff as brought up by Tom. This opened a can of
worms when I tested if the TPL builds or not so I decided to just remove the TPL ymodem stuff. It didn't seem to be used in any defconfig and there isn't a CONFIG_TPL_CRC16 to enable the needed crc16 code anyhow so maybe it hasn't been used for a while?

  cmd/Kconfig            |  1 +
  common/Kconfig         |  4 ++++
  common/Makefile        |  1 -
  common/spl/Kconfig     |  1 +
  common/spl/Kconfig.tpl | 11 +----------
  5 files changed, 7 insertions(+), 11 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..503fc51f6bb4 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
  config CMD_LOADB
  	bool "loadb"
  	default y
+	select YMODEM_SUPPORT
  	help
  	  Load a binary file over serial line.
 
common/Kconfig +0 -0
index 8e8c733aa295..0db74aa580e4 100644

common/Kconfig config IO_TRACE · line 1280

Quoted 7 lines
common/Kconfig +4 -0
@@ -1274,3 +1274,7 @@ 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_SUPPORT
+	bool
+	select CRC16

Is there any reason we wouldn't want the user to be able to select this independently from CMD_LOADB?

I'm asking because this is both invisible (no prompt) and has no help text.

Cheers,
Quentin

#2 lore raw
Quoted 100 lines · Quentin Schulz

Hi Daniel,

Quoted 20 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'

- Add CONFIG_YMODEM_SUPPORT, make that select CONFIG_CRC16 and make CONFIG_LOADB select CONFIG_YMODEM_SUPPORT.

- SPL/TPL already have Kconfig symbols for ymodem support but the spl ymodem code has issues building in the TPL phase and doesn't seem to be used:

/usr/bin/aarch64-linux-gnu-ld.bfd: common/spl/spl_ymodem.o: in function `spl_ymodem_load_image':
u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): undefined reference to spl_load_simple_fit' u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol spl_load_simple_fit' make[1]: *** [scripts/Makefile.xpl:546: tpl/u-boot-tpl] Error 1

Quoted 7 lines

- Remove the ymodem symbol entirely for TPL.

- Select CONFIG_SPL_CRC16 for SPL.

- Finally, since everyone is now using the ymodem support symbols remove the special rule for loadb in the makefile.

When you need to list what you're doing in a commit log, it usually means you should be splitting the content into multiple separate patches (in a single series is usually fine/recommended).

What I could identify (slightly reworked, which better match how *I* would write the patches):

- changes made to common/spl/Kconfig.tpl with the justification given above,
- adding the missing CRC16 dependency to CMD_LOADB,
- adding missing SPL_CRC16 dependency to SPL_YMODEM_SUPPORT (possibly squashed with the CMD_LOADB+CRC16 patch above, I'm undecided on what's best here),
- create new YMODEM_SUPPORT symbol and migrate CMD_LOADB + common/Makefile to use that,

This makes it clearer what the purpose of each individual commit is:
- remove dead code
- fix existing support for CMD_LOADB,
- fix existing support for SPL_YMODEM_SUPPORT,
- quality of life improvement by migrating the CRC16 dependency from CMD_LOADB into a new symbol + making use of that new symbol in common/Makefile instead of "hardlinking" CMD_LOADB with building xyzModem.o (which is quite honestly confusing, so good to see this fixed!),

What do you think?

Quoted 32 lines

---

v2: Fix the SPL/TPL stuff as brought up by Tom. This opened a can of
worms when I tested if the TPL builds or not so I decided to just remove the TPL ymodem stuff. It didn't seem to be used in any defconfig and there isn't a CONFIG_TPL_CRC16 to enable the needed crc16 code anyhow so maybe it hasn't been used for a while?

  cmd/Kconfig            |  1 +
  common/Kconfig         |  4 ++++
  common/Makefile        |  1 -
  common/spl/Kconfig     |  1 +
  common/spl/Kconfig.tpl | 11 +----------
  5 files changed, 7 insertions(+), 11 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..503fc51f6bb4 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
  config CMD_LOADB
  	bool "loadb"
  	default y
+	select YMODEM_SUPPORT
  	help
  	  Load a binary file over serial line.
common/Kconfig +0 -0
index 8e8c733aa295..0db74aa580e4 100644

common/Kconfig config IO_TRACE · line 1280

Quoted 7 lines
common/Kconfig +4 -0
@@ -1274,3 +1274,7 @@ 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_SUPPORT
+	bool
+	select CRC16

Is there any reason we wouldn't want the user to be able to select this independently from CMD_LOADB?

Quoted 1 line

I'm asking because this is both invisible (no prompt) and has no help text.

I think this should stay hidden as it's *not* hidden for xPL as it's the equivalent of CMD_LOADB but it's the symbol for the library portion. As a maybe clearer result, maybe the library symbol should be XYZMODEM_SUPPORT / xPL_XYZMODEM_SUPPORT, to control building common/xyzModem.o ?

Signature · 1 line
Tom
#3 lore raw
Quoted 32 lines · Tom Rini
Quoted 31 lines · Quentin Schulz

Hi Daniel,

Quoted 27 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'

- Add CONFIG_YMODEM_SUPPORT, make that select CONFIG_CRC16 and make CONFIG_LOADB select CONFIG_YMODEM_SUPPORT.

- SPL/TPL already have Kconfig symbols for ymodem support but the spl ymodem code has issues building in the TPL phase and doesn't seem to be used:

/usr/bin/aarch64-linux-gnu-ld.bfd: common/spl/spl_ymodem.o: in function `spl_ymodem_load_image':
u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): undefined reference to spl_load_simple_fit' u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol spl_load_simple_fit' make[1]: *** [scripts/Makefile.xpl:546: tpl/u-boot-tpl] Error 1

- Remove the ymodem symbol entirely for TPL.

- Select CONFIG_SPL_CRC16 for SPL.

- Finally, since everyone is now using the ymodem support symbols remove the special rule for loadb in the makefile.

Quoted 8 lines
Quoted 8 lines

When you need to list what you're doing in a commit log, it usually means you should be splitting the content into multiple separate patches (in a single series is usually fine/recommended).

What I could identify (slightly reworked, which better match how *I* would write the patches):

- changes made to common/spl/Kconfig.tpl with the justification given above,

And I also see a mention of CONFIG_TPL_YMODEM_SUPPORT=y in doc/usage/spl_boot.rst that would need removal

Quoted 61 lines
Quoted 61 lines

- adding the missing CRC16 dependency to CMD_LOADB,
- adding missing SPL_CRC16 dependency to SPL_YMODEM_SUPPORT (possibly squashed with the CMD_LOADB+CRC16 patch above, I'm undecided on what's best here),
- create new YMODEM_SUPPORT symbol and migrate CMD_LOADB + common/Makefile to use that,

This makes it clearer what the purpose of each individual commit is:
- remove dead code
- fix existing support for CMD_LOADB,
- fix existing support for SPL_YMODEM_SUPPORT,
- quality of life improvement by migrating the CRC16 dependency from CMD_LOADB into a new symbol + making use of that new symbol in common/Makefile instead of "hardlinking" CMD_LOADB with building xyzModem.o (which is quite honestly confusing, so good to see this fixed!),

What do you think?

Quoted 32 lines

---

v2: Fix the SPL/TPL stuff as brought up by Tom. This opened a can of
worms when I tested if the TPL builds or not so I decided to just remove the TPL ymodem stuff. It didn't seem to be used in any defconfig and there isn't a CONFIG_TPL_CRC16 to enable the needed crc16 code anyhow so maybe it hasn't been used for a while?

   cmd/Kconfig            |  1 +
   common/Kconfig         |  4 ++++
   common/Makefile        |  1 -
   common/spl/Kconfig     |  1 +
   common/spl/Kconfig.tpl | 11 +----------
   5 files changed, 7 insertions(+), 11 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..503fc51f6bb4 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
   config CMD_LOADB
   	bool "loadb"
   	default y
+	select YMODEM_SUPPORT
   	help
   	  Load a binary file over serial line.
common/Kconfig +0 -0
index 8e8c733aa295..0db74aa580e4 100644

common/Kconfig config IO_TRACE · line 1280

Quoted 7 lines
common/Kconfig +4 -0
@@ -1274,3 +1274,7 @@ 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_SUPPORT
+	bool
+	select CRC16

Is there any reason we wouldn't want the user to be able to select this independently from CMD_LOADB?

Quoted 8 lines
Quoted 1 line

I'm asking because this is both invisible (no prompt) and has no help text.

I think this should stay hidden as it's *not* hidden for xPL as it's the equivalent of CMD_LOADB but it's the symbol for the library portion. As a maybe clearer result, maybe the library symbol should be XYZMODEM_SUPPORT / xPL_XYZMODEM_SUPPORT, to control building common/xyzModem.o ?

I'm not sure to understand how the rename would help here? I'm assuming we have an issue of the symbol having a different meaning in xPL and in proper. If I understood correctly, YMODEM_SUPPORT in proper is for building the library and using it, while in xPL it's both for building the library and add support for loading the next U-Boot stage over UART. Is this what you meant? Are you suggesting we split "build library code" and "load next stage from UART" into separate symbols?

Also, lib/Makefile has

obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o

which is.... odd? Shouldn't this handle the case of "missing" SPL_CRC16 dependency? So: does it really not build if SPL_CRC16=n but SPL_YMODEM_SUPPORT=y? If it does not build, is bringing SPL_CRC16 too much? We only need crc16-ccitt.o I think, and this will also bring crc16.o into the SPL, which may not be desired (size increase).

Cheers,
Quentin

#4 lore raw
Quoted 117 lines · Quentin Schulz
Quoted 32 lines · Tom Rini
Quoted 31 lines · Quentin Schulz

Hi Daniel,

Quoted 27 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'

- Add CONFIG_YMODEM_SUPPORT, make that select CONFIG_CRC16 and make CONFIG_LOADB select CONFIG_YMODEM_SUPPORT.

- SPL/TPL already have Kconfig symbols for ymodem support but the spl ymodem code has issues building in the TPL phase and doesn't seem to be used:

/usr/bin/aarch64-linux-gnu-ld.bfd: common/spl/spl_ymodem.o: in function `spl_ymodem_load_image':
u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): undefined reference to spl_load_simple_fit' u-boot/common/spl/spl_ymodem.c:138:(.text.spl_ymodem_load_image+0xdc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol spl_load_simple_fit' make[1]: *** [scripts/Makefile.xpl:546: tpl/u-boot-tpl] Error 1

- Remove the ymodem symbol entirely for TPL.

- Select CONFIG_SPL_CRC16 for SPL.

- Finally, since everyone is now using the ymodem support symbols remove the special rule for loadb in the makefile.

Quoted 8 lines
Quoted 8 lines

When you need to list what you're doing in a commit log, it usually means you should be splitting the content into multiple separate patches (in a single series is usually fine/recommended).

What I could identify (slightly reworked, which better match how *I* would write the patches):

- changes made to common/spl/Kconfig.tpl with the justification given above,

And I also see a mention of CONFIG_TPL_YMODEM_SUPPORT=y in doc/usage/spl_boot.rst that would need removal

Quoted 61 lines
Quoted 61 lines

- adding the missing CRC16 dependency to CMD_LOADB,
- adding missing SPL_CRC16 dependency to SPL_YMODEM_SUPPORT (possibly squashed with the CMD_LOADB+CRC16 patch above, I'm undecided on what's best here),
- create new YMODEM_SUPPORT symbol and migrate CMD_LOADB + common/Makefile to use that,

This makes it clearer what the purpose of each individual commit is:
- remove dead code
- fix existing support for CMD_LOADB,
- fix existing support for SPL_YMODEM_SUPPORT,
- quality of life improvement by migrating the CRC16 dependency from CMD_LOADB into a new symbol + making use of that new symbol in common/Makefile instead of "hardlinking" CMD_LOADB with building xyzModem.o (which is quite honestly confusing, so good to see this fixed!),

What do you think?

Quoted 32 lines

---

v2: Fix the SPL/TPL stuff as brought up by Tom. This opened a can of
worms when I tested if the TPL builds or not so I decided to just remove the TPL ymodem stuff. It didn't seem to be used in any defconfig and there isn't a CONFIG_TPL_CRC16 to enable the needed crc16 code anyhow so maybe it hasn't been used for a while?

   cmd/Kconfig            |  1 +
   common/Kconfig         |  4 ++++
   common/Makefile        |  1 -
   common/spl/Kconfig     |  1 +
   common/spl/Kconfig.tpl | 11 +----------
   5 files changed, 7 insertions(+), 11 deletions(-)
cmd/Kconfig +1 -0
index c71c6824a196..503fc51f6bb4 100644
@@ -1412,6 +1412,7 @@ config CMD_W1
   config CMD_LOADB
   	bool "loadb"
   	default y
+	select YMODEM_SUPPORT
   	help
   	  Load a binary file over serial line.
common/Kconfig +0 -0
index 8e8c733aa295..0db74aa580e4 100644

common/Kconfig config IO_TRACE · line 1280

Quoted 7 lines
common/Kconfig +4 -0
@@ -1274,3 +1274,7 @@ 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_SUPPORT
+	bool
+	select CRC16

Is there any reason we wouldn't want the user to be able to select this independently from CMD_LOADB?

Quoted 8 lines
Quoted 1 line

I'm asking because this is both invisible (no prompt) and has no help text.

I think this should stay hidden as it's *not* hidden for xPL as it's the equivalent of CMD_LOADB but it's the symbol for the library portion. As a maybe clearer result, maybe the library symbol should be XYZMODEM_SUPPORT / xPL_XYZMODEM_SUPPORT, to control building common/xyzModem.o ?

Quoted 2 lines

I'm not sure to understand how the rename would help here? I'm assuming we have an issue of the symbol having a different meaning in xPL and in proper.

To try and be clear, we don't have a symbol for common/xyzModem.o today, I was suggesting introducing one as part of fixing Daniel's problem.

Quoted 1 line

If I understood correctly, YMODEM_SUPPORT in proper is for building the

In this v2, it would be for that, yes.

Quoted 2 lines

library and using it, while in xPL it's both for building the library and add support for loading the next U-Boot stage over UART. Is this what you

Correct, xPL_YMODEM_SUPPORT covers both common/xyzModem.o (library) and common/spl/spl_ymodem.o (user).

Quoted 2 lines

meant? Are you suggesting we split "build library code" and "load next stage from UART" into separate symbols?

Thinking harder about the problem, yes. That would make things clearer in the long term. Maybe even with a move of common/xyzModem.c to lib/xyzModem.c (and yes bad filename, but matches the ancient upstream its from I bet) and introduction of LIB_XYZMODEM (and xPL_LIBXYZMODEM) which in turn selects the required CRC16 symbols.

Quoted 9 lines

Also, lib/Makefile has

obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o

which is.... odd? Shouldn't this handle the case of "missing" SPL_CRC16 dependency? So: does it really not build if SPL_CRC16=n but SPL_YMODEM_SUPPORT=y? If it does not build, is bringing SPL_CRC16 too much? We only need crc16-ccitt.o I think, and this will also bring crc16.o into the SPL, which may not be desired (size increase).

This indeed looks to be another odd case to look in to and figure out the right solution for.

Signature · 1 line
Tom
#5 lore raw
In reply to Quentin Schulz

Hi Quentin, Tom

Quoted 6 lines · Quentin Schulz

Also, lib/Makefile has

obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o

which is.... odd? Shouldn't this handle the case of "missing" SPL_CRC16 dependency?

I didn't see this. So it seems like for now just adding CONFIG_YMODEM_SUPPORT, making that select CONFIG_CRC16 and the Makefile tweak would be enough for now.

Would that be acceptable for now? It seems like the xyzmodem thing needs a bit of refactoring etc. I actually have an almost entirely rewritten version of it somewhere that I wrote because of the issues in the current version. I'd prefer to fix the build issue for now and refactor + replace most of the code when I have time to do it properly.

Thanks,

Daniel

#6 lore raw

hi Daniel,

Quoted 14 lines · Daniel Palmer

Hi Quentin, Tom

Quoted 6 lines · Quentin Schulz

Also, lib/Makefile has

obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o

which is.... odd? Shouldn't this handle the case of "missing" SPL_CRC16 dependency?

I didn't see this. So it seems like for now just adding CONFIG_YMODEM_SUPPORT, making that select CONFIG_CRC16 and the Makefile tweak would be enough for now.

Quoted 7 lines

Would that be acceptable for now? It seems like the xyzmodem thing needs a bit of refactoring etc. I actually have an almost entirely rewritten version of it somewhere that I wrote because of the issues in the current version. I'd prefer to fix the build issue for now and refactor + replace most of the code when I have time to do it properly.

I'm fine fixing what needs to be fixed now and improvements later on.

Note that we generally do not like complete rewrites in one patch but rather small incremental changes (which may end up in the same result, but is "more reviewable"). We don't have a maintainer for that feature, though Tom is the "catch-all" maintainer, so maybe you can convince him a full rewrite is ok. In any case, I'm sure we would really appreciate tests (I don't think we have any from the cursory check I just made) so make sure to include some (especially for the issues you encountered so we don't regress!).

Cheers,
Quentin

#7 lore raw

Hi Quentin,

Quoted 1 line · Quentin Schulz

I'm fine fixing what needs to be fixed now and improvements later on.

Ok, I'll wait for if/when Tom replies and maybe send a v3 just fixes the main u-boot part.

Quoted 8 lines

Note that we generally do not like complete rewrites in one patch but rather small incremental changes (which may end up in the same result, but is "more reviewable"). We don't have a maintainer for that feature, though Tom is the "catch-all" maintainer, so maybe you can convince him a full rewrite is ok. In any case, I'm sure we would really appreciate tests (I don't think we have any from the cursory check I just made) so make sure to include some (especially for the issues you encountered so we don't regress!).

I haven't touched it for a long time. But from what I remember fixing the issues in it was basically rewriting it because of the code style etc being so different from the rest of u-boot.
Maybe I can use AI for good and have it generate a series of patches from my version. I'm assuming sensible non-spam AI assisted changes are ok :)

Cheers,

Daniel

#8 lore raw

Hi Daniel,

Quoted 17 lines · Daniel Palmer

Hi Quentin,

Quoted 1 line · Quentin Schulz

I'm fine fixing what needs to be fixed now and improvements later on.

Ok, I'll wait for if/when Tom replies and maybe send a v3 just fixes the main u-boot part.

Quoted 8 lines

Note that we generally do not like complete rewrites in one patch but rather small incremental changes (which may end up in the same result, but is "more reviewable"). We don't have a maintainer for that feature, though Tom is the "catch-all" maintainer, so maybe you can convince him a full rewrite is ok. In any case, I'm sure we would really appreciate tests (I don't think we have any from the cursory check I just made) so make sure to include some (especially for the issues you encountered so we don't regress!).

Quoted 3 lines

I haven't touched it for a long time. But from what I remember fixing the issues in it was basically rewriting it because of the code style etc being so different from the rest of u-boot.

Different code style is not an issue. I'm sure lwip and mbedtls have a different coding style than U-Boot, yet they are still part of it because we imported them and don't want to modify them too much from their respective upstream.

It's unclear if there's an upstream for XYZ modem. But in any case, different coding style isn't a sufficient reason for doing a full rewrite.

I guess it might be ok if it's incremental changes that are doing nothing but changing the coding style (but then, is it really worth it) and they are reasonably easy to review. Confidence in the patches doing nothing but changes the coding style would be increased if tests are written for the current state of the xyz modem support with the old coding style and making sure they still pass after the "rewrite".

Quoted 4 lines

Maybe I can use AI for good and have it generate a series of patches from my version. I'm assuming sensible non-spam AI assisted changes are ok :)

The current somewhat-official-but-not-written-down stance of the project on that topic is "don't", see https://lore.kernel.org/u-boot/20260520143639.GM1858239@bill-the-cat/.

There are a quite a few defconfigs which enable CONFIG_SPL_YMODEM_SUPPORT so we need to have a good confidence in the patches not breaking existing boards, and the use of AI is not really inspiring trust in that.

Cheers,
Quentin

#9 lore raw
In reply to Daniel Palmer
Quoted 7 lines · Daniel Palmer

Hi Quentin,

Quoted 1 line · Quentin Schulz

I'm fine fixing what needs to be fixed now and improvements later on.

Ok, I'll wait for if/when Tom replies and maybe send a v3 just fixes the main u-boot part.

Yes, lets just do the fixes for now, and Kconfig / Makefile logic cleanups later.

Quoted 9 lines
Quoted 8 lines

Note that we generally do not like complete rewrites in one patch but rather small incremental changes (which may end up in the same result, but is "more reviewable"). We don't have a maintainer for that feature, though Tom is the "catch-all" maintainer, so maybe you can convince him a full rewrite is ok. In any case, I'm sure we would really appreciate tests (I don't think we have any from the cursory check I just made) so make sure to include some (especially for the issues you encountered so we don't regress!).

Quoted 6 lines

I haven't touched it for a long time. But from what I remember fixing the issues in it was basically rewriting it because of the code style etc being so different from the rest of u-boot.
Maybe I can use AI for good and have it generate a series of patches from my version. I'm assuming sensible non-spam AI assisted changes are ok :)

Since Quentin already sent my answer about AI (thanks!), what I'll add here is that yes, xyzModem.c is very old, but, there's known (to me) issues with it either. If someone really wants to replace that with a modern version (that's equal or better in terms of binary size (CMD_LOADB is enabled on virtually every platform) maybe Zephyr has something we can borrow that's appropriately licensed? When touching code that's enabled in a large percent of the platforms I become very concerned with the tradeoffs between binary size and whatever the new functionality is. Thanks!

Signature · 1 line
Tom