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.xmece.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 )

---------------------------- new 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 , 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 )

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

--------------------------new cmd_handler.c:MAX_IMAGE_SIZE --------------------------------
/* Maximum size for an image */
//#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)

--------------------------new CODE_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.修改,我现在可以确认单位running and QSPI partition Table is in QSPI location per partition table defined, but it can't be obtained any more in SmartSnippets Toolbox (v4.8.3.1804), is this because of partition table address is assumed as 0X7F000?

Thanks in advanced!
提姆林

Device:
PM_Dialog
Offline
Last seen:3 days 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi ilxt001,

Hi ilxt001,

1) You are able to use up to 64MB QSPI flash, but only the 32MB will be cacheable. The other 32MB can be used only for data and not for the firmware. As I can see in your code that you have posted, you have a misunderstanding about the PARTITION2 macro. The first attribute of the macro is for the start of the physical memory address and the second attribute is for the size. The PARTITION2 macro is defined as : PARTITION2(start , size, id, flag)

2) The PARTITION_TABLE_ADDR should always point to the NVMS_PARTITION_TABLE. The flash image is located into the NVMS_FIRMWARE_PART and this partition should be 128KB at least. There is a bug in the cache memory and by default the NVMS_FIRMWARE_PART partition has 0x020000 (128KB) size. Also, by default, the 1Μ/partition_table.h is activated. How do you make your changes? If you make the changes into the 1Μ/partition_table.h, you don’t have to make any other changes. It is recommended to make you own partition table and included it in a different file, with the same way that the 1Μ/partition_table.h is included. The SDK provides 3 different partitions schemes (1M , 2M , 512K)

3) It is expected that the SmartSnippets Toolbox can’t obtain the QSPI flash partition with you modifications, because the partition table is by default configured by the tool in 0x7F00 physical address. So, it is recommended to not change the partition table physical address and change the other partitions. If you don’t change the partition table physical address, the tool can’t work correctly and you will not be able to see the partitions.

Thanks, PM_Dialog

ilxt001
Offline
Last seen:1 year 1 month ago
Joined:2017-06-29 10:36
Hi PM_Dialog,

Hi 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) our device has SUOTA feature so first 128KB space in QSPI is used by ble suota image as default in suota type partition, that is partition setting for 0 ~ 128KB space is left unchanged. NVMS_FIRMWARE_PART is set to PARTITION2( 0x000000 , 0x01E000 , NVMS_FIRMWARE_PART , 0 ) as default.

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 defined(USE_PARTITION_TABLE_16MB)
#include <16M/partition_table.h>
#elif defined(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:3 days 18 hours ago
Staff
Joined:2018-02-08 11:03
Hi ilxt001,

Hi 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