Commit 5e30d5d
Merge #519
519: Be more careful computing the size of an array Cluster. r=burrbull a=rcls
`cluster_size_in_bits` was ignoring array information, leading to incorrect padding with nested clusters.
I noticed this as incorrect padding on the three SARs in PASS0 on the Cypress cyt4bb. (The .svd for this requires registration on the Cypress website.)
It also shows up as incorrect padding on the TCPWM0 in the Cypress PSOC6_04 (svd at https://github.com/cypresssemiconductorco/psoc6pdl/blob/master/devices/svd/psoc6_04.svd)
E.g., for the PSOC TCPWM0, the diffs on the generated code from this change are:
```
diff --git a/src/tcpwm0.rs b/src/tcpwm0.rs
index 678d146..7165c46 100644
--- a/src/tcpwm0.rs
+++ b/src/tcpwm0.rs
@@ -3,7 +3,7 @@
pub struct RegisterBlock {
#[doc = "0x00 - Group of counters"]
pub grp0: GRP,
- _reserved1: [u8; 32640usize],
+ _reserved1: [u8; 31744usize],
#[doc = "0x8000 - Group of counters"]
pub grp1: GRP,
}
```
Eyeballing the GRP, it has 8 * 128byte entries = 1024 bytes, and the correct padding is then 32768 - 1024 = 31744 bytes.
Co-authored-by: Andrey Zgarbul <[email protected]>
Co-authored-by: Ralph Loader <[email protected]>2 files changed
+51
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| 18 | + | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
486 | 495 | | |
487 | 496 | | |
488 | 497 | | |
| |||
533 | 542 | | |
534 | 543 | | |
535 | 544 | | |
536 | | - | |
| 545 | + | |
537 | 546 | | |
538 | 547 | | |
539 | 548 | | |
| |||
592 | 601 | | |
593 | 602 | | |
594 | 603 | | |
595 | | - | |
596 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
597 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
598 | 632 | | |
599 | 633 | | |
600 | 634 | | |
| |||
632 | 666 | | |
633 | 667 | | |
634 | 668 | | |
635 | | - | |
| 669 | + | |
636 | 670 | | |
637 | 671 | | |
638 | 672 | | |
| |||
0 commit comments