Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/spi
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoboGu committed Jul 2, 2024
2 parents 57469dc + 3ef766e commit 5c8e8f9
Show file tree
Hide file tree
Showing 33 changed files with 2,026 additions and 23 deletions.
61 changes: 61 additions & 0 deletions HPMicro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,43 @@ variants:
- core0
flash_algorithms:
- flash-algo-hpm5300
- name: HPM6360
cores:
- name: core0
type: riscv
core_access_options: !Riscv {}
memory_map:
- !Ram
name: ILM0
range:
start: 0x0
end: 0x20000
cores:
- core0
- !Ram
name: DLM0
range:
start: 0x00080000
end: 0x000a0000
cores:
- core0
- !Ram
name: AXI_SRAM
range:
start: 0x01080000
end: 0x01100000
cores:
- core0
- !Nvm
name: XPI0
range:
start: 0x80000000
end: 0x90000000
is_boot_memory: true
cores:
- core0
flash_algorithms:
- flash-algo-hpm6300
- name: HPM6E80
cores:
- name: core0
Expand Down Expand Up @@ -137,3 +174,27 @@ flash_algorithms:
address: 0x0
cores:
- core0
- name: flash-algo-hpm6300
description: A flash algorithm under test
default: true
instructions: EwEB3CMuESIjLIEiIyqRIiMoISO3BQAABUV9Fo1GI4KlSGN41gy3FQD0A6AFgH1WI6DFgAOgBYEjqMWAI6KlkGgAEwYAEIFFlwAAAOeA4C4jLgEQIywBEDcF+fwFBSMmoRAdRSMooRAjKgEQNwUCIAMlRfF0RdHCNwUE82wAcAI3CQTzgpYqhCnpskQjAAEEDAgIEhMGwA+XAAAA54AAFmgMbAJRRpcAAADngCAVNwUAACMmlTaTBMU2E4VEAAwSEwYAEZcAAADngEATI6okETcFAACFRSMCtUgihYMgwSMDJIEjgyRBIwMpASMTAQEkgoCXAAAA54BADZcAAADngMAOtwUAAAPGRUgFRQHGAUUjggVIgoC3BQAAg8VFSJ3BtwUCIIOlRfGcUZnPtwUAABOGxTYDJ0YRtwYAgKmOkUU6hYKHBUWCgJcAAADngOAJtwYA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20
pc_init: 0x0
pc_uninit: 0x102
pc_program_page: 0x150
pc_erase_sector: 0x116
pc_erase_all: 0x194
data_section_offset: 0x464
flash_properties:
address_range:
start: 0x80000000
end: 0x90000000
page_size: 0x1000
erased_byte_value: 0xff
program_page_timeout: 1000
erase_sector_timeout: 2000
sectors:
- size: 0x1000
address: 0x0
cores:
- core0
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,31 @@ This crate is a working-in-progress and not ready for use.
- [x] basic start up code: linker, startup
- [x] Embassy time driver using MCHTMR
- [x] SYSCTL init
- [x] PLL setting (only PLL0 is supported, since others might be unsafe)
- [x] GPIO, Flex, Input, Output
- [x] Async GPIO
- [x] PLL setting
- [x] GPIO, Flex, Input, Output, Async
- [x] RTT support (defmt, defmt-rtt)
- [x] UART blocking TX, RX
- [x] I2C blocking
- [x] MBX, blocking and async
- MCUs
- HPM5300
- HPM6E00, without PLL setting
- [x] FEMC
- [x] SDRAM init
- Long term Plans
- [ ] andes-riscv for specific CSRs
- [ ] hpm-riscv-rt for customized runtime (riscv-rt is not fit)
- [ ] CPU1 support - how to?

| MCU Family | Demo | PAC | SYSCTL | GPIO | UART | I2C | MBX | ADC | DMA |
|------------|:----:|:---:|:------:|:----:|:----:|:---:|:---:|:---:|:---:|
| HPM6700 ||| | | | | | | |
| HPM6300 ||| | | | | | | |
| HPM6200 | || | | | | | | |
| HPM5300 |||||||| | |
| HPM6800 | || | | | | | | |
| HPM6E00 |||||| ? | ? | | |

- ✓: Implemented
- ?: Requires demo verification
- Blank: Not implemented

### Toolchain Support

