Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[multitop_dev] Make uart_smoketest compile #25440

Merged
merged 46 commits into from
Dec 5, 2024

Conversation

pamaury
Copy link
Contributor

@pamaury pamaury commented Nov 27, 2024

Build with:

./bazelisk.sh build  --//hw/top=darjeeling //sw/device/tests:uart_smoketest_sim_dv

It compiles and links but I doubt it works out of the box. In order to get access to the files (test_rom, binary, etc), run:

./bazelisk.sh cquery --output=starlark --starlark:expr='"\n".join([f.path for f in target.data_runfiles.files.to_list()])'  --//hw/top=darjeeling '//sw/device/tests:uart_smoketest_sim_dv'

It will print (for example):

bazel-out/k8-fastbuild-ST-4b94735babb6/bin/sw/host/opentitantool/opentitantool
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.elf
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.bin
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.39.scr.vmem
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.dis
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.logs.txt
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.rodata.txt
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/lib/testing/test_rom/test_rom_sim_dv.map
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.elf
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.bin
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.64.scr.vmem
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.dis
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.logs.txt
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.rodata.txt
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.map
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.64.vmem
bazel-out/k8-fastbuild-ST-32b82a8f3fd7/bin/sw/device/tests/uart_smoketest_sim_dv.bash

WARNING: there is a major hack so far! The opentitantool built is that of earlgrey, ie the "golden toolchain" transition set //hw/top=earlgrey. This was the only way to make it compile in a short time. It's unclear how much of it is earlgrey specific but I think it's not used so far in this flow.

@pamaury pamaury force-pushed the multitop_wip branch 5 times, most recently from 8c28693 to 3b67771 Compare November 28, 2024 13:49
@pamaury pamaury changed the title Multitop wip [multitop_dev] Make uart_smoketest compile Nov 28, 2024
@pamaury pamaury force-pushed the multitop_wip branch 5 times, most recently from 58a887c to e7e328e Compare December 2, 2024 09:24
This avoid including by mistake the wrong file: because it is
marked as incompatible, it will fail to compile.

Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury force-pushed the multitop_wip branch 3 times, most recently from 957ebc7 to c7ade26 Compare December 3, 2024 13:02
In order to support multiple ROM images, scramble_image.py now only
relies on the passed top hjson file and a scrambling mode to fetch
all needed parameters to scramble the image.

The script maps the scrambling mode (e.g. "base-rom") to its memory
controller name, memory type, module name, scrambling key and nonce
names in the top HJSON file, and can then retrieve the scrambling key,
nonce, base address and size of the image to generate.

This allows for passing different image paths (e.g.
/path/to/base_rom_*.vmem and /path/to/second_rom_*.vmem) and generate
the corresponding images with a single script.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
Linker files are not preprocessed, which makes it hard to support
several tops. In particular, including different files based on
the top, or using a different region is very difficult.

The `ld_library` rule is modified to take a new substitution
dictionary as input which is subject to location expansion. This
allows for example to do in the linker script:
```
INCLUDE @@myfile@@
```
and then in the BUILD file:
```
ld_library(
  ...,
  substitutions = {
    "@@myfile@@": "$(location //path/to/my/file)",
  },
)
```

Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury force-pushed the multitop_wip branch 2 times, most recently from 000fb17 to 90af7d1 Compare December 4, 2024 22:43
Signed-off-by: Amaury Pouly <[email protected]>
We cannot use DT in assembly code so we have to create macros for
each top. At least this clarifies what is needed by the top and
adds support for darjeeling and english breakfast.

Signed-off-by: Amaury Pouly <[email protected]>
Darjeeling is quite different Earlgrey: it does not have a flash
controller and does not bootstrap. At the moment, the test_rom
simply expects the test code to already be in the CTN RAM.

Signed-off-by: Amaury Pouly <[email protected]>
The `nonce.c` file has some requirements that pull a lot of code.
On the other hand, some headers only require the definition of
a nonce and not the implementation that goes with it.

Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
This field is only initialized when using the new `init_from_dt`
function and is left NULL otherwise.

Signed-off-by: Amaury Pouly <[email protected]>
Due to a limitation of the design of exec_env, it is not possible
to create two `sim_dv` environments and compile binaries for both
(this is because they will share the same provider). Instead,
create a darjeeling exec_env for sim_dv, and a new alias in
`//hw/top`. Then replace the earlgre-specific exec_env
in `EARLGREY_TEST_ENVS` by this new one.

This means that with this change, any previously sim_dv-enabled
test can be compile on darjeeling simply by passing
--//hw/top=darjeeling on the command line.

Signed-off-by: Amaury Pouly <[email protected]>
Unfortunately, opentitantool is far from compiling with darjeeling
due to many explicit dependencies on earlgrey. At the same time,
opentitantool provides many operations which are not earlgrey-specific
at all such as flash image generation.

This commit introduces a horrible hack: in the host transition
for the golden toolchain, always set the top to earlgrey. This way
we can ensure that opentitantool will compile. For now this does
not introduce any problem but this is not a proper fix.

Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury marked this pull request as ready for review December 5, 2024 15:16
@pamaury pamaury requested review from msfschaffner, cfrantz and a team as code owners December 5, 2024 15:16
@pamaury pamaury requested review from moidx and removed request for a team December 5, 2024 15:16
@pamaury pamaury merged commit 80461f6 into lowRISC:multitop_dev Dec 5, 2024
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant