Software APIs
resizable_test.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stdbool.h>
6 
8 #include "sw/device/lib/testing/test_framework/check.h"
10 #include "sw/device/silicon_creator/lib/manifest_def.h"
11 #include "sw/device/silicon_creator/rom/boot_policy_ptrs.h"
12 
13 OTTF_DEFINE_TEST_CONFIG();
14 
15 #ifdef ARRAY_SIZE
16 static const unsigned char arr[ARRAY_SIZE] = {1, 2, 3};
17 #endif
18 
19 bool test_main(void) {
20 #ifdef ARRAY_SIZE
21  for (size_t i = 0; i < ARRAY_SIZE; i += (ARRAY_SIZE / 4)) {
22  LOG_INFO("arr[%d] = %d", i, arr[i]);
23  }
24 #endif
25 
26  // Check image of the expected size.
27  const manifest_t *manifest = boot_policy_manifest_a_get();
28  LOG_INFO("Image Length (bytes) = %d", manifest->length);
29  CHECK(manifest->length > CHIP_ROM_EXT_SIZE_MAX);
30  CHECK(manifest->length <= CHIP_ROM_EXT_RESIZABLE_SIZE_MAX);
31  return true;
32 }