Expand Down
58 changes: 58 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,64 @@ fn main() {
(("uart", "RX"), quote!(crate::uart::RxDma)),
(("uart", "TX"), quote!(crate::uart::TxDma)),
(("i2c", "GLOBAL"), quote!(crate::i2c::I2cDma)),
// FEMC
(("femc", "A00"), quote!(crate::femc::A00Pin)),
(("femc", "A01"), quote!(crate::femc::A01Pin)),
(("femc", "A02"), quote!(crate::femc::A02Pin)),
(("femc", "A03"), quote!(crate::femc::A03Pin)),
(("femc", "A04"), quote!(crate::femc::A04Pin)),
(("femc", "A05"), quote!(crate::femc::A05Pin)),
(("femc", "A06"), quote!(crate::femc::A06Pin)),
(("femc", "A07"), quote!(crate::femc::A07Pin)),
(("femc", "A08"), quote!(crate::femc::A08Pin)),
(("femc", "A09"), quote!(crate::femc::A09Pin)),
(("femc", "A10"), quote!(crate::femc::A10Pin)),
(("femc", "A11"), quote!(crate::femc::A11Pin)),
(("femc", "A12"), quote!(crate::femc::A12Pin)),
(("femc", "BA0"), quote!(crate::femc::BA0Pin)),
(("femc", "BA1"), quote!(crate::femc::BA1Pin)),
(("femc", "CAS"), quote!(crate::femc::CASPin)),
(("femc", "CKE"), quote!(crate::femc::CKEPin)),
(("femc", "CLK"), quote!(crate::femc::CLKPin)),
(("femc", "CS0"), quote!(crate::femc::CS0Pin)),
(("femc", "CS1"), quote!(crate::femc::CS1Pin)),
(("femc", "DM0"), quote!(crate::femc::DM0Pin)),
(("femc", "DM1"), quote!(crate::femc::DM1Pin)),
(("femc", "DQS"), quote!(crate::femc::DQSPin)),
(("femc", "DQ00"), quote!(crate::femc::DQ00Pin)),
(("femc", "DQ01"), quote!(crate::femc::DQ01Pin)),
(("femc", "DQ02"), quote!(crate::femc::DQ02Pin)),
(("femc", "DQ03"), quote!(crate::femc::DQ03Pin)),
(("femc", "DQ04"), quote!(crate::femc::DQ04Pin)),
(("femc", "DQ05"), quote!(crate::femc::DQ05Pin)),
(("femc", "DQ06"), quote!(crate::femc::DQ06Pin)),
(("femc", "DQ07"), quote!(crate::femc::DQ07Pin)),
(("femc", "DQ08"), quote!(crate::femc::DQ08Pin)),
(("femc", "DQ09"), quote!(crate::femc::DQ09Pin)),
(("femc", "DQ10"), quote!(crate::femc::DQ10Pin)),
(("femc", "DQ11"), quote!(crate::femc::DQ11Pin)),
(("femc", "DQ12"), quote!(crate::femc::DQ12Pin)),
(("femc", "DQ13"), quote!(crate::femc::DQ13Pin)),
(("femc", "DQ14"), quote!(crate::femc::DQ14Pin)),
(("femc", "DQ15"), quote!(crate::femc::DQ15Pin)),
(("femc", "DQ16"), quote!(crate::femc::DQ16Pin)),
(("femc", "DQ17"), quote!(crate::femc::DQ17Pin)),
(("femc", "DQ18"), quote!(crate::femc::DQ18Pin)),
(("femc", "DQ19"), quote!(crate::femc::DQ19Pin)),
(("femc", "DQ20"), quote!(crate::femc::DQ20Pin)),
(("femc", "DQ21"), quote!(crate::femc::DQ21Pin)),
(("femc", "DQ22"), quote!(crate::femc::DQ22Pin)),
(("femc", "DQ23"), quote!(crate::femc::DQ23Pin)),
(("femc", "DQ24"), quote!(crate::femc::DQ24Pin)),
(("femc", "DQ25"), quote!(crate::femc::DQ25Pin)),
(("femc", "DQ26"), quote!(crate::femc::DQ26Pin)),
(("femc", "DQ27"), quote!(crate::femc::DQ27Pin)),
(("femc", "DQ28"), quote!(crate::femc::DQ28Pin)),
(("femc", "DQ29"), quote!(crate::femc::DQ29Pin)),
(("femc", "DQ30"), quote!(crate::femc::DQ30Pin)),
(("femc", "DQ31"), quote!(crate::femc::DQ31Pin)),
(("femc", "RAS"), quote!(crate::femc::RASPin)),
(("femc", "WE"), quote!(crate::femc::WEPin)),
]
.into();

Expand Down
30 changes: 30 additions & 0 deletions examples/hpm6300evk/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[build]
target = "riscv32imafc-unknown-none-elf"

[target.riscv32imafc-unknown-none-elf]
# runner = 'riscv64-unknown-elf-gdb -x ../../openocd.gdb'
runner = "probe-rs run --chip HPM6360 --protocol jtag --chip-description-path ../../HPMicro.yaml"

rustflags = [
# +zba,+zbb,+zbc,+zbs are not available
# Linker scripts:
"-C",
"link-arg=-Tmemory.x",
"-C",
"link-arg=-Tdevice.x", # __VECTORED_INTERRUPTS
"-C",
"link-arg=-Tlink-fixed.x",
"-C",
"link-arg=-Tdefmt.x",
"-C",
"link-arg=-nmagic",

# "--emit", "obj",
# "--emit", "asm",
]

[unstable]
build-std = ["core"]

[env]
DEFMT_LOG = "info"
24 changes: 24 additions & 0 deletions examples/hpm6300evk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "hpm6300evk"
version = "0.1.0"
edition = "2021"

[dependencies]
defmt = "0.3.8"
defmt-rtt = "0.4.1"
embedded-hal = "1.0.0"
hpm-metapac = { path = "../../../hpm-data/build/hpm-metapac", features = [
"hpm6360",
"memory-x",
"rt",
] }
panic-halt = "0.2.0"
riscv = { version = "0.11.1", features = ["critical-section-single-hart"] }
riscv-rt = { version = "0.12.2", features = ["single-hart"] }


[profile.release]
strip = false # symbols are not flashed to the microcontroller, so don't strip them.
lto = true
opt-level = "z" # Optimize for size.
debug = 2
Loading

0 comments on commit 5c8e8f9

Please sign in to comment.