Skip to content

Commit 8807ffb

Browse files
committed
feat: 添加55系列芯片
1 parent e8094b9 commit 8807ffb

File tree

10 files changed

+475
-0
lines changed

10 files changed

+475
-0
lines changed

sftool-lib/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub mod common;
1616

1717
// 芯片特定的实现模块
1818
pub mod sf32lb52;
19+
pub mod sf32lb55;
1920
pub mod sf32lb56;
2021
pub mod sf32lb58;
2122

@@ -70,6 +71,8 @@ impl AfterOperation {
7071
pub enum ChipType {
7172
#[cfg_attr(feature = "cli", clap(name = "SF32LB52"))]
7273
SF32LB52,
74+
#[cfg_attr(feature = "cli", clap(name = "SF32LB55"))]
75+
SF32LB55,
7376
#[cfg_attr(feature = "cli", clap(name = "SF32LB56"))]
7477
SF32LB56,
7578
#[cfg_attr(feature = "cli", clap(name = "SF32LB58"))]
@@ -206,6 +209,7 @@ pub trait SifliTool:
206209
pub fn create_sifli_tool(chip_type: ChipType, base_param: SifliToolBase) -> Box<dyn SifliTool> {
207210
match chip_type {
208211
ChipType::SF32LB52 => sf32lb52::SF32LB52Tool::create_tool(base_param),
212+
ChipType::SF32LB55 => sf32lb55::SF32LB55Tool::create_tool(base_param),
209213
ChipType::SF32LB56 => sf32lb56::SF32LB56Tool::create_tool(base_param),
210214
ChipType::SF32LB58 => sf32lb58::SF32LB58Tool::create_tool(base_param),
211215
}

sftool-lib/src/ram_stub.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub static CHIP_FILE_NAME: phf::Map<&'static str, &'static str> = phf_map! {
99
"sf32lb52_nor" => "ram_patch_52X.bin",
1010
"sf32lb52_nand" => "ram_patch_52X_NAND.bin",
1111
"sf32lb52_sd" => "ram_patch_52X_SD.bin",
12+
"sf32lb55_nor" => "ram_patch_55X.bin",
13+
"sf32lb55_sd" => "ram_patch_55X_SD.bin",
1214
"sf32lb56_nor" => "ram_patch_56X.bin",
1315
"sf32lb56_nand" => "ram_patch_56X_NAND.bin",
1416
"sf32lb56_sd" => "ram_patch_56X_SD.bin",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use super::SF32LB55Tool;
2+
use crate::common::erase_flash::EraseOps;
3+
use crate::erase_flash::EraseFlashTrait;
4+
use crate::{EraseFlashParams, EraseRegionParams, Result};
5+
6+
impl EraseFlashTrait for SF32LB55Tool {
7+
fn erase_flash(&mut self, params: &EraseFlashParams) -> Result<()> {
8+
EraseOps::erase_all(self, params.address)
9+
}
10+
11+
fn erase_region(&mut self, params: &EraseRegionParams) -> Result<()> {
12+
// 处理每个区域
13+
for region in params.regions.iter() {
14+
EraseOps::erase_region(self, region.address, region.size)?;
15+
}
16+
Ok(())
17+
}
18+
}

0 commit comments

Comments
 (0)