• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users




(1) 2 »


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#11
初級會員
初級會員


查看用戶資訊
我該如何將命令加到我的asm source code中定義位址呢?

真是不好意思~請不吝解答,謝謝版大~

--------------------------------------------------

我還是用我原來的方法好了,這個有機會再學~謝謝版大。

發表於: 2008/3/26 20:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#10
版主
版主


查看用戶資訊
int __attribute__ ((address(0x1000))) Mabonga = 1;

是說用 _ _ Attribute __((address(0x1000))) 將變數或查表資料強制放在位址 0x1000 的地方。用的就是 (address )的屬性宣告。

發表於: 2008/3/26 17:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#9
初級會員
初級會員


查看用戶資訊
目前用笨方法~就是用 .word 0xFFFF 把記憶區塊擠到1c00以後,但總覺得不太專業~ :p

發表於: 2008/3/26 15:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#8
初級會員
初級會員


查看用戶資訊
好像不好設定耶~ 如果我要定義一區塊叫"FLASH"在0x1C00-0x1FFE...
1.在程式碼新增
int __attribute__((__section__(".flash"))) PrintString(const char *s); (我要怎麼改寫為組合語言)
2.在LINK檔中新增
.flash 0x1C00 :
{ *(.flash); } >program
3.在程式碼中,直接下 ".flash"就能指定到我設定的區域嗎?

發表於: 2008/3/26 11:17
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#7
版主
版主


查看用戶資訊
User's Guide 有說明 :
Likewise, to locate variable Mabonga at address 0x1000 in data memory:
int __attribute__ ((address(0x1000))) Mabonga = 1; Another way to locate code or data is by placing the function or variable into a user-defined section, and specifying the starting address of that section in a custom linker script. This is done as follows: Modify the code or data declaration in the C source to specify a user-defined section. Add the user-defined section to a custom linker script file to specify the starting address of the section. For example, to locate the function PrintString at address 0x8000 in program memory, first declare the function as follows in the C source: int __attribute__((__section__(".myTextSection"))) PrintString(const char *s); The section attribute specifies that the function should be placed in a section named .myTextSection, rather than the default .text section. It does not specify where the user-defined section is to be located. That must be done in a custom linker script, as follows. Using the device-specific linker script as a base, add the following section definition: .myTextSection 0x8000 : { *(.myTextSection); } >program This specifies that the output file should contain a section named .myTextSection starting at location 0x8000 and containing all input sections named.myTextSection. Since, in this example, there is a single function PrintString in that section, then the function will be located at address 0x8000 in program memory. Similarly, to locate the variable Mabonga at address 0x1000 in data memory, first declare the variable as follows in the C source: int __attribute__((__section__(".myDataSection"))) Mabonga = 1; The section attribute specifies that the function should be placed in a section named .myDataSection, rather than the default .data section. It does not specify where the user-defined section is to be located. Again, that must be done in a custom linker script, as follows. Using the device-specific linker script as a base, add the following section definition: .myDataSection 0x1000 : { *(.myDataSection); } >data This specifies that the output file should contain a section named.myDataSection starting at location 0x1000 and containing all input sections named.myDataSection. Since, in this example, there is a single variable Mabonga in that section, then the variable will be located at address 0x1000 in data memory.

發表於: 2008/3/26 9:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#6
初級會員
初級會員


查看用戶資訊
豁出去了,我打算保留512指令字元在程式最後區段1C00-1FFF來存我需要存的幾個參數,清掉也沒關係,可以從ram載入。

新問題,我要如何將要記憶的參數定義於程式區段1C00-1FFF?
麻煩版大幫我解答,謝謝~

問題兒童,請多包涵~

發表於: 2008/3/26 9:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#5
版主
版主


查看用戶資訊
如果要儲存一個被 Erase 的 Image,那就麻煩了。如果是要更新程式而不用管舊的內容值那就簡單多了。在這小IC裡要模擬 EEPROM 的話就有諸多限制,可否考慮用外加的 SPI (25LCxx) 或 I2C (24LCxx) 的串列型 EEPROM。這些 EEPROM 的價格爛到不行了。

發表於: 2008/3/26 8:58
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#4
初級會員
初級會員


查看用戶資訊
算錯 512指令字元=1536 bytes 這顆cpu好像只有1024byte RAM,是不是根本沒機會~ >"<

發表於: 2008/3/25 21:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#3
初級會員
初級會員


查看用戶資訊
感謝版大解答,不過真糟糕,我都用組合寫,因為能節省程式碼,若ROM夠大,才會考慮用C寫。
我的新問題,ERASE FLASH最小區塊為512指令字元,沒辦法更小嗎,512指令字元,我必須以768位元組來做IMAGE,很恐怖吧,24HJ12GP202這顆這麼小,這一清,佔了1/8程式碼,會要了它的命,請問版大,有好的方法嗎? 謝謝~
nvmcon=0x404f =>清除0000~1FFE
nvmcon=0x4042 =>清除page(512指令字元)

發表於: 2008/3/25 20:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問24HJ12GP202如何把FLASH當EEPROM用?
#2
版主
版主


查看用戶資訊
http://www.microchip.com/Stellent/idc ... eId=1824&appnote=en530593

AN1095 參考一下。不過是用c30寫的。

發表於: 2008/3/25 15:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------