保留RAM区域的用法

7个职位/0个新职位
Last post
CD
Offline
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
保留RAM区域的用法

Hi all,

Please let me ask the question about the usage for “Retention RAM” and “SysRAM(page0,1)”.
我们正在努力缩小代码大小(RAM区域(代码)比我们想象的要小……)
我已经阅读了UM-B-011文档,但仍然没有信心使用这些区域。

=My condition=
- Use Extended Sleep
- BLE_CONNECTION_MAX_USER = 1

=My understandings=
Regarding the UM-B-011, Sizes of ATT, ENV and MSG heaps are:
ATT 1036 Bytes
ENV 360 Bytes
消息1324字节
and these heaps are allocated to LR_RETENTION_RAM2 depending on Scatter file.
(I also checked real map file.)
And “arch_main.o (BLE_exchange_memory)” is also allocated to LR_RETENTION_RAM2 area.

我列出的地图文件如下:
————————
Load Region LR_RETENTION_RAM2 (Base: 0x00080768, Size: 0x00000000, Max: 0x00002898, ABSOLUTE)

执行区域ZI_RET20(基:0x00080768,大小:0x00000a8c,最大值:0x00002b8,绝对值,UNINIT)

Base Addr Size Type Attr Idx E Section Name Object

0x00080768 0x0000040c Zero RW 541 heap_db_area jump_table.o
0x00080b74 0x00000154 Zero RW 542 heap_env_area jump_table.o
0x00080cc8 0x0000052c Zero RW 544 heap_msg_area jump_table.o

Execution Region ZI_RET21 (Base: 0x00082a20, Size: 0x000005e0, Max: 0x000005e0, ABSOLUTE)

Base Addr Size Type Attr Idx E Section Name Object

0x00082a20 0x000005de Zero RW 287 BLE_exchange_memory arch_main.o
————————
Regarding this .map file, 0x82a20 - (0x80cc8 + 0x52c) = 0x182c (Bytes) seems empty. So we can use this area freely.
> Question 1. Is it correct??

If question 1 is correct, we can use these area to book any variables as __attribute((section(“retention_mem_area0"),zero_init)). There are two places where retention_mem_area0 is defined in Scatter file. (When ext-sleep usage) And if first place(0x20008000) for retention_mem_area0 is not enough to allocate retentioned variables, those variables will be allocated to second place(0x80768-).
>问题2。对吗(事实上,我做了测试,看起来很有效……)

I could move some variables from 0x200000000 area to 0x80000 area, but I couldn’t move code like function() in some_file.c by just adding "some_file.o" to LR_RETENTION_RAM2 region. I got error while writing code to Flash Memory via SmartSnipetts… Is it proper behavior? I think this is proper because I had not defined "some_file.o" to scatter_file as “Executed Region”.
>问题3。有没有可能将函数/代码(不是变量)移到这个自由保留区(0x811f4-0x82a20)编辑散点文件,比如执行区域或其他什么??

If I could have any comment on this, it would be much appreciated.
谢谢very much for your supports in advance.

致以最诚挚的问候,
CD

设备:
MT_dialog
Offline
Last seen:1 month 1 day ago
工作人员
加入:2015-06-08 11:34
嗨,CD,

嗨,CD,

Yes you can use the region to place data inside. The thing is that when you are in extended sleep the sysram doesn't turns off so all the sysram is retained, when you use the __attribute((section(“retention_mem_area0"),zero_init)) if your retention is full, extra variables will be placed in the sysram and whenever you 've instructed in your scatterfile to place variables with the specific attribute (retention_mem_area0). I suppose that what you 've experienced with the Smart Snippets tool is correct. In order to move functions from the sysram to the retention RAM (0x80000 area for example) you have to declare new execution regions in 0x80000 in the allready existing Load Regions.

Thanks MT_dialog

CD
Offline
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
Hi MT_dialog,

Hi MT_dialog,

非常感谢你的回复。
我可以理解我们可以使用这个数据保留区。实际上,效果很好。
"Moving the data from SysRAM to Retention RAM"apparentlymakes the memory area on 0x20000000 getting more rooms to code, I think. (Because we don't use 0x80000 area in default except STACK and HEAP. Of course total size is almost same, though...)
-对吗(现在我有一个DA14583上的代码大小限制问题。。。。我正在寻找戒备,以减少/腾出空间来编写代码。我担心的是,即使我将数据移动到Ret.RAM区域,0x20000000区域的大小也不会使房间。。。我想这样就可以在0x20000000上进行编码了。)

Regarding the Execution Region(ER), still I got the error from SmartSnippets....

Read 0 bytes from file ble_app_barebone_580.hex. 15684 bytes have been ignored because their record address was greater or equal to 0x80000.

I'm just testing to move "user_barebone.o" to Retention area on BLE APP Barebone example. I tried to change the SDK standard scatter file "scatterfile_common.sct" to like attached file. But I can't make it yet. What's wrong about my scatter file?? (The sample scatter file is a complex little bit, but I modified it referring bootloader.sct in Secondary boot loader example, and I hope it works.... but it could not yet.)

If anyone could advise me, it would be much much appreciated.

致以最诚挚的问候,
CD

凯茜
Offline
Last seen:2 years 3 months ago
加入:2016-07-29 10:01
Hi, have you solved this

Hi, have you solved this problem? I am facing the same problem as yours, could you share your solution?

MT_dialog
Offline
Last seen:1 month 1 day ago
工作人员
加入:2015-06-08 11:34
嗨,CD,

嗨,CD,

A dialog's local member will contact you for more details on this.

Thanks MT_dialog

凯茜
Offline
Last seen:2 years 3 months ago
加入:2016-07-29 10:01
嗨,Dialog,我也遇到了这个

嗨,Dialog,我也遇到了这个problem. My application is limited by the code size. I also hope place some function.o to LR_RETENTION_RAM2 . Could you give me an example to follow? Thanks.

MT_dialog
Offline
Last seen:1 month 1 day ago
工作人员
加入:2015-06-08 11:34
Hi caiziee,

Hi caiziee,

As mentioned in your other post, we will contact you directly on this since there isn't an example that exceeds the 32KB of code that you can compile with the evaluation version of Keil.

Thanks MT_dialog