...

2.2.2 CPU Memory Space
cpu存储空间(以下叫地址空间)

XDATA memory space. The XDATA memory map is given in Figure 2-1.
Xdata地址空间,64KB
The SRAM is mapped into address range of 0x0000 through (SRAM_SIZE – 1).
sram被映射在地址空间的的0-SRAM_SIZE-1
The XREG area is mapped into the 1-KB address range (0x6000–0x63FF). These registers are additional
registers, effectively extending the SFR register space. Some peripheral registers and most of the radio
control and data registers are mapped in here.
XREG寄存器被映射在0x6000–0x63FF。XREG寄存器是额外的寄存器,是SFR的补充。主要用于射频控制等。
The SFR registers are mapped into address range (0x7080–0x70FF).
SFR寄存器被映射在0x7080–0x70FF。
The flash information page (2 KB) is mapped into the address range (0x7800–0x7FFF). This is a read-only
area and contains various information about the device.
flash信息页被映射在0x7080–0x70FF。只读。
The upper 32 KB of the XDATA memory space (0x8000–0xFFFF) is a read-only flash code bank (XBANK)
and can be mapped to any of the available flash banks using the MEMCTR.XBANK[2:0] bits.
flash bank的任意一页可以映射在0x8000–0xFFFF,这个区域是XBANK。
The mapping of flash memory, SRAM, and registers to XDATA allows the DMA controller and the CPU
access to all the physical memories in a single unified address space.
这种将SRAM,falsh和寄存器映射到XDATA的地址映射方式,可以使得DMA和CPU在一个统一的地址空间中,寻址所有物理内存。

CODE memory space. The CODE memory space is 64 KB and is divided into a common area
(0x0000–0x7FFF) and a bank area (0x8000–0xFFFF) as shown in Figure 2-2. The common area is
always mapped to the lower 32 KB of the physical flash memory (bank 0). The bank area can be mapped
to any of the available 32-KB flash banks (from 0 to 7). The number of available flash banks depends on
the flash size option. Use the flash-bank-select register, FMAP, to select the flash bank. On 32 KB
devices, no flash memory can be mapped into the bank area. Reads from this region return 0x00 on these

devices.

code地址空间,64KB
被划分为一个通用区(启动区)0x0000–0x7FFF和一个bank区域0x8000–0xFFFF。bank区域可以映射flash的的任意一个可用bank.
cpu启动时从CODE地址空间的0地址处取指令。

To allow program execution from SRAM, it is possible to map the available SRAM into the lower range of
the bank area from 0x8000 through (0x8000+SRAM_SIZE–1). The rest of of the currently selected bank is
still mapped into the address range from (0x8000 + SRAM_SIZE) through 0xFFFF). Set the

MEMCTR.XMAP bit to enable this feature.
为了可以从SRAM中执行程序,可以将SRAM映射到CODE的bank区域0x8000+SRAM_SIZE–1。这样在启动区放置一条跳转代码,就可以直接跳转到SRAM执行了。

DATA memory space.The 8-bit address range of DATA memory is mapped into the upper 256 bytes of
the SRAM, i.e., the address range from (SRAM_SIZE-256) through (SRAM_SIZE-1).
DATA地址空间,256B
位于SRAM的最上边的256字节。比如寄存器R0-R7都要通过DATA地址空间访问。

SFR memory space. The 128-entry hardware register area is accessed through this memory space. The
SFR registers are also accessible through the XDATA address space at the address range (0x7080 –
0x70FF). Some CPU-specific SFR registers reside inside the CPU core and can only be accessed using
the SFR memory space and not through the duplicate mapping into XDATA memory space. These
specific SFR registers are listed in SFR Registers .
128个硬件寄存器通过这块内存访问,部分SFR寄存器也可以通过XDATA地址空间0x7080 –0x70FF访问,如下
P0 0x80 CPU Port 0. Readable from XDATA (0x7080).
P1 0x90 CPU Port 1. Readable from XDATA (0x7090).
P2 0xA0 CPU Port 2. Readable from XDATA (0x70A0).
一些cpu特定的寄存器位于cpu核内部,只能通过SFR地址空间访问而不能通过XDATA地址空间访问。大部分SFR都不能通过XDATA访问。

