ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

DA14580存储空间映射

2021-05-02 18:30:04  阅读:222  来源: 互联网

标签:DA14580 ZI 映射 area mem scatter BLE ANY 存储空间


在这里插入图片描述
UM-B-011文档在官网可以下载的到哈。

除了存储空间映射外,还讲use the common scatter file。这个文件是在keil中需要配置的。
在这里插入图片描述
文档适用的case 23配置,这个配置应该是在某个库里面。同时说明了程序从0x20000000开始执行
It is assumed that “Case 23” is used (EM_MAPPING in BLE_CNTL2_REG – default setting) and noremapping has been executed (application code is placed at the section starting from 0x20000000).

在这里插入图片描述
打开keil中配置的这个文件(我打开的是dialog的例程,这里面已经制定好了这个文件),
可见地址0x20000000已经是在SYSRAM2里面了。

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
用户能用的38KB中的37K空间为0x20000440 ~ 0x20008FFF(1088Byte)加上0x20009020 ~ 0x200097FF(36896Byte)

4.1节讲RAM区分配

地址是0x80000 to 0x82FFF
在这里插入图片描述
回看下地址空间,就是这里,是rRAM和RAM空间。
areas 0x80000 to 0x81FFF (Retention RAM) and 0x82000 to0x82FFF (SysRAM pages 0 and 1)
整个空间分派如下:
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
some memory areas are reserved (marked as grey)
灰色表示保留空间。

后面都是在讲,根据BLE_CONNECTION_MAX_USER(目前我理解不了这是啥意思)的大小,针对
三个ATT (DB), ENV and MSG heaps堆空间的需求
在这里插入图片描述
再根据上图的需求,再根据是否需要re-init来区分,这个rRAM还剩下多少可以给用户存数据。
在这里插入图片描述
从这个表中可以明显看出,为了支持4个连接的Deep Sleep,必须重新初始化BLE描述符。

后面的话也看不明白了:
除了必须放置在保留RAM中的这些堆之外,BLE堆栈还使用放置在SysRAM中的另一个堆。
目的是拥有一个“最后的手段”,一个可以当保留的堆中没有剩余的内存时使用。
当然,如果从“非保留堆”中分配了内存,则在释放该内存且堆为空之前,芯片将无法进入深度睡眠。
这是自动完成的,对应用程序代码编写者是透明的。
如前所述,使用扩展睡眠时没有这种限制

反正后续段落都是在讲这个BLE_CONNECTION_MAX_USER在5和6,在deep sleep模式下的各种花式怎么用,怎么配置,或者直接配置到sysRAM中去。所以看不懂。

5 ARM scatter files

这个文件,就是做link的时候用的,指示哪里地址存RW数据,哪里存ROM,
The scatter file instructs the Linker where to place code and data.
在这里插入图片描述
In the area 0x0000 to 0x8000 the code is placed while in the area 0x10000 to 0x16000 RW and ZI data are placed.

在这里插入图片描述
定义一个变量在某个实际物料地址。在函数库中,很多的函数,变量定义,都指定了具体的物理地址,例如有些就指定是在retention_mem_area0,很明显就是在retention RAM里面。搜索下文可以找到retention_mem_area0
在这里插入图片描述

在这里插入图片描述
这里的AREA RESET也可以再SCT里面找到指定的位置是ER_IROM1 0x20000000 0x160

文件scatterfile_prodtest_580.sct打开后是这样
#! armcc -E -I .,…,…\src\config,…\sdk\common_project_files\ --cpu Cortex-M0

#include “da1458x_config_basic.h”
#include “da1458x_config_advanced.h”
#include “da1458x_scatter_config.h”

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
;
; This scatter file is set up for EM_MAP == 23!
; If an application uses a different memory layout then it must
; use a customized scatter file.
;**************************************************************

LR_IROM1 0x20000000 0x160 { ; load region size_region
ER_IROM1 0x20000000 0x160 { ; load address = execution address
*.o (RESET, +First)
}
}

