From b5efdccec26ddc872b111521b79fd7889d831f38 Mon Sep 17 00:00:00 2001 From: Michael Schloh von Bennewitz Date: Wed, 30 Dec 2020 00:28:00 +0100 Subject: [PATCH] Clear area pending integration of current set of firmware projects. --- firmware/.gitignore | 5 --- firmware/.vscode/extensions.json | 7 --- firmware/include/README | 39 ---------------- firmware/lib/README | 46 ------------------- firmware/platformio.ini | 16 ------- firmware/src/main.c | 72 ------------------------------ firmware/src/main.h | 30 ------------- firmware/test/README | 11 ----- firmware/test/test_main.c | 55 ----------------------- firmware/test/unittest_transport.c | 72 ------------------------------ firmware/test/unittest_transport.h | 17 ------- 11 files changed, 370 deletions(-) delete mode 100644 firmware/.gitignore delete mode 100644 firmware/.vscode/extensions.json delete mode 100644 firmware/include/README delete mode 100644 firmware/lib/README delete mode 100644 firmware/platformio.ini delete mode 100644 firmware/src/main.c delete mode 100644 firmware/src/main.h delete mode 100644 firmware/test/README delete mode 100644 firmware/test/test_main.c delete mode 100644 firmware/test/unittest_transport.c delete mode 100644 firmware/test/unittest_transport.h diff --git a/firmware/.gitignore b/firmware/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/firmware/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/firmware/.vscode/extensions.json b/firmware/.vscode/extensions.json deleted file mode 100644 index 0f0d740..0000000 --- a/firmware/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ] -} diff --git a/firmware/include/README b/firmware/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/firmware/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/firmware/lib/README b/firmware/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/firmware/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/firmware/platformio.ini b/firmware/platformio.ini deleted file mode 100644 index efd1549..0000000 --- a/firmware/platformio.ini +++ /dev/null @@ -1,16 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:genericSTM32F405RG] -platform = ststm32 -framework = stm32cube -board = genericSTM32F405RG -build_flags = -DF4 -test_transport = custom diff --git a/firmware/src/main.c b/firmware/src/main.c deleted file mode 100644 index 1c631f0..0000000 --- a/firmware/src/main.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "main.h" - - -void LED_Init() -{ - LED_GPIO_CLK_ENABLE(); - - GPIO_InitTypeDef GPIO_InitStruct; - - GPIO_InitStruct.Pin = LED_PIN; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; - HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct); -} - -#ifndef UNIT_TEST -int main(void) -#else -int app_main(void) -#endif -{ - HAL_Init(); - LED_Init(); - - while (1) - { - HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN); - HAL_Delay(1000); - } -} - -void SysTick_Handler(void) -{ - HAL_IncTick(); -} - -void NMI_Handler(void) -{ -} - -void HardFault_Handler(void) -{ - while (1) {} -} - -void MemManage_Handler(void) -{ - while (1) {} -} - -void BusFault_Handler(void) -{ - while (1) {} -} - -void UsageFault_Handler(void) -{ - while (1) {} -} - -void SVC_Handler(void) -{ -} - -void DebugMon_Handler(void) -{ -} - -void PendSV_Handler(void) -{ -} \ No newline at end of file diff --git a/firmware/src/main.h b/firmware/src/main.h deleted file mode 100644 index 71fc85d..0000000 --- a/firmware/src/main.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MAIN_H -#define MAIN_H - -#if F0 -#include "stm32f0xx_hal.h" -#elif F1 -#include "stm32f1xx_hal.h" -#elif F2 -#include "stm32f2xx_hal.h" -#elif F3 -#include "stm32f3xx_hal.h" -#elif F4 -#include "stm32f4xx_hal.h" -#elif F7 -#include "stm32f7xx_hal.h" -#elif L0 -#include "stm32l0xx_hal.h" -#elif L1 -#include "stm32l1xx_hal.h" -#elif L4 -#include "stm32l4xx_hal.h" -#else -#error "Unsupported STM32 Family" -#endif - -#define LED_PIN GPIO_PIN_5 -#define LED_GPIO_PORT GPIOA -#define LED_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() - -#endif // MAIN_H \ No newline at end of file diff --git a/firmware/test/README b/firmware/test/README deleted file mode 100644 index b94d089..0000000 --- a/firmware/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/firmware/test/test_main.c b/firmware/test/test_main.c deleted file mode 100644 index 1532c38..0000000 --- a/firmware/test/test_main.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - - -void setUp(void) { - HAL_Init(); - - LED_GPIO_CLK_ENABLE(); - - GPIO_InitTypeDef GPIO_InitStruct; - GPIO_InitStruct.Pin = LED_PIN; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; - HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct); -} - -void tearDown(void) { - HAL_GPIO_DeInit(LED_GPIO_PORT, LED_PIN); -} - -void test_led_builtin_pin_number(void) { - TEST_ASSERT_EQUAL(LED_PIN, GPIO_PIN_5); -} - -void test_led_state_high(void) { - HAL_GPIO_WritePin(LED_GPIO_PORT, LED_PIN, GPIO_PIN_SET); - TEST_ASSERT_EQUAL(HAL_GPIO_ReadPin(LED_GPIO_PORT, LED_PIN), GPIO_PIN_SET); -} - -void test_led_state_low(void) { - HAL_GPIO_WritePin(LED_GPIO_PORT, LED_PIN, GPIO_PIN_RESET); - TEST_ASSERT_EQUAL(HAL_GPIO_ReadPin(LED_GPIO_PORT, LED_PIN), GPIO_PIN_RESET); -} - -int main() { - UNITY_BEGIN(); - - RUN_TEST(test_led_builtin_pin_number); - for (unsigned int i = 0; i < 5; i++) - { - RUN_TEST(test_led_state_high); - HAL_Delay(500); - RUN_TEST(test_led_state_low); - HAL_Delay(500); - } - - UNITY_END(); // Stop testing - - while (1) {} -} - -void SysTick_Handler(void) { - HAL_IncTick(); -} diff --git a/firmware/test/unittest_transport.c b/firmware/test/unittest_transport.c deleted file mode 100644 index 4232b3c..0000000 --- a/firmware/test/unittest_transport.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "unittest_transport.h" -#include - -#define USARTx USART2 -#define USARTx_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE() -#define USARTx_CLK_DISABLE() __HAL_RCC_USART2_CLK_DISABLE() -#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() -#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() -#define USARTx_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() -#define USARTx_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() - -#define USARTx_FORCE_RESET() __HAL_RCC_USART2_FORCE_RESET() -#define USARTx_RELEASE_RESET() __HAL_RCC_USART2_RELEASE_RESET() - -#define USARTx_TX_PIN GPIO_PIN_2 -#define USARTx_TX_GPIO_PORT GPIOA -#define USARTx_TX_AF GPIO_AF7_USART2 -#define USARTx_RX_PIN GPIO_PIN_3 -#define USARTx_RX_GPIO_PORT GPIOA -#define USARTx_RX_AF GPIO_AF7_USART2 - - -static UART_HandleTypeDef UartHandle; - -void unittest_uart_begin() -{ - GPIO_InitTypeDef GPIO_InitStruct; - - USARTx_TX_GPIO_CLK_ENABLE(); - USARTx_RX_GPIO_CLK_ENABLE(); - - USARTx_CLK_ENABLE(); - - GPIO_InitStruct.Pin = USARTx_TX_PIN; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FAST; - GPIO_InitStruct.Alternate = USARTx_TX_AF; - - HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); - - GPIO_InitStruct.Pin = USARTx_RX_PIN; - GPIO_InitStruct.Alternate = USARTx_RX_AF; - - HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); - UartHandle.Instance = USARTx; - - UartHandle.Init.BaudRate = 115200; // Or 9600 - UartHandle.Init.WordLength = UART_WORDLENGTH_8B; - UartHandle.Init.StopBits = UART_STOPBITS_1; - UartHandle.Init.Parity = UART_PARITY_NONE; - UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; - UartHandle.Init.Mode = UART_MODE_TX_RX; - UartHandle.Init.OverSampling = UART_OVERSAMPLING_16; - - if (HAL_UART_Init(&UartHandle) != HAL_OK) { - while (1) {} - } -} - -void unittest_uart_putchar(char c) -{ - HAL_UART_Transmit(&UartHandle, (uint8_t*)(&c), 1, 1000); -} - -void unittest_uart_flush() {} - -void unittest_uart_end() { - USARTx_CLK_DISABLE(); - USARTx_RX_GPIO_CLK_DISABLE(); - USARTx_TX_GPIO_CLK_DISABLE(); -} diff --git a/firmware/test/unittest_transport.h b/firmware/test/unittest_transport.h deleted file mode 100644 index e6da735..0000000 --- a/firmware/test/unittest_transport.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef UNITEST_TRANSPORT_H -#define UNITEST_TRANSPORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -void unittest_uart_begin(); -void unittest_uart_putchar(char c); -void unittest_uart_flush(); -void unittest_uart_end(); - -#ifdef __cplusplus -} -#endif - -#endif // UNITEST_TRANSPORT_H