Skip to content

Commit

Permalink
[K32W] Save PDM to external flash on the DK6 board
Browse files Browse the repository at this point in the history
This will free up 32.5K of internal flash space.

Signed-off-by: Doru Gucea <[email protected]>
  • Loading branch information
doru91 committed Jun 2, 2021
1 parent f6af7b9 commit b5c0c19
Show file tree
Hide file tree
Showing 8 changed files with 959 additions and 2,395 deletions.
43 changes: 18 additions & 25 deletions examples/platform/k32w/app/ldscripts/chip-k32w061-linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ BOOT_RESUME_STACK_SIZE = 1024;
going to sleep is more important than the total available stack size */
STACK_SIZE = (4096 - 32);

MEM_RAM0_BASE = 0x4000400;
MEM_RAM0_SIZE = 0x0015c00;
MEM_RAM0_BASE = 0x4000400;
MEM_RAM0_SIZE = 0x0015c00;

MEMORY
{
Expand All @@ -62,32 +62,24 @@ __top_RAM0 = MEM_RAM0_BASE + MEM_RAM0_SIZE; /* 87K bytes */
/* To be improved. At this moment the second RAM bank is dedicated entirely to heap. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0xF000;

/*** flash memory characteristics definitions required for OTA ***/
m_flash_start = 0x00000000;
m_flash_end = 0x0009FFFF;
m_flash_size = 0x000A0000;
m_sector_size = 512;
m_fsl_prodInfo_size = m_sector_size;
/* set external flash properties - external flash is present on the DK6 board */
m_ext_flash_size = 0x00100000;
m_ext_flash_base = 0x00000000;
m_ext_flash_sector_size = 4096;

m_fsl_prodInfo_end = m_flash_size - 17 * m_sector_size - 1;
m_fsl_prodInfo_start = m_fsl_prodInfo_end - m_fsl_prodInfo_size + 1;
NVMSectorCountLink = 63;

NV_STORAGE_MAX_SECTORS = 63;
NV_STORAGE_SIZE = NV_STORAGE_MAX_SECTORS * m_sector_size;
NV_STORAGE_START_ADDRESS = m_fsl_prodInfo_start - 1;
NV_STORAGE_END_ADDRESS = NV_STORAGE_START_ADDRESS - NV_STORAGE_SIZE + 1;
NV_STORAGE_SIZE = NVMSectorCountLink * m_ext_flash_sector_size;
NV_STORAGE_MAX_SECTORS = NVMSectorCountLink;
NV_STORAGE_SECTOR_SIZE = m_ext_flash_sector_size;
NV_STORAGE_START_ADDRESS = m_ext_flash_size - 1;
NV_STORAGE_END_ADDRESS = NV_STORAGE_START_ADDRESS - NV_STORAGE_SIZE + 1;

INT_STORAGE_END = NV_STORAGE_START_ADDRESS - 1;
INT_STORAGE_START = 0x48000;
INT_STORAGE_SIZE = INT_STORAGE_END - INT_STORAGE_START;
m_app_size = 0x00a0000; /* 640K */

FREESCALE_PROD_DATA_BASE_ADDR = m_fsl_prodInfo_start;
INT_STORAGE_SECTOR_SIZE = m_sector_size;
m_app_size = 0xA0000; /* 640K: to accommodate all libs in debug */

__ram_vector_table__ = 1;
vector_table_size = 0x120;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? vector_table_size : 0x0;
__ram_vector_table__ = 1;
vector_table_size = 0x120;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? vector_table_size : 0x0;

ENTRY(ResetISR)

Expand Down Expand Up @@ -328,5 +320,6 @@ SECTIONS
PROVIDE(Chip_LOWPOWER_ChipSoftwareReset = 0x03003fa1);

__StackLimit = _vStackTop - STACK_SIZE;
ASSERT(__StackLimit >= _end_boot_resume_stack, "Possible stack corruption with data/bss/boot_stack")
/* ASSERT(__StackLimit >= _end_boot_resume_stack, "Possible stack corruption with data/bss/boot_stack") */
ASSERT(_etext < NV_STORAGE_START_ADDRESS, "Application does not fit into flash!")
}
7 changes: 6 additions & 1 deletion third_party/k32w_sdk/k32w_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ template("k32w_sdk") {
"${k32w_sdk_root}/middleware/wireless/bluetooth/host/config",
"${k32w_sdk_root}/middleware/wireless/bluetooth/host/interface",
"${k32w_sdk_root}/middleware/wireless/framework/Common",
"${k32w_sdk_root}/middleware/wireless/framework/Flash/External/Interface",
"${k32w_sdk_root}/middleware/wireless/framework/Flash/Internal",
"${k32w_sdk_root}/middleware/wireless/framework/FunctionLib",
"${k32w_sdk_root}/middleware/wireless/framework/GPIO",
Expand Down Expand Up @@ -107,7 +108,7 @@ template("k32w_sdk") {
"${k32w_sdk_root}/middleware/wireless/ble_controller/lib/lib_ble_controller.a",
"${k32w_sdk_root}//middleware/wireless/bluetooth/host/lib/lib_ble_5-0_host_peripheral_cm4_noFP.a",
"${k32w_sdk_root}/middleware/wireless/ieee-802.15.4/lib/libMiniMac_Dynamic_MMAC.a",
"${k32w_sdk_root}/middleware/wireless/framework/PDM/Library/libPDM.a",
"${k32w_sdk_root}/middleware/wireless/framework/PDM/Library/libPDM_extFlash.a",
"${k32w_sdk_root}/middleware/wireless/framework/SecLib/lib_crypto_m4.a",
"${k32w_sdk_root}/middleware/wireless/framework/XCVR/lib/libRadio.a",
]
Expand All @@ -127,6 +128,9 @@ template("k32w_sdk") {
"gTotalHeapSize_c=0xF000",
"gUartDebugConsole_d=1",
"gUsePdm_d=1",
"PDM_EXT_FLASH=1",
"gEepromType_d=gEepromDevice_MX25R8035F_c",
"gOTA_externalFlash_d=1",
"gLEDSupported_d",
"gKeyBoardSupported_d",
"gPdmNbSegments=63",
Expand Down Expand Up @@ -257,6 +261,7 @@ template("k32w_sdk") {
"${k32w_sdk_root}/middleware/wireless/bluetooth/host/config/ble_globals.c",
"${k32w_sdk_root}/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c",
"${k32w_sdk_root}/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c",
"${k32w_sdk_root}/middleware/wireless/framework/Flash/External/Source/Eeprom_MX25R8035F.c",
"${k32w_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c",
"${k32w_sdk_root}/middleware/wireless/framework/GPIO/GPIO_Adapter.c",
"${k32w_sdk_root}/middleware/wireless/framework/Keyboard/Source/Keyboard.c",
Expand Down
Loading

0 comments on commit b5c0c19

Please sign in to comment.