File tree Expand file tree Collapse file tree 5 files changed +40
-23
lines changed
sw/device/silicon_creator Expand file tree Collapse file tree 5 files changed +40
-23
lines changed Original file line number Diff line number Diff line change 44
55load (
66 "@lowrisc_opentitan//rules/opentitan:transform.bzl" ,
7+ "convert_to_vmem" ,
78 _obj_transform = "obj_transform" ,
89)
910load ("@lowrisc_opentitan//rules:rv.bzl" , "rv_rule" )
@@ -53,3 +54,28 @@ obj_transform = rv_rule(
5354 },
5455 toolchains = ["@rules_cc//cc:toolchain_type" ],
5556)
57+
58+ def _vmem_file_impl (ctx ):
59+ outputs = [convert_to_vmem (ctx )]
60+ return [
61+ DefaultInfo (
62+ files = depset (outputs ),
63+ data_runfiles = ctx .runfiles (files = outputs ),
64+ ),
65+ ]
66+
67+ vmem_file = rv_rule (
68+ implementation = _vmem_file_impl ,
69+ attrs = {
70+ "src" : attr .label (
71+ allow_single_file = True ,
72+ doc = "Binary file to convert to vmem format" ,
73+ ),
74+ "word_size" : attr .int (
75+ default = 64 ,
76+ doc = "Word size of VMEM file" ,
77+ mandatory = True ,
78+ values = [32 , 64 ],
79+ ),
80+ },
81+ )
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def convert_to_vmem(ctx, **kwargs):
100100 output = "{}.{}.vmem" .format (name , word_size )
101101
102102 output = ctx .actions .declare_file (output )
103- src = get_override (ctx , "attr .src" , kwargs )
103+ src = get_override (ctx , "file .src" , kwargs )
104104
105105 ctx .actions .run (
106106 outputs = [output ],
Original file line number Diff line number Diff line change 22# Licensed under the Apache License, Version 2.0, see LICENSE for details.
33# SPDX-License-Identifier: Apache-2.0
44
5- load (
6- "//rules:opentitan.bzl" ,
7- "bin_to_vmem" ,
8- "scramble_flash_vmem" ,
9- )
5+ load ("//rules:opentitan.bzl" , "scramble_flash_vmem" )
106load ("//rules/opentitan:cc.bzl" , "exec_env_filegroup" )
7+ load ("//rules/opentitan:legacy.bzl" , "vmem_file" )
118load ("//rules:files.bzl" , "copy_files" )
129
1310package (default_visibility = ["//visibility:public" ])
@@ -42,10 +39,10 @@ exec_env_filegroup(
4239
4340# The below rule sets (bin_to_vmem, scramble_flash_vmem, and filegroup)
4441# are needed to run the perso bin in sim.
45- bin_to_vmem (
42+ vmem_file (
4643 name = "ft_personalize_sival_silicon_creator_vmem64_signed" ,
4744 testonly = True ,
48- bin = ":ft_personalize_sival_silicon_creator.signed.bin" ,
45+ src = ":ft_personalize_sival_silicon_creator.signed.bin" ,
4946 word_size = 64 , # Backdoor-load VMEM image uses 64-bit words
5047)
5148
Original file line number Diff line number Diff line change 44
55load ("@bazel_skylib//lib:dicts.bzl" , "dicts" )
66load ("//rules:const.bzl" , "CONST" , "hex_digits" )
7- load (
8- "//rules:opentitan.bzl" ,
9- "bin_to_vmem" ,
10- "scramble_flash_vmem" ,
11- )
7+ load ("//rules:opentitan.bzl" , "scramble_flash_vmem" )
8+ load ("//rules/opentitan:legacy.bzl" , "vmem_file" )
129load ("//rules/opentitan:keyutils.bzl" , "ECDSA_ONLY_KEY_STRUCTS" )
1310load (
1411 "//rules:otp.bzl" ,
@@ -235,13 +232,13 @@ opentitan_test(
235232 ]
236233]
237234
238- # The below three rule sets (bin_to_vmem , scramble_flash_vmem, and filegroup)
235+ # The below three rule sets (vmem_file , scramble_flash_vmem, and filegroup)
239236# are needed to run `sigverify_always` tests in DV.
240237[
241- bin_to_vmem (
238+ vmem_file (
242239 name = "empty_test_slot_{}_{}_corrupted_sim_dv_vmem64_signed" .format (slot , key ),
243240 testonly = True ,
244- bin = ":empty_test_slot_{}_{}_corrupted_sim_dv_signed_bin" .format (slot , key ),
241+ src = ":empty_test_slot_{}_{}_corrupted_sim_dv_signed_bin" .format (slot , key ),
245242 word_size = 64 , # Backdoor-load VMEM image uses 64-bit words
246243 )
247244 for slot in SLOTS
Original file line number Diff line number Diff line change 22# Licensed under the Apache License, Version 2.0, see LICENSE for details.
33# SPDX-License-Identifier: Apache-2.0
44
5- load (
6- "//rules:opentitan.bzl" ,
7- "bin_to_vmem" ,
8- "scramble_flash_vmem" ,
9- )
5+ load ("//rules:opentitan.bzl" , "scramble_flash_vmem" )
106load ("//rules/opentitan:cc.bzl" , "exec_env_filegroup" )
7+ load ("//rules/opentitan:legacy.bzl" , "vmem_file" )
118
129package (default_visibility = ["//visibility:public" ])
1310
@@ -34,10 +31,10 @@ _DV_EXEC_ENVS = [
3431]
3532
3633[
37- bin_to_vmem (
34+ vmem_file (
3835 name = "ate_gpio_toggle_test_{}_vmem64_signed" .format (env ),
3936 testonly = True ,
40- bin = ":ate_gpio_toggle_test_{}.signed.bin" .format (env ),
37+ src = ":ate_gpio_toggle_test_{}.signed.bin" .format (env ),
4138 word_size = 64 , # Backdoor-load VMEM image uses 64-bit words
4239 )
4340 for env in _DV_EXEC_ENVS
You can’t perform that action at this time.
0 commit comments