[PATCH v2 00/12] display_options: Start to unify print_buffer() and hexdump

Simon Glass sjg at chromium.org
Sat May 8 14:59:55 CEST 2021


At present we have two ways of showing a hex dump. Once has been in U-Boot
since the dawn of time and the other was recently added from Linux.

They both have their own unique features.

This series makes a few changes to bring them closer together. It also
adds support for logging a buffer, which is useful since it can put it
through the same log drivers as other logging output.

Also it adds tests, so we can check the behaviour.

The code-size impact of the main part of this series is 160 bytes on
Thumb2, which seems acceptable. However the final patch adds another 600
bytes or so, which is not.

Changes in v2:
- Drop unwanted #if at top of file
- Fix sandbox build error

Simon Glass (12):
  console: Report an error when output buffer is exhausted
  test: Detect when expect_str is too small
  test: Convert print tests to use ut framework
  test: Add a test for print_buffer()
  display_options: Drop two spaces before the ASCII column
  hexdump: Move API to header file
  hexdump: Add support for sandbox
  hexdump: Support any rowsize
  hexdump: Allow ctrl-c to interrupt output
  display_options: Split print_buffer() into two functions
  log: Add support for logging a buffer
  RFC: display_options: Use print_hex_dump() for print_buffer()

 common/console.c                  |  18 +-
 common/log.c                      |  30 ++++
 include/asm-generic/global_data.h |  16 +-
 include/console.h                 |   3 +-
 include/display_options.h         |  25 +++
 include/hexdump.h                 |  81 ++++++++-
 include/log.h                     |  35 ++++
 include/test/suites.h             |   1 +
 include/test/test.h               |   4 +-
 lib/display_options.c             | 124 ++++++++-----
 lib/hexdump.c                     | 104 +++--------
 test/cmd/mem_search.c             |  26 +--
 test/cmd_ut.c                     |   2 +
 test/dm/rtc.c                     |   9 +-
 test/log/log_test.c               |  27 +++
 test/print_ut.c                   | 284 ++++++++++++++++++++++++------
 test/ut.c                         |  55 +++++-
 17 files changed, 629 insertions(+), 215 deletions(-)

-- 
2.31.1.607.g51e8a6a459-goog



More information about the U-Boot mailing list