From 6eded1c5cc9b98ab8191f424394ac3543230c744 Mon Sep 17 00:00:00 2001 From: bartool Date: Sat, 29 May 2021 10:44:58 +0200 Subject: [PATCH] przygotowany projekt do testowania --- .cproject | 6 +- .gitignore | 3 +- .mxproject | 28 +++--- .project | 2 +- .settings/language.settings.xml | 4 +- .settings/stm32cubeide.project.prefs | 5 +- .vscode/c_cpp_properties.json | 20 ++++ .vscode/launch.json | 28 ++++++ .vscode/settings.json | 3 + Core/Inc/SSD1306_oled.h | 4 + Core/Src/SSD1306_oled.c | 4 + ps4_buttons.ioc => oled_fonts.ioc | 0 project.yml | 140 +++++++++++++++++++++++++++ ps4_buttons Debug.launch | 73 -------------- 14 files changed, 224 insertions(+), 96 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json rename ps4_buttons.ioc => oled_fonts.ioc (100%) create mode 100644 project.yml delete mode 100644 ps4_buttons Debug.launch diff --git a/.cproject b/.cproject index e086da9..1c1f05b 100644 --- a/.cproject +++ b/.cproject @@ -51,7 +51,7 @@ - + @@ -203,7 +203,7 @@ - + @@ -311,7 +311,7 @@ - + diff --git a/.gitignore b/.gitignore index e6d8d29..166f2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -Debug/ \ No newline at end of file +Debug/ +build/ \ No newline at end of file diff --git a/.mxproject b/.mxproject index 007b8ed..f0fdd83 100644 --- a/.mxproject +++ b/.mxproject @@ -9,23 +9,23 @@ CDefines=USE_HAL_DRIVER;STM32F303xE;USE_HAL_DRIVER;USE_HAL_DRIVER; [PreviousGenFiles] AdvancedFolderStructure=true HeaderFileListSize=6 -HeaderFiles#0=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/gpio.h -HeaderFiles#1=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/i2c.h -HeaderFiles#2=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/usart.h -HeaderFiles#3=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/stm32f3xx_it.h -HeaderFiles#4=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/stm32f3xx_hal_conf.h -HeaderFiles#5=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc/main.h +HeaderFiles#0=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/gpio.h +HeaderFiles#1=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/i2c.h +HeaderFiles#2=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/usart.h +HeaderFiles#3=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/stm32f3xx_it.h +HeaderFiles#4=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/stm32f3xx_hal_conf.h +HeaderFiles#5=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc/main.h HeaderFolderListSize=1 -HeaderPath#0=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Inc +HeaderPath#0=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Inc HeaderFiles=; SourceFileListSize=6 -SourceFiles#0=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/gpio.c -SourceFiles#1=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/i2c.c -SourceFiles#2=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/usart.c -SourceFiles#3=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/stm32f3xx_it.c -SourceFiles#4=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/stm32f3xx_hal_msp.c -SourceFiles#5=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src/main.c +SourceFiles#0=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/gpio.c +SourceFiles#1=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/i2c.c +SourceFiles#2=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/usart.c +SourceFiles#3=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/stm32f3xx_it.c +SourceFiles#4=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/stm32f3xx_hal_msp.c +SourceFiles#5=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src/main.c SourceFolderListSize=1 -SourcePath#0=Z:/stm32/AIO_stm32cubeIDE/ps4_buttons/Core/Src +SourcePath#0=Z:/stm32/AIO_stm32cubeIDE/oled_fonts/Core/Src SourceFiles=; diff --git a/.project b/.project index 302f7d1..f54dc68 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - ps4_buttons + oled_fonts diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 651b3ed..2018b57 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -13,7 +13,7 @@ - + @@ -37,7 +37,7 @@ - + diff --git a/.settings/stm32cubeide.project.prefs b/.settings/stm32cubeide.project.prefs index 3246a04..c9d3704 100644 --- a/.settings/stm32cubeide.project.prefs +++ b/.settings/stm32cubeide.project.prefs @@ -1,4 +1,5 @@ +2F62501ED4689FB349E356AB974DBE57=30B5DBD14C9AE20F9B7A95E29127C0B7 66BE74F758C12D739921AEA421D593D3=1 -8DF89ED150041C4CBC7CB9A9CAA90856=93CE753708EB0111B382A806AD3853A1 -DC22A860405A8BF2F2C095E5B6529F12=93CE753708EB0111B382A806AD3853A1 +8DF89ED150041C4CBC7CB9A9CAA90856=30B5DBD14C9AE20F9B7A95E29127C0B7 +DC22A860405A8BF2F2C095E5B6529F12=11AEDEDFACF4D8CA7563836C15A914CD eclipse.preferences.version=1 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..0b6a963 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,20 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "/var/lib/gems/2.7.0/gems/ceedling-0.31.0/vendor/unity/src/", + "/var/lib/gems/2.7.0/gems/ceedling-0.31.0/vendor/cmock/src/" + ], + "defines": [ + "STM32F303xE" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++14", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5760901 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Ceedling Test Explorer Debug", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "miDebuggerPath": "/usr/bin/gdb" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f7e0123 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ceedlingExplorer.debugConfiguration": "Ceedling Test Explorer Debug" +} \ No newline at end of file diff --git a/Core/Inc/SSD1306_oled.h b/Core/Inc/SSD1306_oled.h index c17ecf7..d3d9444 100644 --- a/Core/Inc/SSD1306_oled.h +++ b/Core/Inc/SSD1306_oled.h @@ -85,4 +85,8 @@ void ssd1306_set_pixel(uint8_t x, uint8_t y, uint8_t bw); void ssd1306_write_to_buffer(const uint8_t* data, uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y); void ssd1306_clear_buffer (uint8_t width, uint8_t height, uint8_t pos_x, uint8_t pos_y); +#ifdef TEST +extern uint8_t buffer_oled[SSD1306_BUF_SIZE]; +#endif + #endif /* INC_SSD1306_OLED_H_ */ diff --git a/Core/Src/SSD1306_oled.c b/Core/Src/SSD1306_oled.c index e2b18e7..1e12e27 100644 --- a/Core/Src/SSD1306_oled.c +++ b/Core/Src/SSD1306_oled.c @@ -11,7 +11,11 @@ I2C_HandleTypeDef *oled_i2c; +#ifndef TEST static uint8_t buffer_oled[SSD1306_BUF_SIZE]; +#else +uint8_t buffer_oled[SSD1306_BUF_SIZE]; +#endif void SSD1306_SendCommand(uint8_t cmd) { diff --git a/ps4_buttons.ioc b/oled_fonts.ioc similarity index 100% rename from ps4_buttons.ioc rename to oled_fonts.ioc diff --git a/project.yml b/project.yml new file mode 100644 index 0000000..5f809df --- /dev/null +++ b/project.yml @@ -0,0 +1,140 @@ +--- + +# Notes: +# Sample project C code is not presently written to produce a release artifact. +# As such, release build options are disabled. +# This sample, therefore, only demonstrates running a collection of unit tests. + +:project: + :use_exceptions: FALSE + :use_test_preprocessor: TRUE + :use_auxiliary_dependencies: TRUE + :build_root: build +# :release_build: TRUE + :test_file_prefix: test_ + :which_ceedling: vendor/ceedling + :ceedling_version: 0.31.0 + :default_tasks: + - test:all + +#:test_build: +# :use_assembly: TRUE + +#:release_build: +# :output: MyApp.out +# :use_assembly: FALSE + +:environment: + +:extension: + :executable: .out + +:paths: + :test: + - +:test/** + - -:test/support + :source: + - Core/** + - Drivers/** + :support: + - test/support + :libraries: [] + +:defines: + # in order to add common defines: + # 1) remove the trailing [] from the :common: section + # 2) add entries to the :common: section (e.g. :test: has TEST defined) + :common: &common_defines + - STM32F303xE + - CMOCK_MEM_PTR_AS_INT=uint32_t + :test: + - *common_defines + - TEST + :test_preprocess: + - *common_defines + - TEST + +:cmock: + :includes: + # - Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h + - /home/bartool/Public/c_test/test2/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :plugins: + - :ignore + - :callback + :treat_as: + # uint8: HEX8 + # uint16: HEX16 + # uint32: UINT32 + # int8: INT8 + bool: UINT8 + char: HEX8 + int8_t: INT8 + int16_t: INT16 + int32_t: INT + INT8_T: INT8 + INT16_T: INT16 + INT32_T: INT + unsigned int: HEX32 + unsigned long': HEX32 + uint32: HEX32 + uint32_t: HEX32 + UINT32: HEX32 + UINT32_T: HEX32 + void*: HEX8_ARRAY + unsigned short: HEX16 + uint16: HEX16 + uint16_t: HEX16 + UINT16: HEX16 + UINT16_T: HEX16 + unsigned char: HEX8 + uint8: HEX8 + uint8_t: HEX8 + UINT8: HEX8 + UINT8_T: HEX8 + # char*: STRING + # pCHAR: STRING + # cstring: STRING + # CSTRING: STRING + # float: FLOAT + # double: FLOAT + + +# Add -gcov to the plugins list to make sure of the gcov plugin +# You will need to have gcov and gcovr both installed to make it work. +# For more information on these options, see docs in plugins/gcov +:gcov: + :reports: + - HtmlDetailed + :gcovr: + :html_medium_threshold: 75 + :html_high_threshold: 90 + +#:tools: +# Ceedling defaults to using gcc for compiling, linking, etc. +# As [:tools] is blank, gcc will be used (so long as it's in your system path) +# See documentation to configure a given toolchain for use + +# LIBRARIES +# These libraries are automatically injected into the build process. Those specified as +# common will be used in all types of builds. Otherwise, libraries can be injected in just +# tests or releases. These options are MERGED with the options in supplemental yaml files. +:libraries: + :placement: :end + :flag: "-l${1}" + :path_flag: "-L ${1}" + :system: [] # for example, you might list 'm' to grab the math library + :test: [] + :release: [] + +:plugins: + :load_paths: + - vendor/ceedling/plugins + :enabled: + - stdout_pretty_tests_report + - module_generator + - raw_output_report + - xml_tests_report +... diff --git a/ps4_buttons Debug.launch b/ps4_buttons Debug.launch deleted file mode 100644 index 7d02d4d..0000000 --- a/ps4_buttons Debug.launch +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -