From 2740d305ba3f2e1612437812012bd4cf0455cba0 Mon Sep 17 00:00:00 2001 From: Marek Kraus Date: Sat, 7 Jan 2023 16:57:45 +0100 Subject: [PATCH] Added initial BL61X and BL808 support, some chip changes --- include/blisp_chip.h | 13 +++++++++++-- lib/chip/blisp_chip_bl60x.c | 3 ++- lib/chip/blisp_chip_bl61x.c | 11 +++++++++++ lib/chip/blisp_chip_bl70x.c | 3 ++- lib/chip/blisp_chip_bl808.c | 11 +++++++++++ tools/blisp/src/cmd/write.c | 2 +- 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 lib/chip/blisp_chip_bl61x.c create mode 100644 lib/chip/blisp_chip_bl808.c diff --git a/include/blisp_chip.h b/include/blisp_chip.h index 4b3672b..3415973 100644 --- a/include/blisp_chip.h +++ b/include/blisp_chip.h @@ -5,17 +5,26 @@ #include #include -enum blisp_chip_type { BLISP_CHIP_BL60X, BLISP_CHIP_BL70X }; +enum blisp_chip_type { + BLISP_CHIP_BL60X, + BLISP_CHIP_BL70X, + BLISP_CHIP_BL606P, + BLISP_CHIP_BL808, + BLISP_CHIP_BL61X, +}; struct blisp_chip { // TODO: Move elsewhere? enum blisp_chip_type type; const char* type_str; bool usb_isp_available; float handshake_byte_multiplier; - const char* default_eflash_loader_xtal; // TODO: Make this selectable + const char* default_xtal; // TODO: Make this selectable + bool needs_eflash_loader; }; extern struct blisp_chip blisp_chip_bl60x; extern struct blisp_chip blisp_chip_bl70x; +extern struct blisp_chip blisp_chip_bl808; +extern struct blisp_chip blisp_chip_bl61x; #endif \ No newline at end of file diff --git a/lib/chip/blisp_chip_bl60x.c b/lib/chip/blisp_chip_bl60x.c index f9cc5be..250fdd2 100644 --- a/lib/chip/blisp_chip_bl60x.c +++ b/lib/chip/blisp_chip_bl60x.c @@ -5,6 +5,7 @@ struct blisp_chip blisp_chip_bl60x = { .type = BLISP_CHIP_BL60X, .type_str = "bl60x", .usb_isp_available = false, - .default_eflash_loader_xtal = "40m", + .default_xtal = "40m", .handshake_byte_multiplier = 0.006f, + .needs_eflash_loader = true }; diff --git a/lib/chip/blisp_chip_bl61x.c b/lib/chip/blisp_chip_bl61x.c new file mode 100644 index 0000000..28bf183 --- /dev/null +++ b/lib/chip/blisp_chip_bl61x.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +#include "blisp.h" + +struct blisp_chip blisp_chip_bl61x = { + .type = BLISP_CHIP_BL61X, + .type_str = "bl808", + .usb_isp_available = true, + .default_xtal = "-", // ? + .handshake_byte_multiplier = 0.003f, + .needs_eflash_loader = false +}; diff --git a/lib/chip/blisp_chip_bl70x.c b/lib/chip/blisp_chip_bl70x.c index 805481a..dfaf326 100644 --- a/lib/chip/blisp_chip_bl70x.c +++ b/lib/chip/blisp_chip_bl70x.c @@ -5,6 +5,7 @@ struct blisp_chip blisp_chip_bl70x = { .type = BLISP_CHIP_BL70X, .type_str = "bl70x", .usb_isp_available = true, - .default_eflash_loader_xtal = "32m", + .default_xtal = "32m", .handshake_byte_multiplier = 0.003f, + .needs_eflash_loader = true }; diff --git a/lib/chip/blisp_chip_bl808.c b/lib/chip/blisp_chip_bl808.c new file mode 100644 index 0000000..35f7339 --- /dev/null +++ b/lib/chip/blisp_chip_bl808.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +#include "blisp.h" + +struct blisp_chip blisp_chip_bl808 = { + .type = BLISP_CHIP_BL808, + .type_str = "bl808", + .usb_isp_available = true, // TODO: Only for BL808D :-( + .default_xtal = "-", // ? + .handshake_byte_multiplier = 0.003f, + .needs_eflash_loader = false +}; diff --git a/tools/blisp/src/cmd/write.c b/tools/blisp/src/cmd/write.c index fe9afdc..94653fe 100644 --- a/tools/blisp/src/cmd/write.c +++ b/tools/blisp/src/cmd/write.c @@ -286,7 +286,7 @@ void blisp_flash_firmware() { } snprintf(eflash_loader_path, PATH_MAX, "%s/data/%s/eflash_loader_%s.bin", exe_path, device.chip->type_str, - device.chip->default_eflash_loader_xtal); + device.chip->default_xtal); printf("Loading the eflash loader file from disk\n"); eflash_loader_file = fopen(eflash_loader_path, "rb"); // TODO: Error handling if (eflash_loader_file == NULL) {