Skip to content

Commit 6788e8d

Browse files
cfrantznasahlpa
authored andcommitted
[rom] Measure ROM space utilization
1. Add a script to transform the mapfile to json and visualize the space utilization with a `d3.js` treemap. 2. Add a build config to disable hardening and measure the impact of hardening on code size. Signed-off-by: Chris Frantz <[email protected]> (cherry picked from commit bc285b7)
1 parent 180b491 commit 6788e8d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ build --strip='never'
1919
# impact of the hardened sequences on code size.
2020
build:disable_hardening --features=-guards --copt=-DOT_DISABLE_HARDENING=1
2121

22+
# Use --config=disable_hardening to disable hardening to measure the
23+
# impact of the hardened sequences on code size.
24+
build:disable_hardening --features=-guards --copt=-DOT_DISABLE_HARDENING=1
25+
2226
# Enable toolchain resolution with cc
2327
build --incompatible_enable_cc_toolchain_resolution
2428

sw/device/lib/base/hardened.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ inline uint32_t launder32(uint32_t val) {
241241

242242
// When we're building for static analysis, reduce false positives by
243243
// short-circuiting the inline assembly block.
244-
#if OT_BUILD_FOR_STATIC_ANALYZER || \
245-
(defined(OT_DISABLE_HARDENING) && OT_DISABLE_HARDENING)
244+
#if OT_BUILD_FOR_STATIC_ANALYZER || OT_DISABLE_HARDENING
246245
return val;
247246
#endif
248247

@@ -264,8 +263,7 @@ inline uint32_t launder32(uint32_t val) {
264263
*/
265264
OT_WARN_UNUSED_RESULT
266265
inline uintptr_t launderw(uintptr_t val) {
267-
#if OT_BUILD_FOR_STATIC_ANALYZER || \
268-
(defined(OT_DISABLE_HARDENING) && OT_DISABLE_HARDENING)
266+
#if OT_BUILD_FOR_STATIC_ANALYZER || OT_DISABLE_HARDENING
269267
return val;
270268
#endif
271269
asm volatile("" : "+r"(val));

0 commit comments

Comments
 (0)