bugfix: dual core chip haven't started the pro cpu in the bootloader, so no workaround is needed

This commit is contained in:
wuzhenghui
2023-01-05 17:51:01 +08:00
parent c0d2fcded7
commit db61945537

View File

@@ -44,7 +44,7 @@ void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data,
copy_words = MIN(word_len, copy_words); copy_words = MIN(word_len, copy_words);
// Wait for SHA engine idle // Wait for SHA engine idle
while (REG_READ(SHA_256_BUSY_REG) != 0) { } while (_DPORT_REG_READ(SHA_256_BUSY_REG) != 0) { }
// Copy to memory block // Copy to memory block
for (size_t i = 0; i < copy_words; i++) { for (size_t i = 0; i < copy_words; i++) {
@@ -61,9 +61,9 @@ void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data,
// If we loaded a full block, run the SHA engine // If we loaded a full block, run the SHA engine
if (block_count == BLOCK_WORDS) { if (block_count == BLOCK_WORDS) {
if (words_hashed == BLOCK_WORDS) { if (words_hashed == BLOCK_WORDS) {
REG_WRITE(SHA_256_START_REG, 1); _DPORT_REG_WRITE(SHA_256_START_REG, 1);
} else { } else {
REG_WRITE(SHA_256_CONTINUE_REG, 1); _DPORT_REG_WRITE(SHA_256_CONTINUE_REG, 1);
} }
block_count = 0; block_count = 0;
} }
@@ -103,9 +103,9 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
assert(words_hashed % BLOCK_WORDS == 0); assert(words_hashed % BLOCK_WORDS == 0);
while (REG_READ(SHA_256_BUSY_REG) == 1) { } while (_DPORT_REG_READ(SHA_256_BUSY_REG) == 1) { }
REG_WRITE(SHA_256_LOAD_REG, 1); _DPORT_REG_WRITE(SHA_256_LOAD_REG, 1);
while (REG_READ(SHA_256_BUSY_REG) == 1) { } while (_DPORT_REG_READ(SHA_256_BUSY_REG) == 1) { }
uint32_t *digest_words = (uint32_t *)digest; uint32_t *digest_words = (uint32_t *)digest;
uint32_t *sha_text_reg = (uint32_t *)(SHA_TEXT_BASE); uint32_t *sha_text_reg = (uint32_t *)(SHA_TEXT_BASE);