QSPI image size bigger than 508KB

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
ILXT001.
Offline
Last seen:1 year 1 month ago
Joined:2017-06-29 10:36
QSPI image size bigger than 508KB

Hi Dialog,
We have an undergoing project using DA14681 BLE with 16MB QSPI flash to store code and data. Since SUOTA feature (cost 128KB) and tremendous functions inside, the default QSPI image size 0x7f000 (508K) defined in partition table is not sufficient, we have to make it bigger. Followings are what I modified to increase code size from 0x5D000 (372KB) to 8D000 (564K):

----------------------------- old partition table ------------------------------------------------
Partition2(0x000000,0x01e000,nvms_firmware_part,0)
PARTITION2( 0x01E000 , 0x001000 , NVMS_PRODUCT_HEADER_PART , 0 )
PARTITION2( 0x01F000 , 0x001000 , NVMS_IMAGE_HEADER_PART , 0 )
PARTITION2( 0x020000 , 0x05D000 , NVMS_FW_EXEC_PART , 0 )
PARTITION2( 0x07D000 , 0x002000 , NVMS_PLATFORM_PARAMS_PART , PARTITION_FLAG_READ_ONLY )
PARTITION2( 0x07F000 , 0x001000 , NVMS_PARTITION_TABLE , PARTITION_FLAG_READ_ONLY )
Partition2(0x080000,0x010000,NVMS_PARAM_PART,0)
PARTITION2( 0x090000 , 0x1D2000 , NVMS_LOG_PART , 0 )
PARTITION2( 0x262000 , 0x05E000 , NVMS_FW_UPDATE_PART , 0 )
x2c0000 PARTITION2 (0, 0 xd40000 NVMS_GENERIC_PART , 0 )

---------------------------------------------------------------------------
Partition2(0x000000,0x01e000,nvms_firmware_part,0)
PARTITION2( 0x01E000 , 0x001000 , NVMS_PRODUCT_HEADER_PART , 0 )
PARTITION2( 0x01F000 , 0x001000 , NVMS_IMAGE_HEADER_PART , 0 )
PARTITION2( 0x020000 , 0x08D000 , NVMS_FW_EXEC_PART , 0 )
PARTITION2( 0x0AD000 , 0x002000 , NVMS_PLATFORM_PARAMS_PART , PARTITION_FLAG_READ_ONLY )
PARTITION2( 0x0AF000 , 0x001000 , NVMS_PARTITION_TABLE , PARTITION_FLAG_READ_ONLY )
//NVMS_PARAM_PART must be 64KB aligned
PARTITION2( 0x0B0000 , 0x010000 , NVMS_PARAM_PART , 0 )
PARTITION2( 0x0C0000 , 0x1D2000 , NVMS_LOG_PART , 0 )
Partition2(0x292000,0x08e000,nvms_fw_update_part,0)
Partition2(0x320000,0xce0000,NVMS_GENERIC_PART,0)

-------------------------------------------------------------------------------
//#define PARTITION_TABLE_ADDR (0x080000 - (FLASH_SECTOR_SIZE))
#define PARTITION_TABLE_ADDR (0x0B0000 - (FLASH_SECTOR_SIZE))

---------------------------------------新cmd_handler.c:max_image_size --------------------------------
/ *图像的最大大小* /
//#define MAX_IMAGE_SIZE 0x7F000
#define max_image_size 0xaf000.

---------------------------new dlg_suota.c:SUOTA_MAX_IMAGE_SIZE --------------------------------
#define suota_max_image_size(564 * 1024)

------------------------新码_Size-------------------------------
#define CODE_SIZE (564 * 1024)

With above update, it looks like QSPI image size supports bigger than 508K and device could work normally. Below are my questions need your inputs:
1. Can DA14681 itself work with QSPI image size greater than 508KB?
2. If answer of Q1 is positive, is there somewhere else need to update accordingly to support image size greater than 508K.
3.通过我的修改,我可以确认单位现在正在运行,并且QSPI分区表是在每个分区表中定义的QSPI位置,但它无法在SmartSnippets工具箱(v4.8.3.1804)中获得任何内容,这是因为它分区表地址被假定为0x7f000?

