Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K32W] Update E-Lock demo app to the latest master #4956

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[K32W] Update E-Lock demo app to the latest master
* fix compilation issues from Logging.cpp;
* use directly the current OT stack and avoid forcing the user
to manually update the OT code.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
  • Loading branch information
doru91 committed Feb 23, 2021
commit a4c8939d3eebd2301744c8999580d35b27f7fcd9
7 changes: 1 addition & 6 deletions examples/lock-app/k32w/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,12 @@ distribution (the demo-application was compiled on Ubuntu 20.04).
user@ubuntu:~/Desktop/git/connectedhomeip$ export K32W061_SDK_ROOT=/home/user/Desktop/SDK_2.6.2_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/k32w_sdk/mr2_fixes/patch_k32w_mr2_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/openthread/repo/
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/openthread/repo$ git checkout a8265a5628af2f11914d7ff181e58aa110f93cea
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/openthread/repo$ cd ../../../examples/lock-app/k32w/
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/openthread/repo$ cd examples/lock-app/k32w/
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" is_debug=true"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ ninja -C out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ $K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
```

Note that openthread must be updated to the latest master for including the
latest K32W openthread updates.

Note that "patch_k32w_mr2_sdk.sh" script must be run for patching the K32W061
SDK 2.6.2.

Expand Down
18 changes: 16 additions & 2 deletions src/platform/K32W/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

#include <core/CHIPConfig.h>
#include <platform/CHIPDeviceConfig.h>
#include <src/lib/support/CodeUtils.h>
#include <support/logging/Constants.h>

#include <cstring>

#define K32W_LOG_MODULE_NAME chip
#define EOL_CHARS "\r\n" /* End of Line Characters */
#define EOL_CHARS_LEN 2 /* Length of EOL */
Expand All @@ -17,6 +20,10 @@

extern "C" void K32WWriteBlocking(const uint8_t * aBuf, uint32_t len);

namespace chip {
namespace Logging {
namespace Platform {

void GetMessageString(char * buf, uint8_t chipCategory, uint8_t otLevelLog)
{
if (chipCategory != kLogCategory_None)
Expand Down Expand Up @@ -58,10 +65,14 @@ void GetMessageString(char * buf, uint8_t chipCategory, uint8_t otLevelLog)
}
}

} // namespace Platform
} // namespace Logging
} // namespace chip

void FillPrefix(char * buf, uint8_t bufLen, uint8_t chipCategory, uint8_t otLevelLog)
{
/* add the error string */
::GetMessageString(buf, chipCategory, otLevelLog);
chip::Logging::Platform::GetMessageString(buf, chipCategory, otLevelLog);
}

namespace chip {
Expand All @@ -87,7 +98,8 @@ void GenericLog(const char * format, va_list arg)
size_t prefixLen, writtenLen;

/* Prefix is composed of [Debug String][MOdule Name String] */
FillPrefix(formattedMsg, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE - 1, kLogCategory_None, kLogCategory_Detail);
FillPrefix(formattedMsg, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE - 1, chip::Logging::kLogCategory_None,
chip::Logging::kLogCategory_Detail);
prefixLen = strlen(formattedMsg);

// Append the log message.
Expand All @@ -105,6 +117,7 @@ void GenericLog(const char * format, va_list arg)

namespace chip {
namespace Logging {
namespace Platform {

/**
* CHIP log output function.
Expand All @@ -122,6 +135,7 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v)
#endif // K32W_LOG_ENABLED
}

} // namespace Platform
} // namespace Logging
} // namespace chip

Expand Down
2 changes: 1 addition & 1 deletion third_party/k32w_sdk/k32w_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ template("k32w_sdk") {
_sdk_include_dirs = [
"${k32w_sdk_root}/boards/k32w061dk6/wireless_examples/openthread/reed/bm",
"${k32w_sdk_root}/boards/k32w061dk6/wireless_examples/openthread/enablement",
"${k32w_sdk_root}/boards/k32w061dk6/wireless_examples/hybrid/ble_ot/chip",
"${chip_root}/src/platform/K32W",
"${k32w_sdk_root}/CMSIS/Include",
"${k32w_sdk_root}/components/serial_manager",
"${k32w_sdk_root}/components/uart",
Expand Down
2 changes: 0 additions & 2 deletions third_party/k32w_sdk/mr2_fixes/patch_k32w_mr2_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ if [[ ! -d $K32W061_SDK_ROOT ]]; then
exit 1
fi

cp -r ./third_party/k32w_sdk/mr2_fixes/chip "$K32W061_SDK_ROOT"/boards/k32w061dk6/wireless_examples/hybrid/ble_ot/
cp ./third_party/k32w_sdk/mr2_fixes/PWR.c "$K32W061_SDK_ROOT"/middleware/wireless/framework/LowPower/Source/k32w061dk6/
cp ./third_party/k32w_sdk/mr2_fixes/controller_interface.h "$K32W061_SDK_ROOT"/middleware/wireless/ble_controller/interface/
cp ./third_party/k32w_sdk/mr2_fixes/Messaging.h "$K32W061_SDK_ROOT"/middleware/wireless/framework/Messaging/Interface/
cp ./third_party/k32w_sdk/mr2_fixes/ble_conn_manager.h "$K32W061_SDK_ROOT"/middleware/wireless/bluetooth/application/common/
cp ./third_party/k32w_sdk/mr2_fixes/GenericList.h "$K32W061_SDK_ROOT"/middleware/wireless/framework/Lists/
cp ./third_party/k32w_sdk/mr2_fixes/pin_mux.c "$K32W061_SDK_ROOT"/boards/k32w061dk6/wireless_examples/openthread/enablement/

echo "K32W MR2 patched"
exit 0
200 changes: 0 additions & 200 deletions third_party/k32w_sdk/mr2_fixes/pin_mux.c

This file was deleted.