nrf5340之pm_static.yml文件分析

2023-10-24 06:30
文章标签 分析 static yml pm nrf5340

本文主要是介绍nrf5340之pm_static.yml文件分析,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

pm_static.yml文件内容举例:

app:address: 0xc200  region: flash_primarysize: 0xE8E00
external_flash:address: 0region: external_flashsize: 0xF17000 
mcuboot:address: 0x0  placement:before:- mcuboot_primaryregion: flash_primarysize: 0xc000
mcuboot_pad:address: 0xc000size: 0x200
mcuboot_primary:address: 0xc000orig_span: &id001  - mcuboot_pad- appregion: flash_primarysize: 0xE9000span: *id001
mcuboot_primary_app:address: 0xc200orig_span: &id002- appregion: flash_primarysize: 0xE8E00span: *id002
mcuboot_secondary:address: 0xF17000device: MX25R64region: external_flashsize: 0xE9000
otp:address: 0xff8100end_address: 0xff83fcregion: otpsize: 0x2fc
pcd_sram:address: 0x2007e000end_address: 0x20080000placement:before:- endregion: sram_primarysize: 0x2000
sram_primary:address: 0x20000000end_address: 0x2007e000region: sram_primarysize: 0x7e000
app_pad:address: 0xF5000region: flash_primarysize: 0x1000
settings_storage:address: 0xF6000end_address: 0xFF000region: flash_primarysize: 0x9000
cywee:address: 0xff000end_address: 0x100000region: flash_primaryplacement:before:- end  size: 0x1000

该文件经过python处理之后变成了build_nrf5340dk_nrf5340_cpuapp\zephyr\include\generated目录下面的pm_config.h 文件

pm_config.h文件内容如下:

