refactor: 工程清理,打造基础模板

- 删除冗余文件:main_backup/main_minimal/main_full、GD32F4xx_AddOn_Temp/、GD32F4xx_Custom_Backup/、GD32F4xx_Official/
- 删除无关工具:read_pdf.py、openocd_test.txt、version.txt
- 重构 main.cpp:去除 STEP 机制,简化为线性启动流程
- 清理 CMakeLists.txt:移除 usart0.c 引用、死代码、冗余 REMOVE_ITEM
- 修正 config.h SystemCoreClock 为 168MHz
- 修复 gd32f4xx_it.cpp 中已删除的 main.h 引用
This commit is contained in:
2026-04-26 16:38:14 +08:00
parent fc10ef2e10
commit 851c3db56e
20 changed files with 211 additions and 2324 deletions
-2
View File
@@ -1,2 +0,0 @@
Error: Debug Adapter has to be specified, see "adapter driver" command
-20
View File
@@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
import sys
import PyPDF2
def extract_pdf_text(pdf_path):
try:
with open(pdf_path, 'rb') as file:
pdf_reader = PyPDF2.PdfReader(file)
text = ""
for page_num in range(len(pdf_reader.pages)):
page = pdf_reader.pages[page_num]
text += page.extract_text()
return text
except Exception as e:
return f"Error reading PDF: {e}"
if __name__ == "__main__":
pdf_path = "ÁºÉ½Pi¿ª·¢°å.pdf"
text = extract_pdf_text(pdf_path)
print(text[:2000])
-48
View File
@@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
import sys
import os
# 尝试用简单方法读取PDF
pdf_path = "LSPi_Project/doc/梁山Pi开发板.pdf"
# 方法1: 尝试使用pdfminer(如果可用)
try:
from pdfminer.high_level import extract_text
text = extract_text(pdf_path)
print("=== PDF内容 (pdfminer) ===")
print(text[:3000])
sys.exit(0)
except ImportError:
print("pdfminer不可用")
# 方法2: 尝试用二进制读取并查找可打印字符
try:
with open(pdf_path, 'rb') as f:
data = f.read()
# 提取可打印ASCII字符
text_chars = []
for byte in data:
if 32 <= byte < 127: # 可打印ASCII
text_chars.append(chr(byte))
elif byte == 10 or byte == 13: # 换行符
text_chars.append('\n')
text = ''.join(text_chars)
# 查找可能有用的部分
lines = text.split('\n')
useful_lines = []
keywords = ['pin', 'gpio', 'uart', 'i2c', 'spi', 'adc', 'timer', 'usart', 'tx', 'rx', 'scl', 'sda', 'miso', 'mosi', 'sck', 'cs']
for line in lines:
line_lower = line.lower()
if any(keyword in line_lower for keyword in keywords):
useful_lines.append(line)
print("=== 提取的有用信息 ===")
for line in useful_lines[:50]:
print(line)
except Exception as e:
print(f"错误: {e}")
-43
View File
@@ -1,43 +0,0 @@
#!/usr/bin/env python3
import sys
import os
pdf_path = "LSPi_Project/doc/ÁºÉ½Pi¿ª·¢°å.pdf"
# Simple binary read and extract text
try:
with open(pdf_path, 'rb') as f:
data = f.read()
# Extract printable ASCII characters
text_chars = []
for byte in data:
if 32 <= byte < 127: # Printable ASCII
text_chars.append(chr(byte))
elif byte == 10 or byte == 13: # Newline
text_chars.append('\n')
text = ''.join(text_chars)
# Find potentially useful sections
lines = text.split('\n')
useful_lines = []
keywords = ['pin', 'gpio', 'uart', 'i2c', 'spi', 'adc', 'timer', 'usart', 'tx', 'rx', 'scl', 'sda', 'miso', 'mosi', 'sck', 'cs', 'pa', 'pb', 'pc', 'pd', 'pe', 'pf', 'pg']
for line in lines:
line_lower = line.lower()
if any(keyword in line_lower for keyword in keywords):
useful_lines.append(line)
print("=== Useful information from PDF ===")
for i, line in enumerate(useful_lines[:100]):
print(f"{i+1}: {line}")
# Also show some general content
print("\n=== First 2000 characters of PDF content ===")
print(text[:2000])
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()