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

Add Qorvo QPG6200L #838

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
run: |
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
script/test qpg6105
script/test qpg6200

gcc-arm-none-linux-gnueabihf:
name: gcc-arm-none-linux-gnueabihf-${{ matrix.gcc_ver }}
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ project(ot-qorvo VERSION 0.1.0)
set(QORVO_PLATFORM_VALUES
"gp712"
"qpg6105"
"qpg6200"
"qpg7015m"
)
set(QORVO_MBEDTLS_USED
"qpg6105"
"qpg6200"
)

set_property(CACHE QORVO_PLATFORM PROPERTY STRINGS ${QORVO_PLATFORM_VALUES})
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

# OpenThread on Qorvo Example

This repo contains example platform drivers for [Qorvo GP712][gp712], [Qorvo QPG6105][qpg6105] and [Qorvo QPG7015M][qpg7015m].
This repo contains example platform drivers for [Qorvo GP712][gp712], [Qorvo QPG6105][qpg6105], [Qorvo QPG6200L][qpg6200] and [Qorvo QPG7015M][qpg7015m].

[gp712]: https://www.qorvo.com/products/p/GP712
[qpg6105]: https://www.qorvo.com/products/p/QPG6105
[qpg6200]: https://www.qorvo.com/products/p/QPG6200L
[qpg7015m]: https://www.qorvo.com/products/p/QPG7015M

To learn more about building and running the examples please check the [documentation](https://github.com/Qorvo/qpg-openthread/blob/master/README.md)
Expand Down
6 changes: 3 additions & 3 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set -euxo pipefail

OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-}

QORVO_PLATFORMS=(gp712 qpg6105 qpg7015m)
QORVO_PLATFORMS=(gp712 qpg6105 qpg6200 qpg7015m)
readonly QORVO_PLATFORMS

OT_SRCDIR="$(pwd)"
Expand Down Expand Up @@ -93,15 +93,15 @@ main()
options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-linux-gnueabihf.cmake")
build -DQORVO_PLATFORM="${platform}" "${options[@]}" "${cmdline_options[@]}"
;;
qpg6105)
qpg6105 | qpg6200)
OT_CMAKE_NINJA_TARGET=("ot-cli-ftd" "ot-cli-mtd")
options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake")
build -DQORVO_PLATFORM="${platform}" "${options[@]}" "${cmdline_options[@]}"
;;
esac

case "${platform}" in
qpg6105)
qpg6105 | qpg6200)
find "${builddir}/bin" -type f -executable -not -name '*.*' -not -name "${platform}-*" -not -name "*-test-*" \
-execdir sh -c 'x="$1"; arm-none-eabi-objcopy -O ihex "$1" "$2-$(basename ${x}).hex"' _ {} "${platform}" \;
;;
Expand Down
2 changes: 1 addition & 1 deletion script/test
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

set -euxo pipefail

QORVO_PLATFORMS=(gp712 qpg6105 qpg7015m)
QORVO_PLATFORMS=(gp712 qpg6105 qpg6200 qpg7015m)
readonly QORVO_PLATFORMS

OT_BUILDDIR="$(pwd)/build"
Expand Down
2 changes: 2 additions & 0 deletions src/qpg6105/crypto/common-mbedtls-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
#define MBEDTLS_SSL_COOKIE_C
#define MBEDTLS_SSL_SRV_C
#elif OPENTHREAD_CONFIG_JOINER_ENABLE
#define MBEDTLS_SSL_COOKIE_C
#endif

#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
Expand Down
137 changes: 137 additions & 0 deletions src/qpg6200/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#
# Copyright (c) 2024, 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.
#

target_compile_definitions(ot-config INTERFACE
"MBEDTLS_CONFIG_FILE=\"${SDK_DIR}/${QORVO_PLATFORM}/inc/${QORVO_PLATFORM}-mbedtls-config.h\""
)

list(APPEND OT_PUBLIC_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/crypto"
)

set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)

set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)

