当前位置: 首页 > wzjs >正文

服务行业网站建设app开发用什么软件

服务行业网站建设,app开发用什么软件,ppt做的比较好的网站有哪些,网店美工招聘信息自动化生成配置的.h .c文件 在开发中,有些需求参数是客户提供的,并且常常增加更新,汽车控制域开发中经常采集各通道上的CAN。可以用python脚本的模板库自动生成对应cfg.h cfg.c文件 from openpyxl import load_workbook import warnings war…

自动化生成配置的.h .c文件

   在开发中,有些需求参数是客户提供的,并且常常增加更新,汽车控制域开发中经常采集各通道上的CAN。可以用python脚本的模板库自动生成对应cfg.h cfg.c文件

from openpyxl import load_workbook
import warnings
warnings.filterwarnings("ignore", category=UserWarning, module="openpyxl")
from mako.template import Template
from datetime import datetime# 获取当前时间
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")# 创建Mako模板
template_str = """
/** 文件名: str_cfg.c* 生成时间: ${current_time}* 作者: wl*/
#ifndef _STR_CFG_H_
#define _STR_CFG_H_#include <stdint.h>// 定义结构体
typedef struct {const char* name;const uint6_t value;
} StrCfg;// 定义结构体数组
StrCfg str_cfg_array[] = {
% for index,(name, value) in enumerate(data_list):<% sapcenum =  " " *(25-len(name)-len(str(value))) %> \{"${name}",  ${sapcenum}  ${value}},                    /* index:${index}, ${name},${value} */
% endfor<% sapcenum =  " " *(25-len("NULL")-4) %> \{NULL,       ${sapcenum}  0}
};<%  total_sum_befor = 0 %> 
<%  total_sum_update = 0 %>   // 计算宏的值
%  for index,(name, value) in enumerate(data_list):    <% total_sum_update = int(value) + total_sum_befor %>   \/* ${total_sum_update}  =  ${value} + ${total_sum_befor}  */ \<% total_sum_befor = total_sum_update %>       
% endfor#define STR_CFG_ARRAY_SIZE (${total_sum_update}u)#endif
"""# Press the green button in the gutter to run the script.
if __name__ == '__main__':workbook = load_workbook('./SmartMi V23 VCCM BigData_Upload_Cfg.xlsx')# wb.get_sheet_names()# Select the worksheetworksheet = workbook['Upload_Config']# 创建一个列表来存储结构体变量data_list = []# 遍历列D和列H,从第二行开始for row in worksheet.iter_rows(min_row=2, values_only=True):column_d_value = row[3]column_e_value = row[7]# 将列D和列H的数据作为一个元组添加到列表中data_list.append((column_d_value, column_e_value))# 打印结构体变量的内容# print(f"Column D: {column_d_value}, Column E: {column_e_value}")for index, (msgname, msglen) in enumerate(data_list):print(f"Index: {index}, Msgname: {msgname}, Msglen: {msglen}")# 计算宏的值# macro_value = sum(int(value) for _, value in data_list)#print(macro_value)# 使用Mako渲染模板rendered_c_code = Template(template_str).render(current_time=current_time,data_list=data_list)# 将渲染后的C代码写入文件with open('str_cfg.c', 'w') as f:f.write(rendered_c_code)

上面的脚本主要采集excel脚本中对应的列内容,自动填充到str_cfg.c的结构体中并做一些必要的运算。可以省去大部分重复工作

自动化生成MCU RAM FLASH占用空间

下面截图是MCU生成ELF后的map文件,用python统计其各个section的占比,以及RAM FLash的占用量

 

