Skip to content

Commit

Permalink
v0.6.0: support for older bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmimi committed Jun 17, 2020
1 parent 7d377eb commit cb98b28
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 109 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
## [nu-isp-cli](./nu-isp-cli/README.md)
## [nu-isp](./nu-isp/README.md)

## ChangeLog
### v0.6.0
- support for older ISP_HID bootloader
- 'boot' subcommand
4 changes: 2 additions & 2 deletions nu-isp-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nu-isp-cli"
version = "0.5.0"
version = "0.6.0"
authors = ["Ein Terakawa <[email protected]>"]
edition = "2018"
description = "CLI tool for Nuvoton ISP_HID Bootloaders"
Expand All @@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
readme = "README.md"

[dependencies.nu-isp]
version = "0.5.0"
version = "0.6.0"
path = "../nu-isp"

[dependencies]
Expand Down
52 changes: 39 additions & 13 deletions nu-isp-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ fn main() {
.help("Show version"),
)
.subcommand(SubCommand::with_name("info").about("print target information"))
.subcommand(
SubCommand::with_name("boot")
.about("boot into application program ( Reset to APROM )")
.alias("run")
.alias("reset")
.alias("reboot")
.alias("launch"),
)
.subcommand(
SubCommand::with_name("erase").about("erase APROM ( DATA flash will be kept intact )"),
)
Expand All @@ -198,7 +206,10 @@ fn main() {
Arg::with_name("INPUT")
.help("Sets the input file to use")
.required(true),
),
)
.alias("write")
.alias("program")
.alias("download"),
);
let matches = app
.get_matches_from_safe_borrow(std::env::args())
Expand All @@ -217,17 +228,11 @@ fn main() {
builder.parse_filters(&s);
} else {
match matches.occurrences_of("v") {
0 => (),
1 => {
builder.parse_filters("info");
}
2 => {
builder.parse_filters("debug");
}
3 | _ => {
builder.parse_filters("trace");
}
}
0 => builder.parse_filters("warn"),
1 => builder.parse_filters("info"),
2 => builder.parse_filters("debug"),
3 | _ => builder.parse_filters("trace"),
};
}

builder.try_init().unwrap();
Expand All @@ -247,7 +252,11 @@ fn main() {
input = Some(file)
}

if matches.is_present("flash") || matches.is_present("info") || matches.is_present("erase") {
if matches.is_present("flash")
|| matches.is_present("info")
|| matches.is_present("erase")
|| matches.is_present("boot")
{
if let Some(param) = matches.value_of("INPUT") {
let pv: Vec<u16> = param
.split(':')
Expand Down Expand Up @@ -484,6 +493,23 @@ fn main() {
if matches.is_present("info") {
do_info(&context);
println!("Done.");
} else if matches.is_present("boot") {
println!("Reboot to APROM...");
// do_info(&context);
context
.nu_isp_launch()
.map_err(|err| {
eprintln!("{}!", err);
ecoloredln!(
"{}{}ERROR!{} {:?}",
fg!(Some(Color::Red)),
bold!(true),
reset!(),
err
);
std::process::exit(1)
})
.unwrap();
} else if matches.is_present("erase") {
println!("Erasing APROM...");
do_info(&context);
Expand Down
2 changes: 1 addition & 1 deletion nu-isp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nu-isp"
version = "0.5.0"
version = "0.6.0"
authors = ["Ein Terakawa <[email protected]>"]
edition = "2018"
description = "Nuvoton ISP_HID protocol library"
Expand Down
Loading

0 comments on commit cb98b28

Please sign in to comment.