Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/commands.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ struct ReadPage : public Commands<T> {
int run() override {
if (auto page = this->flash.single_read_page(addr)) {
std::println("Single read {:#x} : {}", addr, *page);
return 0;
} else {
std::println("page failed");
return 1;
Comment thread
marnovandermaas marked this conversation as resolved.
Outdated
}

return 1;
}
};

Expand Down
17 changes: 6 additions & 11 deletions app/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ static std::vector<ftdi::DeviceInfo> scan() {
exit(0);
}

// for (auto &device: devices) {
// if (device.type == ftdi::DeviceType::Ftdi_unknown) {
// std::println("Warning: device not {}");
// }
// }
return devices;
}

Expand Down Expand Up @@ -117,7 +112,7 @@ int main(int argc, char* argv[]) {
return 0;
};

auto jedec_cmd = new_flash_command("jedec", "Test the ftdi connection.");
auto jedec_cmd = new_flash_command("jedec", "Read the JEDEC identifier.");
program.add_subparser(*jedec_cmd);
commands["jedec"] = [&]() -> int {
auto spih = handle_flash_command(jedec_cmd);
Expand All @@ -126,7 +121,7 @@ int main(int argc, char* argv[]) {
return 0;
};

auto sfdp_cmd = new_flash_command("sfdp", "Test the ftdi connection.");
auto sfdp_cmd = new_flash_command("sfdp", "Read serial flash description.");
program.add_subparser(*sfdp_cmd);
commands["sfdp"] = [&]() -> int {
auto spih = handle_flash_command(sfdp_cmd);
Expand All @@ -135,7 +130,7 @@ int main(int argc, char* argv[]) {
return 0;
};

auto read_page_cmd = new_flash_command("read-page", "Read a specific page");
auto read_page_cmd = new_flash_command("read-page", "Read a specific page.");
read_page_cmd->add_argument("--addr").help("The page address").scan<'x', std::size_t>();
program.add_subparser(*read_page_cmd);
commands["read-page"] = [&]() -> int {
Expand All @@ -146,7 +141,7 @@ int main(int argc, char* argv[]) {
return 0;
};

auto test_page_cmd = new_flash_command("test-page", "Write a pattern to a page and read it back");
auto test_page_cmd = new_flash_command("test-page", "Write a pattern to a page and read it back.");
test_page_cmd->add_argument("--addr")
.help("The address to be loaded")
.default_value(std::size_t{0})
Expand Down Expand Up @@ -184,7 +179,7 @@ int main(int argc, char* argv[]) {
};

auto verify_file_cmd = new_flash_command(
"verify-file", "Compare the hash if a file to hash of the flash content at the address.");
"verify-file", "Compare the hash of a file to the hash of the flash content at the address.");
verify_file_cmd->add_argument("filename").help("The file path.");
verify_file_cmd->add_argument("--addr")
.help("The address to be loaded")
Expand All @@ -207,7 +202,7 @@ int main(int argc, char* argv[]) {
};

auto bootstrap_cmd = new_flash_command(
"bootstrap", "Write the content of a binary file to a address and reset the target");
"bootstrap", "Write the content of a binary file to an address and reset the target.");
bootstrap_cmd->add_argument("filename").help("The file path.");
bootstrap_cmd->add_argument("--addr")
.help("The address to be loaded")
Expand Down
Binary file modified doc/img/deps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/ftdi/spi_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SpiHost::transfer(std::span<uint8_t> write, std::span<uint8_t> read) {

FT4222_STATUS status;
status = FT4222_SPIMaster_SingleWrite(handle, write.data(), write.size(), &transfered, false);
status = FT4222_SPIMaster_SingleRead(handle, read.data(), write.size(), &transfered, true);
status = FT4222_SPIMaster_SingleRead(handle, read.data(), read.size(), &transfered, true);
if (FT4222_OK != status) {
std::cerr << std::format("SingleReadWrite:{}\n", status);
return embeddedpp::Code::Generic;
Expand Down
3 changes: 0 additions & 3 deletions lib/ftdi/spi_host.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class SpiHost {
explicit SpiHost(FT_HANDLE handle, bool mpsse = false) noexcept
: handle(handle), mpsse(mpsse), traces(false) {}
~SpiHost() {
// std::println("destructor");
// TODO: fix copy elision.
// close();
}

void close() {
Expand Down