opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

Look for build systems which support cross-compiling to multiple targets/devices

Open imphil opened this issue 7 years ago • 5 comments

NOTE ON TERMINOLOGY: Unfortunately, every build tool uses the words build/host/target with totally different meanings. Below is the naming that meson and autotools use (docs). gn uses different terminology, where build (meson) == host (gn) and host(meson) = target (gn) (docs). meson also has target, but that's something else.

We have three types of software in our tree:

  • "host software": build == x86, host == x86: e.g. spiflash
  • "device software": build == x86, host == rv32: all our software running on the chip
  • "build time utilities": helper tools used during the build process.

If we want to have a build system which can build all three types of software from the same tool, we need one that supports cross-compiling to multiple hosts.

  • meson doesn't seem to support it, as PR https://github.com/lowRISC/stwg-base/pull/937 has shown.
  • gn: Seems to support multiple hosts ("targets" in gn language): https://gn.googlesource.com/gn/+/master/docs/cross_compiles.md. We have not tried it out yet.

We need to have a look again at other options, or drop the requirement to compile all software in one invocation of the build system.

imphil avatar Aug 22 '19 10:08 imphil

@moidx could you (or someone from the software side) drive this discussion?

imphil avatar Aug 22 '19 10:08 imphil

Just to expand a bit more on the multi host support. I envision that with a single invocation we can build host tools and device target software, and be able to use build system test hooks to invoke system level tests.

Keeping dependency management within the scope of the build system will make it easier for us to get to a fully hermetic build configuration for development, CI and release environments.

moidx avatar Aug 22 '19 14:08 moidx

https://github.com/lowRISC/stwg-base/pull/982 shows how it may be possible to support multi-toolchain configurations with GN.

GN also provides template support which can be easily extended with Python. The PR shows how this can be leveraged to implement custom embedded targets.

moidx avatar Aug 24 '19 01:08 moidx

@moidx with our current thinking with meson, is this one still and issue?

sjgitty avatar Oct 25 '19 05:10 sjgitty

We have settled with Meson now and worked around the deficiencies to work well enough for our use case.

imphil avatar Jul 03 '20 11:07 imphil