Skip to content

Commit

Permalink
Add flash partition capsule support (#60)
Browse files Browse the repository at this point in the history
* Add flash storage logical driver and organize into `flash_driver` package

* update dummy flash ctrl page_size to 256 bytes

* Flash storage driver in-kernel testing

* Add flash partition capsule and instantiate syscall driver in board.rs

* Bug fix for erase path

* Address review comments

* Address review comments: enhance partial erase handling

* Bug fix in parial erase handling code path and improvement of storage erase test cases
  • Loading branch information
helloxiling authored Dec 20, 2024
1 parent 9e62777 commit afa092b
Show file tree
Hide file tree
Showing 23 changed files with 1,393 additions and 23 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ gdbstub_arch = "0.2.4"
getrandom = "0.2"
hex = "0.4.3"
i3c-driver = { path = "runtime/i3c" }
flash-driver = { path = "runtime/flash" }
capsules-runtime = { path = "runtime/capsules" }
lazy_static = "1.4.0"
num-derive = "0.4.2"
Expand Down
2 changes: 2 additions & 0 deletions emulator/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ test-flash-ctrl-read-write-page = []
test-flash-ctrl-erase-page = []
test-mctp-ctrl-cmds = ["emulator-periph/test-mctp-ctrl-cmds"]
test-mctp-send-loopback = ["emulator-periph/test-mctp-send-loopback"]
test-flash-storage-read-write = []
test-flash-storage-erase = []
2 changes: 2 additions & 0 deletions emulator/periph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ test-flash-ctrl-read-write-page = []
test-flash-ctrl-erase-page = []
test-mctp-ctrl-cmds = []
test-mctp-send-loopback = []
test-flash-storage-read-write = []
test-flash-storage-erase = []
4 changes: 2 additions & 2 deletions emulator/periph/src/flash_ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ pub struct DummyFlashCtrl {

impl DummyFlashCtrl {
/// Page size for the flash storage connected to the controller.
pub const PAGE_SIZE: usize = 1024;
pub const PAGE_SIZE: usize = 256;

/// Maximum number of pages in the flash storage connected to the controller.
/// This is a dummy value, the actual value should be set based on the flash storage size.
pub const MAX_PAGES: u32 = 64 * 1024;
pub const MAX_PAGES: u32 = 64 * 1024 * 1024 / Self::PAGE_SIZE as u32;

/// I/O processing delay in ticks
pub const IO_START_DELAY: u64 = 200;
Expand Down
3 changes: 3 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ capsules-runtime.workspace = true
capsules-system = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
components = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
flash-driver.workspace = true
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
registers-generated.workspace = true
riscv = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
Expand All @@ -30,3 +31,5 @@ test-flash-ctrl-read-write-page = []
test-flash-ctrl-erase-page = []
test-mctp-ctrl-cmds = []
test-mctp-send-loopback = []
test-flash-storage-read-write = []
test-flash-storage-erase = []
1 change: 1 addition & 0 deletions runtime/capsules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e

capsules-extra = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
flash-driver.workspace = true
zerocopy.workspace = true
bitfield.workspace = true
romtime.workspace = true
Loading

0 comments on commit afa092b

Please sign in to comment.