first commit

This commit is contained in:
2025-06-20 23:40:45 +08:00
parent 9d04a93b70
commit 55c13e8bb6
152 changed files with 21525 additions and 0 deletions

160
Ses/Application.emProject Normal file
View File

@@ -0,0 +1,160 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="Solution 'Application'" target="8" version="2">
<configuration
LIBRARY_IO_TYPE="None"
Name="Debug"
arm_assembler_variant="gcc"
arm_compiler_variant="gcc"
arm_linker_variant="GNU"
arm_stm32cubeprogrammer_directory="C:/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer"
arm_target_connect_with_reset_stlink="Yes"
c_preprocessor_definitions="DEBUG;USE_STDPERIPH_DRIVER;STM32F10X_HD"
c_preprocessor_definitions_c_only=""
c_user_include_directories="$(ProjectDir)/../../../StdLib/Inc;$(ProjectDir)/../../../ThirdLib/LetterShell/Inc;$(ProjectDir)/../../../System;$(ProjectDir)/../../../System/CMSIS;$(ProjectDir)/../../../Bsp/Inc;$(ProjectDir)/../App/Inc;$(ProjectDir)/"
compile_post_build_command=""
compile_pre_build_command=""
debug_target_connection="ST-Link"
gcc_c_language_standard="gnu99"
gcc_debugging_level="Level 3"
gcc_entry_point="Reset_Handler"
gcc_has_Oz_optimization_level="Yes"
gcc_omit_frame_pointer="Yes"
gcc_optimization_level="Level 0"
gdb_server_allow_memory_access_during_execution="Yes"
gdb_server_autostart_server="No"
gdb_server_command_line=""
gdb_server_ignore_checksum_errors="Yes"
gdb_server_port="61234"
gdb_server_register_access="General and Individual"
gdb_server_reset_command="reset"
gdb_server_type="ST-LINK"
link_include_standard_libraries="Yes"
link_linker_script_file="../../../../System/LinkScripts/TrueStudio/stm32f10x_flash_extsram.ld"
linker_patch_build_command=""
linker_post_build_command=""
linker_pre_build_command=""
linker_printf_fmt_level="long long"
linker_printf_fp_enabled="Double"
linker_printf_wchar_enabled="Yes"
linker_printf_width_precision_supported="Yes"
linker_scanf_character_group_matching_enabled="Yes"
linker_scanf_fmt_level="long long"
linker_scanf_fp_enabled="Yes"
post_build_command=""
target_script_file="$(ProjectDir)/STM32F1xx_Target.js" />
<configuration
Name="Release"
c_preprocessor_definitions="NDEBUG"
gcc_debugging_level="Level 2"
gcc_omit_frame_pointer="Yes"
gcc_optimization_level="Level 2 balanced" />
<project Name="Application">
<configuration
LIBRARY_IO_TYPE="RTT"
Name="Common"
Target="STM32F103ZE"
arm_architecture="v7M"
arm_compiler_variant="gcc"
arm_core_type="Cortex-M3"
arm_endian="Little"
arm_fp_abi="Soft"
arm_fpu_type="None"
arm_linker_heap_size="1024"
arm_linker_process_stack_size="0"
arm_linker_stack_size="2048"
arm_linker_variant="SEGGER"
arm_simulator_memory_simulation_parameter="ROM;0x08000000;0x00080000;RAM;0x20000000;0x00010000"
arm_target_device_name="STM32F103ZE"
arm_target_interface_type="SWD"
c_preprocessor_definitions="ARM_MATH_CM3;STM32F10X_HD;__STM32F103_SUBFAMILY;__STM32F1XX_FAMILY;__NO_FPU_ENABLE"
c_user_include_directories="$(ProjectDir)/STM32F1xx/Device/Include"
debug_register_definition_file="$(ProjectDir)/STM32F103xx_Registers.xml"
debug_stack_pointer_start="__stack_end__"
debug_start_from_entry_point_symbol="Yes"
debug_target_connection="J-Link"
file_codec="UTF-8"
gcc_entry_point="Reset_Handler"
link_linker_script_file="$(ProjectDir)/STM32F1xx_Flash.icf"
linker_memory_map_file="$(ProjectDir)/STM32F103ZE_MemoryMap.xml"
macros="DeviceHeaderFile=$(PackagesDir)/STM32F1xx/Device/Include/stm32f10x.h;DeviceSystemFile=$(PackagesDir)/STM32F1xx/Device/Source/system_stm32f10x.c;DeviceVectorsFile=$(PackagesDir)/STM32F1xx/Source/stm32f10x_hd_Vectors.s;DeviceFamily=STM32F1xx;DeviceSubFamily=STM32F103;Target=STM32F103ZE"
project_directory=""
project_type="Executable"
target_reset_script="Reset();" />
<configuration
LIBRARY_IO_TYPE="None"
Name="Debug"
arm_compiler_variant="gcc"
arm_library_optimization="Balanced"
arm_linker_variant="GNU"
c_additional_options=""
c_only_additional_options=""
debug_stack_pointer_start="_estack"
debug_target_connection="ST-Link"
gcc_c_language_standard="gnu11"
gcc_entry_point="Reset_Handler"
link_include_standard_libraries="Yes"
link_linker_script_file="../../../System/LinkScripts/TrueStudio/stm32_flash_ze.ld"
link_use_linker_script_file="Yes"
linker_additional_options=""
linker_printf_fmt_level="long long"
linker_printf_fp_enabled="Double"
post_build_command=""
pre_build_command=""
target_reset_script="Reset()"
target_script_file="$(ProjectDir)/STM32F1xx_Target.js" />
<folder Name="App">
<file file_name="../App/Src/LetterShell.c">
<configuration Name="Debug" build_exclude_from_build="No" />
</file>
<file file_name="../App/Src/Main.c" />
</folder>
<folder Name="Bsp">
<configuration Name="Debug" build_exclude_from_build="No" />
<file file_name="../../../Bsp/Src/Bsp.c" />
<file file_name="../../../Bsp/Src/Delay.c" />
<file file_name="../../../Bsp/Src/Gpio.c" />
<file file_name="../../../Bsp/Src/Interrupt.c" />
<file file_name="../../../Bsp/Src/Usart.c" />
</folder>
<folder Name="LetterShell">
<configuration Name="Debug" build_exclude_from_build="No" />
<file file_name="../../../ThirdLib/LetterShell/Src/shell.c" />
<file file_name="../../../ThirdLib/LetterShell/Src/shell_cmd_list.c" />
<file file_name="../../../ThirdLib/LetterShell/Src/shell_companion.c" />
<file file_name="../../../ThirdLib/LetterShell/Src/shell_ext.c" />
</folder>
<folder Name="StdLib">
<configuration Name="Debug" build_exclude_from_build="No" />
<file file_name="../../../StdLib/Src/misc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_adc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_bkp.c" />
<file file_name="../../../StdLib/Src/stm32f10x_can.c" />
<file file_name="../../../StdLib/Src/stm32f10x_cec.c" />
<file file_name="../../../StdLib/Src/stm32f10x_crc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_dac.c" />
<file file_name="../../../StdLib/Src/stm32f10x_dbgmcu.c" />
<file file_name="../../../StdLib/Src/stm32f10x_dma.c" />
<file file_name="../../../StdLib/Src/stm32f10x_exti.c" />
<file file_name="../../../StdLib/Src/stm32f10x_flash.c" />
<file file_name="../../../StdLib/Src/stm32f10x_fsmc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_gpio.c" />
<file file_name="../../../StdLib/Src/stm32f10x_i2c.c" />
<file file_name="../../../StdLib/Src/stm32f10x_iwdg.c" />
<file file_name="../../../StdLib/Src/stm32f10x_pwr.c" />
<file file_name="../../../StdLib/Src/stm32f10x_rcc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_rtc.c" />
<file file_name="../../../StdLib/Src/stm32f10x_sdio.c" />
<file file_name="../../../StdLib/Src/stm32f10x_spi.c" />
<file file_name="../../../StdLib/Src/stm32f10x_tim.c" />
<file file_name="../../../StdLib/Src/stm32f10x_usart.c" />
<file file_name="../../../StdLib/Src/stm32f10x_wwdg.c" />
</folder>
<folder Name="SystemFiles">
<file file_name="../../../System/CMSIS/core_cm3.c" />
<file file_name="../../../System/Startup/TrueStudio/startup_stm32f10x_hd.s" />
<file file_name="../../../System/LinkScripts/TrueStudio/stm32_flash_ze.ld" />
<file file_name="../../../System/stm32f10x_it.c" />
<file file_name="../../../System/system_stm32f10x.c" />
</folder>
</project>
</solution>

