Andes Workshop

It is currently Sat Mar 30, 2024 12:22 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 如何將某個file的.bss獨立成放在某一段?
PostPosted: Fri Jul 13, 2012 6:29 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
假設有2個*.c檔,
他們產生的.bss要放在不同的位置,不要放在一起。
可以如下列的寫法。

Code:
MEMORY
{
  ROM (rwx) : ORIGIN = 0x1000, LENGTH = 0x1000
  RAM (rwx) : ORIGIN = 0x4000, LENGTH = 0x1000
}

SECTIONS
{
   .text : {
      foo.o (.text)
      * (.text)
   } AT>ROM

  .sbss_w1           :
  {
    foo.o (.sbss_w .sbss_w.*)
  } AT>ROM

  .sbss_w2           :
  {
    *(.sbss_w .sbss_w.*)
  } AT>RAM


}


附件是完整的example。
注意!要分開寫的foo.o (.text)必須要放在* (.text)的前面。
否則會* (.text)就包含了全部的.text,就不會把foo.o (.text)單獨置放。


Attachments:
test_ld.zip [4.76 KiB]
Downloaded 878 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 28 guests


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