• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: 關於用Address來存取Ram的內容
#2
管理員
管理員


查看用戶資訊
RAM的存取就像範例那樣沒錯,
但是在LinkScript中定義的範圍是ARM core跑程式的使用區, 直接去存取都會遭遇不可預期的Hard Fault,
如果你要建立一塊自己的SRAM區域時, 建議避開LinkScript中指定的範圍,
\src\config\sam_e54_xpro\ATSAME54P20A.ld
MEMORY
{
  
rom (LRX) : ORIGIN ROM_ORIGINLENGTH ROM_LENGTH
  ram 
(WX!R) : ORIGIN RAM_ORIGINLENGTH RAM_LENGTH
  tcm 
(WX) : ORIGIN TCM_ORIGINLENGTH __XC32_TCM_LENGTH
  config_00804000 
ORIGIN 0x00804000LENGTH 0x4
  config_00804008 
ORIGIN 0x00804008LENGTH 0x4
  config_00804004 
ORIGIN 0x00804004LENGTH 0x4
}


由於Bootloader的APP SRAM的區域是在Properties中自定義的, 所以這個範例來看就是
-DRAM_ORIGIN=0x20000010, -DRAM_LENGTH=0x3fff0

這區域是程式的使用區, 直接存取不當會Fault,

如果真的要透過直接記憶體存取, 來查看程式中某個全域或是靜態變數的記憶體值,
就需要去看編譯後的MAP file, 找到該變數的記憶體地址,
\test_app\firmware\sam_e54_xpro.X\dist\sam_e54_xpro\production\sam_e54_xpro.X.production.map

比如, appData.state 這個狀態機的狀態, 記憶體位址是0x2000027c
.bss.appData 0x2000027c 0x1 1

或是在Debug狀態下, 暫停時, 用X IDE的 \Window\Target Memory Views\Data Memory也可以查看

發表於: 2021/7/17 12:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於用Address來存取Ram的內容
#1
資深會員
資深會員


查看用戶資訊
在Bootloader APP中有一段程式是

#define BTL_TRIGGER_PATTERN (0x5048434DUL)
#define BTL_TRIGGER_RAM_START  0x20000000U
static uint32_t *ramStart = (uint32_t *) BTL_TRIGGER_RAM_START;

                
ramStart[0] = BTL_TRIGGER_PATTERN;
                
ramStart[1] = BTL_TRIGGER_PATTERN;
                
ramStart[2] = BTL_TRIGGER_PATTERN;
                
ramStart[3] = BTL_TRIGGER_PATTERN;
                
DCACHE_CLEAN_BY_ADDR(ramStart16);
                
NVIC_SystemReset();


功能應該是在RAM中寫入標記,表示應執行bootloader流程,然後reset到bootloader的地方開始動作

我在自己的APP中加入這一段的時候,跑到ramStart[0] = BTL_TRIGGER_PATTERN;時,
就跳到HardFault,我原本以為是因為RAM範圍設定的關係,因為範例要求設定
RAM_LENGTH=0x3fff0
RAM_ORIGIN
=0x20000010

來保留上面的bootloader記號使用的範圍,但我把BTL_TRIGGER_RAM_START 改成可用的RAM位址一樣會錯,
所以我覺得是不是有什麼設定值在保護直接用ADDR來存取RAM的內容?

我從官網上的說明沒有看到相關的內容

不知道有沒有相關的說明可以參考?

發表於: 2021/7/16 16:05
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... ]

教育訓練中心

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