導航:首頁 > 版本升級 > stvdmap文件分析

stvdmap文件分析

發布時間:2024-07-20 06:02:02

❶ stm8s stvd 怎麼看代碼大小

下載一個小工具

1、把解開後的size.exe復制到COSMICCXSTM8文件夾,就是你的COSMIC編譯工具里有cpstm8.exe的那個文件夾。
2、在SVTD的Project->settings中打開Post-Build選項卡,在commands的最後一行加入:size $(OutputPath)$(TargetSName).map
3、保存返回,編譯試試,最後會出現如:Program Size: Code=12470 Eeprom=0 ZeroPage=227 Ram=180的結果。


思路:


打開map文件,統計各段的長度,然後輸出。


主要代碼:

static void Main(string[] args)

{

StreamReader sr = new StreamReader(args[0]);

string[] s;

char[] charSeparators = new char[] { ' ' };


int code_size = 0;

int zeropage_size = 0;

int ram_size = 0;

int eeprom_size = 0;


for (int i = 0; i < 8; i++)

{

string s1 = sr.ReadLine();

}


while (true)

{

string s1 = sr.ReadLine();

s = s1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);

if(s.Length == 0)

{

break;

}

else if (s[7] == ".text" || s[7] == ".const" || s[7] == ".init")

{

code_size += int.Parse(s[5]);

}

else if (s[7] == ".eeprom")

{

eeprom_size += int.Parse(s[5]);

}

else if (s[7] == ".bsct," && s[8] == "initialized")

{

zeropage_size += int.Parse(s[5]);

}

else if (s[7] == ".ubsct" || s[7] == ".share")

{

zeropage_size += int.Parse(s[5]);

}

else if (s[7] == ".data," && s[8] == "initialized")

{

ram_size += int.Parse(s[5]);

}

else if (s[7] == ".bss")

{

ram_size += int.Parse(s[5]);

}

}

Console.WriteLine("");

//Program Size: Code=5056 RO-data=288 RW-data=68 ZI-data=1140

Console.WriteLine("Program Size: Code=" + code_size.ToString() + " Eeprom=" + eeprom_size.ToString() + " ZeroPage=" + zeropage_size.ToString() + " Ram=" + ram_size.ToString());

}

閱讀全文

與stvdmap文件分析相關的資料

熱點內容
cefs文件系統 瀏覽:404
學平面設計個編程哪個好 瀏覽:701
如何把編程文件轉為hex 瀏覽:80
清除蘋果地圖來自地址 瀏覽:233
已經打開的文件如何清理 瀏覽:685
視頻網站有什麼用 瀏覽:70
多個表格文件怎樣壓縮文件 瀏覽:729
cad文件大很卡如何解決 瀏覽:633
將java程序打包成apk 瀏覽:277
2021唱吧文件找不到了 瀏覽:463
華為p9手機文件管理 瀏覽:284
固定在工具欄的文件夾怎麼查找路徑 瀏覽:667
半條命2有幾個版本 瀏覽:333
電腦管家微信備份文件夾 瀏覽:826
ubuntu文件夾解鎖 瀏覽:34
網站多少錢一單 瀏覽:382
系統鏡像恢復找不到文件 瀏覽:255
進什麼網站 瀏覽:588
修改了配置文件代碼沒有讀出來 瀏覽:749
vss資料庫是什麼 瀏覽:899

友情鏈接