Skip to content

Commit

Permalink
enhance: refine memory section handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Jun 9, 2024
1 parent 6d061b1 commit 8700096
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 40 deletions.
8 changes: 4 additions & 4 deletions data/chips/HPM5301.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ memory:
- address: 0x00000000
kind: ram
name: ILM
size: 131072 # 128K
size: 128K
- address: 0x00080000
kind: ram
name: DLM
size: 131072 # 128K
size: 128K
- address: 0xf0400000
kind: ram
name: AHB_SRAM
size: 32768 # 32K
size: 32K
- address: 0x80000000
kind: flash
name: XPI0
size: 1048576 # 1M
size: 1M
cores:
- name: RV32-IMAFDCPB # D25
ip-core: Andes D25
Expand Down
10 changes: 6 additions & 4 deletions data/chips/HPM5321.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ memory:
- address: 0x00000000
kind: ram
name: ILM
size: 131072 # 128K
size: 128K
- address: 0x00080000
kind: ram
name: DLM
size: 131072 # 128K
size: 128K
- address: 0xf0400000
kind: ram
name: AHB_SRAM
size: 32768 # 32K
size: 32K
- address: 0x80000000
kind: flash
name: XPI0
size: 1048576 # 1M
size: 1M
cores:
- name: RV32-IMAFDCPB # D25
ip-core: Andes D25
Expand All @@ -36,6 +36,8 @@ cores:
- "../family/HPM5300.yaml"
- "../family/HPM5300_GPTMR23.yaml"
- "../family/HPM5300_UART4567.yaml"
- "../family/HPM5300_SPI23.yaml"
- "../family/HPM5300_I2C23.yaml"
- "../family/HPM5300_ADC1.yaml"
- "../family/HPM5300_MCAN.yaml"
include_interrupts: "../interrupts/HPM5361.yaml"
Expand Down
9 changes: 5 additions & 4 deletions data/chips/HPM5331.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@ memory:
- address: 0x00000000
kind: ram
name: ILM
size: 131072 # 128K
size: 128K
- address: 0x00080000
kind: ram
name: DLM
size: 131072 # 128K
size: 128K
- address: 0xf0400000
kind: ram
name: AHB_SRAM
size: 32768 # 32K
size: 32K
- address: 0x80000000
kind: flash
name: XPI0
size: 1048576 # 1M
size: 1M
cores:
- name: RV32-IMAFDCPB # D25
ip-core: Andes D25
include_peripherals:
- "../family/COMMON.yaml"
- "../family/HPM5300.yaml"
- "../family/HPM5300_SPI23.yaml"
- "../family/HPM5300_GPTMR23.yaml"
- "../family/HPM5300_ADC1.yaml"
- "../family/HPM5300_DAC.yaml"
Expand Down
2 changes: 2 additions & 0 deletions data/chips/HPM5361.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ cores:
- "../family/HPM5300.yaml"
- "../family/HPM5300_GPTMR23.yaml"
- "../family/HPM5300_UART4567.yaml"
- "../family/HPM5300_SPI23.yaml"
- "../family/HPM5300_I2C23.yaml"
- "../family/HPM5300_ADC1.yaml"
- "../family/HPM5300_DAC.yaml"
- "../family/HPM5300_OPAMP.yaml"
Expand Down
49 changes: 49 additions & 0 deletions data/chips/HPM64A0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: HPM64A0
family: HPM6400 Series
sub_family: HPM6400, Automotive
packages:
- name: HPM64A0xAN
package: BGA196
pins: 196
- name: HPM64A0xVM
package: BGA289
pins: 289
memory:
- address: 0x00000000
kind: ram
name: ILM
size: 262144 # 256K
- address: 0x00080000
kind: ram
name: DLM
size: 262144 # 256K
- address: 0x01080000
kind: ram
name: AXI_SRAM
size: 524288 # 512K
- address: 0x01100000
kind: ram
name: AXI_SRAM_NOCACHE # AXI SRAM1
size: 262144 # 256K
- address: 0x0117C000
kind: ram
name: SHARE_RAM
size: 16384 # 16K
- address: 0xF0300000
kind: ram
name: AHB_SRAM
size: 32768 # 32K
- address: 0xF40F0000
kind: ram
name: APB_SRAM
size: 8192 # 8K
- address: 0x80000000
kind: flash
name: XPI0
size: 1048576 # 1M
cores:
- name: RV32-IMAFDCP
ip-core: Andes D45
peripherals: []
include_peripherals:
- "../family/COMMON.yaml"
24 changes: 0 additions & 24 deletions data/family/HPM5300.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,6 @@
kind: spi
version: v53
block: SPI
- name: SPI2
address: 0xF0078000
registers:
kind: spi
version: v53
block: SPI
- name: SPI3
address: 0xF007C000
registers:
kind: spi
version: v53
block: SPI

- name: I2C0
address: 0xF0060000
Expand All @@ -264,18 +252,6 @@
kind: i2c
version: v53
block: I2C
- name: I2C2
address: 0xF0068000
registers:
kind: i2c
version: v53
block: I2C
- name: I2C3
address: 0xF006C000
registers:
kind: i2c
version: v53
block: I2C

- name: PTPC
address: 0xF02FC000
Expand Down
Empty file added data/family/HPM5300_I2C23.yaml
Empty file.
12 changes: 12 additions & 0 deletions data/family/HPM5300_SPI23.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: SPI2
address: 0xF0078000
registers:
kind: spi
version: v53
block: SPI
- name: SPI3
address: 0xF007C000
registers:
kind: spi
version: v53
block: SPI
35 changes: 31 additions & 4 deletions hpm-metapac-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,20 @@ fn gen_memory_x(out_dir: &Path, chip: &Chip) {
let ilm = chip
.memory
.iter()
.find(|r| r.kind == MemoryRegionKind::Ram && r.name == "DLM")
.find(|r| r.kind == MemoryRegionKind::Ram && r.name == "ILM")
.unwrap();
let axi_sram = chip
.memory
.iter()
.find(|r| r.kind == MemoryRegionKind::Flash && r.name == "AXI_SRAM");
.find(|r| r.kind == MemoryRegionKind::Ram && r.name == "AXI_SRAM");
let ahb_sram = chip
.memory
.iter()
.find(|r| r.kind == MemoryRegionKind::Ram && r.name == "AHB_SRAM");
let sdram = chip
.memory
.iter()
.find(|r| r.kind == MemoryRegionKind::Ram && r.name == "SDRAM");

write!(memory_x, "MEMORY\n{{\n").unwrap();
writeln!(
Expand All @@ -485,8 +493,27 @@ fn gen_memory_x(out_dir: &Path, chip: &Chip) {
if let Some(axi_sram) = axi_sram {
writeln!(
memory_x,
" AXI_SRAM : ORIGIN = 0x{:08x}, LENGTH = {:>4}",
axi_sram.address, axi_sram.size,
" AXI_SRAM : ORIGIN = 0x{:08x}, LENGTH = {:>4}K",
axi_sram.address,
axi_sram.size / 1024,
)
.unwrap();
}
if let Some(ahb_sram) = ahb_sram {
writeln!(
memory_x,
" AHB_SRAM : ORIGIN = 0x{:08x}, LENGTH = {:>4}K",
ahb_sram.address,
ahb_sram.size / 1024,
)
.unwrap();
}
if let Some(sdram) = sdram {
writeln!(
memory_x,
" SDRAM : ORIGIN = 0x{:08x}, LENGTH = {:>4}K",
sdram.address,
sdram.size / 1024,
)
.unwrap();
}
Expand Down

0 comments on commit 8700096

Please sign in to comment.