Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a5a24fa
Add test executor and support code
khalifima Mar 12, 2020
814f720
Add testing to core
khalifima Feb 11, 2020
27a58f5
Neaten up core/testing code
ChiefGokhlayehBosch Sep 7, 2020
e5a5904
Properly await echo in UART integration test
ChiefGokhlayehBosch Sep 7, 2020
04eacbc
Build essentials integration test in CI/CD
ChiefGokhlayehBosch Sep 7, 2020
b17d572
Change KISO_INTEGRATION_TEST_NAME to ...ENTRY_PATH
ChiefGokhlayehBosch Sep 8, 2020
f4d2b97
Add documentation about integration test framework
ChiefGokhlayehBosch Sep 8, 2020
b99cb5f
Fix test-suite setup and teardown
ChiefGokhlayehBosch Sep 10, 2020
d33f5e1
Adapt CCMsg sub-type for ACK and REPORT
ChiefGokhlayehBosch Sep 10, 2020
6b11d22
Remove hugo theme directory before clone
ChiefGokhlayehBosch Sep 14, 2020
d9934f8
Add JLink to Dockerfile
ChiefGokhlayehBosch Sep 15, 2020
456883e
Split Dockerfile for dev and agent purposes
ChiefGokhlayehBosch Sep 15, 2020
5d725e3
Move JLink install to agent only
ChiefGokhlayehBosch Sep 15, 2020
73085ff
Move ITF CI/CD stuff in separate Jenkinsfile
ChiefGokhlayehBosch Sep 14, 2020
b07a99e
Raise UART RxErrors too
ChiefGokhlayehBosch Sep 16, 2020
40bd708
Enable use of remote JLink via cmake setting
ChiefGokhlayehBosch Sep 16, 2020
813a1c2
Clone and invoke kiso-testing in CI/CD
ChiefGokhlayehBosch Sep 16, 2020
012ae5e
Run on agent with remote JLink
ChiefGokhlayehBosch Sep 16, 2020
0cc52ee
Export integration testing overview as SVG
ChiefGokhlayehBosch Sep 16, 2020
fd4c523
Add integration testing setup guide
ChiefGokhlayehBosch Sep 16, 2020
9f67f2c
Import Essentials test config from kiso-testing
ChiefGokhlayehBosch Sep 17, 2020
5668e9e
Move contents of ci/itf into testing/integration
ChiefGokhlayehBosch Sep 17, 2020
bf99b83
Upgrade agent base image to multi-arch supported
ChiefGokhlayehBosch Sep 17, 2020
eb52506
Add arm64 bit support to agent image
ChiefGokhlayehBosch Sep 17, 2020
42535fc
Upgrade CI/CD docker image version to v0.0.8
ChiefGokhlayehBosch Sep 17, 2020
ca15ddd
Add ca-certificate workaround for ARM 32-bit
ChiefGokhlayehBosch Sep 17, 2020
5895511
Remove debug line from int-test Jenkinsfile
ChiefGokhlayehBosch Sep 17, 2020
00d61c1
Add SEGGER Terms of Use disclaimer to Dockerfile
ChiefGokhlayehBosch Sep 21, 2020
29c78ac
Clarify UART setup in Essentials UART test-spec
ChiefGokhlayehBosch Sep 21, 2020
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/debug
build
builddir-*
.vscode
.vscode
__pycache__/
testing/integration/test-coordinator/kiso-testing/
29 changes: 20 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option(ENABLE_FORMAT_CHECKS "Run format checks during configuration stage and ge
option(SKIP_FORMAT_REPORTS "Skip generation of format XML reports in build directory" ON)
option(ENABLE_STATIC_CHECKS "Configure a build tree for static code analysis" OFF)
option(ENABLE_COVERAGE "Build unit tests with coverage information to use with GCOV and LCOV" ON)
option(ENABLE_INTEGRATION_TESTING "Build for integration tests application" OFF)

## Include config file if it exists
include(kiso_defaults.cmake OPTIONAL)
Expand All @@ -17,14 +18,16 @@ if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND NOT ${ENABLE_TESTING})
include(cmake/ArmToolchain.cmake)
endif()

