This repository was archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
adding testapp - bsp - testentry #159
Open
khalifima
wants to merge
7
commits into
master
Choose a base branch
from
feature/#17-add-test-application-and-adapt-bsp-stm32f7
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
77d35dc
adding testapp - bsp - testentry
khalifima 0d00638
Merge branch 'master' into feature/#17-add-test-application-and-adapt…
khalifima 06ce39a
Update CMakeLists.txt
khalifima c3fc06e
Update CMakeLists.txt
khalifima 94d5e14
Update CMakeLists.txt
khalifima 8fc0a79
Update bsp_api_testif.c
khalifima c0332aa
Update TestSuiteUart.c
khalifima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,228 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2010-2019 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 "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 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| cmake_minimum_required(VERSION 3.6) | ||
|
|
||
| project ("Essentials integration test entry" C ASM) | ||
|
|
||
| # the checks will be executed as it would be on the desired compile step | ||
| if(${ENABLE_STATIC_CHECKS}) | ||
| set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY} --extra-arg=--target=arm-none-eabi --extra-arg=-mthumb --extra-arg=--sysroot=${CMAKE_SYSROOT} -checks=-*,readability-*,clang-analyzer-*,-clang-analyzer-cplusplus*) | ||
| set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} --extra-arg=--target=arm-none-eabi --extra-arg=--sysroot=${CMAKE_SYSROOT} -checks=-*,readability-*,clang-analyzer-*,-clang-analyzer-cplusplus*) | ||
| endif() | ||
|
|
||
| ## Only compilable for a target | ||
| if(${CMAKE_CROSSCOMPILING}) | ||
| file(GLOB TEST_ENTRY_SOURCES | ||
| source/*.c | ||
| ) | ||
| add_library(testentry STATIC ${TEST_ENTRY_SOURCES}) | ||
|
|
||
| target_include_directories(testentry | ||
| PRIVATE | ||
| source | ||
| ) | ||
| # List of additional libs from board_config.cmake | ||
| target_link_libraries(testentry testing essentials ${KISO_BOARD_LIBS}) | ||
| endif(${CMAKE_CROSSCOMPILING}) | ||
|
|
||
| # Include the tests for this module | ||
| if(${CMAKE_TESTING_ENABLED}) | ||
| #add_subdirectory(testentry/test) | ||
| endif() | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Integration Test Framework | ||
|
|
||
| It is composed by the following packages: | ||
| * Test-scheduler: Called in the continious integration. Define where the tests should be run. | ||
| * Test-coordinator: Coordiante the build and execution of the tests. | ||
| * Test-auxiliaries: List of elements that supports more complex tests (example: communication tests between a cloud service and a device) | ||
| * Test-executor: Software that will be flashed on the device under test. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, ...not dramatic, as the contents of
endif(...)are ignored anyway :)