feat: ✨ Update dependencies and adapt code
This commit is contained in:
parent
22cfebecfb
commit
c6909757ab
1125
Cargo.lock
generated
1125
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
32
Cargo.toml
32
Cargo.toml
@ -2,12 +2,30 @@
|
||||
name = "web-flash"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Björn Quentin <bjoern.quentin@mobile-j.de>",
|
||||
"Sergio Gasquez Arcos <sergio.gasquez@gmail.com>",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/esp-rs/esp-web-flash-server"
|
||||
keywords = [
|
||||
"cli",
|
||||
"embedded",
|
||||
"esp",
|
||||
]
|
||||
categories = [
|
||||
"command-line-utilities",
|
||||
"development-tools",
|
||||
"embedded",
|
||||
]
|
||||
|
||||
|
||||
[dependencies]
|
||||
rocket = "0.5.0-rc.2"
|
||||
espflash = "2.0.0-rc.1"
|
||||
esp-idf-part = "0.1.1"
|
||||
clap = { version = "3.1.18", features=["env", "derive"] }
|
||||
opener = "0.5.0"
|
||||
anyhow = "1.0.57"
|
||||
xmas-elf = "0.8.0"
|
||||
rocket = "0.5.0-rc.3"
|
||||
espflash = "2.0.0"
|
||||
esp-idf-part = "0.4.1"
|
||||
clap = { version = "4.3.5", features=["env", "derive"] }
|
||||
opener = "0.6.1"
|
||||
anyhow = "1.0.71"
|
||||
xmas-elf = "0.9.0"
|
||||
|
67
src/main.rs
67
src/main.rs
@ -4,7 +4,7 @@ use std::{path::PathBuf, time::Duration};
|
||||
|
||||
use clap::Parser;
|
||||
use esp_idf_part::PartitionTable;
|
||||
use espflash::{elf::ElfFirmwareImage, flasher::FlashSize::Flash4Mb, targets::Chip};
|
||||
use espflash::{elf::ElfFirmwareImage, flasher::FlashSize::_4Mb, targets::Chip};
|
||||
use rocket::{response::content, State};
|
||||
|
||||
#[macro_use]
|
||||
@ -13,18 +13,19 @@ extern crate rocket;
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// chip name
|
||||
#[arg(short, long)]
|
||||
/// Chip name
|
||||
#[clap(short, long)]
|
||||
chip: Chip,
|
||||
|
||||
/// path to bootloader
|
||||
#[arg(short, long)]
|
||||
/// Path to bootloader
|
||||
#[clap(short, long)]
|
||||
bootloader: Option<PathBuf>,
|
||||
|
||||
/// path to partition table csv
|
||||
#[arg(short, long)]
|
||||
/// Path to partition table CSV
|
||||
#[clap(short, long)]
|
||||
partition_table: Option<PathBuf>,
|
||||
|
||||
/// Path to the ELF file
|
||||
elf: PathBuf,
|
||||
}
|
||||
|
||||
@ -122,6 +123,23 @@ fn manifest() -> content::RawJson<&'static str> {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-C2",
|
||||
"parts": [
|
||||
{
|
||||
"path": "bootloader.bin",
|
||||
"offset": 0
|
||||
},
|
||||
{
|
||||
"path": "partitions.bin",
|
||||
"offset": 32768
|
||||
},
|
||||
{
|
||||
"path": "firmware.bin",
|
||||
"offset": 65536
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-C3",
|
||||
"parts": [
|
||||
@ -140,7 +158,24 @@ fn manifest() -> content::RawJson<&'static str> {
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-C2",
|
||||
"chipFamily": "ESP32-C6",
|
||||
"parts": [
|
||||
{
|
||||
"path": "bootloader.bin",
|
||||
"offset": 0
|
||||
},
|
||||
{
|
||||
"path": "partitions.bin",
|
||||
"offset": 32768
|
||||
},
|
||||
{
|
||||
"path": "firmware.bin",
|
||||
"offset": 65536
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-H2",
|
||||
"parts": [
|
||||
{
|
||||
"path": "bootloader.bin",
|
||||
@ -231,18 +266,14 @@ fn prepare() -> Result<PartsData> {
|
||||
Chip::Esp32s3 => "ESP32-S3",
|
||||
Chip::Esp8266 => "ESP8266",
|
||||
Chip::Esp32c2 => "ESP32-C2",
|
||||
Chip::Esp32c6 => "ESP32-C6",
|
||||
Chip::Esp32h2 => "ESP32-H2",
|
||||
_ => panic!("Unsupported chip"),
|
||||
};
|
||||
|
||||
let image = chip.into_target().get_flash_image(
|
||||
&firmware,
|
||||
b,
|
||||
p,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Some(Flash4Mb),
|
||||
None,
|
||||
)?;
|
||||
let image =
|
||||
chip.into_target()
|
||||
.get_flash_image(&firmware, b, p, None, None, None, Some(_4Mb), None)?;
|
||||
let parts: Vec<_> = image.flash_segments().collect();
|
||||
let bootloader = &parts[0];
|
||||
let partitions = &parts[1];
|
||||
|
Loading…
Reference in New Issue
Block a user