更新内存占用

This commit is contained in:
许晟昊 2024-11-27 12:35:30 +08:00
parent 2c4a2ab0f4
commit b457eb5bc2
8 changed files with 19 additions and 1432 deletions

View File

@ -1,77 +0,0 @@
// File: STM32L4x5_4x6.dbgconf
// Version: 1.0.0
// Note: refer to STM32L4x5 and STM32L4x6 Reference manual (RM0351)
// refer to STM32L475xx STM32L476xx STM32L486xx STM32L496xx STM32L4A6xx datasheets
// <<< Use Configuration Wizard in Context Menu >>>
// <h> Debug MCU configuration register (DBGMCU_CR)
// <o.2> DBG_STANDBY <i> Debug Standby mode
// <o.1> DBG_STOP <i> Debug Stop mode
// <o.0> DBG_SLEEP <i> Debug Sleep mode
// </h>
DbgMCU_CR = 0x00000007;
// <h> Debug MCU APB1 freeze register1 (DBGMCU_APB1FZR1)
// <i> Reserved bits must be kept at reset value
// <o.31> DBG_LPTIM1_STOP <i> LPTIM1 counter stopped when core is halted
// <o.26> DBG_CAN2_STOP <i> bxCAN2 stopped when core is halted
// <o.25> DBG_CAN1_STOP <i> bxCAN1 stopped when core is halted
// <o.23> DBG_I2C3_STOP <i> I2C3 SMBUS timeout counter stopped when core is halted
// <o.22> DBG_I2C2_STOP <i> I2C2 SMBUS timeout counter stopped when core is halted
// <o.21> DBG_I2C1_STOP <i> I2C1 SMBUS timeout counter stopped when core is halted
// <o.12> DBG_IWDG_STOP <i> Independent watchdog counter stopped when core is halted
// <o.11> DBG_WWDG_STOP <i> Window watchdog counter stopped when core is halted
// <o.10> DBG_RTC_STOP <i> RTC counter stopped when core is halted
// <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
// <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
// <o.3> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
// <o.2> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
// <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
// <o.0> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
// </h>
DbgMCU_APB1_Fz1 = 0x00000000;
// <h> Debug MCU APB1 freeze register 2 (DBGMCU_APB1FZR2)
// <i> Reserved bits must be kept at reset value
// <o.5> DBG_LPTIM2_STOP <i> LPTIM2 counter stopped when core is halted
// <o.1> DBG_I2C4_STOP <i> I2C4 SMBUS timeout counter stopped when core is halted
// </h>
DbgMCU_APB1_Fz2 = 0x00000000;
// <h> Debug MCU APB2 freeze register (DBGMCU_APB2FZR)
// <i> Reserved bits must be kept at reset value
// <o.18> DBG_TIM17_STOP <i> TIM17 counter stopped when core is halted
// <o.17> DBG_TIM16_STOP <i> TIM16 counter stopped when core is halted
// <o.16> DBG_TIM15_STOP <i> TIM15 counter stopped when core is halted
// <o.13> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
// <o.11> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
// </h>
DbgMCU_APB2_Fz = 0x00000000;
// <h> TPIU Pin Routing (TRACECLK fixed on Pin PE2)
// <i> TRACECLK: Pin PE2
// <o1> TRACED0
// <i> ETM Trace Data 0
// <0x00040003=> Pin PE3
// <0x00020001=> Pin PC1
// <o2> TRACED1
// <i> ETM Trace Data 1
// <0x00040004=> Pin PE4
// <0x0002000A=> Pin PC10
// <o3> TRACED2
// <i> ETM Trace Data 2
// <0x00040005=> Pin PE5
// <0x00030002=> Pin PD2
// <o4> TRACED3
// <i> ETM Trace Data 3
// <0x00040006=> Pin PE6
// <0x0002000C=> Pin PC12
// </h>
TraceClk_Pin = 0x00040002;
TraceD0_Pin = 0x00040003;
TraceD1_Pin = 0x00040004;
TraceD2_Pin = 0x00040005;
TraceD3_Pin = 0x00040006;
// <<< end of configuration section >>>

File diff suppressed because one or more lines are too long

View File