提前致谢!
提姆林

设备:
PM_Dialog
Offline
Last seen:17小时44分钟前
Staff
Joined:2018-02-08 11:03
嗨Ilxt001,

嗨Ilxt001,

1)您能够使用多达64MB的QSPI闪光灯,但只有32MB将可缓存。其他32MB只能用于数据而不是固件。正如我在您发布的代码中所看到的,您对Partition2宏有一个误解。宏的第一个属性用于物理内存地址的开始,第二属性是大小。Partition2宏被定义为:Partition2(开始,大小,ID,标志)

2)Partition_Table_Addr应始终指向NVMS_PARTITION_TABLE。Flash Image位于NVMS_Firmware_Part中,此分区应至少为128KB。缓存内存中有一个错误,默认情况下,nvms_firmware_part分区的大小为0x020000(128kb)。此外,默认情况下,1μ/ partition_table.h被激活。你如何进行更改?如果将更改变为1μ/ partition_table.h,则不必进行任何其他更改。建议您制作自己的分区表并将其包含在不同的文件中,以相同的方式包含1μ/ partition_table.h。SDK提供3个不同的隔板方案(1M,2M,512K)

3)预计SmartSnippets工具箱无法使用修改获取QSPI闪存分区,因为分区表是由0x7F00物理地址中的工具配置的默认值。因此,建议不要更改分区表物理地址并更改其他分区。如果您不更改分区表物理地址,则该工具无法正常工作,您将无法看到分区。

Thanks, PM_Dialog

ILXT001.
Offline
Last seen:1 year 1 month ago
Joined:2017-06-29 10:36
嗨pm_dialog,

嗨pm_dialog,
First of all, thanks for your quick response.
1) Yes, I know the PARTITION2 macro is defined as : PARTITION2(start , size, id, flag) and my new partition table was organized accordingly too. Would you please point out what's wrong in my new partition table or somewhere else? Thanks.

2) NVMS_PARTITION_TABLE is located starting from 0xAF000 in new partition table and PARTITION_TABLE_ADDR is defined as (0x0B0000 - (FLASH_SECTOR_SIZE)) (this is the original way to calculate PARTITION_TABLE_ADDR instead of direct 0xAF000 in flash_partitions.h) where FLASH_SECTOR_SIZE is 0x1000, that is PARTITION_TABLE_ADDR is equal to 0xAF000. Therefore The PARTITION_TABLE_ADDR is indeed point to the NVMS_PARTITION_TABLE.

3)我们的设备具有Suota功能,因此BLE Suota Image在Suota类型分区中使用QSPI中的第一个128KB空间,即0〜128KB空间的分区设置不变。nvms_firmware_part被设置为partition2(0x000000,0x01e000,nvms_firmware_part,0)默认。

4) we do add our own partition tables at sdk/bsp/config/16M/suota/partition_table.h and this file will be included in project by below config in /sdk/adapters/include/partition_table.h, sorry I did not mention we had already made this changes too.
#if定义(use_partition_table_16mb)
#include <16m / partition_table.h>
#elif定义(use_partition_table_16mb_with_suota)
#include <16M/suota/partition_table.h>

5) I hope to keep NVMS_PARTITION_TABLE at space of 0x7F000~0X7FFFF, but in fact I can't. QSPI space 0~128KB is used by BLE SUTOA code and our application (firmware and code related data) starts at 0x20000, if NVMS_PARTITION_TABLE is located at 0x7F000, the maximum size could be left to firmware is (0x7F000 - 0x2000 - 0x20000 = 0x5D000, 372KB). This fact make us no chance but move NVMS_PARTITION_TABLE backward. Although QSPI partition Table information can't be obtained any more in SmartSnippets Toolbox (v4.8.3.1804), I do see they are at QSPI flash 0xAF000 as defined in partition_table.h after device runs. I think it is okay for me if there is no other functional issue inside firmware.

Thanks/Tim

PM_Dialog
Offline
Last seen:17小时44分钟前
Staff
Joined:2018-02-08 11:03
嗨Ilxt001,

嗨Ilxt001,

Could you please let me know if you have any problems with the modified partition table? If yes, which problems do you have?

Thanks, PM_Dialog