message("------------- KISO CONFIG -------------")
message("Building Kiso tests: ${ENABLE_TESTING}")
message(" ... with coverage: ${ENABLE_COVERAGE}")
message("Kiso Board Path: ${KISO_BOARD_PATH}")
message("Kiso OS: ${KISO_OS_LIB}")
message("Kiso Application Path: ${KISO_APPLICATION_PATH}")
message("Project Config Path: ${PROJECT_CONFIG_PATH}")
message("------------- KISO CONFIG -------------")
message("---------------------------------- KISO CONFIG ----------------------------------")
message("Building Kiso tests: ${ENABLE_TESTING}")
message(" ... with coverage: ${ENABLE_COVERAGE}")
message("Building Kiso integration tests: ${ENABLE_INTEGRATION_TESTING}")
message(" ... with entry in: ${KISO_INTEGRATION_TEST_ENTRY_PATH}")
message("Kiso Board Path: ${KISO_BOARD_PATH}")
message("Kiso OS: ${KISO_OS_LIB}")
message("Kiso Application Path: ${KISO_APPLICATION_PATH}")
message("Project Config Path: ${PROJECT_CONFIG_PATH}")
message("---------------------------------- KISO CONFIG ----------------------------------")

project (Kiso C)

Expand Down Expand Up @@ -89,7 +92,12 @@ if(${ENABLE_STATIC_CHECKS})
endif()

## Add application code
add_subdirectory(${KISO_APPLICATION_PATH} ${CMAKE_CURRENT_BINARY_DIR}/applications/${KISO_APPLICATION_NAME})
if(${ENABLE_INTEGRATION_TESTING})
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/testing/integration/test-executor)
add_subdirectory(${KISO_INTEGRATION_TEST_ENTRY_PATH})
else(${ENABLE_INTEGRATION_TESTING})
add_subdirectory(${KISO_APPLICATION_PATH} ${CMAKE_CURRENT_BINARY_DIR}/applications/${KISO_APPLICATION_NAME})
endif(${ENABLE_INTEGRATION_TESTING})

include(KisoLibsConfig)

Expand All @@ -98,6 +106,9 @@ include(KisoLibsConfig)
add_subdirectory(core/essentials)
add_subdirectory(core/utils)
add_subdirectory(core/connectivity/cellular)
if(${ENABLE_INTEGRATION_TESTING})
add_subdirectory(core/testing)
endif(${ENABLE_INTEGRATION_TESTING})

## Add thirdparty libs
add_subdirectory(thirdparty)
Expand Down
7 changes: 5 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pipeline
containerTemplate
{
name 'kiso-build-env'
image 'eclipse/kiso-build-env:v0.0.7'
image 'eclipse/kiso-build-env:v0.0.8'
ttyEnabled true
resourceRequestCpu '2'
resourceLimitCpu '2'
Expand Down Expand Up @@ -85,7 +85,9 @@ pipeline
{
script
{
echo "run integration-tests placeholder"
echo "build integration-tests"
sh 'cmake . -Bbuilddir-integration -G"Ninja" -DENABLE_INTEGRATION_TESTING=1 -DKISO_INTEGRATION_TEST_ENTRY_PATH="core/essentials/test/integration" -DKISO_BOARD_NAME="NucleoF767"'
sh 'cmake --build builddir-integration'
}
}
}
Expand All @@ -107,6 +109,7 @@ pipeline
script
{
echo "Generate Hugo Website"
sh 'rm -rf docs/website/themes/learn/'
sh 'git clone --depth 1 --branch 2.5.0 https://github.com/matcornic/hugo-theme-learn.git docs/website/themes/learn/'
sh 'hugo -s docs/website'
}
Expand Down
4 changes: 4 additions & 0 deletions boards/NucleoF767/bsp/config/core/essentials/Kiso_BSPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
#define KISO_FEATURE_BSP_BUTTON 1
#endif

#ifndef KISO_FEATURE_BSP_GENERIC_UART
#define KISO_FEATURE_BSP_GENERIC_UART 1
#endif