综上,4个地址空间
XDATA,几乎所有的物理存储器都可以映射到这个地址空间之上,包括sram,flash,xreg,information fage,少部分SFR。
CODE,falsh可以映射到其上,SRAM也可以。
DATA,只有SRAM的最高256字节可以映射其上。
SFR,大部分的SFR寄存器都使用SFR地址空间寻址。

注意:DATA地址空间和SRAM内存似乎有点混论,只要记住data地址空间就是用来访问SRAM的最高256字节的。
2.2.3 Physical Memory
物理存储器

RAM. All devices contain static RAM. At power on, the content of RAM is undefined. RAM content is
retained in all power modes.
SRAM可以映射到XDATA地址空间0起始地址,也可以映射到CODE地址空间的上半截。

Flash Memory. The on-chip flash memory is primarily intended to hold program code and constant data.
The flash memory has the following features:
· Page size: 2 KB
· Flash-page erase time: 20 ms
· Flash-chip (mass) erase time: 20 ms
· Flash write time (4 bytes): 20 ms
· Data retention (at room temperature): 100 years
· Program/erase endurance: 20,000 cycles
falsh可以映射到CODE地址空间和XDATA地址空间的XBANK
SFR Registers. The special function registers (SFRs) control several of the features of the 8051 CPU
core and/or peripherals. Many of the 8051 core SFRs are identical to the standard 8051 SFRs. However,
there are additional SFRs that control features that are not available in the standard 8051. The additional
SFRs are used to interface with the peripheral units and RF transceiver.
可以使用SFR地址空间访问,部分寄存器也可以使用XDATA地址空间访问。

The Information Page is a 2 KB read-only region that stores various device information. Among other
things it contains a unique IEEE address from the TI range of addresses. It is stored with the least
significant byte first at XDATA address 0x780C. A separate design note will be published that details the
contents of the information page.
SFR Registers. The special function registers (SFRs) control several of the features of the 8051 CPU
core and/or peripherals. Many of the 8051 core SFRs are identical to the standard 8051 SFRs. However,
there are additional SFRs that control features that are not available in the standard 8051. The additional
SFRs are used to interface with the peripheral units and RF transceiver.
保存了设备信息比如IEEE地址。
只能使用XDATA地址空间访问。

XREG Registers. The XREG registers are additional registers in the XDATA memory space. These
registers are mainly used for radio configuration and control. A complete description of each register is
given in Section 3.6. Table 2-2 gives a descriptive overview of the register address space.
只能通过XDATA地址空间访问

另外:
arm(9,11)执行指令时,是从ram中取代码的。所以开机时需要先将程序代码从nandflash搞到ram中去(如果是norflash,arm9,11也可以直接执行之)。
单片机执行指令时,是从flash中取代码的。
一般在ram中运行很快,但是单片机的ram比较小,一般不足以放置一个较大的代码,所以就直接从flash中运行了。

flash寿命-http://e2e.ti.com/support/low_power_rf/f/155/t/36547.aspx
For CC2530 and CC2531, the flash can handle 20,000 erase cycles.

cc2530读flash
HalFlashRead
cc2530共计有256KBflash,每2KB划分为1page,每16page划分为1 bank
如图


在读取flash中数据的时候,首先要知道是读的哪个第几个bank中的数据,因为要把对应的flash bank映射到xdata地址空间的XBANK上,在xdata地址空间去读。映射bank的时候需要配置寄存器MEMCTR为相应的bank号。

 //所以如果是pg=63,offset=0,则要读的xdata地址是0x8000+pg%16*2048+offset
