Fixed bug in reading chip ID

This commit is contained in:
Pavel Zakopaylo 2023-12-01 15:56:44 +11:00
parent 80a0854f2c
commit 04916cf5a4
No known key found for this signature in database
GPG Key ID: 9D4130BD5891F5CB
2 changed files with 30 additions and 15 deletions

View File

@ -279,12 +279,15 @@ blisp_return_t blisp_device_get_boot_info(struct blisp_device* device,
if (ret < 0) if (ret < 0)
return ret; return ret;
memcpy(boot_info->boot_rom_version, &device->rx_buffer[0], // TODO: Endianess; this may break on big endian machines
4); // TODO: Endianess; this may break on big endian machines memcpy(boot_info->boot_rom_version, &device->rx_buffer[0], 4);
if (device->chip->type == BLISP_CHIP_BL70X || device->chip->type == BLISP_CHIP_BL808) { // TODO: This is only 70X related
if (device->chip->type == BLISP_CHIP_BL70X) {
memcpy(boot_info->chip_id, &device->rx_buffer[16], 8); memcpy(boot_info->chip_id, &device->rx_buffer[16], 8);
} else {
memcpy(boot_info->chip_id, &device->rx_buffer[12], 6);
} }
// TODO: BL60X, BL808
return BLISP_OK; return BLISP_OK;
} }

View File

@ -78,6 +78,9 @@ blisp_return_t blisp_common_prepare_flash(struct blisp_device* device) {
return ret; return ret;
} }
// TODO: Do we want this to print in big endian to match the output
// of Bouffalo's software?
if (device->chip->type == BLISP_CHIP_BL70X) {
printf( printf(
"BootROM version %d.%d.%d.%d, ChipID: " "BootROM version %d.%d.%d.%d, ChipID: "
"%02X%02X%02X%02X%02X%02X%02X%02X\n", "%02X%02X%02X%02X%02X%02X%02X%02X\n",
@ -86,6 +89,15 @@ blisp_return_t blisp_common_prepare_flash(struct blisp_device* device) {
boot_info.chip_id[0], boot_info.chip_id[1], boot_info.chip_id[2], boot_info.chip_id[0], boot_info.chip_id[1], boot_info.chip_id[2],
boot_info.chip_id[3], boot_info.chip_id[4], boot_info.chip_id[5], boot_info.chip_id[3], boot_info.chip_id[4], boot_info.chip_id[5],
boot_info.chip_id[6], boot_info.chip_id[7]); boot_info.chip_id[6], boot_info.chip_id[7]);
} else {
printf(
"BootROM version %d.%d.%d.%d, ChipID: "
"%02X%02X%02X%02X%02X%02X\n",
boot_info.boot_rom_version[0], boot_info.boot_rom_version[1],
boot_info.boot_rom_version[2], boot_info.boot_rom_version[3],
boot_info.chip_id[0], boot_info.chip_id[1], boot_info.chip_id[2],
boot_info.chip_id[3], boot_info.chip_id[4], boot_info.chip_id[5]);
}
if (device->chip->type == BLISP_CHIP_BL808) { if (device->chip->type == BLISP_CHIP_BL808) {
printf("Setting clock parameters ...\n"); printf("Setting clock parameters ...\n");