修复BOOT丢帧问题,优化标志位的存储
This commit is contained in:
+43
-45
@@ -19,7 +19,6 @@ u8 USART0_init() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int fputc(int ch, FILE *f) throw() {
|
||||
usart_data_transmit(EVAL_COM0, (uint8_t)ch);
|
||||
while (RESET == usart_flag_get(EVAL_COM0, USART_FLAG_TBE))
|
||||
@@ -48,7 +47,7 @@ void unused_pin_init() {
|
||||
* @param page_count 扫描的页数,默认为0表示扫描整个APP区域
|
||||
* @retval 无
|
||||
*/
|
||||
void scanAppFlashContent(bool print_content = true, u32 page_count = 0) {
|
||||
void scanAppFlashContent(bool print_content, u32 page_count) {
|
||||
u32 start_addr = APPLATEST_START_ADDR;
|
||||
u32 total_size = 0xC000;
|
||||
|
||||
@@ -86,48 +85,48 @@ void scanAppFlashContent(bool print_content = true, u32 page_count = 0) {
|
||||
} else {
|
||||
data_pages++;
|
||||
|
||||
// 只有在非空页面且需要打印时才输出内容
|
||||
if (print_content) {
|
||||
printf("Page 0x%08X: \r\n", addr);
|
||||
// // 只有在非空页面且需要打印时才输出内容
|
||||
// if (print_content) {
|
||||
// printf("Page 0x%08X: \r\n", addr);
|
||||
|
||||
// 打印所有内容
|
||||
for (u32 offset = 0; offset < FMC_PAGE_SIZE;
|
||||
offset += 16) { // 每行打印16字节
|
||||
// 打印地址偏移
|
||||
printf(" +%03X: ", offset);
|
||||
// // 打印所有内容
|
||||
// for (u32 offset = 0; offset < FMC_PAGE_SIZE;
|
||||
// offset += 16) { // 每行打印16字节
|
||||
// // 打印地址偏移
|
||||
// printf(" +%03X: ", offset);
|
||||
|
||||
// 打印十六进制数据
|
||||
for (u32 byte_idx = 0; byte_idx < 16; byte_idx++) {
|
||||
if ((offset + byte_idx) < FMC_PAGE_SIZE) {
|
||||
u8 data = *(__IO u8 *)(addr + offset + byte_idx);
|
||||
printf("%02X ", data);
|
||||
} else {
|
||||
printf(" "); // 空白填充
|
||||
}
|
||||
// // 打印十六进制数据
|
||||
// for (u32 byte_idx = 0; byte_idx < 16; byte_idx++) {
|
||||
// if ((offset + byte_idx) < FMC_PAGE_SIZE) {
|
||||
// u8 data = *(__IO u8 *)(addr + offset + byte_idx);
|
||||
// printf("%02X ", data);
|
||||
// } else {
|
||||
// printf(" "); // 空白填充
|
||||
// }
|
||||
|
||||
// 每8字节加个小空格,便于阅读
|
||||
if (byte_idx == 7) {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
// // 每8字节加个小空格,便于阅读
|
||||
// if (byte_idx == 7) {
|
||||
// printf(" ");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 打印可打印字符
|
||||
printf("|");
|
||||
for (u32 byte_idx = 0; byte_idx < 16; byte_idx++) {
|
||||
if ((offset + byte_idx) < FMC_PAGE_SIZE) {
|
||||
u8 data = *(__IO u8 *)(addr + offset + byte_idx);
|
||||
if (data >= 32 && data <= 126) { // 可打印字符范围
|
||||
printf("%c", data);
|
||||
} else {
|
||||
printf(".");
|
||||
}
|
||||
} else {
|
||||
printf(" "); // 空白填充
|
||||
}
|
||||
}
|
||||
printf("|\r\n");
|
||||
}
|
||||
}
|
||||
// // 打印可打印字符
|
||||
// printf("|");
|
||||
// for (u32 byte_idx = 0; byte_idx < 16; byte_idx++) {
|
||||
// if ((offset + byte_idx) < FMC_PAGE_SIZE) {
|
||||
// u8 data = *(__IO u8 *)(addr + offset + byte_idx);
|
||||
// if (data >= 32 && data <= 126) { // 可打印字符范围
|
||||
// printf("%c", data);
|
||||
// } else {
|
||||
// printf(".");
|
||||
// }
|
||||
// } else {
|
||||
// printf(" "); // 空白填充
|
||||
// }
|
||||
// }
|
||||
// printf("|\r\n");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
page_count_scanned++;
|
||||
@@ -177,11 +176,10 @@ void enter_deep_sleep() {
|
||||
pmu_to_deepsleepmode(PMU_LDO_LOWPOWER, WFI_CMD);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 写地址
|
||||
* @return fmc_state_enum
|
||||
*/
|
||||
/**
|
||||
* @brief 写地址
|
||||
* @return fmc_state_enum
|
||||
*/
|
||||
fmc_state_enum write_ADDRESS(u32 address, u32 data) {
|
||||
fmc_unlock();
|
||||
fmc_flag_clear(FMC_FLAG_PGERR | FMC_FLAG_PGAERR | FMC_FLAG_WPERR);
|
||||
|
||||
Reference in New Issue
Block a user