LR_IROM2 0x20000160 0x160 {
ER_IROM2 0x20000160 0x160 {
.ANY (jump_table_mem_area)
}
}

LR_IROM3 0x200002C0 0x80 {
ER_IROM3 0x200002C0 0x80 {
.ANY (timeout_table_area)
}
}

LR_IROM4 0x20000340 0x100 {
ER_IROM4 0x20000340 0x100 {
.ANY (nvds_data_storage_area)
}
}

LR_IROM5 0x20000440 0x93c0 {
ER_IROM5 0x20000440 0x7ac0 {
*(InRootKaTeX parse error: Expected group after '_' at position 149: …, for example, _̲_main.o, …Table
boot_vectors.o (+RO)
system_ARMCM0.o (+RO)
;armlib (+RO)
.ANY (+RO)
.ANY (+RW)
}
ER_2 AlignExpr(+0,8) UNINIT
{
* (non_init)
}

; *********************************************************************************************
; * END OF OTP - ANYTHING BELOW THIS POINT IS NOT WRITTEN WHEN THE CODE IS BURNED TO THE OTP! *
; *********************************************************************************************

#if (ZI_AT_8000 > 0)
RW_IRAM50 0x20008000 ZI_AT_8000 { ; ZI
#if (USE_MEMORY_MAP == EXT_SLEEP_SETUP)
.ANY (retention_mem_area0) ; application data
#endif

    .ANY (+ZI)

}
#endif

;
; not retained HEAP
;
RW_IRAM51 (0x20009000 - NON_RET_HEAP_SIZE) UNINIT NON_RET_HEAP_SIZE {    
    jump_table.o (heap_mem_area_not_ret)    

}

RW_IRAM52 0x20009000 EMPTY 0x20 {}          ; reserved for ROM code  

RW_IRAM53 0x20009020 0x1e0 {                ; Remaining area above 0x20009020 is set as ZI
    .ANY (+ZI)

}

RW_IRAM54 0x20009200 UNINIT 0x600 {         ; Stack
    .ANY (STACK)

}
}

#if (BLE_CONNECTION_MAX_USER > 4)
LR_RETENTION_RAM1 0x000800e8 0x16c {
ZI_RET1 0x00800e8 UNINIT 0x16c {
#if (USE_MEMORY_MAP != EXT_SLEEP_SETUP)
; use
* (retention_mem_area1) ; application data (up to 364 bytes!)
; or specify explicitly each object that has data to be placed in here
; app.o (retention_mem_area0)
; arch_main.o (retention_mem_area0)
; etc.
;
; execution region’s size restrictions do apply!
#else
.ANY (retention_mem_area0) ; application data (up to 364 bytes!)
#endif
}
}
#endif

#if (USE_MEMORY_MAP != EXT_SLEEP_SETUP)
LR_RETENTION_RAM0 0x00080768 (RETRAM_LEN + EXCHANGE_MEMORY_SIZE) {
;------------------------------------------------------------------------------------------
; if Deep Sleep is not used then ER_RET0 should occupy the whole memory space
; (length = 0x2898)
;------------------------------------------------------------------------------------------

; Deep Sleep mode
; RetRAM : 0x80000 - 0x82000
ZI_RET00 0x00080768 UNINIT RETRAM_LEN {     ; 0x80768 is the last address used by the ROM code
#if (BLE_CONNECTION_MAX_USER > 4)
    arch_system.o (cs_area)
#endif
    * (retention_mem_area0)                 ; application data
    jump_table.o (heap_env_area)
    jump_table.o (heap_db_area)
    jump_table.o (heap_msg_area)
}

ZI_RET01 EXCHANGE_MEMORY_BASE EXCHANGE_MEMORY_SIZE {
    arch_main.o (BLE_exchange_memory)
}

}

LR_RETENTION_RAM2 0x00082000 ExtRETRAM_LEN {
ZI_RET20 0x00082000 UNINIT ExtRETRAM_LEN {
.ANY (+ZI)
}
}

#else
LR_RETENTION_RAM2 0x00080768 0x2898 {
; Extended Sleep mode
; Extended RetRAM : 0x80000 - 0x83000
ZI_RET20 0x00080768 UNINIT 0x22b8 { ; 0x80768 is the last address used by the ROM code
#if (BLE_CONNECTION_MAX_USER > 4)
arch_system.o (cs_area)
#endif
jump_table.o (heap_env_area)
jump_table.o (heap_db_area)
jump_table.o (heap_msg_area)
.ANY (retention_mem_area0) ; application data
.ANY (+ZI)
}

ZI_RET21 EXCHANGE_MEMORY_BASE EXCHANGE_MEMORY_SIZE {
    arch_main.o (BLE_exchange_memory)
}

}
#endif

;LR_GUARD_RAM 0x50000000 0x0 {
;RW_GRAM0 0x50000000 0x0 { ; Make sure that nothing has been placed in here!
;*.o (exchange_mem_case1)
;}
;}

第六章,DA14580 MemoryMapTool.xlsm这个文件怎么用

网上我没有找到这个文件,但是我有,邮箱1013846180@qq.com可以找我要,也可以去我的CSDN资源里面下载,我上传在CSDN里面的。

The maximum number of connections the application is built for. This is the same as
BLE_CONNECTION_MAX_USER. If it is a slave then this value is 1. If it is a master device then
it can be from 1 to 6. This parameter affects the sizes of the heaps.
讲到BLE_CONNECTION_MAX_USER的定义,可以说和我之前在网上查资料的理解一直。
作为BLE的主机,可以连接多个从机,这里写的是1~6。
作为BLE的从机,只能连接1个主机哈。
这里的连接,是同时连接的意思,例如手机同时连接蓝牙鼠标,蓝牙键盘,蓝牙耳机。
但是,连接可能,应该是在不同的蓝牙信道。
另,手机蓝牙也只有1根天线不是,所以这里的“同时”也是分时复用的概念,类似于电脑CPU同时跑多个进程。
反正这里的同时连接大概就是这么个意思,软件层面理解为同时,硬件层面肯定是分时的(就算你信道不一样,但是天线只有一根,对吧!)。
在这里插入图片描述
前面两项结果说的是
The first section shows where the heaps and the BLEdescriptors are placed.
哪些放在sRAM里面,哪些放在sysRAM里面的。

下一节将展示计算出的堆大小和系统进入深度睡眠(堆耗尽的概率为零)时可支持的并发连接数。
The next section shows the calculated sizes of the heaps and the number of concurrent connections that can be supported while the system enters into deep sleep, with zero probability of heap depletion.

最后一项定义这里,这些定义需要写在da14580_config.h 这个文件里面,目的就是最优化存储空间的管理。
The last section contains the #defines that have to be entered by the user to the file
da14580_config.h in order to build the code with the optimum memory configuration.

6.3.1 Deep Sleep with 1 connection
In this example, the user has built an application that has only 46 bytes of data to be placed at the
Retention RAM and is for a slave device that is able to enter into Deep Sleep. The user uses the
Excel tool so as to find the proper settings.
这里比较实用,讲的是配置为从机,肯定就是1个连接,

第七章讲scatter file configuration

scatter file 相关的头文件有:
da14580_config.h
da14580_scatter_config.h
da14580_stack_config.h
相关配置,自己看原文档吧。

总的而言,keil的linker调用scatter file文件,尾缀为.sct文件,
然后上述的3个.h文件是和.sct文件符合对应的。

7.1 Deep Sleep memory layout
7.2 Extended Sleep memory layout
这两个小节就讲不同的sleep怎么分布的memory

第八章讲常见的link时候的报错原因

8 Building the application – Keil’s status report

都是上面说的各个文件的配置不协调统一问题。
UM-B-011 DA14580 MemoryMapTool.xlsm
scatter file .sct文件
da14580_config.h
da14580_scatter_config.h
da14580_stack_config.h

标签:DA14580,ZI,映射,area,mem,scatter,BLE,ANY,存储空间
来源: https://blog.csdn.net/qq_45146783/article/details/116309079

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有