Re: ATSAME54P20A--定址

作者 Gordon0010 於 2020年05月22日 16:52:41
引用:

Libra 寫道:
所以如果使用自動變數就會正常?
uint8_t Can0MessageRAM[CAN0_MESSAGE_RAM_CONFIG_SIZE];
uint8_t Can1MessageRAM[CAN1_MESSAGE_RAM_CONFIG_SIZE];


是的,CAN的傳送接收都正常。
但一定址就會出問題。


引用:

Libra 寫道:
.bss是在linker file中去指定的
SAME54的Global Linker file在(XC32 v2.40之後只有64bit)
C:\Program Files\Microchip\xc32\v2.40\pic32c\lib\proc\ATSAME54P20A\ATSAME54P20A.ld

這裡不可以改它, 如果你要修改時, 要把它Copy到你的專案下, 然後在你的專案下的\Linker Files中加進來
















以下為ld檔修改的內容:

#ifndef RAM_LENGTH
#  define RAM_LENGTH 0x40000
#elif (RAM_LENGTH > 0x40000)
#  error RAM_LENGTH is greater than the max size of 0x40000
#endif
//---------------------------------------
#ifndef RAM_LENGTH_01
#  define RAM_LENGTH_01 0x3FEC0
#elif (RAM_LENGTH_01 > 0x3FEC0)
#  error RAM_LENGTH_01 is greater than the max size of 0x3FEC0
#endif

MEMORY
{
  
rom (LRX) : ORIGIN = ROM_ORIGIN, LENGTH = ROM_LENGTH
  
//--------------------------------------------------------
  /*ram (WX!R) : ORIGIN = RAM_ORIGIN, LENGTH = RAM_LENGTH*/
  
ram (WX!R) : ORIGIN = RAM_ORIGIN_01, LENGTH = RAM_LENGTH_01
  
//--------------------------------------------------------
  
tcm (WX) : ORIGIN = TCM_ORIGIN, LENGTH = __XC32_TCM_LENGTH
  config_00804000
: ORIGIN = 0x00804000, LENGTH = 0x4
  config_00804004
: ORIGIN = 0x00804004, LENGTH = 0x4
  config_00804008
: ORIGIN = 0x00804008, LENGTH = 0x4

}


依照一樣的方式,並未造成任何變更。

1.    RAM Data
-Memory Usage
2.    section                    address  length
[bytes]      (dec)  Description
3.    
-------                 ----------  -------------------------  -----------
4.    .bss                    0x20000000          0x178         376  Uninitialized data
5.    
.data.impure_data       0x20000178          0x418        1048
6.    
.data.__malloc_av_      0x20000590          0x408        1032
7.    
.data.__global_locale   0x20000998          0x16c         364
8.    
.bss.message            0x20000b04           0x40          64
9.    
.bss.rx_message         0x20000b44           0x40          64
10.    
.bss.can1RxMsg          0x20000b84           0x30          48
11.    
.bss.can0RxMsg          0x20000bb4           0x30          48
12.    
.bss.can1Obj            0x20000be4           0x28          40
13.    
.bss.can0Obj            0x20000c0c           0x28          40
14.    
.bss.__malloc_current_m 0x20000c34           0x28          40
15.    
.bss.can1CallbackObj    0x20000c5c           0x20          32
16.    
.bss.can0CallbackObj    0x20000c7c           0x20          32
17.    
.bss                    0x20000c9c           0x1c          28  Uninitialized data
18.    
.bss.messageID          0x20000cb8            0x4           4
19.    
.bss.rx_messageID       0x20000cbc            0x4           4
20.    
.bss.xferContext        0x20000cc0            0x4           4
21.    
.data._impure_ptr       0x20000cc4            0x4           4
22.    
.bss.__malloc_max_sbrke 0x20000cc8            0x4           4
23.    
.bss.__malloc_max_total 0x20000ccc            0x4           4
24.    
.bss.__malloc_top_pad   0x20000cd0            0x4           4
25.    
.data.__malloc_sbrk_bas 0x20000cd4            0x4           4
26.    
.data.__malloc_trim_thr 0x20000cd8            0x4           4
27.    
.bss                    0x20000cdc            0x4           4  Uninitialized data
28.    
.bss.timestamp          0x20000ce0            0x2           2
29.    
.bss.messageMarker.8529 0x20000ce2            0x1           1
30.    
.bss.loop_count         0x20000ce3            0x1           1
31.    
.bss.messageLength      0x20000ce4            0x1           1
32.    
.bss.rx_messageLength   0x20000ce5            0x1           1
33.    
.data.state             0x20000ce6            0x1           1
34.    _0c5728f05ec78eed       0x20010000           0x60          96
35.    _0c5729485ec78eed       0x20010060           0x60          96
1.    Total RAM used  
:       0xda7        3495  1.3% of 0x40000
ii
.    --------------------------------------------------------------------------
1.    Total Data Memory used  :       0xda7        3495  1.3% of 0x40000
iii
.    --------------------------------------------------------------------------


這是使用定址的異常狀況:



















這是不使用定址的傳送與接收:
ID=0x469
















ID=0x111



附加檔案:



jpg  20200522-001.jpg (119.82 KB)
76681_5ec7902bdd4e5.jpg 898X527 px

jpg  20200522-002.jpg (281.08 KB)
76681_5ec7959dd024e.jpg 1452X1034 px

jpg  20200522-003.jpg (341.09 KB)
76681_5ec7970c552a9.jpg 1590X1032 px

jpg  20200522-004.jpg (300.06 KB)
76681_5ec797166a857.jpg 1554X983 px

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=11&topic_id=22894&post_id=80685