[PATCH 00/11] OpenSBI compile-time C arrays

Anup Patel apatel at ventanamicro.com
Mon May 2 20:37:48 PDT 2022


This series aims at removing hard-coded C arrays for drivers and modules
in OpenSBI sources and replace it with dynamically generated arrays at
compile-time. External firmwares which use OpenSBI as library will have
to create these arrays separately because they typically don't use OpenSBI
build system.

These patches can also be found in generated_carray_v1 branch at:
https://github.com/avpatel/opensbi.git

Anup Patel (11):
  Makefile: Allow generated C source to be anywhere in build directory
  Makefile: Add support for generating C array at compile time
  lib: utils/reset: Generate FDT reset driver list at compile-time
  lib: utils/serial: Generate FDT serial driver list at compile-time
  lib: utils/timer: Generate FDT timer driver list at compile-time
  lib: utils/irqchip: Generate FDT irqchip driver list at compile-time
  lib: utils/ipi: Generate FDT ipi driver list at compile-time
  lib: utils/i2c: Generate FDT i2c adapter driver list at compile-time
  lib: utils/gpio: Generate FDT gpio driver list at compile-time
  platform: generic: Generate platform override module list at
    compile-time
  platform: generic: Move Sifive platform overrides into own directory

 Makefile                                      | 17 +++-
 include/sbi_utils/gpio/fdt_gpio.h             |  2 +
 lib/utils/gpio/fdt_gpio.c                     | 18 ++---
 lib/utils/gpio/fdt_gpio_drivers.carray        |  3 +
 lib/utils/gpio/objects.mk                     |  4 +
 lib/utils/i2c/fdt_i2c.c                       | 14 ++--
 lib/utils/i2c/fdt_i2c_adapter_drivers.carray  |  3 +
 lib/utils/i2c/objects.mk                      |  4 +
 lib/utils/ipi/fdt_ipi.c                       | 12 ++-
 lib/utils/ipi/fdt_ipi_drivers.carray          |  3 +
 lib/utils/ipi/objects.mk                      |  4 +
 lib/utils/irqchip/fdt_irqchip.c               | 16 ++--
 lib/utils/irqchip/fdt_irqchip_drivers.carray  |  3 +
 lib/utils/irqchip/objects.mk                  |  8 ++
 lib/utils/reset/fdt_reset.c                   | 22 ++----
 lib/utils/reset/fdt_reset_drivers.carray      |  3 +
 lib/utils/reset/objects.mk                    | 12 +++
 lib/utils/serial/fdt_serial.c                 | 28 ++-----
 lib/utils/serial/fdt_serial_drivers.carray    |  3 +
 lib/utils/serial/objects.mk                   | 16 ++++
 lib/utils/timer/fdt_timer.c                   | 12 ++-
 lib/utils/timer/fdt_timer_drivers.carray      |  3 +
 lib/utils/timer/objects.mk                    |  4 +
 platform/generic/objects.mk                   |  3 +-
 platform/generic/platform.c                   | 14 ++--
 .../generic/platform_override_modules.carray  |  3 +
 .../{sifive_fu540.c => sifive/fu540.c}        |  0
 .../{sifive_fu740.c => sifive/fu740.c}        |  0
 platform/generic/sifive/objects.mk            |  9 +++
 scripts/carray.sh                             | 77 +++++++++++++++++++
 30 files changed, 224 insertions(+), 96 deletions(-)
 create mode 100644 lib/utils/gpio/fdt_gpio_drivers.carray
 create mode 100644 lib/utils/i2c/fdt_i2c_adapter_drivers.carray
 create mode 100644 lib/utils/ipi/fdt_ipi_drivers.carray
 create mode 100644 lib/utils/irqchip/fdt_irqchip_drivers.carray
 create mode 100644 lib/utils/reset/fdt_reset_drivers.carray
 create mode 100644 lib/utils/serial/fdt_serial_drivers.carray
 create mode 100644 lib/utils/timer/fdt_timer_drivers.carray
 create mode 100644 platform/generic/platform_override_modules.carray
 rename platform/generic/{sifive_fu540.c => sifive/fu540.c} (100%)
 rename platform/generic/{sifive_fu740.c => sifive/fu740.c} (100%)
 create mode 100644 platform/generic/sifive/objects.mk
 create mode 100755 scripts/carray.sh

-- 
2.34.1




More information about the opensbi mailing list