set(PLATFORM_SOURCES
alarm.c
diag.c
entropy.c
logging.c
misc.c
platform.c
radio.c
settings.c
syscalls_stubs.c
uart.c
)

add_library(${PLATFORM_TARGET_FTD}
STATIC
${PLATFORM_SOURCES}
)

set_target_properties(${PLATFORM_TARGET_FTD}
PROPERTIES
C_STANDARD 99
CXX_STANDARD 20
)

target_link_libraries(${PLATFORM_TARGET_FTD}
PRIVATE
-lc # Required to rearrange linking order to pick up syscalls stubs for libc
-Wl,--start-group
${PLATFORM_DRIVER_FTD}
ot-config
-Wl,--end-group
PUBLIC
-T${SDK_DIR}/${QORVO_PLATFORM}/ld/${QORVO_PLATFORM}.ld
-nostdlib
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map,--cref
)

target_compile_definitions(${PLATFORM_TARGET_FTD}
PUBLIC
${OT_PLATFORM_DEFINES}
)

target_compile_options(${PLATFORM_TARGET_FTD}
PRIVATE
${OT_CFLAGS}
)

target_include_directories(${PLATFORM_TARGET_FTD}
PRIVATE
${OT_PUBLIC_INCLUDES}
${OPENTHREAD_DIR}/examples/platforms
)

add_library(${PLATFORM_TARGET_MTD}
STATIC
${PLATFORM_SOURCES}
)

set_target_properties(${PLATFORM_TARGET_MTD}
PROPERTIES
C_STANDARD 99
CXX_STANDARD 20
)

target_link_libraries(${PLATFORM_TARGET_MTD}
PRIVATE
-lc # Required to rearrange linking order to pick up syscalls stubs for libc
-Wl,--start-group
${PLATFORM_DRIVER_MTD}
ot-config
-Wl,--end-group
PUBLIC
-T${SDK_DIR}/${QORVO_PLATFORM}/ld/${QORVO_PLATFORM}.ld
-nostdlib
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map,--cref
)

target_compile_definitions(${PLATFORM_TARGET_MTD}
PUBLIC
${OT_PLATFORM_DEFINES}
)

target_compile_options(${PLATFORM_TARGET_MTD}
PRIVATE
${OT_CFLAGS}
)

target_include_directories(${PLATFORM_TARGET_MTD}
PRIVATE
${OT_PUBLIC_INCLUDES}
${OPENTHREAD_DIR}/examples/platforms
)

target_include_directories(ot-config INTERFACE ${OT_PUBLIC_INCLUDES})
target_compile_definitions(ot-config INTERFACE ${OT_PLATFORM_DEFINES})
87 changes: 87 additions & 0 deletions src/qpg6200/alarm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2024, 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.
*/

/**
* @file
* This file implements the OpenThread platform abstraction for the alarm.
*
*/

#include <stdbool.h>
#include <stdint.h>

#include "alarm_qorvo.h"
#include <openthread/platform/alarm-micro.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>

uint32_t otPlatAlarmMilliGetNow(void)
{
return qorvoAlarmGetTimeMs();
}

static void qorvoAlarmMilliFired(void *aInstance)
{
otPlatAlarmMilliFired((otInstance *)aInstance);
}

void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(t0);

qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance);
qorvoAlarmMilliStart(dt, qorvoAlarmMilliFired, aInstance);
}

void otPlatAlarmMilliStop(otInstance *aInstance)
{
qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMilliFired, aInstance);
}

uint32_t otPlatAlarmMicroGetNow(void)
{
return qorvoAlarmGetTimeUs();
}

static void qorvoAlarmMicroFired(void *aInstance)
{
otPlatAlarmMicroFired((otInstance *)aInstance);
}

void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(t0);

qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance);
qorvoAlarmMicroStart(dt, qorvoAlarmMicroFired, aInstance);
}

void otPlatAlarmMicroStop(otInstance *aInstance)
{
qorvoAlarmStop((qorvoAlarmCallback_t)qorvoAlarmMicroFired, aInstance);
}
Loading