移植完成mdkv5工程

This commit is contained in:
2025-06-30 23:25:38 +08:00
commit 2b2747fef7
28 changed files with 11692 additions and 0 deletions

38
Eide/.clang-format Normal file
View File

@@ -0,0 +1,38 @@
---
BasedOnStyle: Microsoft
Language: Cpp
###################################
# indent conf
###################################
UseTab: Never
IndentWidth: 4
TabWidth: 4
ColumnLimit: 0
AccessModifierOffset: -4
NamespaceIndentation: All
FixNamespaceComments: false
BreakBeforeBraces: Linux
###################################
# other styles
###################################
#
# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
IndentCaseLabels: true
SortIncludes: false
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: Consecutive

18
Eide/.clangd Normal file
View File

@@ -0,0 +1,18 @@
CompileFlags:
Add:
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\arm-none-eabi\include\newlib-nano
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\arm-none-eabi\include\c++\14.2.1
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\arm-none-eabi\include\c++\14.2.1\arm-none-eabi\thumb\v7-m\nofp
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\arm-none-eabi\include\c++\14.2.1\backward
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\lib\gcc\arm-none-eabi\14.2.1\include
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\lib\gcc\arm-none-eabi\14.2.1\include-fixed
- -IC:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\arm-none-eabi\include
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\arm-none-eabi\include\newlib-nano
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\arm-none-eabi\include\c++\10.3.1
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\arm-none-eabi\include\c++\10.3.1\arm-none-eabi\thumb\v7-m\nofp
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\arm-none-eabi\include\c++\10.3.1\backward
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\lib\gcc\arm-none-eabi\10.3.1\include
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\lib\gcc\arm-none-eabi\10.3.1\include-fixed
- -Ic:\program files (x86)\gnu arm embedded toolchain\10 2021.10\arm-none-eabi\include
CompilationDatabase: ./build/Debug
Compiler: c:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-g++.exe

View File

@@ -0,0 +1,110 @@
##############################################
#
# STM32 Option Bytes
#
# Usage: Uncomment to enable options
#
##############################################
# RDP = <Level>
# BOR_LEV = <Level>
# WWDG_SW = <Value>
# IWDG_SW = <Value>
# IWDG_STOP = <Value>
# IWDG_STDBY = <Value>
# IWDG_ULP = <Value>
# FZ_IWDG_STOP = <Value>
# FZ_IWDG_STDBY = <Value>
# nRST_STOP = <Value>
# nRST_STDBY = <Value>
# nBOOT_SEL = <Value>
# nRST_SHDW = <Value>
# PCROP_RDP = <Value>
# nBFB2 = <Value>
# BFB2 = <Value>
# nBoot1 = <Value>
# Boot1 = <Value>
# nBoot0 = <Value>
# nBoot0_SW_Cfg = <Value>
# VDDA = <Value>
# SDADC12_VDD = <Value>
# DB1M = <Value>
# DUALBANK = <Value>
# nDBANK = <Value>
# BOOT0_nSW_Config = <Value>
# Data0 = <Value>
# Data1 = <Value>
# nSRAM_Parity = <Value>
# SRAM2_RST = <Value>
# SRAM2_PE = <Value>
# DDS = <Value>
# FSD = <Value>
# SFSA = <Value>
# C2OPT = <Value>
# NBRSD = <Value>
# SNBRSA = <Value>
# SBRSA = <Value>
# BRSD = <Value>
# SBRV = <Value>
# DMEPB = <Value>
# DMESB = <Value>
# Security = <Value>
# CM7_BOOT_ADD0 = <Value>
# CM7_BOOT_ADD1 = <Value>
# IWDG1 = <Value>
# IWDG2 = <Value>
# nRST_STDBY_D2 = <Value>
# BOOT_CM4 = <Value>
# nRST_STDBY_D1 = <Value>
# BOOT_CM7 = <Value>
# CM7_BOOT_ADD0 = <Value>
# CM7_BOOT_ADD1 = <Value>
# DMEPA = <Value>
# DMESA = <Value>
# SECA_strt = <Value>
# SECA_end = <Value>
# SECB_strt = <Value>
# SECB_end = <Value>
# DTCM_RAM = <Value>
# SPRMOD = <Value>
# WPRMOD = <Value>
# PCROPA_STRT = <Value>
# PCROPA_END = <Value>
# PCROPB_STRT = <Value>
# PCROPB_END = <Value>
# WRP = <Value>
# WRP2 = <Value>
# WRP3 = <Value>
# WRP4 = <Value>
# WRP1A_STRT = <Value>
# WRP1A_END = <Value>
# WRP1B_STRT = <Value>
# WRP1B_END = <Value>
# WRP2A_STRT = <Value>
# WRP2A_END = <Value>
# WRP2B_STRT = <Value>
# WRP2B_END = <Value>
# IPCCDBA = <Value>

156
Eide/.eide/eide.json Normal file
View File