@ -464,12 +464,10 @@ void app_init(void)
noinit_data.rest_flag = 0xFFFF; noinit_data.rest_flag = 0xFFFF;
} }
} }
key_init(); // 按键初始化 key_init(); // 按键初始化
diagnosis_init(); // 诊断模块初始化 diagnosis_init(); // 诊断模块初始化
params_init(); // 参数初始化 params_init(); // 参数初始化
if (noinit_data.rest_flag != NOINIT_NORESET_FLAG) if (noinit_data.rest_flag != NOINIT_NORESET_FLAG)
{ {
noinit_data.rest_flag = NOINIT_NORESET_FLAG; // 复位标志位 noinit_data.rest_flag = NOINIT_NORESET_FLAG; // 复位标志位

View File

@ -33,7 +33,10 @@ static void mode_autoload_change(uint16_t autoload)
*/ */
static void mode_params_save_cb(void) static void mode_params_save_cb(void)
{ {
storage_write_all(mode_params_storage, (uint8_t *)&mode_params); if (mode_params_storage != NULL)
{
storage_write_all(mode_params_storage, (uint8_t *)&mode_params);
}
} }
/** /**

View File

@ -170,19 +170,25 @@ void params_init(void)
osel_memset((uint8_t *)&rt_data, 0, sizeof(real_time_data_t)); osel_memset((uint8_t *)&rt_data, 0, sizeof(real_time_data_t));
wl_flash_read(&wl_flash_board_data, (uint8_t *)&board_data, sizeof(board_data_t)); wl_flash_read(&wl_flash_board_data, (uint8_t *)&board_data, sizeof(board_data_t));
rt_data.mem_percent = my_mem_perused(SRAMIN);
// 存储地址映射 // 存储地址映射
{ {
calib_param_storage_init(CALIB_PARAM_ADDRESS_START); calib_param_storage_init(CALIB_PARAM_ADDRESS_START);
rt_data.mem_percent = my_mem_perused(SRAMIN);
mode_params_storage_init(MODE_PARAMS_ADDRESS_START); mode_params_storage_init(MODE_PARAMS_ADDRESS_START);
rt_data.mem_percent = my_mem_perused(SRAMIN);
specification_table_data_storage_init(SPECIFICATION_TABLE_DATA_ADDRESS_START); specification_table_data_storage_init(SPECIFICATION_TABLE_DATA_ADDRESS_START);
rt_data.mem_percent = my_mem_perused(SRAMIN);
hart_attribute_storage_init(HART_PARAMS_ADDRESS_START); // HART参数存储初始化 hart_attribute_storage_init(HART_PARAMS_ADDRESS_START); // HART参数存储初始化
hart_variable_storage_init(HART_VARIABLE_ADDRESS_START); // HART变量存储初始化 rt_data.mem_percent = my_mem_perused(SRAMIN);
hart_constant_storage_init(HART_CONSTANT_ADDRESS_START); // HART常量存储初始化 hart_variable_storage_init(HART_VARIABLE_ADDRESS_START); // HART变量存储初始化
rt_data.mem_percent = my_mem_perused(SRAMIN);
hart_constant_storage_init(HART_CONSTANT_ADDRESS_START); // HART常量存储初始化
rt_data.mem_percent = my_mem_perused(SRAMIN);
hart_standard_variable_storage_init(HART_STANDARD_VARIABLE_ADDRESS_START); // HART标准变量存储初始化 hart_standard_variable_storage_init(HART_STANDARD_VARIABLE_ADDRESS_START); // HART标准变量存储初始化
} }
rt_data.mem_percent = my_mem_perused(SRAMIN);
if (board_data.app_preload_flag != APP_PRELOAD_FLAG) if (board_data.app_preload_flag != APP_PRELOAD_FLAG)
{ {
params_restart(PARAMS_RESET_CALIB_PARAM); params_restart(PARAMS_RESET_CALIB_PARAM);
@ -609,7 +615,7 @@ static void restart_udevice(void)
// 定位器软件版本号 // 定位器软件版本号
udevice.dev_sw_version = SW_VER; udevice.dev_sw_version = SW_VER;
// 定位器输出模式 // 定位器输出模式
udevice.dev_algorithm_mode = MODE_VARIABLE_FREQUENCY_CONTROL_ALGORITHM; udevice.dev_algorithm_mode = MODE_FREQUENCY_DOMAIN_CONTROL_ALGORITHM;
// 定位器型号 // 定位器型号
udevice.dev_model = POSITIONER_MODEL_GPS2000; udevice.dev_model = POSITIONER_MODEL_GPS2000;
// 阀门类型:直行程/角行程 TRAVEL_TYPE_STRAIGHT/TRAVEL_TYPE_ANGULAR // 阀门类型:直行程/角行程 TRAVEL_TYPE_STRAIGHT/TRAVEL_TYPE_ANGULAR

View File

@ -125,7 +125,6 @@ void hart_variable_storage_init(uint32_t base_addr)
DBG_ASSERT(hart_variable_storage != NULL __DBG_LINE); DBG_ASSERT(hart_variable_storage != NULL __DBG_LINE);
hart_variable_storage->ops.read = eeprom_fm24_read; hart_variable_storage->ops.read = eeprom_fm24_read;
hart_variable_storage->ops.write = eeprom_fm24_write; hart_variable_storage->ops.write = eeprom_fm24_write;
storage_add_node(hart_variable_storage, DIN_ANALOG_INPUT, sizeof(hart_device_variable_t)); storage_add_node(hart_variable_storage, DIN_ANALOG_INPUT, sizeof(hart_device_variable_t));
storage_add_node(hart_variable_storage, DIN_INTERNAL_TEMPERATURE, sizeof(hart_device_variable_t)); storage_add_node(hart_variable_storage, DIN_INTERNAL_TEMPERATURE, sizeof(hart_device_variable_t));
storage_add_node(hart_variable_storage, DIN_PRESSURE_PORT_A, sizeof(hart_device_variable_t)); storage_add_node(hart_variable_storage, DIN_PRESSURE_PORT_A, sizeof(hart_device_variable_t));

View File

@ -14,12 +14,12 @@
#define SRAMBANK 2 // 定义支持的SRAM块数. 精英版实际上只支持1个内存区域,即内部内存. #define SRAMBANK 2 // 定义支持的SRAM块数. 精英版实际上只支持1个内存区域,即内部内存.
// mem1内存参数设定.mem1完全处于内部SRAM里面.(设置内部SARM的内存池和内存表的参数) // mem1内存参数设定.mem1完全处于内部SRAM里面.(设置内部SARM的内存池和内存表的参数)
#define MEM1_BLOCK_SIZE 32 // 一个内存块大小为32字节 #define MEM1_BLOCK_SIZE 8 // 一个内存块大小为32字节
#define MEM1_MAX_SIZE 20 * 1024 // 最大管理内存 1K (我们这个内存管理系统的内部SRAM可控制的内存大小) #define MEM1_MAX_SIZE 25 * 1024 // 最大管理内存 1K (我们这个内存管理系统的内部SRAM可控制的内存大小)
#define MEM1_ALLOC_TABLE_SIZE MEM1_MAX_SIZE / MEM1_BLOCK_SIZE // 内存表大小(有多少块内存块) #define MEM1_ALLOC_TABLE_SIZE MEM1_MAX_SIZE / MEM1_BLOCK_SIZE // 内存表大小(有多少块内存块)
// mem2内存参数设定.mem2的内存池处于外部SRAM里面 // mem2内存参数设定.mem2的内存池处于外部SRAM里面
#define MEM2_BLOCK_SIZE 32 // 一个内存块大小为32字节 #define MEM2_BLOCK_SIZE 8 // 一个内存块大小为32字节
#define MEM2_MAX_SIZE 20 * 1024 // 因为精英版没有外扩内存,故这里设置一个最小值 #define MEM2_MAX_SIZE 20 * 1024 // 因为精英版没有外扩内存,故这里设置一个最小值
#define MEM2_ALLOC_TABLE_SIZE MEM2_MAX_SIZE / MEM2_BLOCK_SIZE // 内存表大小 #define MEM2_ALLOC_TABLE_SIZE MEM2_MAX_SIZE / MEM2_BLOCK_SIZE // 内存表大小

Binary file not shown.