first commit

This commit is contained in:
liyp
2026-08-25 22:08:26 -04:00
commit 6c99b1201e
16 changed files with 571 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# For more options, open this url: https://clang.llvm.net.cn/docs/ClangFormatStyleOptions.html
---
BasedOnStyle: Microsoft
IndentWidth: 4
UseTab: Never
TabWidth: 4
ColumnLimit: 0
---
Language: Cpp
AccessModifierOffset: -4
NamespaceIndentation: All
FixNamespaceComments: false
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
IndentCaseLabels: true
SortIncludes: false
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: Consecutive
+208
View File
@@ -0,0 +1,208 @@
version: "4.1"
name: Stm32F10xTmp
type: ARM
deviceName: null
packDir: null
srcDirs: []
virtualFolder:
name: <virtual_root>
files: []
folders:
- name: System
files:
- path: VoiletBspStm32F10x/System/system_stm32f10x.c
- path: VoiletBspStm32F10x/System/LinkScripts/Gcc/stm32_flash_ze.ld
- path: VoiletBspStm32F10x/System/Cmsis/Src/core_cm3.c
folders: []
- name: Startup
files:
- path: VoiletBspStm32F10x/System/Startup/Gcc/startup_stm32f10x_hd.s
folders: []
- name: App
files:
- path: App/Src/LetterShell.c
- path: App/Src/main.c
folders: []
- name: Shell
files:
- path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell.c
- path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_cmd_list.c
- path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_companion.c
- path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_ext.c
folders: []
- name: Bsp
files:
- path: VoiletBspStm32F10x/Bsp/Src/Bsp.c
- path: VoiletBspStm32F10x/Bsp/Src/Delay.c
- path: VoiletBspStm32F10x/Bsp/Src/Gpio.c
- path: VoiletBspStm32F10x/Bsp/Src/Interrupt.c
- path: VoiletBspStm32F10x/Bsp/Src/SeggerCall.c
- path: VoiletBspStm32F10x/Bsp/Src/SysCall.c
- path: VoiletBspStm32F10x/Bsp/Src/Uart.c
folders: []
- name: StdLib
files:
- path: VoiletBspStm32F10x/StdLib/Src/misc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_adc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_bkp.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_can.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_cec.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_crc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dac.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dbgmcu.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dma.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_exti.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_flash.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_fsmc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_gpio.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_i2c.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_iwdg.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_pwr.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_rcc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_rtc.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_sdio.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_spi.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_tim.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_usart.c
- path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_wwdg.c
folders: []
dependenceList: []
outDir: Output
miscInfo:
uid: d92a06a9fb4c340402d39197c79d1252
targets:
Debug:
cppPreprocessAttrs:
defineList:
- USE_STDPERIPH_DRIVER
- STM32F10X_HD
- DEBUG
incList:
- App/Inc
- Board
- VoiletBspStm32F10x/Bsp/Inc
- VoiletBspStm32F10x/StdLib/Inc
- VoiletBspStm32F10x/System/Cmsis/Inc
- VoiletBspStm32F10x/System
- VoiletBspStm32F10x/ThirdParty/LetterShellV3/Inc
libList: []
excludeList: []
settings:
debugger: cortex-debug
toolchain: GCC
toolchainConfigMap:
GCC:
archExtensions: ""
cpuType: Cortex-M3
floatingPointHardware: none
options:
version: 5
afterBuildTasks: []
asm-compiler:
ASM_FLAGS: ""
beforeBuildTasks: []
c/cpp-compiler:
CXX_FLAGS: ""
C_FLAGS: ""
language-c: c11
language-cpp: c++11
one-elf-section-per-data: true
one-elf-section-per-function: true
optimization: level-debug
warnings: all-warnings
global:
$float-abi-type: hard
misc-control: ""
not-use-syscalls: true
output-debug-info: enable
use-newlib-nano: true
linker:
$outputTaskExcludes:
- .bin
LD_FLAGS: ""
LIB_FLAGS: -lm
output-format: elf
remove-unused-input-sections: true
scatterFilePath: VoiletBspStm32F10x/System/LinkScripts/Gcc/stm32_flash_ze.ld
storageLayout:
RAM: []
ROM: []
useCustomScatterFile: true
uploadConfigMap:
JLink:
baseAddr: ""
bin: ""
cpuInfo:
cpuName: STM32F103ZE
vendor: ST
otherCmds: ""
proType: 1
speed: 8000
uploader: JLink
Release:
cppPreprocessAttrs:
defineList:
- USE_STDPERIPH_DRIVER
- STM32F10X_HD
incList:
- App/Inc
- Board
- VoiletBspStm32F10x/Bsp/Inc
- VoiletBspStm32F10x/StdLib/Inc
- VoiletBspStm32F10x/System/Cmsis/Inc
- VoiletBspStm32F10x/System
- VoiletBspStm32F10x/ThirdParty/LetterShellV3/Inc
libList: []
excludeList: []
settings:
debugger: cortex-debug
toolchain: GCC
toolchainConfigMap:
GCC:
archExtensions: ""
cpuType: Cortex-M3
floatingPointHardware: none
options:
version: 5
afterBuildTasks: []
asm-compiler:
ASM_FLAGS: ""
beforeBuildTasks: []
c/cpp-compiler:
CXX_FLAGS: ""
C_FLAGS: ""
language-c: c11
language-cpp: c++11
one-elf-section-per-data: true
one-elf-section-per-function: true
optimization: level-debug
warnings: all-warnings
global:
$float-abi-type: hard
misc-control: ""
not-use-syscalls: true
output-debug-info: enable
use-newlib-nano: true
linker:
$outputTaskExcludes:
- .bin
LD_FLAGS: ""
LIB_FLAGS: -lm
output-format: elf
remove-unused-input-sections: true
scatterFilePath: VoiletBspStm32F10x/System/LinkScripts/Gcc/stm32_flash_ze.ld
storageLayout:
RAM: []
ROM: []
useCustomScatterFile: true
uploadConfigMap:
JLink:
baseAddr: ""
bin: ""
cpuInfo:
cpuName: STM32F103ZE
vendor: ST
otherCmds: ""
proType: 1
speed: 8000
uploader: JLink
+23
View File
@@ -0,0 +1,23 @@
##########################################################################################
# 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.1"
options:
Debug:
files: {}
virtualPathFiles: {}
Release:
files: {}
virtualPathFiles: {}
+2
View File
@@ -0,0 +1,2 @@
# Ignore Output directory
Output/
+3
View File
@@ -0,0 +1,3 @@
[submodule "VoiletBspStm32F10x"]
path = VoiletBspStm32F10x
url = https://git.linuxacme.com/iorebuild/VoiletBspStm32F10x.git
+17
View File
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceRoot}",
"type": "cortex-debug",
"request": "launch",
"name": "Debug: JLINK",
"servertype": "jlink",
"interface": "swd",
"executable": "Output/Debug/Stm32F10xTmp.elf",
"runToEntryPoint": "main",
"device": "STM32F103ZE",
"toolchainPrefix": "arm-none-eabi"
}
]
}
+9
View File
@@ -0,0 +1,9 @@
{
"editor.formatOnSave": true,
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
}
}
+40
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": []
}
]
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef __LETTER_SHELL_H__
#define __LETTER_SHELL_H__
#include "Bsp.h"
void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud);
#endif
Executable
+8
View File
@@ -0,0 +1,8 @@
//
// Created by anonymous on 2026/5/24.
//
#ifndef MAIN_H
#define MAIN_H
#endif //MAIN_H
+100
View File
@@ -0,0 +1,100 @@
#include "LetterShell.h"
#include "shell.h"
/* 板级BSP头文件 */
#include "Bsp.h"
#define WR_BUFFER_SIZE 512
/* 1. 创建shell对象,开辟shell缓冲区 */
Shell Host; // Shell实例化
char HostBuffer[WR_BUFFER_SIZE]; // 读写缓冲区
const COM_MAP_T *HostCom = TTY_COM;
/**
* @brief Shell写函数
* @param ComId 串口号,ch 数据
* @retval void
* @note void
* @example void
*/
signed short ShellWrite(char *ch, unsigned short Len)
{
ComSendStr(HostCom, (uint8_t *)ch, Len);
return Len;
}
/**
* @brief Shell读函数 - 中断回调实现
* @param Vector 中断向量号
* @retval void
* @note void
* @example void
*/
void LetterShellIrqFunc(void *Param)
{
uint8_t ch = 0x00;
ch = ComReceiveChar(Param);
shellHandler(&Host, ch);
}
/**
* @brief 初始化Shell
* @note void
* @param ComX 串口号,baud 波特率
* @retval void
*/
void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud)
{
// 初始化串口
ComStdConfig(ComX, Baud);
// 设置串口回调函数
IrqRegister(ComX->Periph.Irqn, LetterShellIrqFunc);
// 设置中断等级
IrqEnable(ComX->Periph.Irqn, 1, 1);
// 注册写函数
Host.write = ShellWrite;
// 初始化LetterShell
shellInit(&Host, HostBuffer, WR_BUFFER_SIZE);
}
// /**
// * @brief 打印版本号
// * @param void
// * @retval void
// * @note void
// * @example void
// */
// void version(void)
// {
// printf("%s,%s\r\n",HARDWARE_VERSION,SOFTWARE_VERSION);
// }
//
// /**
// * @brief 重启单片机
// * @param void
// * @retval void
// * @note void
// * @example void
// */
// void reboot(void)
// {
// SystemReboot();
// }
//
// /**
// * @brief 串口测试程序
// * @param void
// * @retval void
// * @note void
// * @example void
// */
//
// void comTest(uint8_t ComId)
// {
// }
//
// //打印版本号
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), version, version, version);
// //软重启单片机
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), reboot, reboot, reboot);
// //串口测试
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), comTest, comTest, comTest);
Executable
+30
View File
@@ -0,0 +1,30 @@
//
// Created by anonymous on 2026/5/24.
//
/* C标准库头文件 */
#include <stdint.h>
#include <stdio.h>
/* BSP文件 */
#include "Bsp.h"
#include "main.h"
int8_t DiTbl[DI_NUM];
int main(void)
{
BspInit();
while (1)
{
for (uint8_t i = 0; i < DI_NUM; i++)
{
DiTbl[i] = DiGet(i);
}
LedToggle(LED0);
DelayMs(100);
}
EXIT_APP
}
Executable
+41
View File
@@ -0,0 +1,41 @@
//
// Created by anonymous on 2026/5/28.
//
#ifndef _BOARD_H
#define _BOARD_H
/* Voilet Bsp */
#include "VoiletPort.h"
/* Chip Library Enable */
/* Extra Library Enable */
#define TTY_COM COM1
#define TTY_BAUD 115200
#define LED_NUM 2 // LED灯数量
enum {
LED0 = 0,
LED1,
};
#define DI_NUM 3 // 数字信号输入通道数量
enum {
KEY_WK_UP = 0,
KEY_0,
KEY_1,
};
#define DO_NUM 0 // 数字信号输出通道数量
// enum {
//
// };
#define RS485_1 COM1
// #define RS485_2
// #define RS485_3
// #define RS485_4
// #define RS485_5
#endif //_BOARD_H
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
1、克隆仓库
```
git clone --recurse https://git.linuxacme.com/iorebuild/Stm32F10xTmp.git
```
2、将子模块切换为main分支
```
cd Stm32F10xTmp
```
```
git submodule foreach "git checkout main"
```
+47
View File
@@ -0,0 +1,47 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"clangd.arguments": [
"--header-insertion=never"
],
"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",
"dan-c-underwood.arm",
"marus25.cortex-debug"
]
}
}