/* File generated by E:/aw32001/NordicNCS/v1.5.1-dev/nrf/scripts/partition_manager_output.py, do not modify */
#ifndef PM_CONFIG_H__
#define PM_CONFIG_H__
#define PM_EXTERNAL_FLASH_ADDRESS 0x0
#define PM_EXTERNAL_FLASH_END_ADDRESS 0xf17000
#define PM_EXTERNAL_FLASH_SIZE 0xf17000
#define PM_EXTERNAL_FLASH_NAME external_flash
#define PM_EXTERNAL_FLASH_ID 0
#define PM_external_flash_ID PM_EXTERNAL_FLASH_ID
#define PM_external_flash_IS_ENABLED 1
#define PM_0_LABEL EXTERNAL_FLASH
#define PM_EXTERNAL_FLASH_DEV_NAME "MX25R64"
#define PM_MCUBOOT_ADDRESS 0x0
#define PM_MCUBOOT_END_ADDRESS 0xc000
#define PM_MCUBOOT_SIZE 0xc000
#define PM_MCUBOOT_NAME mcuboot
#define PM_MCUBOOT_ID 1
#define PM_mcuboot_ID PM_MCUBOOT_ID
#define PM_mcuboot_IS_ENABLED 1
#define PM_1_LABEL MCUBOOT
#define PM_MCUBOOT_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_MCUBOOT_PAD_ADDRESS 0xc000
#define PM_MCUBOOT_PAD_END_ADDRESS 0xc200
#define PM_MCUBOOT_PAD_SIZE 0x200
#define PM_MCUBOOT_PAD_NAME mcuboot_pad
#define PM_MCUBOOT_PAD_ID 2
#define PM_mcuboot_pad_ID PM_MCUBOOT_PAD_ID
#define PM_mcuboot_pad_IS_ENABLED 1
#define PM_2_LABEL MCUBOOT_PAD
#define PM_MCUBOOT_PAD_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_MCUBOOT_PRIMARY_ADDRESS 0xc000
#define PM_MCUBOOT_PRIMARY_END_ADDRESS 0xf5000
#define PM_MCUBOOT_PRIMARY_SIZE 0xe9000
#define PM_MCUBOOT_PRIMARY_NAME mcuboot_primary
#define PM_MCUBOOT_PRIMARY_ID 3
#define PM_mcuboot_primary_ID PM_MCUBOOT_PRIMARY_ID
#define PM_mcuboot_primary_IS_ENABLED 1
#define PM_3_LABEL MCUBOOT_PRIMARY
#define PM_MCUBOOT_PRIMARY_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_APP_ADDRESS 0xc200
#define PM_APP_END_ADDRESS 0xf5000
#define PM_APP_SIZE 0xe8e00
#define PM_APP_NAME app
#define PM_APP_ID 4
#define PM_app_ID PM_APP_ID
#define PM_app_IS_ENABLED 1
#define PM_4_LABEL APP
#define PM_APP_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_MCUBOOT_PRIMARY_APP_ADDRESS 0xc200
#define PM_MCUBOOT_PRIMARY_APP_END_ADDRESS 0xf5000
#define PM_MCUBOOT_PRIMARY_APP_SIZE 0xe8e00
#define PM_MCUBOOT_PRIMARY_APP_NAME mcuboot_primary_app
#define PM_MCUBOOT_PRIMARY_APP_ID 5
#define PM_mcuboot_primary_app_ID PM_MCUBOOT_PRIMARY_APP_ID
#define PM_mcuboot_primary_app_IS_ENABLED 1
#define PM_5_LABEL MCUBOOT_PRIMARY_APP
#define PM_MCUBOOT_PRIMARY_APP_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_APP_PAD_ADDRESS 0xf5000
#define PM_APP_PAD_END_ADDRESS 0xf6000
#define PM_APP_PAD_SIZE 0x1000
#define PM_APP_PAD_NAME app_pad
#define PM_APP_PAD_ID 6
#define PM_app_pad_ID PM_APP_PAD_ID
#define PM_app_pad_IS_ENABLED 1
#define PM_6_LABEL APP_PAD
#define PM_APP_PAD_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_SETTINGS_STORAGE_ADDRESS 0xf6000
#define PM_SETTINGS_STORAGE_END_ADDRESS 0xff000
#define PM_SETTINGS_STORAGE_SIZE 0x9000
#define PM_SETTINGS_STORAGE_NAME settings_storage
#define PM_SETTINGS_STORAGE_ID 7
#define PM_settings_storage_ID PM_SETTINGS_STORAGE_ID
#define PM_settings_storage_IS_ENABLED 1
#define PM_7_LABEL SETTINGS_STORAGE
#define PM_SETTINGS_STORAGE_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CYWEE_ADDRESS 0xff000
#define PM_CYWEE_END_ADDRESS 0x100000
#define PM_CYWEE_SIZE 0x1000
#define PM_CYWEE_NAME cywee
#define PM_CYWEE_ID 8
#define PM_cywee_ID PM_CYWEE_ID
#define PM_cywee_IS_ENABLED 1
#define PM_8_LABEL CYWEE
#define PM_CYWEE_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_MCUBOOT_SECONDARY_ADDRESS 0xf17000
#define PM_MCUBOOT_SECONDARY_END_ADDRESS 0x1000000
#define PM_MCUBOOT_SECONDARY_SIZE 0xe9000
#define PM_MCUBOOT_SECONDARY_NAME mcuboot_secondary
#define PM_MCUBOOT_SECONDARY_ID 9
#define PM_mcuboot_secondary_ID PM_MCUBOOT_SECONDARY_ID
#define PM_mcuboot_secondary_IS_ENABLED 1
#define PM_9_LABEL MCUBOOT_SECONDARY
#define PM_MCUBOOT_SECONDARY_DEV_NAME "MX25R64"
#define PM_OTP_ADDRESS 0xff8100
#define PM_OTP_END_ADDRESS 0xff83fc
#define PM_OTP_SIZE 0x2fc
#define PM_OTP_NAME otp
#define PM_SRAM_PRIMARY_ADDRESS 0x20000000
#define PM_SRAM_PRIMARY_END_ADDRESS 0x2007e000
#define PM_SRAM_PRIMARY_SIZE 0x7e000
#define PM_SRAM_PRIMARY_NAME sram_primary
#define PM_PCD_SRAM_ADDRESS 0x2007e000
#define PM_PCD_SRAM_END_ADDRESS 0x20080000
#define PM_PCD_SRAM_SIZE 0x2000
#define PM_PCD_SRAM_NAME pcd_sram
#define PM_NUM 10
#define PM_ALL_BY_SIZE "mcuboot_pad otp app_pad cywee pcd_sram settings_storage mcuboot sram_primary app mcuboot_primary_app mcuboot_secondary mcuboot_primary external_flash"
#define PM_CPUNET_B0N_ADDRESS 0x1000000
#define PM_CPUNET_B0N_END_ADDRESS 0x1008600
#define PM_CPUNET_B0N_SIZE 0x8600
#define PM_CPUNET_B0N_NAME b0n
#define PM_CPUNET_B0N_ID 10
#define PM_CPUNET_b0n_ID PM_B0N_ID
#define PM_CPUNET_b0n_IS_ENABLED 1
#define PM_10_LABEL CPUNET_B0N
#define PM_CPUNET_B0N_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CPUNET_B0N_CONTAINER_ADDRESS 0x1000000
#define PM_CPUNET_B0N_CONTAINER_END_ADDRESS 0x1008800
#define PM_CPUNET_B0N_CONTAINER_SIZE 0x8800
#define PM_CPUNET_B0N_CONTAINER_NAME b0n_container
#define PM_CPUNET_B0N_CONTAINER_ID 11
#define PM_CPUNET_b0n_container_ID PM_B0N_CONTAINER_ID
#define PM_CPUNET_b0n_container_IS_ENABLED 1
#define PM_11_LABEL CPUNET_B0N_CONTAINER
#define PM_CPUNET_B0N_CONTAINER_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CPUNET_PROVISION_ADDRESS 0x1008600
#define PM_CPUNET_PROVISION_END_ADDRESS 0x1008800
#define PM_CPUNET_PROVISION_SIZE 0x200
#define PM_CPUNET_PROVISION_NAME provision
#define PM_CPUNET_PROVISION_ID 12
#define PM_CPUNET_provision_ID PM_PROVISION_ID
#define PM_CPUNET_provision_IS_ENABLED 1
#define PM_12_LABEL CPUNET_PROVISION
#define PM_CPUNET_PROVISION_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CPUNET_APP_ADDRESS 0x1008800
#define PM_CPUNET_APP_END_ADDRESS 0x1040000
#define PM_CPUNET_APP_SIZE 0x37800
#define PM_CPUNET_APP_NAME app
#define PM_CPUNET_APP_ID 13
#define PM_CPUNET_app_ID PM_APP_ID
#define PM_CPUNET_app_IS_ENABLED 1
#define PM_13_LABEL CPUNET_APP
#define PM_CPUNET_APP_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CPUNET_HCI_RPMSG_ADDRESS 0x1008800
#define PM_CPUNET_HCI_RPMSG_END_ADDRESS 0x1040000
#define PM_CPUNET_HCI_RPMSG_SIZE 0x37800
#define PM_CPUNET_HCI_RPMSG_NAME hci_rpmsg
#define PM_CPUNET_HCI_RPMSG_ID 14
#define PM_CPUNET_hci_rpmsg_ID PM_HCI_RPMSG_ID
#define PM_CPUNET_hci_rpmsg_IS_ENABLED 1
#define PM_14_LABEL CPUNET_HCI_RPMSG
#define PM_CPUNET_HCI_RPMSG_DEV_NAME "NRF_FLASH_DRV_NAME"
#define PM_CPUNET_SRAM_PRIMARY_ADDRESS 0x21000000
#define PM_CPUNET_SRAM_PRIMARY_END_ADDRESS 0x21010000
#define PM_CPUNET_SRAM_PRIMARY_SIZE 0x10000
#define PM_CPUNET_SRAM_PRIMARY_NAME sram_primary
#define PM_CPUNET_NUM 15
#define PM_CPUNET_ALL_BY_SIZE "provision b0n b0n_container sram_primary hci_rpmsg app"
#define PM_ADDRESS 0xc200
#define PM_SIZE 0xe8e00
#define PM_SRAM_ADDRESS 0x20000000
#define PM_SRAM_SIZE 0x7e000
#endif /* PM_CONFIG_H__ */