void HalFlashRead(uint8 pg, uint16 offset, uint8 *buf, uint16 cnt)
{// Calculate the offset into the containing flash bank as it gets mapped into XDATA.uint8 *ptr = (uint8 *)(offset + HAL_FLASH_PAGE_MAP) +((pg % HAL_FLASH_PAGE_PER_BANK) * HAL_FLASH_PAGE_SIZE);uint8 memctr = MEMCTR;  // Save to restore.#if !defined HAL_OAD_BOOT_CODEhalIntState_t is;
#endifpg /= HAL_FLASH_PAGE_PER_BANK;  // Calculate the flash bank from the flash page.#if !defined HAL_OAD_BOOT_CODEHAL_ENTER_CRITICAL_SECTION(is);
#endif// Calculate and map the containing flash bank into XDATA.MEMCTR = (MEMCTR & 0xF8) | pg;while (cnt--){*buf++ = *ptr++;}MEMCTR = memctr;#if !defined HAL_OAD_BOOT_CODEHAL_EXIT_CRITICAL_SECTION(is);
#endif
}

协议栈NVITEM使用的flash位于的地址
#define OSAL_NV_PAGE_BEG        HAL_NV_PAGE_BEG//=126-6+1=121

#define OSAL_NV_PAGE_END       (OSAL_NV_PAGE_BEG + OSAL_NV_PAGES_USED - 1)//=121+6-1=126

即0x3C800---0x3F800-1
另外,
在f8w2530.xcl中有对flash逻辑地址作如下定义

// Texas Instruments device specific
// =================================
//
//
// Layout of CODE banks
// -------------------
//
//-D_BANK0_START=0x08000
//-D_BANK0_END=0x0FFFF
//
//-D_BANK1_START=0x18000
//-D_BANK1_END=0x1FFFF
//
//-D_BANK2_START=0x28000
//-D_BANK2_END=0x2FFFF
//
//-D_BANK3_START=0x38000
//-D_BANK3_END=0x3FFFF
//
//-D_BANK4_START=0x48000
//-D_BANK4_END=0x4FFFF
//
//-D_BANK5_START=0x58000
//-D_BANK5_END=0x5FFFF
//
//-D_BANK6_START=0x68000
//-D_BANK6_END=0x6FFFF
//
//-D_BANK7_START=0x78000
//-D_BANK7_END=0x7FFFF

与falsh的实际物理地址如下对应

NVItem有如下定义
// Internal flash used for NV address space: reserving 6 pages.
//
-D_ZIGNV_ADDRESS_SPACE_START=(((_NR_OF_BANKS+1)*_FIRST_BANK_ADDR)-0x3800)   
-D_ZIGNV_ADDRESS_SPACE_END=(_ZIGNV_ADDRESS_SPACE_START+0x2FFF)
-Z(CODE)ZIGNV_ADDRESS_SPACE=_ZIGNV_ADDRESS_SPACE_START-_ZIGNV_ADDRESS_SPACE_END

D_ZIGNV_ADDRESS_SPACE_START=(7+1)*0x8000-0x3800 = 0x3C800

// IEEE address space (EUI-64) put at last 8 bytes of last page before the flash lock bits.
-D_IEEE_ADDRESS_SPACE_START=(((_NR_OF_BANKS+1)*_FIRST_BANK_ADDR)-0x18)
-D_IEEE_ADDRESS_SPACE_END=(_IEEE_ADDRESS_SPACE_START+7)
-Z(CODE)IEEE_ADDRESS_SPACE=_IEEE_ADDRESS_SPACE_START-_IEEE_ADDRESS_SPACE_END

D_IEEE_ADDRESS_SPACE_START=(7+1)*0x8000-0x18 = 0x3FFE8
即位于整块flash的最后8个字节-除去lock位

//    CODE
//
-D_CODE_START=0x0000
-D_CODE_END=0x7FFF             // Last address for ROOT bank.    rootbank的莫地址
代码区

// XDATA available to the program.
//
// Reserving address 0x0 for NULL.
-D_XDATA_START=0x0001
-D_XDATA_END=0x1EFF

refer to 飞比  Zstack中关于NV的几个问题(一)

转载于:https://www.cnblogs.com/-song/archive/2013/02/14/3331828.html

