Skip to content

Commit b93ddbe

Browse files
committed
feat: add SF32LB57 support
1 parent 2aca2bc commit b93ddbe

13 files changed

Lines changed: 54 additions & 51 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
## 功能与特性
88
- 基于 **Tauri + Vue 3 + TypeScript**,只需轻点几步即可烧录,降低使用门槛,让固件烧录更简单。
9-
- 支持Sifli系列三个主推芯片型号和存储器类型。
9+
- 支持Sifli系列多款芯片型号和存储器类型。
1010
- 支持查看系统日志,方便查看运行情况和错误原因。
1111

1212
## 支持的产品
1313
### 芯片型号
1414
- SF32LB52
15+
- SF32LB55
1516
- SF32LB56
17+
- SF32LB57
1618
- SF32LB58
1719
### 存储器类型
1820
- NOR

‎docs/src/en/get-started/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ flexibly meet different project needs.
2727
| SF32LB52 | NOR, NAND, SD | UART |
2828
| SF32LB55 | NOR, SD | UART |
2929
| SF32LB56 | NOR | UART, USB |
30+
| SF32LB57 | NOR | UART |
3031
| SF32LB58 | NOR | UART, USB |
3132

3233
### Memory Types Overview

‎docs/src/zh_CN/get-started/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ sftool-gui 支持全面的 SiFli 芯片和存储器配置,能够灵活满足
2121
|SF32LB52 | NOR, NAND, SD |UART|
2222
|SF32LB55 | NOR, SD |UART|
2323
|SF32LB56 | NOR| UART, USB|
24+
|SF32LB57 | NOR| UART|
2425
|SF32LB58 | NOR| UART, USB|
2526

2627
### 存储器类型概览

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/chip-support-test.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ const expectedSupport = {
1515
memories: ['NOR'],
1616
interfaces: ['UART', 'USB'],
1717
},
18+
SF32LB57: {
19+
memories: ['NOR'],
20+
interfaces: ['UART'],
21+
},
1822
SF32LB58: {
1923
memories: ['NOR'],
2024
interfaces: ['UART', 'USB'],
2125
},
2226
};
2327

2428
for (const [chipId, support] of Object.entries(expectedSupport)) {
29+
assert.ok(chips.CHIP_MODELS.some(chip => chip.id === chipId), `${chipId} should be selectable`);
2530
assert.deepEqual(chips.getSupportedMemoryTypes(chipId), support.memories, `${chipId} memory support mismatch`);
2631
assert.deepEqual(chips.getSupportedInterfaces(chipId), support.interfaces, `${chipId} interface support mismatch`);
2732
}

‎scripts/connection-flow-test.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import assert from 'node:assert/strict';
2+
import { readFile } from 'node:fs/promises';
3+
4+
const source = await readFile(new URL('../src/components/DeviceConnection.vue', import.meta.url), 'utf8');
5+
6+
assert.doesNotMatch(source, /runWithTimeout/);
7+
assert.match(source, /await invoke<boolean>\('connect_device', connectParams\)/);
8+
9+
console.log('connection flow does not abandon active serial operations');

‎src-tauri/Cargo.lock‎

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src-tauri/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tauri-plugin-updater = "=2.10.1"
2828
serialport = "4.9"
2929
nusb = "0.2.3"
3030
futures-lite = "2"
31-
sftool-lib = { version = "0.2.3"}
31+
sftool-lib = { git = "https://github.com/OpenSiFli/sftool", branch = "master" }
3232
tauri-plugin-dialog = "=2.7.0"
3333
tauri-plugin-fs = "=2.5.0"
3434
tauri-plugin-process = "=2.3.1"

‎src-tauri/src/utils/stub_ops.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn chip_key(chip_type: &ChipType) -> &'static str {
1919
ChipType::SF32LB52 => "sf32lb52",
2020
ChipType::SF32LB55 => "sf32lb55",
2121
ChipType::SF32LB56 => "sf32lb56",
22+
ChipType::SF32LB57 => "sf32lb57",
2223
ChipType::SF32LB58 => "sf32lb58",
2324
}
2425
}
@@ -74,7 +75,7 @@ pub fn prepare_stub_path(
7475

7576
#[cfg(test)]
7677
mod tests {
77-
use super::prepare_stub_path;
78+
use super::{chip_key, prepare_stub_path};
7879
use sftool_lib::ChipType;
7980
use std::io::Write;
8081
use std::path::Path;
@@ -91,6 +92,11 @@ mod tests {
9192
assert!(temp_owner.is_none());
9293
}
9394

95+
#[test]
96+
fn chip_key_supports_sf32lb57() {
97+
assert_eq!(chip_key(&ChipType::SF32LB57), "sf32lb57");
98+
}
99+
94100
#[test]
95101
fn prepared_stub_temp_file_lives_until_owner_is_dropped() {
96102
let mut config_file = tempfile::NamedTempFile::new().unwrap();

‎src-tauri/src/utils/tool_factory.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fn parse_chip_type(chip_type: &str) -> Result<ChipType, String> {
8181
"SF32LB52" => Ok(ChipType::SF32LB52),
8282
"SF32LB55" => Ok(ChipType::SF32LB55),
8383
"SF32LB56" => Ok(ChipType::SF32LB56),
84+
"SF32LB57" => Ok(ChipType::SF32LB57),
8485
"SF32LB58" => Ok(ChipType::SF32LB58),
8586
_ => Err(format!("不支持的芯片型号: {}", chip_type)),
8687
}
@@ -290,3 +291,14 @@ pub fn create_tool_instance_with_progress(
290291
let tool = create_sifli_tool_checked(chip_type, base)?;
291292
Ok(Box::new(ToolWithStubOwner::new(tool, temp_stub_file)))
292293
}
294+
295+
#[cfg(test)]
296+
mod tests {
297+
use super::parse_chip_type;
298+
use sftool_lib::ChipType;
299+
300+
#[test]
301+
fn parses_sf32lb57() {
302+
assert_eq!(parse_chip_type("SF32LB57"), Ok(ChipType::SF32LB57));
303+
}
304+
}

0 commit comments

Comments
 (0)