#Configuration
INPUT_MAP_FILE = 'path/to/your_map_file.map'  #Update with your actual map file path
OUTPUT_REPORT_FILE = 'memory_report.md'   #Output report file namedef parse_map_file(map_file)sections = {'RAM': [],'Local RAM': [],'Flash': [],}ram_total_bytes = 0local_ram_total_bytes = 0flash_total_bytes = 0with open(map_file,'r') as f:lines = f.readlines()start_parsing = Falseheader_found = Falsefor line in linesline = line.strip()if 'Image Summary' in line:start_parsing = Truecontinueif start_parsing and not header_found:if 'Section' in line and 'Base' in line and 'Size(hex)' in line and 'Size(dec)' in line:header_found = Truecontinueif header_found:if not line or line.startswith('\x0c'):break;parts = line.split()if len(parts) < 5:continuesection_name = parts[0]if '.debug' in section_name:continuebase = parts[1]try:size_dec = int(parts[1])except (ValueError, IndexError):continueif size_dec = 0;continuebase_prefinx = base[2].lower()if base_prefix == 'fe':sectine_type = 'RAM'ram_total_bytes += size_decsection['RAM'].append({'name':section_name, 'size_kb':size_dec/1024})elif base_prefix == 'fd':sectine_type = 'Local RAM'local_ram_total_bytes += size_decsection['LocalRAM'].append({'name':section_name, 'size_kb':size_dec/1024})elif base_prefix == '00':section_type = 'Flash'flash_total_bytes += size_decsection['Flash'].append({'name':section_name, 'size_kb':size_dec/1024})else:continuetotals = {'RAM': ram_total_bytes / 1024,'Local Ram':local_ram_total_bytes / 1024,'Flash': flash_total_bytes / 1024}return sections,totalsdef generate_markdown_report(sections,totals,output_file):with open(output_file,'w') as ff.write('## Memory Usage Report\n\n')f.write('## Summary\n\n') f.write(f"- **RAM**: {totals['RAM']:.2f} KB\n")f.write(f"- **Local RAM**: {totals['Local RAM']:.2f} KB\n")f.write(f"- **Flash RAM**: {totals['Flash']:.2f} KB\n")  for section_type in ['RAM','Local RAM','Flash']entries = section[section_type]if not entries:continuesorted_entries = sorted(entries,key=lambda x:-x['size_kb'])f.write(f"## {section_type} Details\n\n") f.write(f"| Section Name | Size (KB)\n")f.write(f"| ---------|--------------\n")  for entry in sorted_entries:f.write(f"| {entry['name']} | {entry['size_kb']:.2f} |\n") f.write("\\n");if __name__ == "__main__"section,totals = parse_map_file(INPUT_MAP_FILE)print(f"Total RAM Usage:{totals['RAM']:.2f} KB")print(f"Total LOCAL RAM Usage:{totals['Local RAM']:.2f} KB")print(f"Total Flash Usage:{totals['Flash']:.2f} KB")generate_markdown_report(section,totals,OUTPUT_REPORT_FILE)print(f"\n Repot generated successfully: {OUTPUT_REPORT_FILE}")

http://www.dtcms.com/wzjs/384324.html

相关文章:

  • 重庆忠县网站建设公司常见的网络营销手段
  • 学校网站建设项目可行性分析报告引流推广软件
  • 专门做ppt的网站产品怎么做推广和宣传
  • 京东怎么做不同网站同步登陆的青岛百度推广优化怎么做的
  • 营销型网站是什么百度搜索排行榜风云榜
  • 海口网站自助建站发软文是什么意思
  • 做百度网站优化多少钱廊坊seo
  • 锦州做网站的个人昆明网络营销公司哪家比较好
  • 前端页面设计网站易观数据app排行
  • 网站竞品拦截广告怎么做搜索引擎优化中的步骤包括
  • 卢湾专业网站优化公司厦门seo排名公司
  • 在线分析网站深圳网络营销软件
  • 做网站上传照片的尺寸seo关键词推广怎么做
  • 专门做诺丽果的网站手游推广代理平台有哪些
  • 移动端网站欣赏提高工作效率图片
  • 做网站要多少钱汉狮seo云优化外包
  • 做炫光素材的网站友好链接
  • ico加网站各网站收录
  • 双流区规划局建设局网站2023新闻大事件摘抄
  • 营销型网站重要特点是?百度有什么办法刷排名
  • window2008 网站建设北京做网站推广
  • 做外贸怎么看外国网站自己如何做链接推广
  • 怎样自己做卖商品的网站百度推广登录平台网址
  • 徐家汇网站建设2022年国际十大新闻
  • 装修公司网站用的织梦网络营销的优势与不足
  • 网站建设合同缴印花税竞价排名什么意思
  • 工业设计网站哪个最教育培训网站设计
  • 10有免费建网站西地那非片能延时多久
  • 深圳专业建网站多少钱制作公司网站的公司
  • 南宁做网站的有几家搜索软件使用排名