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

View File

@ -78,14 +78,26 @@ blisp_return_t blisp_common_prepare_flash(struct blisp_device* device) {
return ret;
}
printf(
"BootROM version %d.%d.%d.%d, ChipID: "
"%02X%02X%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],
boot_info.chip_id[6], boot_info.chip_id[7]);
// 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(
"BootROM version %d.%d.%d.%d, ChipID: "
"%02X%02X%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],
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) {
printf("Setting clock parameters ...\n");