@@ -0,0 +1,156 @@
{
"name": "Application",
"type": "ARM",
"dependenceList": [],
"srcDirs": [
"../../../Bsp/Src",
"../../../StdLib/Src",
"../../../System/CMSIS",
"../../../ThirdLib/LetterShell/Src",
"../App/Src"
],
"virtualFolder": {
"name": "<virtual_root>",
"files": [
{
"path": "../../../System/Startup/TrueStudio/startup_stm32f10x_hd.s"
},
{
"path": "../../../System/stm32f10x_it.c"
},
{
"path": "../../../System/system_stm32f10x.c"
}
],
"folders": []
},
"outDir": "build",
"deviceName": "STM32F103ZE",
"packDir": ".pack/Keil/STM32F1xx_DFP.2.3.0",
"miscInfo": {
"uid": "ecbbdd2006397faa870eccaf00bbaa03"
},
"targets": {
"Debug": {
"excludeList": [
"../../../../System/LinkScripts",
"../../../../System/Startup"
],
"toolchain": "GCC",
"compileConfig": {
"cpuType": "Cortex-M3",
"floatingPointHardware": "none",
"scatterFilePath": "../../../System/LinkScripts/TrueStudio/stm32_flash_ze.ld",
"useCustomScatterFile": true,
"storageLayout": {
"RAM": [],
"ROM": []
},
"options": "null"
},
"uploader": "OpenOCD",
"uploadConfig": {
"bin": "",
"target": "stm32f1x",
"interface": "stlink-v2-1",
"baseAddr": "0x08000000"
},
"uploadConfigMap": {
"JLink": {
"bin": "",
"baseAddr": "",
"cpuInfo": {
"vendor": "null",
"cpuName": "null"
},
"proType": 1,
"speed": 8000,
"otherCmds": ""
},
"STLink": {
"bin": "",
"proType": "SWD",
"resetMode": "default",
"runAfterProgram": true,
"speed": 4000,
"address": "0x08000000",
"elFile": "None",
"optionBytes": ".eide/debug.st.option.bytes.ini",
"otherCmds": ""
},
"OpenOCD": {
"bin": "",
"target": "stm32f1x",
"interface": "stlink",
"baseAddr": "0x08000000"
}
},
"custom_dep": {
"name": "default",
"incList": [
".",
"../App/Inc",
"../../../Bsp/Inc",
"../../../System",
"../../../StdLib/Inc",
"../../../ThirdLib/LetterShell/Inc",
"../../../System/CMSIS"
],
"libList": [],
"defineList": [
"DEBUG",
"USE_STDPERIPH_DRIVER",
"STM32F10X_HD"
]
},
"builderOptions": {
"GCC": {
"version": 5,
"beforeBuildTasks": [],
"afterBuildTasks": [],
"global": {
"$float-abi-type": "softfp",
"output-debug-info": "enable",
"misc-control": "--specs=nosys.specs --specs=nano.specs"
},
"c/cpp-compiler": {
"language-c": "c99",
"language-cpp": "c++11",
"optimization": "level-debug",
"warnings": "all-warnings",
"one-elf-section-per-function": true,
"one-elf-section-per-data": true
},
"asm-compiler": {},
"linker": {
"output-format": "elf",
"remove-unused-input-sections": true,
"LIB_FLAGS": "-lm",
"$toolName": "auto"
}
},
"AC5": {
"version": 4,
"beforeBuildTasks": [],
"afterBuildTasks": [],
"global": {
"use-microLIB": false,
"output-debug-info": "enable"
},
"c/cpp-compiler": {
"optimization": "level-0",
"one-elf-section-per-function": true,
"c99-mode": true,
"C_FLAGS": "--diag_suppress=1 --diag_suppress=1295",
"CXX_FLAGS": "--diag_suppress=1 --diag_suppress=1295"
},
"asm-compiler": {},
"linker": {
"output-format": "elf"
}
}
}
}
},
"version": "3.5"
}

19
Eide/.eide/env.ini Normal file
View File

@@ -0,0 +1,19 @@
###########################################################
# project environment variables
###########################################################
# append command prefix for toolchain
#COMPILER_CMD_PREFIX=
# mcu ram size (used to print memory usage)
#MCU_RAM_SIZE=0x00
# mcu rom size (used to print memory usage)
#MCU_ROM_SIZE=0x00
# put your global variables ...
#GLOBAL_VAR=
[debug]
# put your variables for 'debug' target ...
#VAR=

View File

@@ -0,0 +1,20 @@
##########################################################################################
# Append Compiler Options For Source Files
##########################################################################################
# syntax:
# <your pattern>: <compiler options>
# For get pattern syntax, please refer to: https://www.npmjs.com/package/micromatch
#
# examples:
# 'main.cpp': --cpp11 -Og ...
# 'src/*.c': -gnu -O2 ...
# 'src/lib/**/*.cpp': --cpp11 -Os ...
# '!Application/*.c': -O0
# '**/*.c': -O2 -gnu ...
version: "2.0"
options:
Debug:
files: {}
virtualPathFiles: {}