#ifndef KISO_FEATURE_BSP_CELLULAR_SARAR4N4
#define KISO_FEATURE_BSP_CELLULAR_SARAR4N4 0
#endif
Expand Down
1 change: 1 addition & 0 deletions boards/NucleoF767/bsp/include/BSP_NucleoF767.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum BSP_NUCLEOF767y_Modules_E
MODULE_BSP_API_BOARD,
MODULE_BSP_API_LED,
MODULE_BSP_API_TEST_IF,
MODULE_BSP_API_GENERICUART,
MODULE_BSP_TIME,
MODULE_BSP_BUTTON,
};
Expand Down
1 change: 0 additions & 1 deletion boards/NucleoF767/bsp/source/bsp_api_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
/*---------------------- LOCAL FUNCTIONS DECLARATION ----------------------------------------------------------------*/

void EXTI15_10_IRQHandler(void);
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin);

/*---------------------- VARIABLES DECLARATION ----------------------------------------------------------------------*/

Expand Down
230 changes: 230 additions & 0 deletions boards/NucleoF767/bsp/source/bsp_api_genericuart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
/********************************************************************************
* Copyright (c) 2010-2020 Robert Bosch GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial contribution
*
********************************************************************************/

#include "Kiso_BSP_GenericUart.h"

#if KISO_FEATURE_BSP_GENERIC_UART

#include "Kiso_Basics.h"
#include "Kiso_Retcode.h"
#include "stm32/stm32f7/Kiso_MCU_STM32F7_UART_Handle.h"
#include "Kiso_HAL_Delay.h"
#include "BSP_NucleoF767.h"
#include "protected/gpio.h"

/*---------------------- MACROS DEFINITION --------------------------------------------------------------------------*/

#undef KISO_MODULE_ID
#define KISO_MODULE_ID MODULE_BSP_API_GENERICUART

#define UART_INT_PRIORITY UINT32_C(10)
#define UART_SUBPRIORITY UINT32_C(1)

/*---------------------- LOCAL FUNCTIONS DECLARATION ----------------------------------------------------------------*/

void USART2_IRQHandler(void);

/*---------------------- VARIABLES DECLARATION ----------------------------------------------------------------------*/

static uint8_t bspState = (uint8_t)BSP_STATE_INIT; /**< BSP State of the cellular module */

/**
* Static structure storing the UART handle for Test Interface
*/
static struct MCU_UART_S uartCtrlStruct =
{
.TxMode = KISO_HAL_TRANSFER_MODE_INTERRUPT,
.RxMode = KISO_HAL_TRANSFER_MODE_INTERRUPT,
.Datarate = 115200U,
.huart.Instance = USART2,
.huart.Init.BaudRate = 115200U,
.huart.Init.WordLength = UART_WORDLENGTH_8B,
.huart.Init.StopBits = UART_STOPBITS_1,
.huart.Init.Parity = UART_PARITY_NONE,
.huart.Init.Mode = UART_MODE_TX_RX,
.huart.Init.HwFlowCtl = UART_HWCONTROL_NONE,
.huart.Init.OverSampling = UART_OVERSAMPLING_16,
.huart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,
.huart.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,
};
/*---------------------- EXPOSED FUNCTIONS IMPLEMENTATION -----------------------------------------------------------*/

/**
* See API interface for function documentation
* @retval RETCODE_OK in case of success.
* @retval RETCODE_INCONSISTENT_STATE in case the module is not in a state to allow connecting.
*/
Retcode_T BSP_GenericUart_Connect(uint32_t id)
{
KISO_UNUSED(id);
Retcode_T retcode = RETCODE_OK;

if (!(bspState & (uint8_t)BSP_STATE_TO_CONNECTED))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_INCONSISTENT_STATE);
}
if (RETCODE_OK == retcode)
{
/* IOSV bit MUST be set to access GPIO port G[2:15] */
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_RCC_LPTIM1_CLK_ENABLE();

GPIO_InitTypeDef GPIO_InitStruct = {0};

/* UART RX/TX GPIO pin configuration */
GPIO_OpenClockGate(GPIO_PORT_D, PIND_USART2_TX | PIND_USART2_RX);

GPIO_InitStruct.Pin = PIND_USART2_TX | PIND_USART2_RX;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;

HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

bspState = (uint8_t)BSP_STATE_CONNECTED;
}
return retcode;
}

