diff --git a/.settings/RT-GasFlowMeter.DAPLink.Debug.rttlaunch b/.settings/RT-GasFlowMeter.DAPLink.Debug.rttlaunch new file mode 100644 index 0000000..8532a04 --- /dev/null +++ b/.settings/RT-GasFlowMeter.DAPLink.Debug.rttlaunch @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index e964664..05d1960 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + diff --git a/.settings/projcfg.ini b/.settings/projcfg.ini index e529ce7..d5d2493 100644 --- a/.settings/projcfg.ini +++ b/.settings/projcfg.ini @@ -1,5 +1,5 @@ #RT-Thread Studio Project Configuration -#Mon Jul 14 08:03:29 CST 2025 +#Tue Jul 15 21:24:37 CST 2025 project_type=rtt chip_name=STM32H750XBHx cpu_name=None @@ -17,6 +17,6 @@ tool_chain=gcc uart_name=uart3 tx_pin_name=PD8 rtt_nano_path= -output_project_path=D\:/RT-ThreadStudio/workspace +output_project_path=D\:\\RT-ThreadStudio\\workspace hardware_adapter=DAP-LINK project_name=RTGasFlowMeter diff --git a/applications/main.c b/applications/main.c index f96807b..8a10965 100644 --- a/applications/main.c +++ b/applications/main.c @@ -43,7 +43,7 @@ static void led_thread_entry(void *parameter) { /* 切换 LED 状态 */ led_state = !led_state; - rt_pin_write(LED_PIN, led_state); + rt_pin_write(LED_PIN, !led_state); rt_pin_write(LED_PIN1, led_state); rt_pin_write(LED_PIN2, led_state); rt_thread_mdelay(200); @@ -57,6 +57,8 @@ static void led_thread_entry(void *parameter) rt_pin_write(LED_PIN1, !led_state); rt_pin_write(LED_PIN2, !led_state); rt_thread_mdelay(200); + + rt_kprintf("Numb \n",led_state); } } diff --git a/drivers/board.c b/drivers/board.c index ab56fcd..0fd2322 100644 --- a/drivers/board.c +++ b/drivers/board.c @@ -25,6 +25,7 @@ rt_weak void rt_hw_board_init() /* Set the shell console output device */ #if defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE) + /* 初始化串口驱动 */ rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif diff --git a/linkscripts/STM32H750XBHx/link.lds b/linkscripts/STM32H750XBHx/link.lds index ed55c9b..8fe29be 100644 --- a/linkscripts/STM32H750XBHx/link.lds +++ b/linkscripts/STM32H750XBHx/link.lds @@ -1,140 +1,138 @@ /* - * linker script for STM32H750XBHx with GNU ld + * STM32H750XBHx 的 GNU ld 链接脚本 */ -/* Program Entry, set to mark it as "used" and avoid gc */ +/* 程序入口点,设置为"used"避免被GC */ MEMORY { - ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128k /* 128K flash */ - RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */ + ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128k /* 128K 内部Flash */ + RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K SRAM */ } -ENTRY(Reset_Handler) -_system_stack_size = 0x400; +ENTRY(Reset_Handler) /* 入口点为复位处理函数 */ +_system_stack_size = 0x400; /* 系统栈大小=1KB */ SECTIONS { - .text : + .text : /* 代码段 */ { - . = ALIGN(4); - _stext = .; - KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); /* 4字节对齐 */ + _stext = .; /* 代码段起始地址 */ + KEEP(*(.isr_vector)) /* 保留中断向量表(必须放在开头) */ . = ALIGN(4); - *(.text) /* remaining code */ - *(.text.*) /* remaining code */ - *(.rodata) /* read-only data (constants) */ + *(.text) /* 程序代码 */ + *(.text.*) /* 程序子代码段 */ + *(.rodata) /* 只读数据(常量) */ *(.rodata*) - *(.glue_7) - *(.glue_7t) + *(.glue_7) /* ARM/Thumb胶合代码 */ + *(.glue_7t) /* Thumb/ARM胶合代码 */ *(.gnu.linkonce.t*) - /* section information for finsh shell */ + /* Finsh shell的符号表信息 */ . = ALIGN(4); - __fsymtab_start = .; - KEEP(*(FSymTab)) - __fsymtab_end = .; + __fsymtab_start = .; /* Finsh符号表起始 */ + KEEP(*(FSymTab)) /* 保留Finsh符号表 */ + __fsymtab_end = .; /* Finsh符号表结束 */ + /* 系统组件的符号表 */ . = ALIGN(4); - __vsymtab_start = .; - KEEP(*(VSymTab)) - __vsymtab_end = .; + __vsymtab_start = .; /* 组件符号表起始 */ + KEEP(*(VSymTab)) /* 保留组件符号表 */ + __vsymtab_end = .; /* 组件符号表结束 */ - /* section information for utest */ + /* utest测试框架的段信息 */ . = ALIGN(4); - __rt_utest_tc_tab_start = .; - KEEP(*(UtestTcTab)) - __rt_utest_tc_tab_end = .; + __rt_utest_tc_tab_start = .; /* utest测试用例表起始 */ + KEEP(*(UtestTcTab)) /* 保留测试用例表 */ + __rt_utest_tc_tab_end = .; /* utest测试用例表结束 */ - /* section information for at server */ + /* AT指令服务器的段信息 */ . = ALIGN(4); - __rtatcmdtab_start = .; - KEEP(*(RtAtCmdTab)) - __rtatcmdtab_end = .; + __rtatcmdtab_start = .; /* AT指令表起始 */ + KEEP(*(RtAtCmdTab)) /* 保留AT指令表 */ + __rtatcmdtab_end = .; /* AT指令表结束 */ . = ALIGN(4); - /* section information for initial. */ + /* RT-Thread初始化函数表 */ . = ALIGN(4); - __rt_init_start = .; - KEEP(*(SORT(.rti_fn*))) - __rt_init_end = .; + __rt_init_start = .; /* 初始化函数表起始 */ + KEEP(*(SORT(.rti_fn*))) /* 保留排序后的初始化函数指针 */ + __rt_init_end = .; /* 初始化函数表结束 */ . = ALIGN(4); - PROVIDE(__ctors_start__ = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE(__ctors_end__ = .); + /* C++构造函数表 */ + PROVIDE(__ctors_start__ = .); /* 构造函数表起始 */ + KEEP (*(SORT(.init_array.*))) /* 保留排序的构造函数 */ + KEEP (*(.init_array)) /* 保留普通构造函数 */ + PROVIDE(__ctors_end__ = .); /* 构造函数表结束 */ . = ALIGN(4); - _etext = .; - } > ROM = 0 + _etext = .; /* 代码段结束地址 */ + } > ROM = 0 /* 位于ROM区域,填充0 */ - /* .ARM.exidx is sorted, so has to go in its own output section. */ - __exidx_start = .; - .ARM.exidx : + /* .ARM.exidx 是已排序的,必须放在自己的输出段 */ + __exidx_start = .; /* ARM异常索引起始 */ + .ARM.exidx : /* ARM异常处理索引表 */ { *(.ARM.exidx* .gnu.linkonce.armexidx.*) - /* This is used by the startup in order to initialize the .data secion */ - _sidata = .; + /* 以下变量用于启动时初始化.data段 */ + _sidata = .; /* 初始化数据在ROM中的加载地址 */ } > ROM - __exidx_end = .; + __exidx_end = .; /* ARM异常索引结束 */ - /* .data section which is used for initialized data */ - - .data : AT (_sidata) + /* .data段 - 用于已初始化的数据 */ + .data : AT (_sidata) /* AT指定运行时加载地址 */ { . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _sdata = . ; + _sdata = . ; /* 数据段在RAM中的起始地址(运行时) */ - *(.data) + *(.data) /* 已初始化数据 */ *(.data.*) *(.gnu.linkonce.d*) - - PROVIDE(__dtors_start__ = .); - KEEP(*(SORT(.dtors.*))) - KEEP(*(.dtors)) - PROVIDE(__dtors_end__ = .); + /* C++析构函数表 */ + PROVIDE(__dtors_start__ = .); /* 析构函数表起始 */ + KEEP(*(SORT(.dtors.*))) /* 保留排序的析构函数 */ + KEEP(*(.dtors)) /* 保留普通析构函数 */ + PROVIDE(__dtors_end__ = .); /* 析构函数表结束 */ . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _edata = . ; - } >RAM + _edata = . ; /* 数据段在RAM中的结束地址(运行时) */ + } >RAM /* 位于RAM区域 */ - .stack : + .stack : /* 系统栈段 */ { . = ALIGN(4); - _sstack = .; - . = . + _system_stack_size; + _sstack = .; /* 栈起始地址 */ + . = . + _system_stack_size; /* 分配栈空间 */ . = ALIGN(4); - _estack = .; - } >RAM + _estack = .; /* 栈结束地址 */ + } >RAM /* 位于RAM区域 */ - __bss_start = .; - .bss : + __bss_start = .; /* BSS段起始标记 */ + .bss : /* 未初始化数据段 */ { . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; + _sbss = .; /* BSS段起始地址 */ - *(.bss) + *(.bss) /* 未初始化数据 */ *(.bss.*) - *(COMMON) + *(COMMON) /* 公共符号 */ . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _ebss = . ; + _ebss = . ; /* BSS段结束地址 */ - *(.bss.init) - } > RAM - __bss_end = .; + *(.bss.init) /* 特殊用途的BSS初始化段 */ + } > RAM /* 位于RAM区域 */ + __bss_end = .; /* BSS段结束标记 */ - _end = .; + _end = .; /* 程序内存结束标记 */ - /* Stabs debugging sections. */ + /* 以下为调试段,实际输出时不包含 */ + /* Stabs调试节 */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } @@ -142,19 +140,13 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } - /* DWARF debug sections. - * Symbols in the DWARF debugging sections are relative to the beginning - * of the section so we begin them at 0. */ - /* DWARF 1 */ + /* DWARF调试节 */ .debug 0 : { *(.debug) } .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } @@ -162,9 +154,8 @@ SECTIONS .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } -} +} \ No newline at end of file diff --git a/ngflowcal/Therm.c b/ngflowcal/Therm.c index 52a0c0d..3c19076 100644 --- a/ngflowcal/Therm.c +++ b/ngflowcal/Therm.c @@ -236,8 +236,8 @@ void Therm_CprCvrHS(Therm *therm, NGParSTRUCT *ptNGPar, Detail *detail) { Cvr = Cp - RGAS * (1.0 + ptNGPar->dTf * Cvinc * 0.5 * ptNGPar->dDf); double a = (ptNGPar->dZf + ptNGPar->dTf * detail->ddZdT); double b = (ptNGPar->dZf + ptNGPar->dDf * detail->ddZdD); - double dPdT = RGAS * ptNGPar->dDf * a; - double dPdD = RGAS * ptNGPar->dTf * b; + //double dPdT = RGAS * ptNGPar->dDf * a; + //double dPdD = RGAS * ptNGPar->dTf * b; Cpr = Cvr + RGAS * ((a * a) / b); Cpr /= ptNGPar->dMrx; diff --git a/rtconfig.h b/rtconfig.h index b55a2d9..dc5018c 100644 --- a/rtconfig.h +++ b/rtconfig.h @@ -48,7 +48,7 @@ #define RT_USING_DEVICE #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 -#define RT_CONSOLE_DEVICE_NAME "uart3" +#define RT_CONSOLE_DEVICE_NAME "uart2" #define RT_VER_NUM 0x50100 #define RT_BACKTRACE_LEVEL_MAX_NR 32 /* end of RT-Thread Kernel */ @@ -347,4 +347,6 @@ + #endif +