15
Eide/.gitignore vendored Normal file
View File

@@ -0,0 +1,15 @@
# dot files
/.vscode/launch.json
/.settings
/.eide/log
/.eide.usr.ctx.json
# project out
/build
/bin
/obj
/out
# eide template
*.ept
*.eide-template

1
Eide/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

40
Eide/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${command:eide.project.build}",
"group": "build",
"problemMatcher": []
},
{
"label": "flash",
"type": "shell",
"command": "${command:eide.project.uploadToDevice}",
"group": "build",
"problemMatcher": []
},
{
"label": "build and flash",
"type": "shell",
"command": "${command:eide.project.buildAndFlash}",
"group": "build",
"problemMatcher": []
},
{
"label": "rebuild",
"type": "shell",
"command": "${command:eide.project.rebuild}",
"group": "build",
"problemMatcher": []
},
{
"label": "clean",
"type": "shell",
"command": "${command:eide.project.clean}",
"group": "build",
"problemMatcher": []
}
]
}

View File

@@ -0,0 +1,45 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.autoGuessEncoding": true,
"C_Cpp.default.configurationProvider": "cl.eide",
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
".eideignore": "ignore",
"*.a51": "a51",
"*.h": "c",
"*.c": "c",
"*.hxx": "cpp",
"*.hpp": "cpp",
"*.c++": "cpp",
"*.cpp": "cpp",
"*.cxx": "cpp",
"*.cc": "cpp"
},
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.autoIndent": "advanced"
}
},
"extensions": {
"recommendations": [
"cl.eide",
"keroc.hex-fmt",
"xiaoyongdong.srecord",
"hars.cppsnippets",
"zixuanwang.linkerscript",
"redhat.vscode-yaml",
"IBM.output-colorizer",
"cschlosser.doxdocgen",
"ms-vscode.vscode-serial-monitor",
"alefragnani.project-manager",
"dan-c-underwood.arm",
"marus25.cortex-debug"
]
}
}

146
Eide/SysCall.c Normal file
View File

@@ -0,0 +1,146 @@
/**
******************************************************************************
* @file syscalls.c
* @author Suroy Wrote with Auto-generated by STM32CubeIDE
* @url https://suroy.cn
* @brief STM32CubeIDE Minimal System calls file
*
* For more information about which c-functions
* need which of these lowlevel functions
* please consult the Newlib libc-manual
******************************************************************************
* @attention
*
* Copyright (c) 2020-2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes */
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
#include "Bsp.h"
/* Variables */
extern int __io_putchar(int ch) __attribute__((weak));
extern int __io_getchar(void) __attribute__((weak));
/* Functions */
__attribute__((weak)) int _read(int file, char *ptr, int len)
{
(void)file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
*ptr++ = __io_getchar();
}
return len;
}
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
(void)file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar(*ptr++);
}
return len;
}
// 条件编译
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#define GETCHAR_PROTOTYPE int __io_getchar(void)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#define GETCHAR_PROTOTYPE int fgetc(FILE *f)
#endif /* __GNUC__ */
/**
* 函数功能: 重定向 c库函数 printf到 DEBUG_USARTx
* 输入参数: 无
* 返 回 值: 无
* 说 明:无
*/
PUTCHAR_PROTOTYPE
{
UsartSendChar(TTY_COM, ch); //阻塞式无限等待
return ch;
}
/**
* 函数功能: 重定向 c库函数 getchar,scanf到 DEBUG_USARTx
* 输入参数: 无
* 返 回 值: 无
* 说 明:无
*/
GETCHAR_PROTOTYPE
{
uint8_t ch = 0;
ch = UsartReceiveChar(TTY_COM);
return ch;
}
/* 非GCC模式才允许编译使用即 Keil、IAR 等 */
#ifndef __GNUC__
/**
* @brief 重定向 C 标准库 printf 函数到串口 huart1
* 适用于 Keil、IAR 等IDE不适用 GCC
* @author Suroy
* @param ch
* @param f
* @return int
*
* @usage printf("USART1_Target:\r\n");
*/
int fputc(int ch, FILE *f)
{
//采用轮询方式发送1字节数据超时时间为无限等待
HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,HAL_MAX_DELAY); //huart1是串口的句柄
return ch;
}
/**
* @brief fgets 重定向
* 重定向 C 标准库 scanf 函数到串口 huart1
* 注意以 空格 为结束
* @param f
* @return int
*
* @usage scanf("%c", &RecData);
*/
int fgetc(FILE *f)
{
uint8_t ch;
HAL_UART_Receive(&huart1, (uint8_t *)&ch, 1, HAL_MAX_DELAY); //huart1是串口的句柄
return ch;
}
#endif /* __GNUC__ */