Skip to content

Commit

Permalink
[k32w] use a custom Persistent Data Manager (openthread#5496)
Browse files Browse the repository at this point in the history
This commit add support for a custom PDM (Persistent Data Manager)
which is also used inside Project CHIP.

Signed-off-by: Doru Gucea <[email protected]>
  • Loading branch information
doru91 authored Sep 8, 2020
1 parent f5508ad commit 2c5d22f
Show file tree
Hide file tree
Showing 56 changed files with 17,886 additions and 536 deletions.
26 changes: 13 additions & 13 deletions examples/Makefile-jn5189
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-jn5189
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/jn5189/
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/JN5189DK6/tools/imagetool/

COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-DUSE_RTOS=0 \
-I$(CONFIG_FILE_PATH) \
COMMONCFLAGS :=\
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-imacros "$(AbsTopSourceDir)/examples/platforms/k32w/jn5189/jn5189-sdk-config.h" \
-I$(CONFIG_FILE_PATH) \
$(NULL)

include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
Expand Down
26 changes: 13 additions & 13 deletions examples/Makefile-k32w061
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-k32w06
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/k32w061/
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/K32W061DK6/tools/imagetool/

COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_K32W061HN \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-DUSE_RTOS=0 \
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
-DCPU_K32W061HN \
-DCPU_JN518X \
-DCPU_JN518X_REV=2 \
-DJENNIC_CHIP_FAMILY_JN518x \
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
-DSDK_DEBUGCONSOLE=0 \
-D$(CONFIG_FILE) \
-imacros "$(AbsTopSourceDir)/examples/platforms/k32w/k32w061/k32w061-sdk-config.h" \
-I$(CONFIG_FILE_PATH) \
$(NULL)

Expand Down
16 changes: 15 additions & 1 deletion examples/platforms/k32w/jn5189/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,22 @@ LIB_FLAGS
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/DK6/Build/Include \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/DK6 \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/Common \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/FunctionLib/ \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/Panic/Interface/ \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/MemManager/Interface \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/SerialManager/Source \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/TimersManager/Source \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/PDM/Include \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/Lists \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/OSAbstraction/Interface \
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/Flash/Internal \
-Wno-unknown-pragmas \
-Wno-sign-compare \
-Wno-unused-function \
-Wno-unused-parameter \
-Wno-empty-body \
-Wno-missing-field-initializers \
-Wno-clobbered \
-fno-strict-aliasing \
$(NULL)

Expand All @@ -87,7 +96,6 @@ libopenthread_jn5189_plat_a_CPPFLAGS
PLATFORM_SOURCES = \
src/alarm.c \
src/diag.c \
src/flash.c \
src/logging.c \
src/misc.c \
src/radio.c \
Expand Down Expand Up @@ -123,6 +131,12 @@ libopenthread_jn5189_sdk_a_SOURCES
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/utilities/debug_console/fsl_debug_console.c \
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/utilities/str/fsl_str.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/FunctionLib/FunctionLib.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/Reset/Reset.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/MemManager/Source/MemManager.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/PDM/pdm_port.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/Lists/GenericList.c \
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c \
$(NULL)

libopenthread_jn5189_plat_a_SOURCES = \
Expand Down
1 change: 1 addition & 0 deletions examples/platforms/k32w/jn5189/Makefile.platform.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ LDADD_COMMON
$(top_builddir)/examples/platforms/k32w/libopenthread-jn5189_sdk.a \
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a \
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/lib/libRadio.a \
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/PDM/Library/libPDM.a \
$(NULL)

LDFLAGS_COMMON += \
Expand Down
53 changes: 53 additions & 0 deletions examples/platforms/k32w/jn5189/jn5189-sdk-config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef JN5189_SDK_CONFIG_H
#define JN5189_SDK_CONFIG_H

#ifndef gUsePdm_d
#define gUsePdm_d 1
#endif

#ifndef gPdmMemPoolId_c
#define gPdmMemPoolId_c 0
#endif

#ifndef gPdmNbSegments
#define gPdmNbSegments 63 /* number of sectors contained in PDM storage */
#endif

#ifndef USE_RTOS
#define USE_RTOS 0
#endif

#ifndef PoolsDetails_c
#define PoolsDetails_c \
_block_size_ 512 _number_of_blocks_ 2 _pool_id_(0) _eol_ _block_size_ 768 _number_of_blocks_ 1 _pool_id_(0) _eol_
#endif

#endif // JN5189_SDK_CONFIG_H
12 changes: 6 additions & 6 deletions examples/platforms/k32w/jn5189/jn5189.ld
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ m_fsl_prodInfo_size = m_sector_size;
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;

NV_STORAGE_MAX_SECTORS = 64;
NV_STORAGE_MAX_SECTORS = 63;
NV_STORAGE_SIZE = NV_STORAGE_MAX_SECTORS * m_sector_size;
NV_STORAGE_END_ADDRESS = m_fsl_prodInfo_start - 1;
NV_STORAGE_START_ADDRESS = NV_STORAGE_END_ADDRESS - NV_STORAGE_SIZE + 1;
NV_STORAGE_START_ADDRESS = m_flash_size - 17 * m_sector_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;
Expand Down Expand Up @@ -288,8 +288,8 @@ SECTIONS
_end_boot_resume_stack = .;
} > RAM0

