feat: Update dependencies and adapt code

This commit is contained in:
Sergio Gasquez 2023-06-20 21:38:39 +02:00
parent 22cfebecfb
commit c6909757ab
3 changed files with 810 additions and 556 deletions

1125
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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"

View File

@ -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,
}
@ -55,11 +56,11 @@ fn index() -> content::RawHtml<&'static str> {
font-family: Arial, Helvetica, sans-serif;
color: #343434;
}
h1 {
margin-left: 40px;
}
</style>
</style>
</head>
<body>
<center>
@ -106,89 +107,123 @@ fn manifest() -> content::RawJson<&'static str> {
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32",
"parts": [
{
"path": "bootloader.bin",
"offset": 4096
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-C3",
"parts": [
{
"path": "bootloader.bin",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
"chipFamily": "ESP32",
"parts": [
{
"path": "bootloader.bin",
"offset": 4096
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-C2",
"parts": [
{
"path": "bootloader.bin",
"offset": 0
"path": "bootloader.bin",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-S2",
"parts": [
{
"path": "bootloader.bin",
"offset": 4096
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-S3",
"parts": [
{
"path": "bootloader.bin",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
"chipFamily": "ESP32-C3",
"parts": [
{
"path": "bootloader.bin",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"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",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-S2",
"parts": [
{
"path": "bootloader.bin",
"offset": 4096
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
},
{
"chipFamily": "ESP32-S3",
"parts": [
{
"path": "bootloader.bin",
"offset": 0
},
{
"path": "partitions.bin",
"offset": 32768
},
{
"path": "firmware.bin",
"offset": 65536
}
]
}
]
}
@ -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];