zigbee cc2530地址空间 layout 和flash操作相关推荐

  1. linux flash擦除命令,Linux下flash操作读、写、擦除步骤

    描述 1. 背景介绍 在板上,ZYNQ PL部分通过EMC连接一片NOR FLASH,地址空间如下: 可以看到NOR FLASH的起始地址为0x80000000,这是物理地址,可以把数据存放在以该地址 ...

  2. 会考flash中文字变形为三角形_关于信息技术会考 Flash操作题实用模版

    <信息技术会考 Flash操作题.doc>由会员分享,可免费在线阅读全文,更多与<信息技术会考 Flash操作题>相关文档资源请在帮帮文库(www.woc88.com)数亿文档 ...

  3. 初中计算机flash操作,初中信息技术FLASH基础知识

    <初中信息技术FLASH基础知识>由会员分享,可在线阅读,更多相关<初中信息技术FLASH基础知识(26页珍藏版)>请在人人文库网上搜索. 1.FLASH 第一课,一.Flas ...

  4. S3C2440对Nand Flash操作和电路原理(基于K9F2G08U0A)

    S3C2440对Nand Flash操作和电路原理(基于K9F2G08U0A) S3C2440内部集成了一个Nand flash控制器.S3C2440的Nand flash控制器包含了如下的特性: l ...

  5. zigbee CC2530 系列教程 10 看门狗实验

    所有课程见此链接: zigbee CC2530 系列教程 0 课程介绍 4.9看门狗实验 4.9.1 实验目的 1.学习CC2530看门狗的工作方式: 2.学习看门狗功能在系统中的运行机制: 4.9. ...

  6. 会考flash中文字变形为三角形_会考Flash操作知识点

    <会考Flash操作知识点>由会员分享,可在线阅读,更多相关<会考Flash操作知识点(5页珍藏版)>请在人人文库网上搜索. 1.2012年会考Flash操作知识点会考标准要求 ...

  7. zigbee CC2530 系列教程 0 课程介绍

    本课程主要是CC2530的系列课程,并附上源码. 课程内容大体安排如下: 理论课程: 第一章:ZigBee简介 第二章:ZigBee软件开发平台的搭建 zigbee CC2530 系列教程 3 点亮1 ...

  8. 单片机FLASH操作

    FLASH 操作: 查看程序已经占用的FLASH的扇区,剩余的扇区就是可以操作而不会使程序发生错乱的区域. 找到listing文件夹下面的.map文件 搜索Memory Map of the imag ...

  9. 初中计算机flash考试题,【信息技术中考专区】Flash操作题专练(七)!

    原标题:[信息技术中考专区]Flash操作题专练(七)! 微机中考·flash操作题 ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ 中考微机中 常用的 ...

最新文章

  1. spring Batch实现数据库大数据量读写
  2. c语言输入10个员工,输入10个职工信息,按号码大小排序,再使用查找函数找职工的姓…...
  3. 【论文常用笔记】回归模型评估指标
  4. 一些自己常用的工具类
  5. linux-时间日期类
  6. 用matlab求解工作时间调度问题,置换流水车间调度问题的MATLAB求解.doc
  7. iOS正则表达式(亲测,持续更新)
  8. Win11系统怎样设置更改密码
  9. 将C#Lambda表达式转换为通用过滤器描述符和HTTP查询字符串
  10. harbor 多端口_安装Harbor并修改默认使用的80端口
  11. DataGuard ORA-01111,ORA-01275文件创建失败问题解决
  12. Vue-router之集成
  13. studio one 3 机架声道设置_雅马哈UR242声卡宿主机架直播跳线设置
  14. 是妄言还是实话 云电脑将代替传统PC?
  15. 关于C++中<iostream>操作算子ends显示问题
  16. presto日期转换及计算
  17. Mendix装备制造业应用 | 质量统计分析人工智能应用APP
  18. 警惕男人出轨的六个高发期
  19. H5微信端在IOS上不能播放音乐解决方案
  20. [原]OWC做电子表格和图表的试验

热门文章

  1. 综合布线工作组2009年工作简报
  2. The import com.google cannot be resolved解决方法
  3. spring bean属性scope
  4. iphone安装Deb文件
  5. 读书笔记1 : program paradigm
  6. Java I/O流InputStream,OutputStream,Reader,Writer
  7. Java并发编程—如何取消定时任务
  8. poj2976 Dropping tests(01分数规划 好题)
  9. day18--django3之Ajax
  10. distinct和group by的性能比较