__nv_storage_end_address = NV_STORAGE_END_ADDRESS;
__nv_storage_start_address = NV_STORAGE_START_ADDRESS;
__nv_storage_end_address = NV_STORAGE_START_ADDRESS;
__nv_storage_start_address = NV_STORAGE_END_ADDRESS;

PROVIDE(_vStackTop = __top_RAM0 - 32);
PROVIDE(__mac_buffer_base = (__mac_buffer_start & 0xfffe0000));
Expand All @@ -301,4 +301,4 @@ SECTIONS

__StackLimit = _vStackTop - STACK_SIZE;
ASSERT(__StackLimit >= _end_boot_resume_stack, "Possible stack corruption with data/bss/boot_stack")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
* Define to 1 if you want to use JN589 Flash implementation.
*
*/
#define OPENTHREAD_SETTINGS_RAM 1
#define OPENTHREAD_SETTINGS_RAM 0

/**
* @def OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE
Expand Down
16 changes: 15 additions & 1 deletion examples/platforms/k32w/k32w061/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,23 @@ LIB_FLAGS
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/DK6/Build/Include \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/DK6 \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/Common/ \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/FunctionLib/ \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/Panic/Interface/ \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/MemManager/Interface \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/SerialManager/Source \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/TimersManager/Source \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/PDM/Include \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/Lists \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/OSAbstraction/Interface \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/Flash/Internal \
-I$(top_srcdir)/third_party/nxp/K32W061DK6/boards/k32w061dk6/wireless_examples/openthread/enablement \
-Wno-unknown-pragmas \
-Wno-sign-compare \
-Wno-unused-function \
-Wno-unused-parameter \
-Wno-empty-body \
-Wno-missing-field-initializers \
-Wno-clobbered \
-fno-strict-aliasing \
$(NULL)

Expand All @@ -89,7 +98,6 @@ libopenthread_k32w061_plat_a_CPPFLAGS
PLATFORM_SOURCES = \
src/alarm.c \
src/diag.c \
src/flash.c \
src/logging.c \
src/misc.c \
src/radio.c \
Expand Down Expand Up @@ -125,6 +133,12 @@ libopenthread_k32w061_sdk_a_SOURCES
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/utilities/debug_console/fsl_debug_console.c \
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/utilities/str/fsl_str.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/FunctionLib/FunctionLib.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/Reset/Reset.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/MemManager/Source/MemManager.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/PDM/pdm_port.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/Lists/GenericList.c \
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c \
$(NULL)

libopenthread_k32w061_plat_a_SOURCES = \
Expand Down
1 change: 1 addition & 0 deletions examples/platforms/k32w/k32w061/Makefile.platform.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ LDADD_COMMON
$(top_builddir)/examples/platforms/k32w/libopenthread-k32w061_sdk.a \
$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a \
$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/lib/libRadio.a \
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/PDM/Library/libPDM.a \
$(NULL)

LDFLAGS_COMMON += \
Expand Down
Loading

0 comments on commit 2c5d22f

Please sign in to comment.