温湿度,风速风向更新时间设置为10min可控,可配置参数存储位置更换为内部flash末尾rank2 0x080F F800 - 0x080F FFFF

This commit is contained in:
95384 2024-11-08 16:31:22 +08:00
parent 68293fe710
commit 82330e7bc6
13 changed files with 187 additions and 133 deletions

View File

@ -4,12 +4,12 @@
/* 内部flash存储空间 */
/* page 31,one page 2k, 0x800F800-0x0800FFFF*/
/* page 511,one page 2k, 0x800F800-0x0800FFFF*/
#define STM32_INFLASH_PAGE_SIZE 2048
#define STM32_INFLASH_BASE 0x8000000 /* STM32 FLASH内部起始地址 */
#define STM32_INFLASH_SAVE_ADDR_BEGIN (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*31)
#define STM32_INFLASH_SAVE_ADDR_END (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*32-1)
#define STM32_INFLASH_SAVE_PAGE 31
#define STM32_INFLASH_SAVE_ADDR_BEGIN (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*511)
#define STM32_INFLASH_SAVE_ADDR_END (STM32_INFLASH_BASE+STM32_INFLASH_PAGE_SIZE*512-1)
#define STM32_INFLASH_SAVE_PAGE 511
typedef enum{
FLAG_SAVE_INFLASH_HEAD = 0x55,

View File

@ -466,7 +466,7 @@ void wind_task(void const * argument)
av_speed = 0;
av_angle = 0;
}
term_printf("x:%.2f y:%.2f win_speed %.2f m/s angle %.2f \r\n",av_speedx,av_speedy,av_speed,av_angle);
/// term_printf("x:%.2f y:%.2f win_speed %.2f m/s angle %.2f \r\n",av_speedx,av_speedy,av_speed,av_angle);
}
///term_printf("win_speed %.2f \r\n",weather_info.wind_velocity);
@ -653,12 +653,12 @@ void my_update_mcs_param(float new_wind_speed, float new_wind_dirction)
win_10min.speed_data[win_10min.index] = new_wind_speed; //添加新数据
win_10min.direction_data[win_10min.index] = new_wind_dirction;
if(win_10min.count < /* g_stConfigInfo.speed_average_time */ AVE_TIME)
if(win_10min.count < g_stConfigInfo.speed_average_time /*AVE_TIME*/)
{
win_10min.count++;
}
if(win_10min.count > /* g_stConfigInfo.speed_average_time */AVE_TIME){win_10min.count = AVE_TIME/* g_stConfigInfo.speed_average_time */;}
if(win_10min.count > g_stConfigInfo.speed_average_time/*AVE_TIME*/){win_10min.count = /*AVE_TIME*/g_stConfigInfo.speed_average_time;}
//计算10min风速滑动平均值
win_10min.ave_speed_data[win_10min.index] = sum(win_10min.speed_data, win_10min.count) / win_10min.count;
@ -691,17 +691,17 @@ void my_update_mcs_param(float new_wind_speed, float new_wind_dirction)
float temp_max_speed = win_10min.ave_speed_data[0];
//统计
for (int i = 0; i < win_10min.count; i++) {
if (win_10min.ave_direction_data[i] < temp_min_direction) {
temp_min_direction = win_10min.ave_direction_data[i]; // 更新风向最小值
if (win_10min.direction_data[i] < temp_min_direction) {
temp_min_direction = win_10min.direction_data[i]; // 更新风向最小值
}
if (win_10min.ave_direction_data[i] > temp_max_direction) {
temp_max_direction = win_10min.ave_direction_data[i]; // 更新风向最大值
if (win_10min.direction_data[i] > temp_max_direction) {
temp_max_direction = win_10min.direction_data[i]; // 更新风向最大值
}
if (win_10min.ave_speed_data[i] < temp_min_speed) {
temp_min_speed = win_10min.ave_speed_data[i]; // 更新风速最小值
if (win_10min.speed_data[i] < temp_min_speed) {
temp_min_speed = win_10min.speed_data[i]; // 更新风速最小值
}
if (win_10min.ave_speed_data[i] > temp_max_speed) {
temp_max_speed = win_10min.ave_speed_data[i]; // 更新风速最大值
if (win_10min.speed_data[i] > temp_max_speed) {
temp_max_speed = win_10min.speed_data[i]; // 更新风速最大值
}
}
@ -713,7 +713,7 @@ void my_update_mcs_param(float new_wind_speed, float new_wind_dirction)
g_stMcs_Para.average_wind_speed = win_10min.ave_speed_data[win_10min.index];
g_stMcs_Para.max_wind_speed = temp_max_speed;
win_10min.index = (win_10min.index + 1) % AVE_TIME; //更新索引
win_10min.index = (win_10min.index + 1) % /*AVE_TIME*/g_stConfigInfo.speed_average_time; //更新索引
}
void tem_hum_update_task(void const * argument)

View File

@ -24,7 +24,7 @@ void InFlash_Erase_Pages(u_int16_t PageBeginNum, u_int16_t NbPages)
FLASH_EraseInitTypeDef EraseInitStruct;
u_int32_t PAGEError = 0;
EraseInitStruct.Banks = FLASH_BANK_1;
EraseInitStruct.Banks = FLASH_BANK_2;
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.Page = PageBeginNum;
EraseInitStruct.NbPages = NbPages;

View File

@ -125,7 +125,7 @@ int main(void)
{
/* USER CODE BEGIN 1 */
Flash_EnableReadProtection();//¶Á±£»¤
// Flash_EnableReadProtection();//¶Á±£»¤
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/

View File

@ -84,7 +84,7 @@
</option>
<option>
<name>OCDynDriverList</name>
<state>CMSISDAP_ID</state>
<state>STLINK_ID</state>
</option>
<option>
<name>OCLastSavedByProductVersion</name>

View File

@ -786,7 +786,7 @@
</option>
<option>
<name>IlinkIcfFile</name>
<state>$PROJ_DIR$/stm32l496xx_flash.icf</state>
<state>$PROJ_DIR$\stm32l496xx_flash_app.icf</state>
</option>
<option>
<name>IlinkIcfFileSlave</name>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
</PlDriver>
<Jet>
<JetConnSerialNo>WCH CMSIS-DAP:1BEC8F06A0E4</JetConnSerialNo>
<JetConnSerialNo>WCH CMSIS-DAP:209E8F06A596</JetConnSerialNo>
<JetConnFoundProbes />
<PrevWtdReset>Connect during reset</PrevWtdReset>
<OnlineReset>Software</OnlineReset>
@ -26,11 +26,11 @@
<CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet>
</Jet>
<ArmDriver>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
</ArmDriver>
<DebugChecksum>
<Checksum>1421465675</Checksum>
<Checksum>3487728483</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
@ -50,8 +50,8 @@
<PowerConnectPC>1</PowerConnectPC>
</SWOManager>
<Disassembly>
<InstrCount>0</InstrCount>
<MixedMode>1</MixedMode>
<InstrCount>0</InstrCount>
</Disassembly>
<TerminalIO>
<InputSource>1</InputSource>
@ -68,10 +68,10 @@
<StLinkDriver>
<stlinkserialNo>0665FF323541483043141633</stlinkserialNo>
<stlinkfoundProbes />
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
</StLinkDriver>
<SWOTraceHWSettings>
<OverrideDefaultClocks>0</OverrideDefaultClocks>
@ -91,6 +91,36 @@
<ITMportsLogFile>0</ITMportsLogFile>
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
</SWOTraceHWSettings>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<ETMTraceWindow>
<PortWidth>4</PortWidth>
<PortMode>0</PortMode>
<CaptureDataValues>0</CaptureDataValues>
<CaptureDataAddresses>0</CaptureDataAddresses>
<CaptureDataRange>0</CaptureDataRange>
<DataFirst>0</DataFirst>
<DataLast>4294967295</DataLast>
<StopWhen>0</StopWhen>
<StallCPU>0</StallCPU>
<NoPCCapture>0</NoPCCapture>
</ETMTraceWindow>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
</Trace2>
<SWOTraceWindow>
<PcSampling>0</PcSampling>
<InterruptLogs>0</InterruptLogs>
<ForcedTimeStamps>0</ForcedTimeStamps>
<EventCPI>0</EventCPI>
<EventEXC>0</EventEXC>
<EventFOLD>0</EventFOLD>
<EventLSU>0</EventLSU>
<EventSLEEP>0</EventSLEEP>
</SWOTraceWindow>
<DataLog>
<GraphEnabled>0</GraphEnabled>
<LogEnabled>0</LogEnabled>
@ -122,6 +152,23 @@
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</EventLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<Aliases>
<A0>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Include\arm_math.h" ""</A0>
<A1>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Source\ComplexMathFunctions\arm_cmplx_mag_f32.c" ""</A1>
<A2>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Source\TransformFunctions\arm_rfft_fast_init_f32.c" ""</A2>
<Count>3</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>3</Mode>
@ -129,48 +176,4 @@
<Symbiont>0</Symbiont>
<Exclusions />
</DriverProfiling>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<ETMTraceWindow>
<PortWidth>4</PortWidth>
<PortMode>0</PortMode>
<CaptureDataValues>0</CaptureDataValues>
<CaptureDataAddresses>0</CaptureDataAddresses>
<CaptureDataRange>0</CaptureDataRange>
<DataFirst>0</DataFirst>
<DataLast>4294967295</DataLast>
<StopWhen>0</StopWhen>
<StallCPU>0</StallCPU>
<NoPCCapture>0</NoPCCapture>
</ETMTraceWindow>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
</Trace2>
<SWOTraceWindow>
<ForcedPcSampling>0</ForcedPcSampling>
<ForcedInterruptLogs>0</ForcedInterruptLogs>
<ForcedItmLogs>0</ForcedItmLogs>
<EventCPI>0</EventCPI>
<EventEXC>0</EventEXC>
<EventFOLD>0</EventFOLD>
<EventLSU>0</EventLSU>
<EventSLEEP>0</EventSLEEP>
</SWOTraceWindow>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings>

View File

@ -14,30 +14,18 @@
"--device=STM32L496RG"
"--multicore_nr_of_cores=1"
"--jet_probe=cmsisdap"
"--jet_standard_reset=9,0,0"
"--reset_style=\"0,-,0,Disabled__no_reset_\""
"--reset_style=\"1,-,0,Software\""
"--reset_style=\"2,-,0,Hardware\""
"--reset_style=\"3,-,0,Core\""
"--reset_style=\"4,-,0,System\""
"--reset_style=\"9,ConnectUnderReset,1,Connect_during_reset\""
"--drv_interface=SWD"
"--drv_interface_speed=100"
"--stlink_reset_strategy=0,2"
"--drv_swo_clock_setup=80000000,0,2000000"
"--drv_catch_exceptions=0x000"
"--drv_debug_ap=0"
"--stlink_probe=stlinkv2"

View File

@ -1,6 +1,6 @@
"D:\Program Files\IAR Systems\arm\bin\armPROC.dll"
"D:\Program Files\IAR Systems\arm\bin\armJET.dll"
"D:\Program Files\IAR Systems\arm\bin\armSTLINK.dll"
"E:\Y\IAR\micro_climate\EWARM\micro_climate\Exe\micro_climate.out"

View File

@ -38,4 +38,7 @@ place in RAM_region { readwrite,
block CSTACK, block HEAP };
place in SRAM1_region { };
place in SRAM2_region { };
/**** keep { section FSymTab };
keep { section VSymTab }; */

View File

@ -0,0 +1,40 @@
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08042000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08042000;
define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2004FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x6000;
define symbol __ICFEDIT_size_heap__ = 0x2000;
/**** End of ICF editor section. ###ICF###*/
define symbol __region_SRAM1_start__ = 0x20000000;
define symbol __region_SRAM1_end__ = 0x2003FFFF;
define symbol __region_SRAM2_start__ = 0x20040000;
define symbol __region_SRAM2_end__ = 0x2004FFFF;
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define region SRAM1_region = mem:[from __region_SRAM1_start__ to __region_SRAM1_end__];
define region SRAM2_region = mem:[from __region_SRAM2_start__ to __region_SRAM2_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };
place in SRAM1_region { };
place in SRAM2_region { };