101
Ses/Application.emSession Normal file
View File

@@ -0,0 +1,101 @@
<!DOCTYPE CrossStudio_Session_File>
<session>
<Bookmarks/>
<Breakpoints groups="Breakpoints" active_group="Breakpoints">
<Exceptions set="MemManage;UsageFault_Coprocessor;UsageFault_CheckingError;UsageFault_StateError;BusFault;ExceptionEntryReturnFault;HardFault"/>
</Breakpoints>
<ExecutionProfileWindow/>
<FrameBuffer>
<FrameBufferWindow width="0" keepAspectRatio="0" zoomToFitWindow="0" showGrid="0" addressSpace="" format="0" height="0" autoEvaluate="0" scaleFactor="1" refreshPeriod="0" name="Stm32F1xxProject_Debug" addressText="" accessByDisplayWidth="0"/>
<FrameBufferWindow width="0" keepAspectRatio="0" zoomToFitWindow="0" showGrid="0" addressSpace="" format="0" height="0" autoEvaluate="0" scaleFactor="1" refreshPeriod="0" name="Stm32F1xxTempProject_Debug" addressText="" accessByDisplayWidth="0"/>
<FrameBufferWindow width="0" keepAspectRatio="0" zoomToFitWindow="0" showGrid="0" addressSpace="" format="0" height="0" autoEvaluate="0" scaleFactor="1" refreshPeriod="0" name="Stm32F10xTempProject_Debug" addressText="" accessByDisplayWidth="0"/>
<FrameBufferWindow width="0" keepAspectRatio="0" zoomToFitWindow="0" showGrid="0" addressSpace="" format="0" height="0" autoEvaluate="0" scaleFactor="1" refreshPeriod="0" name="Application_Debug" addressText="" accessByDisplayWidth="0"/>
</FrameBuffer>
<Memory1>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxProject_Debug" sizeText="sizeof({)" addressText="&amp;{"/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxTempProject_Debug" sizeText="sizeof({)" addressText="&amp;{"/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F10xTempProject_Debug" sizeText="sizeof({)" addressText="&amp;{"/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Application_Debug" sizeText="sizeof({)" addressText="&amp;{"/>
</Memory1>
<Memory2>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F10xTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Application_Debug" sizeText="" addressText=""/>
</Memory2>
<Memory3>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F10xTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Application_Debug" sizeText="" addressText=""/>
</Memory3>
<Memory4>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F1xxTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Stm32F10xTempProject_Debug" sizeText="" addressText=""/>
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" viewType="4" addressOrder="0" columnsText="" refreshPeriod="0" name="Application_Debug" sizeText="" addressText=""/>
</Memory4>
<Project>
<ProjectSessionItem path="Solution 'Application'"/>
<ProjectSessionItem path="Solution 'Application';Application"/>
<ProjectSessionItem path="Solution 'Application';Application;App"/>
<ProjectSessionItem path="Solution 'Application';Application;Bsp"/>
<ProjectSessionItem path="Solution 'Application';Application;LetterShell"/>
<ProjectSessionItem path="Solution 'Application';Application;StdLib"/>
<ProjectSessionItem path="Solution 'Application';Application;SystemFiles"/>
</Project>
<Register1>
<RegisterWindow invisibleNodes="" visibleNodes="USART1/SR;USART1/DR;USART1/BRR;USART1/CR1;USART1/CR2;USART1/CR3;USART1/GTPR;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal;CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr" binaryNodes="" asciiNodes="" openNodes="USART1;CPU;CPU - Current Context" name="Stm32F1xxProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context;CPU;CPU/CONTROL;CPU/internal" name="Stm32F10xTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Application_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
</Register1>
<Register2>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F10xTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Application_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
</Register2>
<Register3>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F10xTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Application_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
</Register3>
<Register4>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F1xxTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Stm32F10xTempProject_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
<RegisterWindow invisibleNodes="" visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/MSP;CPU/PSP;CPU/PRIMASK;CPU/BASEPRI;CPU/FAULTMASK;CPU/CONTROL;CPU/internal" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="Application_Debug" decimalNodes="" octalNodes="" unsignedNodes=""/>
</Register4>
<Threads>
<ThreadsWindow showLists=""/>
</Threads>
<TraceWindow>
<Trace enabled="Yes"/>
</TraceWindow>
<Watch1>
<Watches active="1" update="Twice a Second">
<Watchpoint expression="UsartInitSt" name="UsartInitSt" radix="-1" linenumber="68" filename="Bsp/Src/Usart.c"/>
<Watchpoint expression="SystemIntReg" name="SystemIntReg" radix="-1" linenumber="4" filename="Bsp/Src/Interrupt.c"/>
<Watchpoint expression="string" name="string" radix="-1" linenumber="296" filename="../../../ThirdLib/LetterShell/Src/shell.c"/>
<Watchpoint expression="shellText[SHELL_TEXT_INFO]" name="shellText[SHELL_TEXT_INFO]" radix="-1" linenumber="1268" filename="../../../ThirdLib/LetterShell/Src/shell.c"/>
<Watchpoint expression="Len" name="Len" radix="8" linenumber="18" filename="../App/Src/LetterShell.c"/>
<Watchpoint expression="GpioInitSt" name="GpioInitSt" radix="-1" linenumber="86" filename="Bsp/Src/Gpio.c"/>
<Watchpoint expression="fuck" name="fuck" radix="-1" linenumber="4" filename="App/Src/main.c"/>
</Watches>
</Watch1>
<Watch2>
<Watches active="0" update="Never"/>
</Watch2>
<Watch3>
<Watches active="0" update="Never"/>
</Watch3>
<Watch4>
<Watches active="0" update="Never"/>
</Watch4>
<Files>
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="21" useTextEdit="1" path="../App/Src/main.c" left="0" selected="1" top="0" codecName="UTF-8"/>
</Files>
<EMStudioWindow activeProject="Application" fileDialogDefaultFilter="*.*" autoConnectTarget="ST-Link" buildConfiguration="Debug" sessionSettings="" debugSearchFileMap="" fileDialogInitialDirectory="C:/Users/anonymous/Desktop/Embedded/STM32/Projects/Stm32F10xProject/Projects/Stm32F10xTempProject/Ses" debugSearchPath="" autoConnectCapabilities="3455"/>
</session>

288
Ses/SEGGER_THUMB_Startup.s Normal file
View File

@@ -0,0 +1,288 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 2014 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* - Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_THUMB_Startup.s
Purpose : Generic runtime init startup code for ARM CPUs running
in THUMB mode.
Designed to work with the SEGGER linker to produce
smallest possible executables.
This file does not normally require any customization.
Additional information:
Preprocessor Definitions
FULL_LIBRARY
If defined then
- argc, argv are set up by calling SEGGER_SEMIHOST_GetArgs().
- the exit symbol is defined and executes on return from main.
- the exit symbol calls destructors, atexit functions and then
calls SEGGER_SEMIHOST_Exit().
If not defined then
- argc and argv are not valid (main is assumed to not take parameters)
- the exit symbol is defined, executes on return from main and
halts in a loop.
*/
.syntax unified
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef APP_ENTRY_POINT
#define APP_ENTRY_POINT main
#endif
#ifndef ARGSSPACE
#define ARGSSPACE 128
#endif
/*********************************************************************
*
* Macros
*
**********************************************************************
*/
//
// Declare a label as function symbol (without switching sections)
//
.macro MARK_FUNC Name
.global \Name
.thumb_func
.code 16
\Name:
.endm
//
// Declare a regular function.
// Functions from the startup are placed in the init section.
//
.macro START_FUNC Name
.section .init.\Name, "ax"
.global \Name
.balign 2
.thumb_func
.code 16
\Name:
.endm
//
// Declare a weak function
//
.macro WEAK_FUNC Name
.section .init.\Name, "ax", %progbits
.weak \Name
.balign 2
.thumb_func
.code 16
\Name:
.endm
//
// Mark the end of a function and calculate its size
//
.macro END_FUNC name
.size \name,.-\name
.endm
/*********************************************************************
*
* Externals
*
**********************************************************************
*/
.extern APP_ENTRY_POINT // typically main
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* _start
*
* Function description
* Entry point for the startup code.
* Usually called by the reset handler.
* Performs all initialisation, based on the entries in the
* linker-generated init table, then calls main().
* It is device independent, so there should not be any need for an
* end-user to modify it.
*
* Additional information
* At this point, the stack pointer should already have been
* initialized
* - by hardware (such as on Cortex-M),
* - by the device-specific reset handler,
* - or by the debugger (such as for RAM Code).
*/
#undef L
#define L(label) .L_start_##label
START_FUNC _start
//
// Call linker init functions which in turn performs the following:
// * Perform segment init
// * Perform heap init (if used)
// * Call constructors of global Objects (if any exist)
//
ldr R4, =__SEGGER_init_table__ // Set table pointer to start of initialization table
L(RunInit):
ldr R0, [R4] // Get next initialization function from table
adds R4, R4, #4 // Increment table pointer to point to function arguments
blx R0 // Call initialization function
b L(RunInit)
//
MARK_FUNC __SEGGER_init_done
MARK_FUNC __startup_complete
//
// Time to call main(), the application entry point.
//
#ifndef FULL_LIBRARY
//
// In a real embedded application ("Free-standing environment"),
// main() does not get any arguments,
// which means it is not necessary to init R0 and R1.
//
bl APP_ENTRY_POINT // Call to application entry point (usually main())
END_FUNC _start
//
// end of _start
// Fall-through to exit if main ever returns.
//
MARK_FUNC exit
//
// In a free-standing environment, if returned from application:
// Loop forever.
//
b .
.size exit,.-exit
#else
//
// In a hosted environment,
// we need to load R0 and R1 with argc and argv, in order to handle
// the command line arguments.
// This is required for some programs running under control of a
// debugger, such as automated tests.
//
movs R0, #ARGSSPACE
ldr R1, =__SEGGER_init_arg_data
bl SEGGER_SEMIHOST_GetArgs
ldr R1, =__SEGGER_init_arg_data
bl APP_ENTRY_POINT // Call to application entry point (usually main())
bl exit // Call exit function
b . // If we unexpectedly return from exit, hang.
END_FUNC _start
#endif
//
#ifdef FULL_LIBRARY
/*********************************************************************
*
* exit
*
* Function description
* Exit of the system.
* Called on return from application entry point or explicit call
* to exit.
*
* Additional information
* In a hosted environment exit gracefully, by
* saving the return value,
* calling destructurs of global objects,
* calling registered atexit functions,
* and notifying the host/debugger.
*/
#undef L
#define L(label) .L_exit_##label
WEAK_FUNC exit
mov R5, R0 // Save the exit parameter/return result
//
// Call destructors
//
ldr R0, =__dtors_start__ // Pointer to destructor list
ldr R1, =__dtors_end__
L(Loop):
cmp R0, R1
beq L(End) // Reached end of destructor list? => Done
ldr R2, [R0] // Load current destructor address into R2
adds R0, R0, #4 // Increment pointer
push {R0-R1} // Save R0 and R1
blx R2 // Call destructor
pop {R0-R1} // Restore R0 and R1
b L(Loop)
L(End):
//
// Call atexit functions
//
bl __SEGGER_RTL_execute_at_exit_fns
//
// Call debug_exit with return result/exit parameter
//
mov R0, R5
//
// Entry points for _exit and _Exit, which terminate immediately.
// Note: Destructors and registered atexit functions are not called. File descriptors are not closed.
//
MARK_FUNC _exit
MARK_FUNC _Exit
bl SEGGER_SEMIHOST_Exit
//
// If execution is not terminated, loop forever
//
L(ExitLoop):
b L(ExitLoop) // Loop forever.
END_FUNC exit
#endif
#ifdef FULL_LIBRARY
.bss
.balign 4
__SEGGER_init_arg_data:
.space ARGSSPACE
.size __SEGGER_init_arg_data, .-__SEGGER_init_arg_data
.type __SEGGER_init_arg_data, %object
#endif
/*************************** End of file ****************************/

View File

@@ -0,0 +1,5 @@
<!DOCTYPE Board_Memory_Definition_File>
<root name="STM32F103ZE">
<MemorySegment name="FLASH1" start="0x08000000" size="0x00080000" access="ReadOnly" />
<MemorySegment name="RAM1" start="0x20000000" size="0x00010000" access="Read/Write" />
</root>

File diff suppressed because it is too large Load Diff

44
Ses/STM32F1xx_Target.js Normal file
View File

@@ -0,0 +1,44 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 2014 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* - Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
*********************************************************************/
function Reset() {
TargetInterface.resetAndStop();
}
function EnableTrace(traceInterfaceType) {
// TODO: Enable trace
}

288
Ses/SysCall.c Normal file
View File

@@ -0,0 +1,288 @@
/*********************************************************************
* (c) SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
Purpose : Implementation of low-level functions for I/O with the
SEGGER Runtime Library
using a UART (SEGGER's BSP UART module)
*/
/*********************************************************************
*
* #include section
*
**********************************************************************
*/
#include "__SEGGER_RTL_Int.h"
#include "stdio.h"
#include "Bsp.h"
/*********************************************************************
*
* Local types
*
**********************************************************************
*/
struct __SEGGER_RTL_FILE_impl { // NOTE: Provides implementation for FILE
int stub; // only needed so impl has size != 0.
};
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static FILE __SEGGER_RTL_stdin_file = { 0 }; // stdin reads from UART
static FILE __SEGGER_RTL_stdout_file = { 0 }; // stdout writes to UART
static FILE __SEGGER_RTL_stderr_file = { 0 }; // stderr writes to UART
static unsigned int _UART_Port = TTY_COM;
static int _stdin_ungot = EOF;
/*********************************************************************
*
* Public data
*
**********************************************************************
*/
FILE *stdin = &__SEGGER_RTL_stdin_file; // NOTE: Provide implementation of stdin for RTL.
FILE *stdout = &__SEGGER_RTL_stdout_file; // NOTE: Provide implementation of stdout for RTL.
FILE *stderr = &__SEGGER_RTL_stderr_file; // NOTE: Provide implementation of stderr for RTL.
void *__aeabi_read_tp(void) {
return 0; // 单线程环境下直接返回 0
}
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _stdin_getc()
*
* Function description
* Get character from standard input.
*
* Return value
* Character received.
*
* Additional information
* This function never fails to deliver a character.
*/
static char _stdin_getc(void) {
unsigned char c;
if (_stdin_ungot != EOF) {
c = _stdin_ungot;
_stdin_ungot = EOF;
} else {
c = UsartReceiveChar(_UART_Port);
}
return c;
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* RTL_UART_Init()
*
* Function description
* Initialize RTL to use given UART for stdio.
*
* Parameters
* Unit : UART unit number (typically zero-based).
* Baudrate : Baud rate to configure [Hz].
* NumDataBits: Number of data bits to use.
* Parity : One of the following values:
* * BSP_UART_PARITY_NONE
* * BSP_UART_PARITY_ODD
* * BSP_UART_PARITY_EVEN
* NumStopBits: Number of stop bits to use.
*
* Additional description
* Parameters are same as for BSP_UART_Init().
* This also sets appropriate RX and TX interrupt handlers.
*/
void RTL_UART_Init(unsigned int Unit, unsigned long Baudrate, unsigned char NumDataBits, unsigned char Parity, unsigned char NumStopBits) {
_UART_Port = Unit;
UsartStdConfig(_UART_Port, Baudrate);
}
/*********************************************************************
*
* __SEGGER_RTL_X_file_stat()
*
* Function description
* Get file status.
*
* Parameters
* stream - Pointer to file.
*
* Additional information
* Low-overhead test to determine if stream is valid. If stream
* is a valid pointer and the stream is open, this function must
* succeed. If stream is a valid pointer and the stream is closed,
* this function must fail.
*
* The implementation may optionally determine whether stream is
* a valid pointer: this may not always be possible and is not
* required, but may assist debugging when clients provide wild
* pointers.
*
* Return value
* < 0 - Failure, stream is not a valid file.
* >= 0 - Success, stream is a valid file.
*/
int __SEGGER_RTL_X_file_stat(FILE *stream) {
if (stream == stdin || stream == stdout || stream == stderr) {
return 0; // NOTE: stdin, stdout, and stderr are assumed to be valid.
} else {
return EOF;
}
}
/*********************************************************************
*
* __SEGGER_RTL_X_file_bufsize()
*
* Function description
* Get stream buffer size.
*
* Parameters
* stream - Pointer to file.
*
* Additional information
* Returns the number of characters to use for buffered I/O on
* the file stream. The I/O buffer is allocated on the stack
* for the duration of the I/O call, therefore this value should
* not be set arbitrarily large.
*
* For unbuffered I/O, return 1.
*
* Return value
* Nonzero number of characters to use for buffered I/O; for
* unbuffered I/O, return 1.
*/
int __SEGGER_RTL_X_file_bufsize(FILE *stream) {
(void)stream;
return 1;
}
/*********************************************************************
*
* __SEGGER_RTL_X_file_read()
*
* Function description
* Read data from file.
*
* Parameters
* stream - Pointer to file to read from.
* s - Pointer to object that receives the input.
* len - Number of characters to read from file.
*
* Return value
* >= 0 - Success, amount of data read.
* < 0 - Failure.
*
* Additional information
* Reading from any stream other than stdin results in an error.
*/
int __SEGGER_RTL_X_file_read(FILE *stream, char *s, unsigned len) {
int c;
if (stream == stdin) {
c = 0;
while (len > 0) {
*s = _stdin_getc();
++s;
++c;
--len;
}
} else {
c = EOF;
}
return c;
}
/*********************************************************************
*
* __SEGGER_RTL_X_file_write()
*
* Function description
* Write data to file.
*
* Parameters
* stream - Pointer to file to write to.
* s - Pointer to object to write to file.
* len - Number of characters to write to the file.
*
* Return value
* >= 0 - Success.
* < 0 - Failure.
*
* Additional information
* this version is NOT reentrant!
* stdout and stderr are directed to UART;
* writing to any stream other than stdout or stderr results in an error
*/
int __SEGGER_RTL_X_file_write(FILE *stream, const char *s, unsigned len) {
if ((stream == stdout) || (stream == stderr)) {
UsartSendStr(_UART_Port, (uint8_t* ) s, len);
return len;
} else {
return EOF;
}
}
/*********************************************************************
*
* __SEGGER_RTL_X_file_unget()
*
* Function description
* Push character back to stream.
*
* Parameters
* stream - Pointer to file to push back to.
* c - Character to push back.
*
* Return value
* >= 0 - Success.
* < 0 - Failure.
*
* Additional information
* Push-back is only supported for standard input, and
* only a single-character pushback buffer is implemented.
*/
int __SEGGER_RTL_X_file_unget(FILE *stream, int c) {
if (stream == stdin) {
if (c != EOF && _stdin_ungot == EOF) {
_stdin_ungot = c;
} else {
c = EOF;
}
} else {
c = EOF;
}
return c;
}
/*************************** End of file ****************************/