Andes Workshop

It is currently Mon Aug 19, 2019 3:00 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 減少code size或加快speed的gcc最佳化選項
PostPosted: Thu May 05, 2011 3:55 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
對於MCU的廠商來說,code size即為成本,所以每家MCU廠商努力將code size最小化,其中的技術很多,比如說用linker script做sections的overlay。
我分享一些最基本的gcc最佳化選項,最佳化code size或是使執行速度最快,請見附件的ppt檔案。如果您的code包含I/O讀寫不希望最佳化改變code,記得在code前面加上volatile的關鍵字。

裡面寫的sio_printf是一個function直接從UART把字串輸出。不要採用printf,因為它經過system call會造成較大的code size。

Attachment:
Advanced Programming Optimization.ppt [437.5 KiB]
Downloaded 829 times


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group