Hi all,
Please let me ask the question about the usage for “Retention RAM” and “SysRAM(page0,1)”.
我们正在努力缩小代码大小。(RAM area (for code) is smaller than our thoughts… )
I’ve read the UM-B-011 document, but still I can’t have a confidence to use those area.
=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
MSG 1324 Bytes
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.
I’m listing map file as followings:
————————
Load Region LR_RETENTION_RAM2 (Base: 0x00080768, Size: 0x00000000, Max: 0x00002898, ABSOLUTE)
Execution Region ZI_RET20 (Base: 0x00080768, Size: 0x00000a8c, Max: 0x000022b8, ABSOLUTE, 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-).
> Question 2. Is it correct?? (Actually, I tested and it seems to work…)
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”.
> Question 3. Is it possible to move function/codes (not variables) to this free Retention area (0x811f4 - 0x82a20) editing scatter file like Executed Region or something else??
If I could have any comment on this, it would be much appreciated.
谢谢very much for your supports in advance.
Best Regards,
CD
Hi 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
Hi MT_dialog,
Thank you so much for your reply.
I can understand we can use this retention area for data. Actually, it works well.
"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...)
- Is it correct? (Now I have a problem for the code size limitation on DA14583.... I'm searching the wary to reduce/make the room for code. I'm concerning even if I move Data to Ret.RAM area, the size of 0x20000000 area doesn't make the rooms... I suppose this way makes the room on 0x20000000 for coding. )
Regarding the Execution Region(ER), still I got the error from SmartSnippets....
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.
Best Regards,
CD
Hi, have you solved this problem? I am facing the same problem as yours, could you share your solution?
Hi CD,
A dialog's local member will contact you for more details on this.
Thanks MT_dialog
HI, Dialog, I also meet this 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.
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