/**
* See API interface for function documentation
* @retval RETCODE_OK in case of success.
* @retval RETCODE_INCONSISTENT_STATE in case the module is not in a state to allow enabling.
*/
Retcode_T BSP_GenericUart_Enable(uint32_t id)
{
KISO_UNUSED(id);
Retcode_T retcode = RETCODE_OK;

if (!(bspState & (uint8_t)BSP_STATE_TO_ENABLED))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_INCONSISTENT_STATE);
}
if (RETCODE_OK == retcode)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_USART2_FORCE_RESET();
__HAL_RCC_USART2_RELEASE_RESET();
__GPIOD_CLK_ENABLE();
/* Configure the UART resource */
if (HAL_OK != HAL_UART_Init(&uartCtrlStruct.huart))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_BSP_UART_INIT_FAILED);
}
}
if (RETCODE_OK == retcode)
{
NVIC_ClearPendingIRQ(USART2_IRQn);
HAL_NVIC_SetPriority(USART2_IRQn, UART_INT_PRIORITY, UART_SUBPRIORITY);
HAL_NVIC_EnableIRQ(USART2_IRQn);

bspState = (uint8_t)BSP_STATE_ENABLED;
}
return retcode;
}

/**
* See API interface for function documentation
* @retval RETCODE_OK in case of success.
* @retval RETCODE_INCONSISTENT_STATE in case the module is not in a state to allow disabling.
*/
Retcode_T BSP_GenericUart_Disable(uint32_t id)
{
KISO_UNUSED(id);
Retcode_T retcode = RETCODE_OK;

if (!(bspState & (uint8_t)BSP_STATE_TO_DISABLED))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_INCONSISTENT_STATE);
}
if (RETCODE_OK == retcode)
{
/* Disable interrupts and deactivate UART peripheral */
HAL_NVIC_DisableIRQ(USART2_IRQn);
/* Clear the pending interrupt */
HAL_NVIC_ClearPendingIRQ(USART2_IRQn);

if (HAL_OK != HAL_UART_DeInit(&uartCtrlStruct.huart))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_BSP_UART_DEINIT_FAILED);
}
}
if (RETCODE_OK == retcode)
{
__USART2_CLK_DISABLE();
bspState = (uint8_t)BSP_STATE_DISABLED;
}
return retcode;
}

/**
* See API interface for function documentation
* @retval RETCODE_OK in case of success.
* @retval RETCODE_INCONSISTENT_STATE in case the module is not in a state to allow disconnecting.
*/
Retcode_T BSP_GenericUart_Disconnect(uint32_t id)
{
KISO_UNUSED(id);
Retcode_T retcode = RETCODE_OK;
if (!(bspState & (uint8_t)BSP_STATE_TO_DISCONNECTED))
{
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_INCONSISTENT_STATE);
}
if (RETCODE_OK == retcode)
{
HAL_GPIO_DeInit(GPIOD, PIND_USART2_TX | PIND_USART2_RX);
GPIO_CloseClockGate(GPIO_PORT_D, PIND_USART2_TX | PIND_USART2_RX);
}
if (RETCODE_OK == retcode)
{
bspState = (uint8_t)BSP_STATE_DISCONNECTED;
}
return retcode;
}

/**
* See API interface for function documentation
* @return A pointer to the UART control structure
*/
HWHandle_T BSP_GenericUart_GetHandle(uint32_t id)
{
KISO_UNUSED(id);
return (HWHandle_T)&uartCtrlStruct;
}

/**
* This function is not in use.
*/
Retcode_T BSP_GenericUart_UserControl(uint32_t control, void *param)
{
KISO_UNUSED(control);
KISO_UNUSED(param);

return RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_NOT_SUPPORTED);
}

/*---------------------- LOCAL FUNCTIONS IMPLEMENTATION -------------------------------------------------------------*/

/**
* Interrupt Service Routine handling USART2 IRQ. Forwards call to MCU Layer for handling.
*/
void USART2_IRQHandler(void)
{
if (uartCtrlStruct.IrqCallback)
{
uartCtrlStruct.IrqCallback((UART_T)&uartCtrlStruct);
}
}
#endif /* KISO_FEATURE_BSP_TEST_INTERFACE */
Loading