那么我在application中如何使用这些分好的内存区域呢?

以fatfs文件系统为例:
 

#define PM_ID(label) PM_##label##_ID
#define PM_IS_ENABLED(label) PM_##label##_IS_ENABLED#define FLASH_AREA_ID(label) PM_ID(label)static int setup_flash(struct fs_mount_t *mnt)
{int rc = 0;
#if CONFIG_DISK_ACCESS_FLASHunsigned int id;const struct flash_area *pfa;mnt->storage_dev = (void *)FLASH_AREA_ID(external_flash);//这个宏就是获取flash IDid = (uintptr_t)mnt->storage_dev;rc = flash_area_open(id, &pfa);printk("Area %u at 0x%x on %s for %u bytes\n",id, (unsigned int)pfa->fa_off, pfa->fa_dev_name,(unsigned int)pfa->fa_size);if (rc < 0 && IS_ENABLED(CONFIG_APP_WIPE_STORAGE)) {printk("Erasing flash area ... ");rc = flash_area_erase(pfa, 0, pfa->fa_size);printk("%d\n", rc);}if (rc < 0) {flash_area_close(pfa);}
#endifreturn rc;
}static void setup_disk(void)
{struct fs_mount_t *mp = &fs_mnt;struct fs_dir_t dir = { 0 };struct fs_statvfs sbuf;int rc;if (IS_ENABLED(CONFIG_DISK_ACCESS_FLASH)) {rc = setup_flash(mp);//这个函数里面有获取flash ID的实现方法if (rc < 0) {LOG_ERR("Failed to setup flash area");return;}}if (!IS_ENABLED(CONFIG_FILE_SYSTEM_LITTLEFS) &&!IS_ENABLED(CONFIG_FAT_FILESYSTEM_ELM)) {LOG_INF("No file system selected");return;}rc = mount_app_fs(mp);if (rc < 0) {LOG_ERR("Failed to mount filesystem");return;}/* Allow log messages to flush to avoid interleaved output */k_sleep(K_MSEC(50));printk("Mount %s: %d\n", fs_mnt.mnt_point, rc);rc = fs_statvfs(mp->mnt_point, &sbuf);if (rc < 0) {printk("FAIL: statvfs: %d\n", rc);return;}printk("%s: bsize = %lu ; frsize = %lu ;"" blocks = %lu ; bfree = %lu\n",mp->mnt_point,sbuf.f_bsize, sbuf.f_frsize,sbuf.f_blocks, sbuf.f_bfree);rc = fs_opendir(&dir, mp->mnt_point);printk("%s opendir: %d\n", mp->mnt_point, rc);if (rc < 0) {LOG_ERR("Failed to open directory");}while (rc >= 0) {struct fs_dirent ent = { 0 };rc = fs_readdir(&dir, &ent);if (rc < 0) {LOG_ERR("Failed to read directory entries");break;}if (ent.name[0] == 0) {printk("End of files\n");break;}//printk("  %c %u %s\n", (ent.type == FS_DIR_ENTRY_FILE) ? 'F' : 'D', ent.size, ent.name);}(void)fs_closedir(&dir);return;
}void filesystem_init(void)
{k_sem_init(&file_system_lock, 1, 10);
}int main()
{filesystem_init();
}

FLASH_AREA_ID 宏最终获取到的就是下面这个ID

这篇关于nrf5340之pm_static.yml文件分析的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/273327

相关文章

性能分析之MySQL索引实战案例

文章目录 一、前言二、准备三、MySQL索引优化四、MySQL 索引知识回顾五、总结 一、前言 在上一讲性能工具之 JProfiler 简单登录案例分析实战中已经发现SQL没有建立索引问题,本文将一起从代码层去分析为什么没有建立索引? 开源ERP项目地址:https://gitee.com/jishenghua/JSH_ERP 二、准备 打开IDEA找到登录请求资源路径位置

SWAP作物生长模型安装教程、数据制备、敏感性分析、气候变化影响、R模型敏感性分析与贝叶斯优化、Fortran源代码分析、气候数据降尺度与变化影响分析

查看原文>>>全流程SWAP农业模型数据制备、敏感性分析及气候变化影响实践技术应用 SWAP模型是由荷兰瓦赫宁根大学开发的先进农作物模型,它综合考虑了土壤-水分-大气以及植被间的相互作用;是一种描述作物生长过程的一种机理性作物生长模型。它不但运用Richard方程,使其能够精确的模拟土壤中水分的运动,而且耦合了WOFOST作物模型使作物的生长描述更为科学。 本文让更多的科研人员和农业工作者

MOLE 2.5 分析分子通道和孔隙

软件介绍 生物大分子通道和孔隙在生物学中发挥着重要作用,例如在分子识别和酶底物特异性方面。 我们介绍了一种名为 MOLE 2.5 的高级软件工具,该工具旨在分析分子通道和孔隙。 与其他可用软件工具的基准测试表明,MOLE 2.5 相比更快、更强大、功能更丰富。作为一项新功能,MOLE 2.5 可以估算已识别通道的物理化学性质。 软件下载 https://pan.quark.cn/s/57

native和static native区别

本文基于Hello JNI  如有疑惑,请看之前几篇文章。 native 与 static native java中 public native String helloJni();public native static String helloJniStatic();1212 JNI中 JNIEXPORT jstring JNICALL Java_com_test_g

衡石分析平台使用手册-单机安装及启动

单机安装及启动​ 本文讲述如何在单机环境下进行 HENGSHI SENSE 安装的操作过程。 在安装前请确认网络环境,如果是隔离环境,无法连接互联网时,请先按照 离线环境安装依赖的指导进行依赖包的安装,然后按照本文的指导继续操作。如果网络环境可以连接互联网,请直接按照本文的指导进行安装。 准备工作​ 请参考安装环境文档准备安装环境。 配置用户与安装目录。 在操作前请检查您是否有 sud

线性因子模型 - 独立分量分析(ICA)篇

序言 线性因子模型是数据分析与机器学习中的一类重要模型,它们通过引入潜变量( latent variables \text{latent variables} latent variables)来更好地表征数据。其中,独立分量分析( ICA \text{ICA} ICA)作为线性因子模型的一种,以其独特的视角和广泛的应用领域而备受关注。 ICA \text{ICA} ICA旨在将观察到的复杂信号

【软考】希尔排序算法分析

目录 1. c代码2. 运行截图3. 运行解析 1. c代码 #include <stdio.h>#include <stdlib.h> void shellSort(int data[], int n){// 划分的数组,例如8个数则为[4, 2, 1]int *delta;int k;// i控制delta的轮次int i;// 临时变量,换值int temp;in

三相直流无刷电机(BLDC)控制算法实现:BLDC有感启动算法思路分析

一枚从事路径规划算法、运动控制算法、BLDC/FOC电机控制算法、工控、物联网工程师,爱吃土豆。如有需要技术交流或者需要方案帮助、需求:以下为联系方式—V 方案1:通过霍尔传感器IO中断触发换相 1.1 整体执行思路 霍尔传感器U、V、W三相通过IO+EXIT中断的方式进行霍尔传感器数据的读取。将IO口配置为上升沿+下降沿中断触发的方式。当霍尔传感器信号发生发生信号的变化就会触发中断在中断

kubelet组件的启动流程源码分析

概述 摘要: 本文将总结kubelet的作用以及原理,在有一定基础认识的前提下,通过阅读kubelet源码,对kubelet组件的启动流程进行分析。 正文 kubelet的作用 这里对kubelet的作用做一个简单总结。 节点管理 节点的注册 节点状态更新 容器管理(pod生命周期管理) 监听apiserver的容器事件 容器的创建、删除(CRI) 容器的网络的创建与删除

PostgreSQL核心功能特性与使用领域及场景分析

PostgreSQL有什么优点? 开源和免费 PostgreSQL是一个开源的数据库管理系统,可以免费使用和修改。这降低了企业的成本,并为开发者提供了一个活跃的社区和丰富的资源。 高度兼容 PostgreSQL支持多种操作系统(如Linux、Windows、macOS等)和编程语言(如C、C++、Java、Python、Ruby等),并提供了多种接口(如JDBC、ODBC、ADO.NET等