├── .gitigore
├── README.md
├── TC3
├── .cproject
├── .mxproject
├── .project
├── .settings
│ └── language.settings.xml
├── Debug
│ ├── Drivers
│ │ └── STM32F1xx_HAL_Driver
│ │ │ └── Src
│ │ │ ├── stm32f1xx_hal.d
│ │ │ ├── stm32f1xx_hal.o
│ │ │ ├── stm32f1xx_hal_cortex.d
│ │ │ ├── stm32f1xx_hal_cortex.o
│ │ │ ├── stm32f1xx_hal_dma.d
│ │ │ ├── stm32f1xx_hal_dma.o
│ │ │ ├── stm32f1xx_hal_flash.d
│ │ │ ├── stm32f1xx_hal_flash.o
│ │ │ ├── stm32f1xx_hal_flash_ex.d
│ │ │ ├── stm32f1xx_hal_flash_ex.o
│ │ │ ├── stm32f1xx_hal_gpio.d
│ │ │ ├── stm32f1xx_hal_gpio.o
│ │ │ ├── stm32f1xx_hal_gpio_ex.d
│ │ │ ├── stm32f1xx_hal_gpio_ex.o
│ │ │ ├── stm32f1xx_hal_pwr.d
│ │ │ ├── stm32f1xx_hal_pwr.o
│ │ │ ├── stm32f1xx_hal_rcc.d
│ │ │ ├── stm32f1xx_hal_rcc.o
│ │ │ ├── stm32f1xx_hal_rcc_ex.d
│ │ │ ├── stm32f1xx_hal_rcc_ex.o
│ │ │ ├── stm32f1xx_hal_spi.d
│ │ │ ├── stm32f1xx_hal_spi.o
│ │ │ ├── stm32f1xx_hal_spi_ex.d
│ │ │ ├── stm32f1xx_hal_spi_ex.o
│ │ │ ├── stm32f1xx_hal_tim.d
│ │ │ ├── stm32f1xx_hal_tim.o
│ │ │ ├── stm32f1xx_hal_tim_ex.d
│ │ │ ├── stm32f1xx_hal_tim_ex.o
│ │ │ ├── stm32f1xx_hal_uart.d
│ │ │ ├── stm32f1xx_hal_uart.o
│ │ │ └── subdir.mk
│ ├── Src
│ │ ├── SPITemp.d
│ │ ├── SPITemp.o
│ │ ├── main.d
│ │ ├── main.o
│ │ ├── pidMath.d
│ │ ├── pidMath.o
│ │ ├── pulse_math.d
│ │ ├── pulse_math.o
│ │ ├── stm32f1xx_hal_msp.d
│ │ ├── stm32f1xx_hal_msp.o
│ │ ├── stm32f1xx_it.d
│ │ ├── stm32f1xx_it.o
│ │ ├── subdir.mk
│ │ ├── syscalls.d
│ │ ├── syscalls.o
│ │ ├── system_stm32f1xx.d
│ │ ├── system_stm32f1xx.o
│ │ ├── timer.d
│ │ ├── timer.o
│ │ ├── uartInterface.d
│ │ └── uartInterface.o
│ ├── TC3.elf
│ ├── TC3.hex
│ ├── makefile
│ ├── objects.list
│ ├── objects.mk
│ ├── output.map
│ ├── sources.mk
│ └── startup
│ │ ├── startup_stm32f103xb.o
│ │ └── subdir.mk
├── Drivers
│ ├── CMSIS
│ │ ├── Device
│ │ │ └── ST
│ │ │ │ └── STM32F1xx
│ │ │ │ └── Include
│ │ │ │ ├── stm32f103xb.h
│ │ │ │ ├── stm32f1xx.h
│ │ │ │ └── system_stm32f1xx.h
│ │ └── Include
│ │ │ ├── arm_common_tables.h
│ │ │ ├── arm_const_structs.h
│ │ │ ├── arm_math.h
│ │ │ ├── cmsis_armcc.h
│ │ │ ├── cmsis_armcc_V6.h
│ │ │ ├── cmsis_gcc.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ ├── core_sc000.h
│ │ │ └── core_sc300.h
│ └── STM32F1xx_HAL_Driver
│ │ ├── Inc
│ │ ├── Legacy
│ │ │ └── stm32_hal_legacy.h
│ │ ├── stm32f1xx_hal.h
│ │ ├── stm32f1xx_hal_cortex.h
│ │ ├── stm32f1xx_hal_def.h
│ │ ├── stm32f1xx_hal_dma.h
│ │ ├── stm32f1xx_hal_dma_ex.h
│ │ ├── stm32f1xx_hal_flash.h
│ │ ├── stm32f1xx_hal_flash_ex.h
│ │ ├── stm32f1xx_hal_gpio.h
│ │ ├── stm32f1xx_hal_gpio_ex.h
│ │ ├── stm32f1xx_hal_pwr.h
│ │ ├── stm32f1xx_hal_rcc.h
│ │ ├── stm32f1xx_hal_rcc_ex.h
│ │ ├── stm32f1xx_hal_spi.h
│ │ ├── stm32f1xx_hal_tim.h
│ │ ├── stm32f1xx_hal_tim_ex.h
│ │ └── stm32f1xx_hal_uart.h
│ │ └── Src
│ │ ├── stm32f1xx_hal.c
│ │ ├── stm32f1xx_hal_cortex.c
│ │ ├── stm32f1xx_hal_dma.c
│ │ ├── stm32f1xx_hal_flash.c
│ │ ├── stm32f1xx_hal_flash_ex.c
│ │ ├── stm32f1xx_hal_gpio.c
│ │ ├── stm32f1xx_hal_gpio_ex.c
│ │ ├── stm32f1xx_hal_pwr.c
│ │ ├── stm32f1xx_hal_rcc.c
│ │ ├── stm32f1xx_hal_rcc_ex.c
│ │ ├── stm32f1xx_hal_spi.c
│ │ ├── stm32f1xx_hal_spi_ex.c
│ │ ├── stm32f1xx_hal_tim.c
│ │ ├── stm32f1xx_hal_tim_ex.c
│ │ └── stm32f1xx_hal_uart.c
├── Inc
│ ├── SPITemp.h
│ ├── main.h
│ ├── pidMath.h
│ ├── pulse_math.h
│ ├── stm32f1xx_hal_conf.h
│ ├── stm32f1xx_it.h
│ ├── timer.h
│ └── uartInterface.h
├── New_configuration (2).cfg
├── STM32F103C8Tx_FLASH.ld
├── Src
│ ├── SPITemp.c
│ ├── main.c
│ ├── pidMath.c
│ ├── pulse_math.c
│ ├── stm32f1xx_hal_msp.c
│ ├── stm32f1xx_it.c
│ ├── syscalls.c
│ ├── system_stm32f1xx.c
│ ├── timer.c
│ └── uartInterface.c
├── TC3.ioc
├── TC3.xml
└── startup
│ └── startup_stm32f103xb.s
├── build
├── Readme.txt
└── test
│ ├── cache
│ ├── input.yml
│ ├── test_PIDMath.c
│ ├── test_SPITemp.c
│ ├── test_TRIAC_IT.c
│ ├── test_pulse_math.c
│ ├── test_uartInterface.c
│ └── timer.h
│ ├── dependencies
│ └── force_build
│ ├── mocks
│ ├── mock_timer.c
│ └── mock_timer.h
│ ├── out
│ ├── CException.o
│ ├── Exception.o
│ ├── PIDMath.o
│ ├── SPITemp.o
│ ├── TRIAC_IT.o
│ ├── cmock.o
│ ├── mock_timer.o
│ ├── pulse_math.o
│ ├── test_PIDMath.exe
│ ├── test_PIDMath.o
│ ├── test_PIDMath_runner.o
│ ├── test_SPITemp.exe
│ ├── test_SPITemp.o
│ ├── test_SPITemp_runner.o
│ ├── test_TRIAC_IT.exe
│ ├── test_TRIAC_IT.o
│ ├── test_TRIAC_IT_runner.o
│ ├── test_pulse_math.exe
│ ├── test_pulse_math.o
│ ├── test_pulse_math_runner.o
│ ├── test_uartInterface.exe
│ ├── test_uartInterface.o
│ ├── test_uartInterface_runner.o
│ ├── uartInterface.o
│ └── unity.o
│ ├── preprocess
│ ├── files
│ │ ├── test_PIDMath.c
│ │ ├── test_SPITemp.c
│ │ ├── test_TRIAC_IT.c
│ │ ├── test_pulse_math.c
│ │ ├── test_uartInterface.c
│ │ └── timer.h
│ └── includes
│ │ ├── test_PIDMath.c
│ │ ├── test_SPITemp.c
│ │ ├── test_TRIAC_IT.c
│ │ ├── test_pulse_math.c
│ │ ├── test_uartInterface.c
│ │ └── timer.h
│ ├── results
│ ├── test_PIDMath.pass
│ ├── test_SPITemp.pass
│ ├── test_TRIAC_IT.pass
│ ├── test_pulse_math.pass
│ └── test_uartInterface.pass
│ └── runners
│ ├── test_PIDMath_runner.c
│ ├── test_SPITemp_runner.c
│ ├── test_TRIAC_IT_runner.c
│ ├── test_pulse_math_runner.c
│ └── test_uartInterface_runner.c
├── project.yml
├── src
├── CExceptionConfig.h
├── Error.h
├── Exception.c
├── Exception.h
├── PIDMath.c
├── PIDMath.h
├── SPITemp.c
├── SPITemp.h
├── TRIAC_IT.c
├── TRIAC_IT.h
├── pulse_math.c
├── pulse_math.h
├── timer.h
├── uartInterface.c
└── uartInterface.h
├── test
├── support
│ └── Readme.txt
├── test_PIDMath.c
├── test_SPITemp.c
├── test_TRIAC_IT.c
├── test_pulse_math.c
└── test_uartInterface.c
└── vendor
└── ceedling
├── docs
├── CException.md
├── CMock_Summary.md
├── CeedlingPacket.md
├── ThrowTheSwitchCodingStandard.md
├── UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf
├── UnityAssertionsReference.md
├── UnityConfigurationGuide.md
├── UnityGettingStartedGuide.md
└── UnityHelperScriptsGuide.md
├── lib
├── ceedling.rb
└── ceedling
│ ├── build_invoker_utils.rb
│ ├── cacheinator.rb
│ ├── cacheinator_helper.rb
│ ├── cmock_builder.rb
│ ├── configurator.rb
│ ├── configurator_builder.rb
│ ├── configurator_plugins.rb
│ ├── configurator_setup.rb
│ ├── configurator_validator.rb
│ ├── constants.rb
│ ├── defaults.rb
│ ├── dependinator.rb
│ ├── erb_wrapper.rb
│ ├── file_finder.rb
│ ├── file_finder_helper.rb
│ ├── file_path_utils.rb
│ ├── file_system_utils.rb
│ ├── file_system_wrapper.rb
│ ├── file_wrapper.rb
│ ├── flaginator.rb
│ ├── generator.rb
│ ├── generator_helper.rb
│ ├── generator_test_results.rb
│ ├── generator_test_results_sanity_checker.rb
│ ├── generator_test_runner.rb
│ ├── loginator.rb
│ ├── makefile.rb
│ ├── objects.yml
│ ├── par_map.rb
│ ├── plugin.rb
│ ├── plugin_builder.rb
│ ├── plugin_manager.rb
│ ├── plugin_manager_helper.rb
│ ├── plugin_reportinator.rb
│ ├── plugin_reportinator_helper.rb
│ ├── preprocessinator.rb
│ ├── preprocessinator_extractor.rb
│ ├── preprocessinator_file_handler.rb
│ ├── preprocessinator_helper.rb
│ ├── preprocessinator_includes_handler.rb
│ ├── project_config_manager.rb
│ ├── project_file_loader.rb
│ ├── rake_utils.rb
│ ├── rake_wrapper.rb
│ ├── rakefile.rb
│ ├── release_invoker.rb
│ ├── release_invoker_helper.rb
│ ├── reportinator.rb
│ ├── rules_cmock.rake
│ ├── rules_preprocess.rake
│ ├── rules_release.rake
│ ├── rules_release_deep_dependencies.rake
│ ├── rules_tests.rake
│ ├── rules_tests_deep_dependencies.rake
│ ├── setupinator.rb
│ ├── stream_wrapper.rb
│ ├── streaminator.rb
│ ├── streaminator_helper.rb
│ ├── system_utils.rb
│ ├── system_wrapper.rb
│ ├── target_loader.rb
│ ├── task_invoker.rb
│ ├── tasks_base.rake
│ ├── tasks_filesystem.rake
│ ├── tasks_release.rake
│ ├── tasks_release_deep_dependencies.rake
│ ├── tasks_tests.rake
│ ├── tasks_tests_deep_dependencies.rake
│ ├── tasks_vendor.rake
│ ├── test_includes_extractor.rb
│ ├── test_invoker.rb
│ ├── test_invoker_helper.rb
│ ├── tool_executor.rb
│ ├── tool_executor_helper.rb
│ ├── verbosinator.rb
│ ├── version.rb
│ ├── version.rb.erb
│ └── yaml_wrapper.rb
├── plugins
├── bullseye
│ ├── assets
│ │ └── template.erb
│ ├── bullseye.rake
│ ├── config
│ │ └── defaults.yml
│ ├── lib
│ │ └── bullseye.rb
│ └── readme.txt
├── command_hooks
│ ├── README.md
│ └── lib
│ │ └── command_hooks.rb
├── fake_function_framework
│ ├── README.md
│ ├── Rakefile
│ ├── examples
│ │ └── fff_example
│ │ │ ├── project.yml
│ │ │ ├── rakefile.rb
│ │ │ ├── src
│ │ │ ├── bar.c
│ │ │ ├── bar.h
│ │ │ ├── custom_types.h
│ │ │ ├── display.c
│ │ │ ├── display.h
│ │ │ ├── event_processor.c
│ │ │ ├── event_processor.h
│ │ │ ├── foo.c
│ │ │ ├── foo.h
│ │ │ └── subfolder
│ │ │ │ ├── zzz.c
│ │ │ │ └── zzz.h
│ │ │ └── test
│ │ │ ├── test_event_processor.c
│ │ │ └── test_foo.c
│ ├── lib
│ │ ├── fake_function_framework.rb
│ │ └── fff_mock_generator.rb
│ ├── spec
│ │ ├── fff_mock_header_generator_spec.rb
│ │ ├── fff_mock_source_generator_spec.rb
│ │ ├── header_generator.rb
│ │ └── spec_helper.rb
│ └── src
│ │ └── fff_unity_helper.h
├── gcov
│ ├── README.md
│ ├── assets
│ │ └── template.erb
│ ├── config
│ │ └── defaults.yml
│ ├── gcov.rake
│ └── lib
│ │ ├── gcov.rb
│ │ └── gcov_constants.rb
├── junit_tests_report
│ └── lib
│ │ └── junit_tests_report.rb
├── module_generator
│ ├── config
│ │ └── module_generator.yml
│ ├── lib
│ │ └── module_generator.rb
│ └── module_generator.rake
├── stdout_gtestlike_tests_report
│ ├── assets
│ │ ├── template.erb
│ │ └── template.erb copy
│ ├── config
│ │ └── stdout_gtestlike_tests_report.yml
│ └── lib
│ │ └── stdout_gtestlike_tests_report.rb
├── stdout_ide_tests_report
│ ├── config
│ │ └── stdout_ide_tests_report.yml
│ └── lib
│ │ └── stdout_ide_tests_report.rb
├── stdout_pretty_tests_report
│ ├── assets
│ │ └── template.erb
│ ├── config
│ │ └── stdout_pretty_tests_report.yml
│ └── lib
│ │ └── stdout_pretty_tests_report.rb
├── subprojects
│ ├── README.md
│ ├── config
│ │ └── defaults.yml
│ ├── lib
│ │ └── subprojects.rb
│ └── subprojects.rake
├── teamcity_tests_report
│ ├── config
│ │ └── teamcity_tests_report.yml
│ └── lib
│ │ └── teamcity_tests_report.rb
├── warnings_report
│ └── lib
│ │ └── warnings_report.rb
└── xml_tests_report
│ └── lib
│ └── xml_tests_report.rb
└── vendor
├── c_exception
├── lib
│ ├── CException.c
│ └── CException.h
└── release
│ ├── build.info
│ └── version.info
├── cmock
├── config
│ ├── production_environment.rb
│ └── test_environment.rb
├── lib
│ ├── cmock.rb
│ ├── cmock_config.rb
│ ├── cmock_file_writer.rb
│ ├── cmock_generator.rb
│ ├── cmock_generator_plugin_array.rb
│ ├── cmock_generator_plugin_callback.rb
│ ├── cmock_generator_plugin_cexception.rb
│ ├── cmock_generator_plugin_expect.rb
│ ├── cmock_generator_plugin_expect_any_args.rb
│ ├── cmock_generator_plugin_ignore.rb
│ ├── cmock_generator_plugin_ignore_arg.rb
│ ├── cmock_generator_plugin_return_thru_ptr.rb
│ ├── cmock_generator_utils.rb
│ ├── cmock_header_parser.rb
│ ├── cmock_plugin_manager.rb
│ └── cmock_unityhelper_parser.rb
├── release
│ ├── build.info
│ └── version.info
└── src
│ ├── cmock.c
│ ├── cmock.h
│ └── cmock_internals.h
├── deep_merge
└── lib
│ └── deep_merge.rb
├── diy
└── lib
│ ├── diy.rb
│ └── diy
│ └── factory.rb
└── unity
├── auto
├── colour_prompt.rb
├── colour_reporter.rb
├── generate_config.yml
├── generate_module.rb
├── generate_test_runner.rb
├── parse_output.rb
├── stylize_as_junit.rb
├── test_file_filter.rb
├── type_sanitizer.rb
├── unity_test_summary.py
├── unity_test_summary.rb
└── unity_to_junit.py
├── release
├── build.info
└── version.info
└── src
├── unity.c
├── unity.h
└── unity_internals.h
/.gitigore:
--------------------------------------------------------------------------------
1 | build/*
2 | !build/Readme.txt
3 |
--------------------------------------------------------------------------------
/TC3/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TC3
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | fr.ac6.mcu.ide.core.MCUProjectNature
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/TC3/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o
--------------------------------------------------------------------------------
/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/SPITemp.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/SPITemp.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/main.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/main.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/pidMath.d:
--------------------------------------------------------------------------------
1 | Src/pidMath.o: ../Src/pidMath.c \
2 | C:/Users/User/Desktop/BAME3114/TC3/Inc/pidMath.h
3 |
4 | C:/Users/User/Desktop/BAME3114/TC3/Inc/pidMath.h:
5 |
--------------------------------------------------------------------------------
/TC3/Debug/Src/pidMath.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/pidMath.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/pulse_math.d:
--------------------------------------------------------------------------------
1 | Src/pulse_math.o: ../Src/pulse_math.c \
2 | C:/Users/User/Desktop/BAME3114/TC3/Inc/pulse_math.h \
3 | C:/Users/User/Desktop/BAME3114/TC3/Inc/timer.h
4 |
5 | C:/Users/User/Desktop/BAME3114/TC3/Inc/pulse_math.h:
6 |
7 | C:/Users/User/Desktop/BAME3114/TC3/Inc/timer.h:
8 |
--------------------------------------------------------------------------------
/TC3/Debug/Src/pulse_math.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/pulse_math.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/stm32f1xx_hal_msp.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/stm32f1xx_hal_msp.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/stm32f1xx_it.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/stm32f1xx_it.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/subdir.mk:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | # Add inputs and outputs from these tool invocations to the build variables
6 | C_SRCS += \
7 | ../Src/SPITemp.c \
8 | ../Src/main.c \
9 | ../Src/pidMath.c \
10 | ../Src/pulse_math.c \
11 | ../Src/stm32f1xx_hal_msp.c \
12 | ../Src/stm32f1xx_it.c \
13 | ../Src/syscalls.c \
14 | ../Src/system_stm32f1xx.c \
15 | ../Src/timer.c \
16 | ../Src/uartInterface.c
17 |
18 | OBJS += \
19 | ./Src/SPITemp.o \
20 | ./Src/main.o \
21 | ./Src/pidMath.o \
22 | ./Src/pulse_math.o \
23 | ./Src/stm32f1xx_hal_msp.o \
24 | ./Src/stm32f1xx_it.o \
25 | ./Src/syscalls.o \
26 | ./Src/system_stm32f1xx.o \
27 | ./Src/timer.o \
28 | ./Src/uartInterface.o
29 |
30 | C_DEPS += \
31 | ./Src/SPITemp.d \
32 | ./Src/main.d \
33 | ./Src/pidMath.d \
34 | ./Src/pulse_math.d \
35 | ./Src/stm32f1xx_hal_msp.d \
36 | ./Src/stm32f1xx_it.d \
37 | ./Src/syscalls.d \
38 | ./Src/system_stm32f1xx.d \
39 | ./Src/timer.d \
40 | ./Src/uartInterface.d
41 |
42 |
43 | # Each subdirectory must supply rules for building sources it contributes
44 | Src/%.o: ../Src/%.c
45 | @echo 'Building file: $<'
46 | @echo 'Invoking: MCU GCC Compiler'
47 | @echo $(PWD)
48 | arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F103xB -I"C:/Users/User/Desktop/BAME3114/TC3/Inc" -I"C:/Users/User/Desktop/BAME3114/TC3/Drivers/STM32F1xx_HAL_Driver/Inc" -I"C:/Users/User/Desktop/BAME3114/TC3/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy" -I"C:/Users/User/Desktop/BAME3114/TC3/Drivers/CMSIS/Device/ST/STM32F1xx/Include" -I"C:/Users/User/Desktop/BAME3114/TC3/Drivers/CMSIS/Include" -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -o "$@" "$<"
49 | @echo 'Finished building: $<'
50 | @echo ' '
51 |
52 |
53 |
--------------------------------------------------------------------------------
/TC3/Debug/Src/syscalls.d:
--------------------------------------------------------------------------------
1 | Src/syscalls.o: ../Src/syscalls.c
2 |
--------------------------------------------------------------------------------
/TC3/Debug/Src/syscalls.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/syscalls.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/system_stm32f1xx.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/system_stm32f1xx.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/timer.d:
--------------------------------------------------------------------------------
1 | Src/timer.o: ../Src/timer.c \
2 | C:/Users/User/Desktop/BAME3114/TC3/Inc/timer.h
3 |
4 | C:/Users/User/Desktop/BAME3114/TC3/Inc/timer.h:
5 |
--------------------------------------------------------------------------------
/TC3/Debug/Src/timer.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/timer.o
--------------------------------------------------------------------------------
/TC3/Debug/Src/uartInterface.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/Src/uartInterface.o
--------------------------------------------------------------------------------
/TC3/Debug/TC3.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/TC3.elf
--------------------------------------------------------------------------------
/TC3/Debug/makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | -include ../makefile.init
6 |
7 | RM := rm -rf
8 |
9 | # All of the sources participating in the build are defined here
10 | -include sources.mk
11 | -include startup/subdir.mk
12 | -include Src/subdir.mk
13 | -include Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk
14 | -include subdir.mk
15 | -include objects.mk
16 |
17 | ifneq ($(MAKECMDGOALS),clean)
18 | ifneq ($(strip $(S_UPPER_DEPS)),)
19 | -include $(S_UPPER_DEPS)
20 | endif
21 | ifneq ($(strip $(C_DEPS)),)
22 | -include $(C_DEPS)
23 | endif
24 | endif
25 |
26 | -include ../makefile.defs
27 |
28 | # Add inputs and outputs from these tool invocations to the build variables
29 |
30 | # All Target
31 | all: TC3.elf
32 |
33 | # Tool invocations
34 | TC3.elf: $(OBJS) $(USER_OBJS) ../STM32F103C8Tx_FLASH.ld
35 | @echo 'Building target: $@'
36 | @echo 'Invoking: MCU GCC Linker'
37 | arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -specs=nosys.specs -u _printf_float -T"../STM32F103C8Tx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "TC3.elf" @"objects.list" $(USER_OBJS) $(LIBS) -lm
38 | @echo 'Finished building target: $@'
39 | @echo ' '
40 | $(MAKE) --no-print-directory post-build
41 |
42 | # Other Targets
43 | clean:
44 | -$(RM) *
45 | -@echo ' '
46 |
47 | post-build:
48 | -@echo 'Generating hex and Printing size information:'
49 | arm-none-eabi-objcopy -O ihex "TC3.elf" "TC3.hex"
50 | arm-none-eabi-size "TC3.elf"
51 | -@echo ' '
52 |
53 | .PHONY: all clean dependents
54 | .SECONDARY: post-build
55 |
56 | -include ../makefile.targets
57 |
--------------------------------------------------------------------------------
/TC3/Debug/objects.list:
--------------------------------------------------------------------------------
1 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o"
2 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o"
3 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o"
4 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o"
5 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o"
6 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o"
7 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o"
8 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o"
9 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o"
10 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o"
11 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.o"
12 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.o"
13 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o"
14 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o"
15 | "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o"
16 | "Src/SPITemp.o"
17 | "Src/main.o"
18 | "Src/pidMath.o"
19 | "Src/pulse_math.o"
20 | "Src/stm32f1xx_hal_msp.o"
21 | "Src/stm32f1xx_it.o"
22 | "Src/syscalls.o"
23 | "Src/system_stm32f1xx.o"
24 | "Src/timer.o"
25 | "Src/uartInterface.o"
26 | "startup/startup_stm32f103xb.o"
27 |
--------------------------------------------------------------------------------
/TC3/Debug/objects.mk:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | USER_OBJS :=
6 |
7 | LIBS :=
8 |
9 |
--------------------------------------------------------------------------------
/TC3/Debug/sources.mk:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | OBJ_SRCS :=
6 | S_SRCS :=
7 | ASM_SRCS :=
8 | C_SRCS :=
9 | S_UPPER_SRCS :=
10 | O_SRCS :=
11 | EXECUTABLES :=
12 | OBJS :=
13 | S_UPPER_DEPS :=
14 | C_DEPS :=
15 |
16 | # Every subdirectory with source files must be described here
17 | SUBDIRS := \
18 | Drivers/STM32F1xx_HAL_Driver/Src \
19 | Src \
20 | startup \
21 |
22 |
--------------------------------------------------------------------------------
/TC3/Debug/startup/startup_stm32f103xb.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Debug/startup/startup_stm32f103xb.o
--------------------------------------------------------------------------------
/TC3/Debug/startup/subdir.mk:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Automatically-generated file. Do not edit!
3 | ################################################################################
4 |
5 | # Add inputs and outputs from these tool invocations to the build variables
6 | S_SRCS += \
7 | ../startup/startup_stm32f103xb.s
8 |
9 | OBJS += \
10 | ./startup/startup_stm32f103xb.o
11 |
12 |
13 | # Each subdirectory must supply rules for building sources it contributes
14 | startup/%.o: ../startup/%.s
15 | @echo 'Building file: $<'
16 | @echo 'Invoking: MCU GCC Assembler'
17 | @echo $(PWD)
18 | arm-none-eabi-as -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -g -o "$@" "$<"
19 | @echo 'Finished building: $<'
20 | @echo ' '
21 |
22 |
23 |
--------------------------------------------------------------------------------
/TC3/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
--------------------------------------------------------------------------------
/TC3/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
--------------------------------------------------------------------------------
/TC3/Inc/SPITemp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPITemp.h
3 | *
4 | * Created on: 4 Jul 2019
5 | * Author: User
6 | */
7 |
8 | #ifndef SPITEMP_H_
9 | #define SPITEMP_H_
10 |
11 |
12 | #include
13 | #include "stm32f1xx_hal.h"
14 |
15 | float calculateTemp(uint8_t *TempData);
16 | float getTemp(SPI_HandleTypeDef *hspi);
17 |
18 |
19 | #endif /* SPITEMP_H_ */
20 |
--------------------------------------------------------------------------------
/TC3/Inc/main.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : main.h
5 | * @brief : Header for main.c file.
6 | * This file contains the common defines of the application.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2019 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under BSD 3-Clause license,
14 | * the "License"; You may not use this file except in compliance with the
15 | * License. You may obtain a copy of the License at:
16 | * opensource.org/licenses/BSD-3-Clause
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __MAIN_H
24 | #define __MAIN_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f1xx_hal.h"
32 |
33 | /* Private includes ----------------------------------------------------------*/
34 | /* USER CODE BEGIN Includes */
35 |
36 | /* USER CODE END Includes */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /* USER CODE BEGIN ET */
40 |
41 | /* USER CODE END ET */
42 |
43 | /* Exported constants --------------------------------------------------------*/
44 | /* USER CODE BEGIN EC */
45 |
46 | /* USER CODE END EC */
47 |
48 | /* Exported macro ------------------------------------------------------------*/
49 | /* USER CODE BEGIN EM */
50 |
51 | /* USER CODE END EM */
52 |
53 | void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
54 |
55 | /* Exported functions prototypes ---------------------------------------------*/
56 | void Error_Handler(void);
57 |
58 | /* USER CODE BEGIN EFP */
59 |
60 | /* USER CODE END EFP */
61 |
62 | /* Private defines -----------------------------------------------------------*/
63 | /* USER CODE BEGIN Private defines */
64 |
65 | /* USER CODE END Private defines */
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif
70 |
71 | #endif /* __MAIN_H */
72 |
73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
74 |
--------------------------------------------------------------------------------
/TC3/Inc/pidMath.h:
--------------------------------------------------------------------------------
1 | /*
2 | * pidMath.h
3 | *
4 | * Created on: 12 Jul 2019
5 | * Author: User
6 | */
7 |
8 | #ifndef PIDMATH_H_
9 | #define PIDMATH_H_
10 |
11 | #include
12 | #include
13 |
14 | typedef struct{
15 | double setValue;
16 | double kp;
17 | double ki;
18 | double kd;
19 | double errorAcc;
20 | double prevError;
21 | uint32_t prevTime;
22 | bool reachTemp;
23 | }PidInfo;
24 |
25 |
26 | int findPIDValue(PidInfo *pidInfo, double actualTemp, uint32_t currentTime);
27 |
28 | #endif /* PIDMATH_H_ */
29 |
--------------------------------------------------------------------------------
/TC3/Inc/pulse_math.h:
--------------------------------------------------------------------------------
1 | /*
2 | * pulse_math.h
3 | *
4 | * Created on: 27 Jun 2019
5 | * Author: User
6 | */
7 |
8 | #ifndef PULSE_MATH_H_
9 | #define PULSE_MATH_H_
10 |
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | typedef struct{
17 | uint32_t firstCCR;
18 | uint32_t secondCCR;
19 | uint32_t thirdCCR;
20 | uint32_t fourthCCR;
21 | bool flag;
22 | bool triacOnOff
23 | }CCRxData;
24 |
25 |
26 |
27 | void TriacTriggerCallback(CCRxData *ccr3Data);
28 | void config_pulse(CCRxData *CCR3Data, uint32_t angle, uint32_t width);
29 |
30 | #endif /* PULSE_MATH_H_ */
31 |
--------------------------------------------------------------------------------
/TC3/Inc/stm32f1xx_it.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32f1xx_it.h
5 | * @brief This file contains the headers of the interrupt handlers.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __STM32F1xx_IT_H
23 | #define __STM32F1xx_IT_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Private includes ----------------------------------------------------------*/
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | /* Exported types ------------------------------------------------------------*/
35 | /* USER CODE BEGIN ET */
36 |
37 | /* USER CODE END ET */
38 |
39 | /* Exported constants --------------------------------------------------------*/
40 | /* USER CODE BEGIN EC */
41 |
42 | /* USER CODE END EC */
43 |
44 | /* Exported macro ------------------------------------------------------------*/
45 | /* USER CODE BEGIN EM */
46 |
47 | /* USER CODE END EM */
48 |
49 | /* Exported functions prototypes ---------------------------------------------*/
50 | void NMI_Handler(void);
51 | void HardFault_Handler(void);
52 | void MemManage_Handler(void);
53 | void BusFault_Handler(void);
54 | void UsageFault_Handler(void);
55 | void SVC_Handler(void);
56 | void DebugMon_Handler(void);
57 | void PendSV_Handler(void);
58 | void SysTick_Handler(void);
59 | void TIM2_IRQHandler(void);
60 | void USART2_IRQHandler(void);
61 | /* USER CODE BEGIN EFP */
62 |
63 | /* USER CODE END EFP */
64 |
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 |
69 | #endif /* __STM32F1xx_IT_H */
70 |
71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
72 |
--------------------------------------------------------------------------------
/TC3/Inc/timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * timer.h
3 | *
4 | * Created on: Jun 20, 2019
5 | * Author: User
6 | */
7 |
8 | #ifndef TIMER_H_
9 | #define TIMER_H_
10 |
11 | #include
12 | //#include "rcc.h"
13 |
14 | #define TIMER2_BASE_ADDR 0x40000000
15 | #define TIM2 ((TIMx_REG *)(TIMER2_BASE_ADDR))
16 |
17 | typedef struct TIMx_REG TIMx_REG;
18 | struct TIMx_REG {
19 | volatile uint32_t CR1; //0h
20 | volatile uint32_t CR2; //4h
21 | volatile uint32_t SMCR; //8h
22 | volatile uint32_t DIER; //ch
23 | volatile uint32_t SR; //10h
24 | volatile uint32_t EGR; //14h
25 | volatile uint32_t CCMR1; //18h
26 | volatile uint32_t CCMR2; //1ch
27 | volatile uint32_t CCER; //20h
28 | volatile uint32_t CNT; //24h
29 | volatile uint32_t PSC; //28h
30 | volatile uint32_t ARR; //2ch
31 | volatile uint32_t Reserved0; //30h
32 | volatile uint32_t CCR1; //34h
33 | volatile uint32_t CCR2; //38h
34 | volatile uint32_t CCR3; //3ch
35 | volatile uint32_t CCR4; //40h
36 | volatile uint32_t Reserved1; //44h
37 | volatile uint32_t DCR; //48h
38 | volatile uint32_t DMAR; //4ch
39 |
40 | };
41 |
42 | typedef enum{
43 | frozen,
44 | activeOnMatch,
45 | inactiveOnMatch,
46 | toggleOnMatch,
47 | forcedAction,
48 | forcedInactive
49 | }Mode;
50 |
51 | //void enableTimer2();
52 | void UpdateCCR3(uint32_t CCR3);
53 | void enable_OC3_interrupt();
54 | void outputCompareMode(Mode mode);
55 | #endif /* TIMER_H_ */
56 |
--------------------------------------------------------------------------------
/TC3/Inc/uartInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * uartInterface.h
3 | *
4 | * Created on: 18 Jul 2019
5 | * Author: User
6 | */
7 |
8 | #ifndef UARTINTERFACE_H_
9 | #define UARTINTERFACE_H_
10 |
11 | #include
12 | #include "stm32f1xx_hal.h"
13 | #include
14 |
15 |
16 | typedef struct{
17 | uint8_t rxIndx;
18 | char rxBuffer[100];
19 | char rxData[2];
20 | bool transferCplt;
21 | }UartInfo;
22 |
23 |
24 | void interruptRxTx(UART_HandleTypeDef *huart1, UartInfo *uart);
25 |
26 | #endif /* UARTINTERFACE_H_ */
27 |
--------------------------------------------------------------------------------
/TC3/New_configuration (2).cfg:
--------------------------------------------------------------------------------
1 | # This is an TC3 board with a single STM32F103C8Tx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x5000
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32F103C8Tx
13 | set BOARDNAME TC3
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 4000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32f1x.cfg]
37 |
--------------------------------------------------------------------------------
/TC3/Src/SPITemp.c:
--------------------------------------------------------------------------------
1 | /*
2 | * SPITemp.c
3 | *
4 | * Created on: 4 Jul 2019
5 | * Author: User
6 | */
7 |
8 | #include "SPITemp.h"
9 | #include
10 |
11 |
12 | float calculateTemp(uint8_t *TempData)
13 | {
14 | float temp=0;
15 |
16 | if (TempData[0] & 0x4) {
17 | Error_Handler();
18 | }
19 | else{
20 | //each point equal to 0.25 celsius
21 | temp = (float)(((TempData[1]<<5)|(TempData[0]>>3))*0.25);
22 | }
23 | return temp;
24 | }
25 |
26 | float getTemp(SPI_HandleTypeDef *hspi){
27 | HAL_StatusTypeDef status;
28 | uint8_t TempData[2]={0};
29 | float temp=0.0;
30 |
31 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
32 | status = HAL_SPI_Receive(hspi, &TempData[0], 2, 2000);
33 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
34 | temp = calculateTemp(&TempData[0]);
35 |
36 | return temp;
37 | }
38 |
--------------------------------------------------------------------------------
/TC3/Src/pidMath.c:
--------------------------------------------------------------------------------
1 | /*
2 | * pidMath.c
3 | *
4 | * Created on: 12 Jul 2019
5 | * Author: User
6 | */
7 |
8 |
9 | #include "pidMath.h"
10 |
11 | int findPIDValue(PidInfo *pidInfo, double actualTemp, uint32_t currentTime){
12 | int pidProprotional = 0;
13 | int pidDerivative = 0;
14 | int pidValue = 0;
15 |
16 | /*
17 | * find current error.
18 | * find the time difference for the derivative part of pid.
19 | */
20 | double currentError = (pidInfo->setValue)-actualTemp;
21 | uint32_t elapsedTime = currentTime-(pidInfo->prevTime);
22 |
23 |
24 | pidProprotional = (currentError)*(pidInfo->kp);
25 | (pidInfo->errorAcc) = ((pidInfo->ki)*currentError)+(pidInfo->errorAcc);
26 | pidDerivative = (currentError-(pidInfo->prevError))*(pidInfo->kd)/elapsedTime;
27 |
28 | /*
29 | * this code limit the pidIntegrate to 0 - 180
30 | */
31 | if((pidInfo->errorAcc)>=180){
32 | (pidInfo->errorAcc)=180;
33 | }
34 | else if((pidInfo->errorAcc)<=0){
35 | (pidInfo->errorAcc)=0;
36 | }
37 |
38 | /*
39 | * when temperature reach 10 degree (or less) celsius below set temperature,
40 | * it will reset the pidIntegrate once only, it won't reset the pidIntegrate for the remaining temperature below 10
41 | * it will reset the pidIntegrate again if the user set a new temperature.
42 | * pidInfo->reachTemp tell whether the temperature reach 10 degree celsius below once or not.
43 | */
44 | if(currentError<=10 && (pidInfo->reachTemp)==false){
45 | (pidInfo->errorAcc)=90;
46 | (pidInfo->reachTemp)=true;
47 | }
48 |
49 | pidValue = (pidInfo->errorAcc)+pidProprotional+pidDerivative;
50 | if(pidValue<0){
51 | pidValue=0;
52 | }
53 | if(pidValue>180){
54 | pidValue=180;
55 | }
56 |
57 | /*
58 | * hold the current time and current error for the next pid calculation.
59 | */
60 | (pidInfo->prevTime) = currentTime;
61 | (pidInfo->prevError) = currentError;
62 | return pidValue;
63 | }
64 |
--------------------------------------------------------------------------------
/TC3/Src/syscalls.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/TC3/Src/syscalls.c
--------------------------------------------------------------------------------
/TC3/Src/timer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * timer.c
3 | *
4 | * Created on: Jun 20, 2019
5 | * Author: User
6 | */
7 |
8 | #include "timer.h"
9 | /*
10 | void enableTimer2(){
11 | RCC->APB1RSTR &= ~(1);
12 | RCC->APB1ENR |= 1;
13 | }
14 | */
15 | void UpdateCCR3(uint32_t CCR1){
16 | TIM2->CCR1 = CCR1;
17 | }
18 |
19 | void enable_OC3_interrupt(){
20 | TIM2->DIER &= ~(1<<3);
21 | TIM2->DIER |= (1<<3);
22 | }
23 |
24 | void outputCompareMode(Mode mode){
25 | TIM2->CCMR1 &=~(7<<4);
26 | TIM2->CCMR1 |=(mode<<4);
27 | }
28 |
--------------------------------------------------------------------------------
/TC3/Src/uartInterface.c:
--------------------------------------------------------------------------------
1 | /*
2 | * uartInterface.c
3 | *
4 | * Created on: 18 Jul 2019
5 | * Author: User
6 | */
7 |
8 |
9 | #include "uartInterface.h"
10 |
11 | void interruptRxTx(UART_HandleTypeDef *huart, UartInfo *uart){
12 | uint8_t i;
13 | if(uart->rxIndx==0){
14 | for(i=0;i<100;i++)
15 | uart->rxBuffer[i]=0; //clear Rx_Buffer before receiving new data
16 | }
17 | if(uart->rxData[0]!=13){ //if received data different from ascii 13 (enter)
18 | uart->transferCplt=false;
19 | uart->rxBuffer[(uart->rxIndx)++]=uart->rxData[0];
20 | HAL_UART_Transmit(huart, uart->rxData,1, 1000);
21 | }
22 | else{
23 | //uart->rxBuffer[(uart->rxIndx)++]=uart->rxData[0];//testing
24 | uart->rxIndx=0;
25 | uart->transferCplt=true; //transfer complete, data is ready to read
26 | HAL_UART_Transmit(huart,"\r\n" ,2, 1000);
27 | }
28 | HAL_UART_Receive_IT(huart,uart->rxData,1);
29 | //activate UART receive interrupt every time
30 | }
31 |
--------------------------------------------------------------------------------
/TC3/TC3.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ]>
11 |
12 |
13 | TC3
14 | SWD
15 | ST-Link
16 | stm32f103c8tx
17 |
18 |
19 |
--------------------------------------------------------------------------------
/build/Readme.txt:
--------------------------------------------------------------------------------
1 | Do not remove me!
2 |
--------------------------------------------------------------------------------
/build/test/cache/test_SPITemp.c:
--------------------------------------------------------------------------------
1 | #include "build/temp/_test_SPITemp.c"
2 | #include "CException.h"
3 | #include "Exception.h"
4 | #include "Error.h"
5 | #include "SPITemp.h"
6 | #include "unity.h"
7 |
8 |
9 | void setUp(void)
10 |
11 | {
12 |
13 | }
14 |
15 |
16 |
17 | void tearDown(void)
18 |
19 | {
20 |
21 | }
22 |
23 |
24 |
25 | void test_calculateTempFromBinary(void)
26 |
27 | {
28 |
29 |
30 |
31 |
32 |
33 | uint8_t TempData[2];
34 |
35 | TempData[0] = 0b11000000;
36 |
37 | TempData[1] = 0b00000011;
38 |
39 | int temp = calculateTemp(&TempData[0]);
40 |
41 | UnityAssertEqualNumber((UNITY_INT)((30)), (UNITY_INT)((temp)), (
42 |
43 | ((void *)0)
44 |
45 | ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
46 |
47 | }
48 |
49 |
50 |
51 |
52 |
53 | void test_calculateTempThermocoupleIsOpen(void)
54 |
55 | {
56 |
57 | ExceptionPtr ex =
58 |
59 | ((void *)0)
60 |
61 | ;
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | uint8_t TempData[2];
70 |
71 | TempData[0] = 0b11000100;
72 |
73 | TempData[1] = 0b00000011;
74 |
75 | int temp = 0;
76 |
77 |
78 |
79 | { jmp_buf *PrevFrame, NewFrame; unsigned int MY_ID = (0); PrevFrame = CExceptionFrames[MY_ID].pFrame; CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); CExceptionFrames[MY_ID].Exception = ((ExceptionPtr)0x5A5A5A5A); ; if (
80 |
81 | _setjmp((
82 |
83 | NewFrame
84 |
85 | ), __builtin_frame_address (0))
86 |
87 | == 0) { if (1){
88 |
89 | temp = calculateTemp(&TempData[0]);
90 |
91 | UnityFail( (("expect exception to be thrown")), (UNITY_UINT)(40));
92 |
93 | }
94 |
95 | else { } CExceptionFrames[MY_ID].Exception = ((ExceptionPtr)0x5A5A5A5A); ; } else { ex = CExceptionFrames[MY_ID].Exception; (void)ex; ; } CExceptionFrames[MY_ID].pFrame = PrevFrame; ; } if (CExceptionFrames[(0)].Exception != ((ExceptionPtr)0x5A5A5A5A)){
96 |
97 | dumpException(ex);
98 |
99 | UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((temp)), (
100 |
101 | ((void *)0)
102 |
103 | ), (UNITY_UINT)(44), UNITY_DISPLAY_STYLE_INT);
104 |
105 | freeException(ex);
106 |
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/build/test/cache/timer.h:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | typedef char UART_HandleTypeDef;
10 |
11 |
12 |
13 | void UpdateCCR3(uint32_t CCR3);
14 |
15 | void HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
16 |
17 | void HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
18 |
--------------------------------------------------------------------------------
/build/test/dependencies/force_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/dependencies/force_build
--------------------------------------------------------------------------------
/build/test/out/CException.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/CException.o
--------------------------------------------------------------------------------
/build/test/out/Exception.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/Exception.o
--------------------------------------------------------------------------------
/build/test/out/PIDMath.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/PIDMath.o
--------------------------------------------------------------------------------
/build/test/out/SPITemp.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/SPITemp.o
--------------------------------------------------------------------------------
/build/test/out/TRIAC_IT.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/TRIAC_IT.o
--------------------------------------------------------------------------------
/build/test/out/cmock.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/cmock.o
--------------------------------------------------------------------------------
/build/test/out/mock_timer.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/mock_timer.o
--------------------------------------------------------------------------------
/build/test/out/pulse_math.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/pulse_math.o
--------------------------------------------------------------------------------
/build/test/out/test_PIDMath.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_PIDMath.exe
--------------------------------------------------------------------------------
/build/test/out/test_PIDMath.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_PIDMath.o
--------------------------------------------------------------------------------
/build/test/out/test_PIDMath_runner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_PIDMath_runner.o
--------------------------------------------------------------------------------
/build/test/out/test_SPITemp.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_SPITemp.exe
--------------------------------------------------------------------------------
/build/test/out/test_SPITemp.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_SPITemp.o
--------------------------------------------------------------------------------
/build/test/out/test_SPITemp_runner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_SPITemp_runner.o
--------------------------------------------------------------------------------
/build/test/out/test_TRIAC_IT.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_TRIAC_IT.exe
--------------------------------------------------------------------------------
/build/test/out/test_TRIAC_IT.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_TRIAC_IT.o
--------------------------------------------------------------------------------
/build/test/out/test_TRIAC_IT_runner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_TRIAC_IT_runner.o
--------------------------------------------------------------------------------
/build/test/out/test_pulse_math.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_pulse_math.exe
--------------------------------------------------------------------------------
/build/test/out/test_pulse_math.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_pulse_math.o
--------------------------------------------------------------------------------
/build/test/out/test_pulse_math_runner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_pulse_math_runner.o
--------------------------------------------------------------------------------
/build/test/out/test_uartInterface.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_uartInterface.exe
--------------------------------------------------------------------------------
/build/test/out/test_uartInterface.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_uartInterface.o
--------------------------------------------------------------------------------
/build/test/out/test_uartInterface_runner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/test_uartInterface_runner.o
--------------------------------------------------------------------------------
/build/test/out/uartInterface.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/uartInterface.o
--------------------------------------------------------------------------------
/build/test/out/unity.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/build/test/out/unity.o
--------------------------------------------------------------------------------
/build/test/preprocess/files/test_SPITemp.c:
--------------------------------------------------------------------------------
1 | #include "build/temp/_test_SPITemp.c"
2 | #include "CException.h"
3 | #include "Exception.h"
4 | #include "Error.h"
5 | #include "SPITemp.h"
6 | #include "unity.h"
7 |
8 |
9 | void setUp(void)
10 |
11 | {
12 |
13 | }
14 |
15 |
16 |
17 | void tearDown(void)
18 |
19 | {
20 |
21 | }
22 |
23 |
24 |
25 | void test_calculateTempFromBinary(void)
26 |
27 | {
28 |
29 |
30 |
31 |
32 |
33 | uint8_t TempData[2];
34 |
35 | TempData[0] = 0b11000000;
36 |
37 | TempData[1] = 0b00000011;
38 |
39 | int temp = calculateTemp(&TempData[0]);
40 |
41 | UnityAssertEqualNumber((UNITY_INT)((30)), (UNITY_INT)((temp)), (
42 |
43 | ((void *)0)
44 |
45 | ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT);
46 |
47 | }
48 |
49 |
50 |
51 |
52 |
53 | void test_calculateTempThermocoupleIsOpen(void)
54 |
55 | {
56 |
57 | ExceptionPtr ex =
58 |
59 | ((void *)0)
60 |
61 | ;
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | uint8_t TempData[2];
70 |
71 | TempData[0] = 0b11000100;
72 |
73 | TempData[1] = 0b00000011;
74 |
75 | int temp = 0;
76 |
77 |
78 |
79 | { jmp_buf *PrevFrame, NewFrame; unsigned int MY_ID = (0); PrevFrame = CExceptionFrames[MY_ID].pFrame; CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); CExceptionFrames[MY_ID].Exception = ((ExceptionPtr)0x5A5A5A5A); ; if (
80 |
81 | _setjmp((
82 |
83 | NewFrame
84 |
85 | ), __builtin_frame_address (0))
86 |
87 | == 0) { if (1){
88 |
89 | temp = calculateTemp(&TempData[0]);
90 |
91 | UnityFail( (("expect exception to be thrown")), (UNITY_UINT)(40));
92 |
93 | }
94 |
95 | else { } CExceptionFrames[MY_ID].Exception = ((ExceptionPtr)0x5A5A5A5A); ; } else { ex = CExceptionFrames[MY_ID].Exception; (void)ex; ; } CExceptionFrames[MY_ID].pFrame = PrevFrame; ; } if (CExceptionFrames[(0)].Exception != ((ExceptionPtr)0x5A5A5A5A)){
96 |
97 | dumpException(ex);
98 |
99 | UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((temp)), (
100 |
101 | ((void *)0)
102 |
103 | ), (UNITY_UINT)(44), UNITY_DISPLAY_STYLE_INT);
104 |
105 | freeException(ex);
106 |
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/build/test/preprocess/files/timer.h:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | typedef char UART_HandleTypeDef;
10 |
11 |
12 |
13 | void UpdateCCR3(uint32_t CCR3);
14 |
15 | void HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
16 |
17 | void HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
18 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/test_PIDMath.c:
--------------------------------------------------------------------------------
1 | ---
2 | - unity.h
3 | - PIDMath.h
4 | - build/temp/_test_PIDMath.c
5 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/test_SPITemp.c:
--------------------------------------------------------------------------------
1 | ---
2 | - unity.h
3 | - SPITemp.h
4 | - Error.h
5 | - Exception.h
6 | - CException.h
7 | - build/temp/_test_SPITemp.c
8 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/test_TRIAC_IT.c:
--------------------------------------------------------------------------------
1 | ---
2 | - unity.h
3 | - TRIAC_IT.h
4 | - mock_timer.h
5 | - build/temp/_test_TRIAC_IT.c
6 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/test_pulse_math.c:
--------------------------------------------------------------------------------
1 | ---
2 | - unity.h
3 | - pulse_math.h
4 | - Error.h
5 | - Exception.h
6 | - CException.h
7 | - build/temp/_test_pulse_math.c
8 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/test_uartInterface.c:
--------------------------------------------------------------------------------
1 | ---
2 | - unity.h
3 | - uartInterface.h
4 | - mock_timer.h
5 | - build/temp/_test_uartInterface.c
6 |
--------------------------------------------------------------------------------
/build/test/preprocess/includes/timer.h:
--------------------------------------------------------------------------------
1 | --- []
2 |
--------------------------------------------------------------------------------
/build/test/results/test_PIDMath.pass:
--------------------------------------------------------------------------------
1 | ---
2 | :source:
3 | :path: test
4 | :file: test_PIDMath.c
5 | :successes:
6 | - :test: test_FindPIDValue
7 | :line: 25
8 | :message: ''
9 | - :test: test_FindPIDValueNegativeCurrentError
10 | :line: 41
11 | :message: ''
12 | - :test: test_FindPIDValueWithPIDIntegrate
13 | :line: 58
14 | :message: ''
15 | - :test: test_FindPIDValueWithPIDIntegrateAndAvoidPIDValueOver180
16 | :line: 84
17 | :message: ''
18 | - :test: test_FindPIDValueWithPIDInWithinRange
19 | :line: 112
20 | :message: ''
21 | :failures: []
22 | :ignores: []
23 | :counts:
24 | :total: 5
25 | :passed: 5
26 | :failed: 0
27 | :ignored: 0
28 | :stdout: []
29 |
--------------------------------------------------------------------------------
/build/test/results/test_SPITemp.pass:
--------------------------------------------------------------------------------
1 | ---
2 | :source:
3 | :path: test
4 | :file: test_SPITemp.c
5 | :successes:
6 | - :test: test_calculateTempFromBinary
7 | :line: 15
8 | :message: ''
9 | - :test: test_calculateTempThermocoupleIsOpen
10 | :line: 27
11 | :message: ''
12 | :failures: []
13 | :ignores: []
14 | :counts:
15 | :total: 2
16 | :passed: 2
17 | :failed: 0
18 | :ignored: 0
19 | :stdout:
20 | - bit 2 = 1, thermocouple input is open. (err=17)
21 |
--------------------------------------------------------------------------------
/build/test/results/test_TRIAC_IT.pass:
--------------------------------------------------------------------------------
1 | ---
2 | :source:
3 | :path: test
4 | :file: test_TRIAC_IT.c
5 | :successes:
6 | - :test: test_ChangeDataAtSecondCycle
7 | :line: 12
8 | :message: ''
9 | - :test: test_ExpectedNoChangeInFirstCycleUpdateWhenReachSecondCycle
10 | :line: 64
11 | :message: ''
12 | - :test: test_FlagNotSetInSecondCycle
13 | :line: 111
14 | :message: ''
15 | - :test: test_NoFlagInFirstCycleExpectedNoChange
16 | :line: 156
17 | :message: ''
18 | :failures: []
19 | :ignores: []
20 | :counts:
21 | :total: 4
22 | :passed: 4
23 | :failed: 0
24 | :ignored: 0
25 | :stdout: []
26 |
--------------------------------------------------------------------------------
/build/test/results/test_pulse_math.pass:
--------------------------------------------------------------------------------
1 | ---
2 | :source:
3 | :path: test
4 | :file: test_pulse_math.c
5 | :successes:
6 | - :test: test_ConfigWithFlagZero
7 | :line: 16
8 | :message: ''
9 | - :test: test_ConfigWithFlagOne
10 | :line: 43
11 | :message: ''
12 | - :test: test_ConfigOver180Degree
13 | :line: 70
14 | :message: ''
15 | - :test: test_ConfigWidthOver180
16 | :line: 98
17 | :message: ''
18 | - :test: test_ConfigWidthZero
19 | :line: 126
20 | :message: ''
21 | :failures: []
22 | :ignores: []
23 | :counts:
24 | :total: 5
25 | :passed: 5
26 | :failed: 0
27 | :ignored: 0
28 | :stdout:
29 | - ccr3Data->flag == 1, can't config CCR3! (err=1)
30 |
--------------------------------------------------------------------------------
/build/test/results/test_uartInterface.pass:
--------------------------------------------------------------------------------
1 | ---
2 | :source:
3 | :path: test
4 | :file: test_uartInterface.c
5 | :successes:
6 | - :test: test_uartInterfaceFirstInputWithEnter
7 | :line: 13
8 | :message: ''
9 | - :test: test_interruptWithMultipleKeyWords
10 | :line: 53
11 | :message: ''
12 | - :test: test_interruptWithDoubleEnter
13 | :line: 112
14 | :message: ''
15 | :failures: []
16 | :ignores: []
17 | :counts:
18 | :total: 3
19 | :passed: 3
20 | :failed: 0
21 | :ignored: 0
22 | :stdout: []
23 |
--------------------------------------------------------------------------------
/build/test/runners/test_PIDMath_runner.c:
--------------------------------------------------------------------------------
1 | /* AUTOGENERATED FILE. DO NOT EDIT. */
2 |
3 | /*=======Test Runner Used To Run Each Test Below=====*/
4 | #define RUN_TEST(TestFunc, TestLineNum) \
5 | { \
6 | Unity.CurrentTestName = #TestFunc; \
7 | Unity.CurrentTestLineNumber = TestLineNum; \
8 | Unity.NumberOfTests++; \
9 | if (TEST_PROTECT()) \
10 | { \
11 | CEXCEPTION_T e; \
12 | Try { \
13 | setUp(); \
14 | TestFunc(); \
15 | } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
16 | } \
17 | if (TEST_PROTECT()) \
18 | { \
19 | tearDown(); \
20 | } \
21 | UnityConcludeTest(); \
22 | }
23 |
24 | /*=======Automagically Detected Files To Include=====*/
25 | #include "unity.h"
26 | #include
27 | #include
28 | #include "CException.h"
29 |
30 | int GlobalExpectCount;
31 | int GlobalVerifyOrder;
32 | char* GlobalOrderError;
33 |
34 | /*=======External Functions This Runner Calls=====*/
35 | extern void setUp(void);
36 | extern void tearDown(void);
37 | extern void test_FindPIDValue(void);
38 | extern void test_FindPIDValueNegativeCurrentError(void);
39 | extern void test_FindPIDValueWithPIDIntegrate(void);
40 | extern void test_FindPIDValueWithPIDIntegrateAndAvoidPIDValueOver180(void);
41 | extern void test_FindPIDValueWithPIDInWithinRange(void);
42 |
43 |
44 | /*=======Test Reset Option=====*/
45 | void resetTest(void);
46 | void resetTest(void)
47 | {
48 | tearDown();
49 | setUp();
50 | }
51 |
52 |
53 | /*=======MAIN=====*/
54 | int main(void)
55 | {
56 | UnityBegin("test_PIDMath.c");
57 | RUN_TEST(test_FindPIDValue, 25);
58 | RUN_TEST(test_FindPIDValueNegativeCurrentError, 41);
59 | RUN_TEST(test_FindPIDValueWithPIDIntegrate, 58);
60 | RUN_TEST(test_FindPIDValueWithPIDIntegrateAndAvoidPIDValueOver180, 84);
61 | RUN_TEST(test_FindPIDValueWithPIDInWithinRange, 112);
62 |
63 | return (UnityEnd());
64 | }
65 |
--------------------------------------------------------------------------------
/build/test/runners/test_SPITemp_runner.c:
--------------------------------------------------------------------------------
1 | /* AUTOGENERATED FILE. DO NOT EDIT. */
2 |
3 | /*=======Test Runner Used To Run Each Test Below=====*/
4 | #define RUN_TEST(TestFunc, TestLineNum) \
5 | { \
6 | Unity.CurrentTestName = #TestFunc; \
7 | Unity.CurrentTestLineNumber = TestLineNum; \
8 | Unity.NumberOfTests++; \
9 | if (TEST_PROTECT()) \
10 | { \
11 | CEXCEPTION_T e; \
12 | Try { \
13 | setUp(); \
14 | TestFunc(); \
15 | } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
16 | } \
17 | if (TEST_PROTECT()) \
18 | { \
19 | tearDown(); \
20 | } \
21 | UnityConcludeTest(); \
22 | }
23 |
24 | /*=======Automagically Detected Files To Include=====*/
25 | #include "unity.h"
26 | #include
27 | #include
28 | #include "CException.h"
29 |
30 | int GlobalExpectCount;
31 | int GlobalVerifyOrder;
32 | char* GlobalOrderError;
33 |
34 | /*=======External Functions This Runner Calls=====*/
35 | extern void setUp(void);
36 | extern void tearDown(void);
37 | extern void test_calculateTempFromBinary(void);
38 | extern void test_calculateTempThermocoupleIsOpen(void);
39 |
40 |
41 | /*=======Test Reset Option=====*/
42 | void resetTest(void);
43 | void resetTest(void)
44 | {
45 | tearDown();
46 | setUp();
47 | }
48 |
49 |
50 | /*=======MAIN=====*/
51 | int main(void)
52 | {
53 | UnityBegin("test_SPITemp.c");
54 | RUN_TEST(test_calculateTempFromBinary, 15);
55 | RUN_TEST(test_calculateTempThermocoupleIsOpen, 27);
56 |
57 | return (UnityEnd());
58 | }
59 |
--------------------------------------------------------------------------------
/build/test/runners/test_TRIAC_IT_runner.c:
--------------------------------------------------------------------------------
1 | /* AUTOGENERATED FILE. DO NOT EDIT. */
2 |
3 | /*=======Test Runner Used To Run Each Test Below=====*/
4 | #define RUN_TEST(TestFunc, TestLineNum) \
5 | { \
6 | Unity.CurrentTestName = #TestFunc; \
7 | Unity.CurrentTestLineNumber = TestLineNum; \
8 | Unity.NumberOfTests++; \
9 | CMock_Init(); \
10 | UNITY_CLR_DETAILS(); \
11 | if (TEST_PROTECT()) \
12 | { \
13 | CEXCEPTION_T e; \
14 | Try { \
15 | setUp(); \
16 | TestFunc(); \
17 | } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
18 | } \
19 | if (TEST_PROTECT()) \
20 | { \
21 | tearDown(); \
22 | CMock_Verify(); \
23 | } \
24 | CMock_Destroy(); \
25 | UnityConcludeTest(); \
26 | }
27 |
28 | /*=======Automagically Detected Files To Include=====*/
29 | #include "unity.h"
30 | #include "cmock.h"
31 | #include
32 | #include
33 | #include "mock_timer.h"
34 | #include "CException.h"
35 |
36 | int GlobalExpectCount;
37 | int GlobalVerifyOrder;
38 | char* GlobalOrderError;
39 |
40 | /*=======External Functions This Runner Calls=====*/
41 | extern void setUp(void);
42 | extern void tearDown(void);
43 | extern void test_ChangeDataAtSecondCycle(void);
44 | extern void test_ExpectedNoChangeInFirstCycleUpdateWhenReachSecondCycle(void);
45 | extern void test_FlagNotSetInSecondCycle(void);
46 | extern void test_NoFlagInFirstCycleExpectedNoChange(void);
47 |
48 |
49 | /*=======Mock Management=====*/
50 | static void CMock_Init(void)
51 | {
52 | GlobalExpectCount = 0;
53 | GlobalVerifyOrder = 0;
54 | GlobalOrderError = NULL;
55 | mock_timer_Init();
56 | }
57 | static void CMock_Verify(void)
58 | {
59 | mock_timer_Verify();
60 | }
61 | static void CMock_Destroy(void)
62 | {
63 | mock_timer_Destroy();
64 | }
65 |
66 | /*=======Test Reset Option=====*/
67 | void resetTest(void);
68 | void resetTest(void)
69 | {
70 | CMock_Verify();
71 | CMock_Destroy();
72 | tearDown();
73 | CMock_Init();
74 | setUp();
75 | }
76 |
77 |
78 | /*=======MAIN=====*/
79 | int main(void)
80 | {
81 | UnityBegin("test_TRIAC_IT.c");
82 | RUN_TEST(test_ChangeDataAtSecondCycle, 12);
83 | RUN_TEST(test_ExpectedNoChangeInFirstCycleUpdateWhenReachSecondCycle, 64);
84 | RUN_TEST(test_FlagNotSetInSecondCycle, 111);
85 | RUN_TEST(test_NoFlagInFirstCycleExpectedNoChange, 156);
86 |
87 | CMock_Guts_MemFreeFinal();
88 | return (UnityEnd());
89 | }
90 |
--------------------------------------------------------------------------------
/build/test/runners/test_pulse_math_runner.c:
--------------------------------------------------------------------------------
1 | /* AUTOGENERATED FILE. DO NOT EDIT. */
2 |
3 | /*=======Test Runner Used To Run Each Test Below=====*/
4 | #define RUN_TEST(TestFunc, TestLineNum) \
5 | { \
6 | Unity.CurrentTestName = #TestFunc; \
7 | Unity.CurrentTestLineNumber = TestLineNum; \
8 | Unity.NumberOfTests++; \
9 | if (TEST_PROTECT()) \
10 | { \
11 | CEXCEPTION_T e; \
12 | Try { \
13 | setUp(); \
14 | TestFunc(); \
15 | } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
16 | } \
17 | if (TEST_PROTECT()) \
18 | { \
19 | tearDown(); \
20 | } \
21 | UnityConcludeTest(); \
22 | }
23 |
24 | /*=======Automagically Detected Files To Include=====*/
25 | #include "unity.h"
26 | #include
27 | #include
28 | #include "CException.h"
29 |
30 | int GlobalExpectCount;
31 | int GlobalVerifyOrder;
32 | char* GlobalOrderError;
33 |
34 | /*=======External Functions This Runner Calls=====*/
35 | extern void setUp(void);
36 | extern void tearDown(void);
37 | extern void test_ConfigWithFlagZero(void);
38 | extern void test_ConfigWithFlagOne(void);
39 | extern void test_ConfigOver180Degree(void);
40 | extern void test_ConfigWidthOver180(void);
41 | extern void test_ConfigWidthZero(void);
42 |
43 |
44 | /*=======Test Reset Option=====*/
45 | void resetTest(void);
46 | void resetTest(void)
47 | {
48 | tearDown();
49 | setUp();
50 | }
51 |
52 |
53 | /*=======MAIN=====*/
54 | int main(void)
55 | {
56 | UnityBegin("test_pulse_math.c");
57 | RUN_TEST(test_ConfigWithFlagZero, 16);
58 | RUN_TEST(test_ConfigWithFlagOne, 43);
59 | RUN_TEST(test_ConfigOver180Degree, 70);
60 | RUN_TEST(test_ConfigWidthOver180, 98);
61 | RUN_TEST(test_ConfigWidthZero, 126);
62 |
63 | return (UnityEnd());
64 | }
65 |
--------------------------------------------------------------------------------
/build/test/runners/test_uartInterface_runner.c:
--------------------------------------------------------------------------------
1 | /* AUTOGENERATED FILE. DO NOT EDIT. */
2 |
3 | /*=======Test Runner Used To Run Each Test Below=====*/
4 | #define RUN_TEST(TestFunc, TestLineNum) \
5 | { \
6 | Unity.CurrentTestName = #TestFunc; \
7 | Unity.CurrentTestLineNumber = TestLineNum; \
8 | Unity.NumberOfTests++; \
9 | CMock_Init(); \
10 | UNITY_CLR_DETAILS(); \
11 | if (TEST_PROTECT()) \
12 | { \
13 | CEXCEPTION_T e; \
14 | Try { \
15 | setUp(); \
16 | TestFunc(); \
17 | } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
18 | } \
19 | if (TEST_PROTECT()) \
20 | { \
21 | tearDown(); \
22 | CMock_Verify(); \
23 | } \
24 | CMock_Destroy(); \
25 | UnityConcludeTest(); \
26 | }
27 |
28 | /*=======Automagically Detected Files To Include=====*/
29 | #include "unity.h"
30 | #include "cmock.h"
31 | #include
32 | #include
33 | #include "mock_timer.h"
34 | #include "CException.h"
35 |
36 | int GlobalExpectCount;
37 | int GlobalVerifyOrder;
38 | char* GlobalOrderError;
39 |
40 | /*=======External Functions This Runner Calls=====*/
41 | extern void setUp(void);
42 | extern void tearDown(void);
43 | extern void test_uartInterfaceFirstInputWithEnter(void);
44 | extern void test_interruptWithMultipleKeyWords(void);
45 | extern void test_interruptWithDoubleEnter(void);
46 |
47 |
48 | /*=======Mock Management=====*/
49 | static void CMock_Init(void)
50 | {
51 | GlobalExpectCount = 0;
52 | GlobalVerifyOrder = 0;
53 | GlobalOrderError = NULL;
54 | mock_timer_Init();
55 | }
56 | static void CMock_Verify(void)
57 | {
58 | mock_timer_Verify();
59 | }
60 | static void CMock_Destroy(void)
61 | {
62 | mock_timer_Destroy();
63 | }
64 |
65 | /*=======Test Reset Option=====*/
66 | void resetTest(void);
67 | void resetTest(void)
68 | {
69 | CMock_Verify();
70 | CMock_Destroy();
71 | tearDown();
72 | CMock_Init();
73 | setUp();
74 | }
75 |
76 |
77 | /*=======MAIN=====*/
78 | int main(void)
79 | {
80 | UnityBegin("test_uartInterface.c");
81 | RUN_TEST(test_uartInterfaceFirstInputWithEnter, 13);
82 | RUN_TEST(test_interruptWithMultipleKeyWords, 53);
83 | RUN_TEST(test_interruptWithDoubleEnter, 112);
84 |
85 | CMock_Guts_MemFreeFinal();
86 | return (UnityEnd());
87 | }
88 |
--------------------------------------------------------------------------------
/project.yml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | # Notes:
4 | # Sample project C code is not presently written to produce a release artifact.
5 | # As such, release build options are disabled.
6 | # This sample, therefore, only demonstrates running a collection of unit tests.
7 |
8 | :project:
9 | :use_exceptions: TRUE
10 | :use_test_preprocessor: TRUE
11 | :use_auxiliary_dependencies: TRUE
12 | :build_root: build
13 | # :release_build: TRUE
14 | :test_file_prefix: test_
15 | :which_ceedling: vendor/ceedling
16 | :default_tasks:
17 | - test:all
18 |
19 | #:release_build:
20 | # :output: MyApp.out
21 | # :use_assembly: FALSE
22 |
23 | :environment:
24 |
25 | :extension:
26 | :executable: .exe
27 |
28 | :paths:
29 | :test:
30 | - +:test/**
31 | - -:test/support
32 | :source:
33 | - src/**
34 | :support:
35 | - test/support
36 |
37 | :defines:
38 | # in order to add common defines:
39 | # 1) remove the trailing [] from the :common: section
40 | # 2) add entries to the :common: section (e.g. :test: has TEST defined)
41 | :commmon: &common_defines []
42 | :test:
43 | - *common_defines
44 | - TEST
45 | - CEXCEPTION_USE_CONFIG_FILE
46 | - _ISOC99_SOURCE
47 | :test_preprocess:
48 | - *common_defines
49 | - TEST
50 |
51 | :cmock:
52 | :mock_prefix: mock_
53 | :when_no_prototypes: :warn
54 | :enforce_strict_ordering: TRUE
55 | :plugins:
56 | - :ignore
57 | - :callback
58 | :treat_as:
59 | uint8: HEX8
60 | uint16: HEX16
61 | uint32: UINT32
62 | int8: INT8
63 | bool: UINT8
64 |
65 | :gcov:
66 | :html_report_type: basic
67 |
68 | #:tools:
69 | # Ceedling defaults to using gcc for compiling, linking, etc.
70 | # As [:tools] is blank, gcc will be used (so long as it's in your system path)
71 | # See documentation to configure a given toolchain for use
72 |
73 | # LIBRARIES
74 | # These libraries are automatically injected into the build process. Those specified as
75 | # common will be used in all types of builds. Otherwise, libraries can be injected in just
76 | # tests or releases. These options are MERGED with the options in supplemental yaml files.
77 | :libraries:
78 | :placement: :end
79 | :flag: "${1}" # or "-L ${1}" for example
80 | :common: &common_libraries []
81 | :test:
82 | - *common_libraries
83 | :release:
84 | - *common_libraries
85 |
86 | :plugins:
87 | :load_paths:
88 | - vendor/ceedling/plugins
89 | :enabled:
90 | - stdout_pretty_tests_report
91 | - module_generator
92 | ...
93 |
--------------------------------------------------------------------------------
/src/CExceptionConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef CExceptionConfig_H
2 | #define CExceptionConfig_H
3 |
4 | #include "Exception.h"
5 |
6 | #define CEXCEPTION_T ExceptionPtr
7 | #define CEXCEPTION_NONE ((ExceptionPtr)0x5A5A5A5A)
8 |
9 | #endif // CExceptionConfig_H
--------------------------------------------------------------------------------
/src/Error.h:
--------------------------------------------------------------------------------
1 | #ifndef Error_H
2 | #define Error_H
3 |
4 | //configPulse function
5 | #define CCR3DATA_FLAG_1 0x01
6 |
7 |
8 | //GetTemp function
9 | #define THERMOCOUPLE_INPUT_OPEN 0x11
10 |
11 | #endif // Error_H
12 |
--------------------------------------------------------------------------------
/src/Exception.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "Exception.h"
6 | #include "CException.h"
7 |
8 | void throwException(int errorCode, void *data, char *message, ...) {
9 | va_list args;
10 | char *buffer;
11 | int length;
12 | Exception *e;
13 |
14 | va_start(args, message);
15 | e = malloc(sizeof(Exception));
16 |
17 | length = vsnprintf(buffer, 0, message, args);
18 | buffer = malloc(length + 1);
19 | vsnprintf(buffer, length + 1, message, args);
20 |
21 | e->msg = buffer;
22 | e->errorCode = errorCode;
23 | e->data = data;
24 |
25 | Throw(e);
26 | }
27 |
28 | void freeException(Exception *e) {
29 | if(e) {
30 | if(e->msg)
31 | free(e->msg);
32 | free(e);
33 | }
34 | }
35 |
36 | void dumpException(Exception *e) {
37 | printf("%s (err=%d)\n", e->msg, e->errorCode);
38 | }
--------------------------------------------------------------------------------
/src/Exception.h:
--------------------------------------------------------------------------------
1 | #ifndef Exception_H
2 | #define Exception_H
3 |
4 | typedef struct Exception Exception;
5 | typedef Exception* ExceptionPtr;
6 | struct Exception {
7 | char *msg;
8 | int errorCode;
9 | void *data;
10 | };
11 |
12 | Exception *createException(char *msg, int errorCode);
13 | void freeException(Exception *e);
14 | void dumpException(Exception *e);
15 |
16 | void throwException(int errorCode, void *data, char *message, ...);
17 |
18 | int add(int numOfItems, ...);
19 |
20 | #endif // Exception_H
--------------------------------------------------------------------------------
/src/PIDMath.c:
--------------------------------------------------------------------------------
1 | #include "PIDMath.h"
2 |
3 | int findPIDValue(PidInfo *pidInfo, double actualTemp, uint32_t currentTime){
4 | int pidProprotional = 0;
5 | int pidDerivative = 0;
6 | int pidValue = 0;
7 | double currentError = (pidInfo->setValue)-actualTemp;
8 | uint32_t elapsedTime = currentTime-(pidInfo->prevTime);
9 |
10 |
11 | pidProprotional = (currentError)*(pidInfo->kp);
12 | (pidInfo->errorAcc) = ((pidInfo->ki)*currentError)+(pidInfo->errorAcc);
13 | pidDerivative = (currentError-(pidInfo->prevError))*(pidInfo->kd)/elapsedTime;
14 |
15 | if((pidInfo->errorAcc)>=180){
16 | (pidInfo->errorAcc)=180;
17 | }
18 | else if((pidInfo->errorAcc)<=0){
19 | (pidInfo->errorAcc)=0;
20 | }
21 |
22 | if(currentError<0){
23 | (pidInfo->errorAcc)=90;
24 | }
25 |
26 | pidValue = (pidInfo->errorAcc)+pidProprotional+pidDerivative;
27 | if(pidValue<0){
28 | pidValue=0;
29 | }
30 | if(pidValue>180){
31 | pidValue=180;
32 | }
33 | (pidInfo->prevTime) = currentTime;
34 | (pidInfo->prevError) = currentError;
35 | return pidValue;
36 | }
37 |
--------------------------------------------------------------------------------
/src/PIDMath.h:
--------------------------------------------------------------------------------
1 | #ifndef _PIDMATH_H
2 | #define _PIDMATH_H
3 |
4 |
5 | #include
6 |
7 | typedef struct{
8 | double Present;
9 | double Previous;
10 | }PIDErr;
11 |
12 | typedef struct{
13 | double Kp;
14 | double Ki;
15 | double Kd;
16 | }PIDConst;
17 |
18 |
19 | typedef struct{
20 | double setValue;
21 | double kp;
22 | double ki;
23 | double kd;
24 | double errorAcc;
25 | double prevError;
26 | uint32_t prevTime;
27 | }PidInfo;
28 |
29 |
30 | int findPIDValue(PidInfo *pidInfo, double actualTemp, uint32_t currentTime);
31 |
32 | #endif // _PIDMATH_H
33 |
--------------------------------------------------------------------------------
/src/SPITemp.c:
--------------------------------------------------------------------------------
1 | #include "SPITemp.h"
2 | #include "Error.h"
3 | #include "Exception.h"
4 | #include "CException.h"
5 |
6 | float calculateTemp(uint8_t *TempData)
7 | {
8 | float temp=0;
9 |
10 | if (TempData[0] & 0x4) {
11 | throwException(THERMOCOUPLE_INPUT_OPEN,NULL,"bit 2 = 1, thermocouple input is open.");
12 | }
13 | else{
14 | //each point equal to 0.25 celsius
15 | //data is store from bit 14 - bit 3
16 | temp = (float)(((TempData[1]<<5)|(TempData[0]>>3))*0.25);
17 | }
18 | return temp;
19 | }
20 |
--------------------------------------------------------------------------------
/src/SPITemp.h:
--------------------------------------------------------------------------------
1 | #ifndef _SPITEMP_H
2 | #define _SPITEMP_H
3 |
4 | #include
5 | /*
6 | typedef enum
7 | {
8 | HAL_OK = 0x00U,
9 | HAL_ERROR = 0x01U,
10 | HAL_BUSY = 0x02U,
11 | HAL_TIMEOUT = 0x03U
12 | } HAL_StatusTypeDef;
13 |
14 | typedef struct{
15 | HAL_StatusTypeDef spiStatus;
16 |
17 | }
18 | */
19 | float calculateTemp(uint8_t *TempData);
20 |
21 | #endif // _SPITEMP_H
22 |
--------------------------------------------------------------------------------
/src/TRIAC_IT.c:
--------------------------------------------------------------------------------
1 | #include "TRIAC_IT.h"
2 | #include "unity.h"
3 | #include
4 | #include
5 | #include "mock_timer.h"
6 | //#include "pulse_math.h"
7 |
8 |
9 |
10 | void TriacTriggerCallback(CCRxData *ccr3Data){
11 | uint32_t pulse=0;
12 |
13 | typedef enum{
14 | FirstRising,
15 | FirstFalling,
16 | SecondRising,
17 | SecondFalling
18 | }state;
19 |
20 | static state state1 = FirstRising;
21 |
22 | static uint32_t firstCCR=0;
23 | static uint32_t secondCCR=0;
24 | static uint32_t thirdCCR=0;
25 | static uint32_t fourthCCR=0;
26 |
27 | if(ccr3Data->flag == 1 && state1==FirstRising){
28 | firstCCR = ccr3Data->firstCCR;
29 | secondCCR = ccr3Data->secondCCR;
30 | thirdCCR = ccr3Data->thirdCCR;
31 | fourthCCR = ccr3Data->fourthCCR;
32 | ccr3Data->flag = 0;
33 | }
34 |
35 | switch(state1){
36 | case FirstRising:
37 | //CCR3 value is 0 in the beginning
38 | //load CCR3 = 10000 when CNT reach 32500 or 0
39 | UpdateCCR3(firstCCR);
40 | state1 = FirstFalling;
41 | break;
42 |
43 | case FirstFalling:
44 | //load CCR3 = 12500 when CNT reach 10000
45 | UpdateCCR3(secondCCR);
46 | state1 = SecondRising;
47 | break;
48 |
49 | case SecondRising:
50 | //load CCR3 = 30000 when CNT reach 12500
51 | UpdateCCR3(thirdCCR);
52 | state1 = SecondFalling;
53 | break;
54 |
55 | case SecondFalling:
56 | //load CCR3 = 32500 when CNT reach 30000
57 | UpdateCCR3(fourthCCR);
58 | state1=FirstRising;
59 | break;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/TRIAC_IT.h:
--------------------------------------------------------------------------------
1 | #ifndef _TRIAC_IT_H
2 | #define _TRIAC_IT_H
3 |
4 | #include
5 |
6 | typedef struct{
7 | uint32_t firstCCR;
8 | uint32_t secondCCR;
9 | uint32_t thirdCCR;
10 | uint32_t fourthCCR;
11 | uint32_t flag;
12 | }CCRxData;
13 | void TriacTriggerCallback(CCRxData *CCR3Data);
14 |
15 | #endif // _TRIAC_IT_H
16 |
--------------------------------------------------------------------------------
/src/pulse_math.c:
--------------------------------------------------------------------------------
1 | #include "pulse_math.h"
2 | #include "Error.h"
3 | #include "Exception.h"
4 | #include "CException.h"
5 |
6 | void config_pulse(CCRxData *ccr3Data, uint32_t firingAngle, uint32_t width){
7 | //while(flag == 1){};
8 |
9 | if(firingAngle>=180){
10 | firingAngle = 180;
11 | }
12 | if((firingAngle+width)>=180){
13 | width = 180-firingAngle;
14 | }
15 | if(ccr3Data->flag == 1){
16 | //return CCR3Data;
17 | throwException(CCR3DATA_FLAG_1,NULL,"ccr3Data->flag == 1, can't config CCR3!");
18 | }
19 |
20 | ccr3Data->firstCCR = firingAngle*20000/180;
21 | ccr3Data->secondCCR = (width*20000/180)+(ccr3Data->firstCCR);
22 | ccr3Data->thirdCCR = (ccr3Data->firstCCR)+20000;
23 | ccr3Data->fourthCCR = (ccr3Data->secondCCR)+20000;
24 | ccr3Data->flag = 1;
25 | }
26 |
--------------------------------------------------------------------------------
/src/pulse_math.h:
--------------------------------------------------------------------------------
1 | #ifndef _PULSE_MATH_H
2 | #define _PULSE_MATH_H
3 |
4 | #include
5 | typedef struct{
6 | uint32_t firstCCR;
7 | uint32_t secondCCR;
8 | uint32_t thirdCCR;
9 | uint32_t fourthCCR;
10 | uint32_t flag;
11 | }CCRxData;
12 |
13 |
14 | void config_pulse(CCRxData *CCR3Data, uint32_t angle, uint32_t width);
15 |
16 |
17 | #endif // _PULSE_MATH_H
18 |
--------------------------------------------------------------------------------
/src/timer.h:
--------------------------------------------------------------------------------
1 | #ifndef _TIMER_H
2 | #define _TIMER_H
3 |
4 | #include
5 | typedef char UART_HandleTypeDef;
6 |
7 | void UpdateCCR3(uint32_t CCR3);
8 | void HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
9 | void HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
10 |
11 | #endif // _TIMER_H
12 |
--------------------------------------------------------------------------------
/src/uartInterface.c:
--------------------------------------------------------------------------------
1 | #include "uartInterface.h"
2 | #include "unity.h"
3 | #include "mock_timer.h"
4 |
5 | void interruptRxTx(UART_HandleTypeDef *huart1, UartInfo *uart){
6 | uint8_t i;
7 | if(uart->rxIndx==0){
8 | for(i=0;i<100;i++)
9 | uart->rxBuffer[i]=0; //clear Rx_Buffer before receiving new data
10 | }
11 | if(uart->rxData[0]!=13){ //if received data different from ascii 13 (enter)
12 | uart->transferCplt=false;
13 | uart->rxBuffer[(uart->rxIndx)++]=uart->rxData[0];
14 | HAL_UART_Transmit(huart1, uart->rxData,1, 1000);
15 | }
16 | else{
17 | uart->rxIndx=0;
18 | uart->transferCplt=true; //transfer complete, data is ready to read
19 | HAL_UART_Transmit(huart1,"\r\n" ,2, 1000);
20 | }
21 | HAL_UART_Receive_IT(huart1,uart->rxData,1);
22 | //activate UART receive interrupt every time
23 | }
24 |
--------------------------------------------------------------------------------
/src/uartInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef _UARTINTERFACE_H
2 | #define _UARTINTERFACE_H
3 |
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | typedef struct{
10 | uint8_t rxIndx;
11 | char rxBuffer[100];
12 | char rxData[2];
13 | bool transferCplt;
14 | }UartInfo;
15 |
16 | typedef char UART_HandleTypeDef;
17 |
18 | void interruptRxTx(UART_HandleTypeDef *huart1, UartInfo *uart);
19 |
20 |
21 | #endif // _UARTINTERFACE_H
22 |
--------------------------------------------------------------------------------
/test/support/Readme.txt:
--------------------------------------------------------------------------------
1 | Do not remove me!
2 |
--------------------------------------------------------------------------------
/test/test_SPITemp.c:
--------------------------------------------------------------------------------
1 | #include "unity.h"
2 | #include "SPITemp.h"
3 | #include "Error.h"
4 | #include "Exception.h"
5 | #include "CException.h"
6 |
7 | void setUp(void)
8 | {
9 | }
10 |
11 | void tearDown(void)
12 | {
13 | }
14 |
15 | void test_calculateTempFromBinary(void)
16 | {
17 | //30 celsius * 0.25 = 120 in decimal = 0000 0111 1000 in 12 bit data
18 | //bit 0 - bit 2 all zeros
19 | uint8_t TempData[2];
20 | TempData[0] = 0b11000000;
21 | TempData[1] = 0b00000011;
22 | int temp = calculateTemp(&TempData[0]);
23 | TEST_ASSERT_EQUAL(30, temp);
24 | }
25 |
26 |
27 | void test_calculateTempThermocoupleIsOpen(void)
28 | {
29 | CEXCEPTION_T ex = NULL;
30 | //30 celsius * 0.25 = 120 in decimal = 0000 0111 1000 in 12 bit data
31 | //bit 0 - bit 1 all zeros
32 | //bit 2 = 1 to indicate thermocouple input is open
33 | uint8_t TempData[2];
34 | TempData[0] = 0b11000100;
35 | TempData[1] = 0b00000011;
36 | int temp = 0;
37 |
38 | Try{
39 | temp = calculateTemp(&TempData[0]);
40 | TEST_FAIL_MESSAGE("expect exception to be thrown");
41 | }
42 | Catch(ex){
43 | dumpException(ex);
44 | TEST_ASSERT_EQUAL(0, temp);
45 | freeException(ex);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/ceedling/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/vendor/ceedling/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/build_invoker_utils.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 | ##
4 | # Utilities for raiser and reporting errors during building.
5 | class BuildInvokerUtils
6 |
7 | constructor :configurator, :streaminator
8 |
9 | ##
10 | # Processes exceptions and tries to display a useful message for the user.
11 | #
12 | # ==== Attriboops...utes
13 | #
14 | # * _exception_: The exception given by a rescue statement.
15 | # * _context_: A symbol representing where in the build the exception
16 | # occurs.
17 | # * _test_build_: A bool to signify if the exception occurred while building
18 | # from test or source.
19 | #
20 | def process_exception(exception, context, test_build=true)
21 | if (exception.message =~ /Don't know how to build task '(.+)'/i)
22 | error_header = "ERROR: Rake could not find file referenced in source"
23 | error_header += " or test" if (test_build)
24 | error_header += ": '#{$1}'. Possible stale dependency."
25 |
26 | @streaminator.stderr_puts( error_header )
27 |
28 | if (@configurator.project_use_deep_dependencies)
29 | help_message = "Try fixing #include statements or adding missing file. Then run '#{REFRESH_TASK_ROOT}#{context.to_s}' task and try again."
30 | @streaminator.stderr_puts( help_message )
31 | end
32 |
33 | raise ''
34 | else
35 | raise exception
36 | end
37 | end
38 |
39 | end
40 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/cacheinator.rb:
--------------------------------------------------------------------------------
1 |
2 | class Cacheinator
3 |
4 | constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper
5 |
6 | def cache_test_config(hash)
7 | @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash )
8 | end
9 |
10 | def cache_release_config(hash)
11 | @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash )
12 | end
13 |
14 |
15 | def diff_cached_test_file( filepath )
16 | cached_filepath = @file_path_utils.form_test_build_cache_path( filepath )
17 |
18 | if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath )))
19 | @file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
20 | return filepath
21 | elsif (!@file_wrapper.exist?( cached_filepath ))
22 | @file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
23 | return filepath
24 | end
25 |
26 | return cached_filepath
27 | end
28 |
29 |
30 | def diff_cached_test_config?(hash)
31 | cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
32 |
33 | return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
34 | end
35 |
36 | def diff_cached_release_config?(hash)
37 | cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
38 |
39 | return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
40 | end
41 |
42 | end
43 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/cacheinator_helper.rb:
--------------------------------------------------------------------------------
1 |
2 | class CacheinatorHelper
3 |
4 | constructor :file_wrapper, :yaml_wrapper
5 |
6 | def diff_cached_config?(cached_filepath, hash)
7 | return true if ( not @file_wrapper.exist?(cached_filepath) )
8 | return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) )
9 | return false
10 | end
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/cmock_builder.rb:
--------------------------------------------------------------------------------
1 | require 'cmock'
2 |
3 | class CmockBuilder
4 |
5 | attr_accessor :cmock
6 |
7 | def setup
8 | @cmock = nil
9 | end
10 |
11 | def manufacture(cmock_config)
12 | @cmock = CMock.new(cmock_config)
13 | end
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/erb_wrapper.rb:
--------------------------------------------------------------------------------
1 | require 'erb'
2 |
3 | class ErbWrapper
4 | def generate_file(template, data, output_file)
5 | File.open(output_file, "w") do |f|
6 | f << ERB.new(template, 0, "<>").result(binding)
7 | end
8 | end
9 | end
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/file_finder_helper.rb:
--------------------------------------------------------------------------------
1 | require 'fileutils'
2 | require 'ceedling/constants' # for Verbosity enumeration
3 |
4 | class FileFinderHelper
5 |
6 | constructor :streaminator
7 |
8 |
9 | def find_file_in_collection(file_name, file_list, complain, extra_message="")
10 | file_to_find = nil
11 |
12 | file_list.each do |item|
13 | base_file = File.basename(item)
14 |
15 | # case insensitive comparison
16 | if (base_file.casecmp(file_name) == 0)
17 | # case sensitive check
18 | if (base_file == file_name)
19 | file_to_find = item
20 | break
21 | else
22 | blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.")
23 | end
24 | end
25 |
26 | end
27 |
28 | case (complain)
29 | when :error then blow_up(file_name, extra_message) if (file_to_find.nil?)
30 | when :warn then gripe(file_name, extra_message) if (file_to_find.nil?)
31 | #when :ignore then
32 | end
33 |
34 | return file_to_find
35 | end
36 |
37 | private
38 |
39 | def blow_up(file_name, extra_message="")
40 | error = "ERROR: Found no file '#{file_name}' in search paths."
41 | error += ' ' if (extra_message.length > 0)
42 | @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS)
43 | raise
44 | end
45 |
46 | def gripe(file_name, extra_message="")
47 | warning = "WARNING: Found no file '#{file_name}' in search paths."
48 | warning += ' ' if (extra_message.length > 0)
49 | @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN)
50 | end
51 |
52 | end
53 |
54 |
55 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/file_system_utils.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'rake'
3 | require 'set'
4 | require 'fileutils'
5 | require 'ceedling/file_path_utils'
6 |
7 |
8 | class FileSystemUtils
9 |
10 | constructor :file_wrapper
11 |
12 | # build up path list from input of one or more strings or arrays of (+/-) paths & globs
13 | def collect_paths(*paths)
14 | raw = [] # all paths and globs
15 | plus = Set.new # all paths to expand and add
16 | minus = Set.new # all paths to remove from plus set
17 |
18 | # assemble all globs and simple paths, reforming our glob notation to ruby globs
19 | paths.each do |paths_container|
20 | case (paths_container)
21 | when String then raw << (FilePathUtils::reform_glob(paths_container))
22 | when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))}
23 | else raise "Don't know how to handle #{paths_container.class}"
24 | end
25 | end
26 |
27 | # iterate through each path and glob
28 | raw.each do |path|
29 |
30 | dirs = [] # container for only (expanded) paths
31 |
32 | # if a glob, expand it and slurp up all non-file paths
33 | if path.include?('*')
34 | # grab base directory only if globs are snug up to final path separator
35 | if (path =~ /\/\*+$/)
36 | dirs << FilePathUtils.extract_path(path)
37 | end
38 |
39 | # grab expanded sub-directory globs
40 | expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) )
41 | expanded.each do |entry|
42 | dirs << entry if @file_wrapper.directory?(entry)
43 | end
44 |
45 | # else just grab simple path
46 | # note: we could just run this through glob expansion but such an
47 | # approach doesn't handle a path not yet on disk)
48 | else
49 | dirs << FilePathUtils.extract_path_no_aggregation_operators(path)
50 | end
51 |
52 | # add dirs to the appropriate set based on path aggregation modifier if present
53 | FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs)
54 | end
55 |
56 | return (plus - minus).to_a.uniq
57 | end
58 |
59 |
60 | # given a file list, add to it or remove from it
61 | def revise_file_list(list, revisions)
62 | revisions.each do |revision|
63 | # include or exclude file or glob to file list
64 | file = FilePathUtils.extract_path_no_aggregation_operators( revision )
65 | FilePathUtils.add_path?(revision) ? list.include(file) : list.exclude(file)
66 | end
67 | end
68 |
69 | end
70 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/file_system_wrapper.rb:
--------------------------------------------------------------------------------
1 |
2 | class FileSystemWrapper
3 |
4 | def cd(path)
5 | FileUtils.cd path do
6 | yield
7 | end
8 | end
9 |
10 | end
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/file_wrapper.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'rake' # for FileList
3 | require 'fileutils'
4 | require 'ceedling/constants'
5 |
6 |
7 | class FileWrapper
8 |
9 | def get_expanded_path(path)
10 | return File.expand_path(path)
11 | end
12 |
13 | def basename(path, extension=nil)
14 | return File.basename(path, extension) if extension
15 | return File.basename(path)
16 | end
17 |
18 | def exist?(filepath)
19 | return true if (filepath == NULL_FILE_PATH)
20 | return File.exist?(filepath)
21 | end
22 |
23 | def directory?(path)
24 | return File.directory?(path)
25 | end
26 |
27 | def dirname(path)
28 | return File.dirname(path)
29 | end
30 |
31 | def directory_listing(glob)
32 | return Dir.glob(glob, File::FNM_PATHNAME)
33 | end
34 |
35 | def rm_f(filepath, options={})
36 | FileUtils.rm_f(filepath, options)
37 | end
38 |
39 | def rm_r(filepath, options={})
40 | FileUtils.rm_r(filepath, options={})
41 | end
42 |
43 | def cp(source, destination, options={})
44 | FileUtils.cp(source, destination, options)
45 | end
46 |
47 | def compare(from, to)
48 | return FileUtils.compare_file(from, to)
49 | end
50 |
51 | def open(filepath, flags)
52 | File.open(filepath, flags) do |file|
53 | yield(file)
54 | end
55 | end
56 |
57 | def read(filepath)
58 | return File.read(filepath)
59 | end
60 |
61 | def touch(filepath, options={})
62 | FileUtils.touch(filepath, options)
63 | end
64 |
65 | def write(filepath, contents, flags='w')
66 | File.open(filepath, flags) do |file|
67 | file.write(contents)
68 | end
69 | end
70 |
71 | def readlines(filepath)
72 | return File.readlines(filepath)
73 | end
74 |
75 | def instantiate_file_list(files=[])
76 | return FileList.new(files)
77 | end
78 |
79 | end
80 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/flaginator.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'rake' # for ext()
3 | require 'fileutils'
4 | require 'ceedling/constants'
5 |
6 |
7 | # :flags:
8 | # :release:
9 | # :compile:
10 | # :'test_.+'
11 | # - -pedantic # add '-pedantic' to every test file
12 | # :*: # add '-foo' to compilation of all files not main.c
13 | # - -foo
14 | # :main: # add '-Wall' to compilation of main.c
15 | # - -Wall
16 | # :test:
17 | # :link:
18 | # :test_main: # add '--bar --baz' to linking of test_main.exe
19 | # - --bar
20 | # - --baz
21 |
22 | def partition(hash, &predicate)
23 | hash.partition(&predicate).map(&:to_h)
24 | end
25 |
26 | class Flaginator
27 |
28 | constructor :configurator
29 |
30 | def get_flag(hash, file_name)
31 | file_key = file_name.to_sym
32 |
33 | # 1. try literals
34 | literals, magic = partition(hash) { |k, v| k.to_s =~ /^\w+$/ }
35 | return literals[file_key] if literals.include?(file_key)
36 |
37 | any, regex = partition(magic) { |k, v| (k == :'*') || (k == :'.*') } # glob or regex wild card
38 |
39 | # 2. try regexes
40 | find_res = regex.find { |k, v| file_name =~ /^#{k.to_s}$/ }
41 | return find_res[1] if find_res
42 |
43 | # 3. try anything
44 | find_res = any.find { |k, v| file_name =~ /.*/ }
45 | return find_res[1] if find_res
46 |
47 | # 4. well, we've tried
48 | return []
49 | end
50 |
51 | def flag_down( operation, context, file )
52 | # create configurator accessor method
53 | accessor = ('flags_' + context.to_s).to_sym
54 |
55 | # create simple filename key from whatever filename provided
56 | file_name = File.basename( file ).ext('')
57 | file_key = File.basename( file ).ext('').to_sym
58 |
59 | # if no entry in configuration for flags for this context, bail out
60 | return [] if not @configurator.respond_to?( accessor )
61 |
62 | # get flags sub hash associated with this context
63 | flags = @configurator.send( accessor )
64 |
65 | # if operation not represented in flags hash, bail out
66 | return [] if not flags.include?( operation )
67 |
68 | # redefine flags to sub hash associated with the operation
69 | flags = flags[operation]
70 |
71 | return get_flag(flags, file_name)
72 | end
73 |
74 | end
75 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/generator_helper.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 |
4 | class GeneratorHelper
5 |
6 | constructor :streaminator
7 |
8 |
9 | def test_results_error_handler(executable, shell_result)
10 | notice = ''
11 | error = false
12 |
13 | if (shell_result[:output].nil? or shell_result[:output].strip.empty?)
14 | error = true
15 | # mirror style of generic tool_executor failure output
16 | notice = "\n" +
17 | "ERROR: Test executable \"#{File.basename(executable)}\" failed.\n" +
18 | "> Produced no output to $stdout.\n"
19 | elsif ((shell_result[:output] =~ TEST_STDOUT_STATISTICS_PATTERN).nil?)
20 | error = true
21 | # mirror style of generic tool_executor failure output
22 | notice = "\n" +
23 | "ERROR: Test executable \"#{File.basename(executable)}\" failed.\n" +
24 | "> Produced no final test result counts in $stdout:\n" +
25 | "#{shell_result[:output].strip}\n"
26 | end
27 |
28 | if (error)
29 | # since we told the tool executor to ignore the exit code, handle it explicitly here
30 | notice += "> And exited with status: [#{shell_result[:exit_code]}] (count of failed tests).\n" if (shell_result[:exit_code] != nil)
31 | notice += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil)
32 |
33 | notice += "> This is often a symptom of a bad memory access in source or test code.\n\n"
34 |
35 | @streaminator.stderr_puts(notice, Verbosity::COMPLAIN)
36 | raise
37 | end
38 | end
39 |
40 | end
41 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/generator_test_runner.rb:
--------------------------------------------------------------------------------
1 |
2 | class GeneratorTestRunner
3 |
4 | constructor :configurator, :file_path_utils, :file_wrapper
5 |
6 | def find_test_cases(test_file)
7 |
8 | #Pull in Unity's Test Runner Generator
9 | require 'generate_test_runner.rb'
10 | @test_runner_generator ||= UnityTestRunnerGenerator.new( @configurator.get_runner_config )
11 |
12 | if (@configurator.project_use_test_preprocessor)
13 |
14 | #redirect to use the preprocessor file if we're doing that sort of thing
15 | pre_test_file = @file_path_utils.form_preprocessed_file_filepath(test_file)
16 |
17 | #actually look for the tests using Unity's test runner generator
18 | tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(pre_test_file))
19 |
20 | #look up the line numbers in the original file
21 | source_lines = @file_wrapper.read(test_file).split("\n")
22 | source_index = 0;
23 | tests_and_line_numbers.size.times do |i|
24 | source_lines[source_index..-1].each_with_index do |line, index|
25 | if (line =~ /#{tests_and_line_numbers[i][:test]}/)
26 | source_index += index
27 | tests_and_line_numbers[i][:line_number] = source_index + 1
28 | break
29 | end
30 | end
31 | end
32 | else
33 | #Just look for the tests using Unity's test runner generator
34 | tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(test_file))
35 | end
36 |
37 | return tests_and_line_numbers
38 | end
39 |
40 | def generate(module_name, runner_filepath, test_cases, mock_list, test_file_includes=[])
41 | require 'generate_test_runner.rb'
42 |
43 | #actually build the test runner using Unity's test runner generator
44 | #(there is no need to use preprocessor here because we've already looked up test cases and are passing them in here)
45 | @test_runner_generator ||= UnityTestRunnerGenerator.new( @configurator.get_runner_config )
46 | @test_runner_generator.generate( module_name,
47 | runner_filepath,
48 | test_cases,
49 | mock_list,
50 | test_file_includes)
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/loginator.rb:
--------------------------------------------------------------------------------
1 |
2 | class Loginator
3 |
4 | constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper
5 |
6 |
7 | def setup_log_filepath
8 | config_files = []
9 | config_files << @project_file_loader.main_file
10 | config_files << @project_file_loader.user_file
11 | config_files.concat( @project_config_manager.options_files )
12 | config_files.compact!
13 | config_files.map! { |file| file.ext('') }
14 |
15 | log_name = config_files.join( '_' )
16 |
17 | @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') )
18 | end
19 |
20 |
21 | def log(string, heading=nil)
22 | return if (not @configurator.project_logging)
23 |
24 | output = "\n[#{@system_wrapper.time_now}]"
25 | output += " :: #{heading}" if (not heading.nil?)
26 | output += "\n#{string.strip}\n"
27 |
28 | @file_wrapper.write(@project_log_filepath, output, 'a')
29 | end
30 |
31 | end
32 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/makefile.rb:
--------------------------------------------------------------------------------
1 |
2 | # modified version of Rake's provided make-style dependency loader
3 | # customizations:
4 | # (1) handles windows drives in paths -- colons don't confuse task demarcation
5 | # (2) handles spaces in directory paths
6 |
7 | module Rake
8 |
9 | # Makefile loader to be used with the import file loader.
10 | class MakefileLoader
11 |
12 | # Load the makefile dependencies in +fn+.
13 | def load(fn)
14 | open(fn) do |mf|
15 | lines = mf.read
16 | lines.gsub!(/#[^\n]*\n/m, "") # remove comments
17 | lines.gsub!(/\\\n/, ' ') # string together line continuations into single line
18 | lines.split("\n").each do |line|
19 | process_line(line)
20 | end
21 | end
22 | end
23 |
24 | private
25 |
26 | # Process one logical line of makefile data.
27 | def process_line(line)
28 | # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path)
29 | file_tasks, args = line.split(/:\s/)
30 |
31 | return if args.nil?
32 |
33 | # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone)
34 | dependents = args.split(/\b\s+/)
35 | # replace escaped spaces and clean up any extra whitespace
36 | dependents.map! { |path| path.gsub(/\\ /, ' ').strip }
37 |
38 | file_tasks.strip.split.each do |file_task|
39 | file file_task => dependents
40 | end
41 | end
42 | end
43 |
44 | # Install the handler
45 | Rake.application.add_loader('mf', MakefileLoader.new)
46 | end
47 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/par_map.rb:
--------------------------------------------------------------------------------
1 |
2 |
3 | def par_map(n, things, &block)
4 | queue = Queue.new
5 | things.each { |thing| queue << thing }
6 | threads = (1..n).collect do
7 | Thread.new do
8 | begin
9 | while true
10 | yield queue.pop(true)
11 | end
12 | rescue ThreadError
13 |
14 | end
15 | end
16 | end
17 | threads.each { |t| t.join }
18 | end
19 |
20 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/plugin.rb:
--------------------------------------------------------------------------------
1 |
2 | class String
3 | # reformat a multiline string to have given number of whitespace columns;
4 | # helpful for formatting heredocs
5 | def left_margin(margin=0)
6 | non_whitespace_column = 0
7 | new_lines = []
8 |
9 | # find first line with non-whitespace and count left columns of whitespace
10 | self.each_line do |line|
11 | if (line =~ /^\s*\S/)
12 | non_whitespace_column = $&.length - 1
13 | break
14 | end
15 | end
16 |
17 | # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin
18 | self.each_line do |line|
19 | columns = []
20 | margin.times{columns << ' '}
21 | # handle special case of line being narrower than width to be lopped off
22 | if (non_whitespace_column < line.length)
23 | new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}"
24 | else
25 | new_lines << "\n"
26 | end
27 | end
28 |
29 | return new_lines.join
30 | end
31 | end
32 |
33 | class Plugin
34 | attr_reader :name, :environment
35 | attr_accessor :plugin_objects
36 |
37 | def initialize(system_objects, name)
38 | @environment = []
39 | @ceedling = system_objects
40 | @name = name
41 | self.setup
42 | end
43 |
44 | def setup; end
45 |
46 | # mock generation
47 | def pre_mock_generate(arg_hash); end
48 | def post_mock_generate(arg_hash); end
49 |
50 | # test runner generation
51 | def pre_runner_generate(arg_hash); end
52 | def post_runner_generate(arg_hash); end
53 |
54 | # compilation (test or source)
55 | def pre_compile_execute(arg_hash); end
56 | def post_compile_execute(arg_hash); end
57 |
58 | # linking (test or source)
59 | def pre_link_execute(arg_hash); end
60 | def post_link_execute(arg_hash); end
61 |
62 | # test fixture execution
63 | def pre_test_fixture_execute(arg_hash); end
64 | def post_test_fixture_execute(arg_hash); end
65 |
66 | # test task
67 | def pre_test(test); end
68 | def post_test(test); end
69 |
70 | # release task
71 | def pre_release; end
72 | def post_release; end
73 |
74 | # whole shebang (any use of Ceedling)
75 | def pre_build; end
76 | def post_build; end
77 |
78 | def summary; end
79 |
80 | end
81 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/plugin_builder.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 |
3 | class PluginBuilder
4 |
5 | attr_accessor :plugin_objects
6 |
7 | def construct_plugin(plugin_name, object_map_yaml, system_objects)
8 | # @streaminator.stdout_puts("Constructing plugin #{plugin_name}...", Verbosity::OBNOXIOUS)
9 | object_map = {}
10 | @plugin_objects = {}
11 | @system_objects = system_objects
12 |
13 | if object_map_yaml
14 | @object_map = YAML.load(object_map_yaml)
15 | @object_map.each_key do |obj|
16 | construct_object(obj)
17 | end
18 | else
19 | raise "Invalid object map for plugin #{plugin_name}!"
20 | end
21 |
22 | return @plugin_objects
23 | end
24 |
25 | private
26 |
27 | def camelize(underscored_name)
28 | return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase}
29 | end
30 |
31 | def construct_object(obj)
32 | if @plugin_objects[obj].nil?
33 | if @object_map[obj] && @object_map[obj]['compose']
34 | @object_map[obj]['compose'].each do |dep|
35 | construct_object(dep)
36 | end
37 | end
38 | build_object(obj)
39 | end
40 | end
41 |
42 | def build_object(new_object)
43 | if @plugin_objects[new_object.to_sym].nil?
44 | # @streaminator.stdout_puts("Building plugin object #{new_object}", Verbosity::OBNOXIOUS)
45 | require new_object
46 | class_name = camelize(new_object)
47 | new_instance = eval("#{class_name}.new(@system_objects, class_name.to_s)")
48 | new_instance.plugin_objects = @plugin_objects
49 | @plugin_objects[new_object.to_sym] = new_instance
50 | end
51 | end
52 |
53 | end
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/plugin_manager_helper.rb:
--------------------------------------------------------------------------------
1 |
2 | class PluginManagerHelper
3 |
4 | def include?(plugins, name)
5 | include = false
6 | plugins.each do |plugin|
7 | if (plugin.name == name)
8 | include = true
9 | break
10 | end
11 | end
12 | return include
13 | end
14 |
15 | def instantiate_plugin_script(plugin, system_objects, name)
16 | return eval("#{plugin}.new(system_objects, name)")
17 | end
18 |
19 | end
20 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/plugin_reportinator.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 | require 'ceedling/defaults'
3 |
4 | class PluginReportinator
5 |
6 | constructor :plugin_reportinator_helper, :plugin_manager, :reportinator
7 |
8 | def setup
9 | @test_results_template = nil
10 | end
11 |
12 |
13 | def set_system_objects(system_objects)
14 | @plugin_reportinator_helper.ceedling = system_objects
15 | end
16 |
17 |
18 | def fetch_results(results_path, test, options={:boom => false})
19 | return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options )
20 | end
21 |
22 |
23 | def generate_banner(message)
24 | return @reportinator.generate_banner(message)
25 | end
26 |
27 |
28 | def assemble_test_results(results_list, options={:boom => false})
29 | aggregated_results = get_results_structure
30 |
31 | results_list.each do |result_path|
32 | results = @plugin_reportinator_helper.fetch_results( result_path, options )
33 | @plugin_reportinator_helper.process_results(aggregated_results, results)
34 | end
35 |
36 | return aggregated_results
37 | end
38 |
39 |
40 | def register_test_results_template(template)
41 | @test_results_template = template if (@test_results_template.nil?)
42 | end
43 |
44 |
45 | def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block)
46 | run_report( $stdout,
47 | ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template),
48 | hash,
49 | verbosity,
50 | &block )
51 | end
52 |
53 |
54 | def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL)
55 | failure = nil
56 | failure = yield() if block_given?
57 |
58 | @plugin_manager.register_build_failure( failure )
59 |
60 | @plugin_reportinator_helper.run_report( stream, template, hash, verbosity )
61 | end
62 |
63 | private ###############################
64 |
65 | def get_results_structure
66 | return {
67 | :successes => [],
68 | :failures => [],
69 | :ignores => [],
70 | :stdout => [],
71 | :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0}
72 | }
73 | end
74 |
75 | end
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/plugin_reportinator_helper.rb:
--------------------------------------------------------------------------------
1 | require 'erb'
2 | require 'rubygems'
3 | require 'rake' # for ext()
4 | require 'ceedling/constants'
5 |
6 |
7 | class PluginReportinatorHelper
8 |
9 | attr_writer :ceedling
10 |
11 | constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper
12 |
13 | def fetch_results(results_path, options)
14 | pass_path = File.join(results_path.ext( @configurator.extension_testpass ))
15 | fail_path = File.join(results_path.ext( @configurator.extension_testfail ))
16 |
17 | if (@file_wrapper.exist?(fail_path))
18 | return @yaml_wrapper.load(fail_path)
19 | elsif (@file_wrapper.exist?(pass_path))
20 | return @yaml_wrapper.load(pass_path)
21 | else
22 | if (options[:boom])
23 | @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS)
24 | raise
25 | end
26 | end
27 |
28 | return {}
29 | end
30 |
31 |
32 | def process_results(aggregate_results, results)
33 | return if (results.empty?)
34 |
35 | aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0)
36 | aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0)
37 | aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0)
38 | aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0)
39 | aggregate_results[:counts][:total] += results[:counts][:total]
40 | aggregate_results[:counts][:passed] += results[:counts][:passed]
41 | aggregate_results[:counts][:failed] += results[:counts][:failed]
42 | aggregate_results[:counts][:ignored] += results[:counts][:ignored]
43 | aggregate_results[:counts][:stdout] += results[:stdout].size
44 | end
45 |
46 |
47 | def run_report(stream, template, hash, verbosity)
48 | output = ERB.new(template, 0, "%<>")
49 | @streaminator.stream_puts(stream, output.result(binding()), verbosity)
50 | end
51 |
52 | end
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/preprocessinator.rb:
--------------------------------------------------------------------------------
1 |
2 | class Preprocessinator
3 |
4 | attr_reader :preprocess_file_proc
5 |
6 | constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper
7 |
8 |
9 | def setup
10 | # fashion ourselves callbacks @preprocessinator_helper can use
11 | @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) }
12 | @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) }
13 | end
14 |
15 |
16 | def preprocess_test_and_invoke_test_mocks(test)
17 | @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc)
18 |
19 | mocks_list = @preprocessinator_helper.assemble_mocks_list(test)
20 |
21 | @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc)
22 |
23 | @task_invoker.invoke_test_mocks(mocks_list)
24 |
25 | @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc)
26 |
27 | return mocks_list
28 | end
29 |
30 | def preprocess_shallow_includes(filepath)
31 | dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath)
32 | includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule)
33 |
34 | @preprocessinator_includes_handler.write_shallow_includes_list(
35 | @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes)
36 | end
37 |
38 | def preprocess_file(filepath)
39 | @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath)
40 | @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) )
41 | end
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/preprocessinator_extractor.rb:
--------------------------------------------------------------------------------
1 | class PreprocessinatorExtractor
2 | def extract_base_file_from_preprocessed_expansion(filepath)
3 | # preprocessing by way of toolchain preprocessor expands macros, eliminates
4 | # comments, strips out #ifdef code, etc. however, it also expands in place
5 | # each #include'd file. so, we must extract only the lines of the file
6 | # that belong to the file originally preprocessed
7 |
8 | # iterate through all lines and alternate between extract and ignore modes
9 | # all lines between a '#'line containing file name of our filepath and the
10 | # next '#'line should be extracted
11 |
12 | base_name = File.basename(filepath)
13 | not_pragma = /^#(?!pragma\b)/ # preprocessor directive that's not a #pragma
14 | pattern = /^#.*(\s|\/|\\|\")#{Regexp.escape(base_name)}/
15 | found_file = false # have we found the file we care about?
16 |
17 | lines = []
18 | File.readlines(filepath).each do |line|
19 | if found_file and not line.match(not_pragma)
20 | lines << line
21 | else
22 | found_file = false
23 | end
24 |
25 | found_file = true if line.match(pattern)
26 | end
27 |
28 | return lines
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb:
--------------------------------------------------------------------------------
1 |
2 |
3 | class PreprocessinatorFileHandler
4 |
5 | constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper
6 |
7 |
8 | def preprocess_file(filepath, includes)
9 | preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath)
10 |
11 | command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, [], filepath, preprocessed_filepath)
12 | @tool_executor.exec(command[:line], command[:options])
13 |
14 | contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath)
15 |
16 | includes.each{|include| contents.unshift("#include \"#{include}\"")}
17 |
18 | @file_wrapper.write(preprocessed_filepath, contents.join("\n"))
19 | end
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/preprocessinator_helper.rb:
--------------------------------------------------------------------------------
1 |
2 |
3 | class PreprocessinatorHelper
4 |
5 | constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils
6 |
7 |
8 | def preprocess_includes(test, preprocess_includes_proc)
9 | if (@configurator.project_use_test_preprocessor)
10 | preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test)
11 | preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) )
12 | @test_includes_extractor.parse_includes_list(preprocessed_includes_list)
13 | else
14 | @test_includes_extractor.parse_test_file(test)
15 | end
16 | end
17 |
18 | def assemble_mocks_list(test)
19 | return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) )
20 | end
21 |
22 | def preprocess_mockable_headers(mock_list, preprocess_file_proc)
23 | if (@configurator.project_use_test_preprocessor)
24 | preprocess_files_smartly(
25 | @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list),
26 | preprocess_file_proc ) { |file| @file_finder.find_header_file(file) }
27 | end
28 | end
29 |
30 | def preprocess_test_file(test, preprocess_file_proc)
31 | return if (!@configurator.project_use_test_preprocessor)
32 |
33 | preprocess_file_proc.call(test)
34 | end
35 |
36 | private ############################
37 |
38 | def preprocess_files_smartly(file_list, preprocess_file_proc)
39 | if (@configurator.project_use_deep_dependencies)
40 | @task_invoker.invoke_test_preprocessed_files(file_list)
41 | else
42 | file_list.each { |file| preprocess_file_proc.call( yield(file) ) }
43 | end
44 | end
45 |
46 | end
47 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/project_config_manager.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 |
4 | class ProjectConfigManager
5 |
6 | attr_reader :options_files, :release_config_changed, :test_config_changed
7 | attr_accessor :config_hash
8 |
9 | constructor :cacheinator, :yaml_wrapper
10 |
11 |
12 | def setup
13 | @options_files = []
14 | @release_config_changed = false
15 | @test_config_changed = false
16 | end
17 |
18 |
19 | def merge_options(config_hash, option_filepath)
20 | @options_files << File.basename( option_filepath )
21 | config_hash.deep_merge!( @yaml_wrapper.load( option_filepath ) )
22 | end
23 |
24 |
25 |
26 | def process_release_config_change
27 | # has project configuration changed since last release build
28 | @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash )
29 | end
30 |
31 |
32 | def process_test_config_change
33 | # has project configuration changed since last test build
34 | @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash )
35 | end
36 |
37 | end
38 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rake_utils.rb:
--------------------------------------------------------------------------------
1 |
2 | class RakeUtils
3 |
4 | constructor :rake_wrapper
5 |
6 | def task_invoked?(task_regex)
7 | task_invoked = false
8 | @rake_wrapper.task_list.each do |task|
9 | if ((task.already_invoked) and (task.to_s =~ task_regex))
10 | task_invoked = true
11 | break
12 | end
13 | end
14 | return task_invoked
15 | end
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rake_wrapper.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'rake'
3 | require 'ceedling/makefile' # our replacement for rake's make-style dependency loader
4 |
5 | include Rake::DSL if defined?(Rake::DSL)
6 |
7 | class Rake::Task
8 | attr_reader :already_invoked
9 | end
10 |
11 | class RakeWrapper
12 |
13 | def initialize
14 | @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above
15 | end
16 |
17 | def [](task)
18 | return Rake::Task[task]
19 | end
20 |
21 | def task_list
22 | return Rake::Task.tasks
23 | end
24 |
25 | def create_file_task(file_task, dependencies)
26 | file(file_task => dependencies)
27 | end
28 |
29 | def load_dependencies(dependencies_path)
30 | @makefile_loader.load(dependencies_path)
31 | end
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/release_invoker.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 |
4 | class ReleaseInvoker
5 |
6 | constructor :configurator, :release_invoker_helper, :build_invoker_utils, :dependinator, :task_invoker, :file_path_utils, :file_wrapper
7 |
8 |
9 | def setup_and_invoke_c_objects( c_files )
10 | objects = @file_path_utils.form_release_build_c_objects_filelist( c_files )
11 |
12 | begin
13 | @release_invoker_helper.process_deep_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) )
14 |
15 | @dependinator.enhance_release_file_dependencies( objects )
16 | @task_invoker.invoke_release_objects( objects )
17 | rescue => e
18 | @build_invoker_utils.process_exception( e, RELEASE_SYM, false )
19 | end
20 |
21 | return objects
22 | end
23 |
24 |
25 | def setup_and_invoke_asm_objects( asm_files )
26 | objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files )
27 |
28 | begin
29 | @dependinator.enhance_release_file_dependencies( objects )
30 | @task_invoker.invoke_release_objects( objects )
31 | rescue => e
32 | @build_invoker_utils.process_exception( e, RELEASE_SYM, false )
33 | end
34 |
35 | return objects
36 | end
37 |
38 |
39 | def refresh_c_deep_dependencies
40 | return if (not @configurator.project_use_deep_dependencies)
41 |
42 | @file_wrapper.rm_f(
43 | @file_wrapper.directory_listing(
44 | File.join( @configurator.project_release_dependencies_path, '*' + @configurator.extension_dependencies ) ) )
45 |
46 | @release_invoker_helper.process_deep_dependencies(
47 | @file_path_utils.form_release_dependencies_filelist(
48 | @configurator.collection_all_source ) )
49 | end
50 |
51 |
52 | def artifactinate( *files )
53 | files.flatten.each do |file|
54 | @file_wrapper.cp( file, @configurator.project_release_artifacts_path ) if @file_wrapper.exist?( file )
55 | end
56 | end
57 |
58 | def convert_libraries_to_arguments(libraries)
59 | args = (libraries || []) + ((defined? LIBRARIES_SYSTEM) ? LIBRARIES_SYSTEM : [])
60 | if (defined? LIBRARIES_FLAG)
61 | args.map! {|v| LIBRARIES_FLAG.gsub(/\$\{1\}/, v) }
62 | end
63 | return args
64 | end
65 |
66 | def sort_objects_and_libraries(both)
67 | extension = "\\" + ((defined? EXTENSION_SUBPROJECTS) ? EXTENSION_SUBPROJECTS : ".LIBRARY")
68 | sorted_objects = both.group_by {|v| v.match(/.+#{extension}$/) ? :libraries : :objects }
69 | libraries = sorted_objects[:libraries] || []
70 | objects = sorted_objects[:objects] || []
71 | return objects, libraries
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/release_invoker_helper.rb:
--------------------------------------------------------------------------------
1 |
2 |
3 | class ReleaseInvokerHelper
4 |
5 | constructor :configurator, :dependinator, :task_invoker
6 |
7 |
8 | def process_deep_dependencies(dependencies_list)
9 | return if (not @configurator.project_use_deep_dependencies)
10 |
11 | @dependinator.enhance_release_file_dependencies( dependencies_list )
12 | @task_invoker.invoke_release_dependencies_files( dependencies_list )
13 | @dependinator.load_release_object_deep_dependencies( dependencies_list )
14 | end
15 |
16 | end
17 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/reportinator.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Pretifies reports
3 | class Reportinator
4 |
5 | ##
6 | # Generates a banner for a message based on the length of the message or a
7 | # given width.
8 | # ==== Attributes
9 | #
10 | # * _message_: The message to put.
11 | # * _width_: The width of the message. If nil the size of the banner is
12 | # determined by the length of the message.
13 | #
14 | # ==== Examples
15 | #
16 | # rp = Reportinator.new
17 | # rp.generate_banner("Hello world!") => "------------\nHello world!\n------------\n"
18 | # rp.generate_banner("Hello world!", 3) => "---\nHello world!\n---\n"
19 | #
20 | #
21 | def generate_banner(message, width=nil)
22 | dash_count = ((width.nil?) ? message.strip.length : width)
23 | return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n"
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rules_cmock.rake:
--------------------------------------------------------------------------------
1 |
2 |
3 | rule(/#{CMOCK_MOCK_PREFIX}[^\/\\]+#{'\\'+EXTENSION_SOURCE}$/ => [
4 | proc do |task_name|
5 | @ceedling[:file_finder].find_header_input_for_mock_file(task_name)
6 | end
7 | ]) do |mock|
8 | @ceedling[:generator].generate_mock(TEST_SYM, mock.source)
9 | end
10 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rules_preprocess.rake:
--------------------------------------------------------------------------------
1 |
2 |
3 | # invocations against this rule should only happen when enhanced dependencies are enabled;
4 | # otherwise, dependency tracking will be too shallow and preprocessed files could intermittently
5 | # fail to be updated when they actually need to be.
6 | rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [
7 | proc do |task_name|
8 | @ceedling[:file_finder].find_test_or_source_or_header_file(task_name)
9 | end
10 | ]) do |file|
11 | if (not @ceedling[:configurator].project_use_deep_dependencies)
12 | raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.'
13 | end
14 | @ceedling[:generator].generate_preprocessed_file(TEST_SYM, file.source)
15 | end
16 |
17 |
18 | # invocations against this rule can always happen as there are no deeper dependencies to consider
19 | rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [
20 | proc do |task_name|
21 | @ceedling[:file_finder].find_test_or_source_or_header_file(task_name)
22 | end
23 | ]) do |file|
24 | @ceedling[:generator].generate_shallow_includes_list(TEST_SYM, file.source)
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rules_release_deep_dependencies.rake:
--------------------------------------------------------------------------------
1 |
2 |
3 | rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
4 | proc do |task_name|
5 | @ceedling[:file_finder].find_compilation_input_file(task_name, :error, true)
6 | end
7 | ]) do |dep|
8 | @ceedling[:generator].generate_dependencies_file(
9 | TOOLS_RELEASE_DEPENDENCIES_GENERATOR,
10 | RELEASE_SYM,
11 | dep.source,
12 | @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source),
13 | dep.name)
14 | end
15 |
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rules_tests.rake:
--------------------------------------------------------------------------------
1 |
2 |
3 | rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [
4 | proc do |task_name|
5 | @ceedling[:file_finder].find_test_input_for_runner_file(task_name)
6 | end
7 | ]) do |runner|
8 | @ceedling[:generator].generate_test_runner(TEST_SYM, runner.source, runner.name)
9 | end
10 |
11 |
12 | rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [
13 | proc do |task_name|
14 | @ceedling[:file_finder].find_compilation_input_file(task_name)
15 | end
16 | ]) do |object|
17 | @ceedling[:generator].generate_object_file(
18 | TOOLS_TEST_COMPILER,
19 | OPERATION_COMPILE_SYM,
20 | TEST_SYM,
21 | object.source,
22 | object.name,
23 | @ceedling[:file_path_utils].form_test_build_list_filepath( object.name ) )
24 | end
25 |
26 |
27 | rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
28 |
29 | lib_args = ((defined? LIBRARIES_SYSTEM) ? LIBRARIES_SYSTEM : [])
30 | lib_args.map! {|v| LIBRARIES_FLAG.gsub(/\$\{1\}/, v) } if (defined? LIBRARIES_FLAG)
31 |
32 | @ceedling[:generator].generate_executable_file(
33 | TOOLS_TEST_LINKER,
34 | TEST_SYM,
35 | bin_file.prerequisites,
36 | bin_file.name,
37 | @ceedling[:file_path_utils].form_test_build_map_filepath( bin_file.name ),
38 | lib_args )
39 | end
40 |
41 |
42 | rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [
43 | proc do |task_name|
44 | @ceedling[:file_path_utils].form_test_executable_filepath(task_name)
45 | end
46 | ]) do |test_result|
47 | @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_SYM, test_result.source, test_result.name)
48 | end
49 |
50 |
51 | namespace TEST_SYM do
52 | # use rules to increase efficiency for large projects (instead of iterating through all sources and creating defined tasks)
53 |
54 | rule(/^#{TEST_TASK_ROOT}\S+$/ => [ # test task names by regex
55 | proc do |task_name|
56 | test = task_name.sub(/#{TEST_TASK_ROOT}/, '')
57 | test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX))
58 | @ceedling[:file_finder].find_test_from_file_path(test)
59 | end
60 | ]) do |test|
61 | @ceedling[:rake_wrapper][:directories].invoke
62 | @ceedling[:test_invoker].setup_and_invoke([test.source])
63 | end
64 | end
65 |
66 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/rules_tests_deep_dependencies.rake:
--------------------------------------------------------------------------------
1 |
2 |
3 | rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
4 | proc do |task_name|
5 | @ceedling[:file_finder].find_compilation_input_file(task_name)
6 | end
7 | ]) do |dep|
8 | @ceedling[:generator].generate_dependencies_file(
9 | TOOLS_TEST_DEPENDENCIES_GENERATOR,
10 | TEST_SYM,
11 | dep.source,
12 | @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source),
13 | dep.name)
14 | end
15 |
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/setupinator.rb:
--------------------------------------------------------------------------------
1 |
2 | class Setupinator
3 |
4 | attr_reader :config_hash
5 | attr_writer :ceedling
6 |
7 | def setup
8 | @ceedling = {}
9 | @config_hash = {}
10 | end
11 |
12 | def load_project_files
13 | @ceedling[:project_file_loader].find_project_files
14 | return @ceedling[:project_file_loader].load_project_config
15 | end
16 |
17 | def do_setup(config_hash)
18 | @config_hash = config_hash
19 |
20 | # load up all the constants and accessors our rake files, objects, & external scripts will need;
21 | # note: configurator modifies the cmock section of the hash with a couple defaults to tie
22 | # project together - the modified hash is used to build cmock object
23 | @ceedling[:configurator].populate_defaults( config_hash )
24 | @ceedling[:configurator].populate_unity_defaults( config_hash )
25 | @ceedling[:configurator].populate_cmock_defaults( config_hash )
26 | @ceedling[:configurator].find_and_merge_plugins( config_hash )
27 | @ceedling[:configurator].merge_imports( config_hash )
28 | @ceedling[:configurator].tools_setup( config_hash )
29 | @ceedling[:configurator].eval_environment_variables( config_hash )
30 | @ceedling[:configurator].eval_paths( config_hash )
31 | @ceedling[:configurator].standardize_paths( config_hash )
32 | @ceedling[:configurator].validate( config_hash )
33 | @ceedling[:configurator].build( config_hash, :environment )
34 |
35 | @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins )
36 | @ceedling[:configurator].tools_supplement_arguments( config_hash )
37 |
38 | # merge in any environment variables plugins specify, after the main build
39 | @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) do |env|
40 | @ceedling[:configurator].eval_environment_variables( env )
41 | @ceedling[:configurator].build_supplement( config_hash, env )
42 | end
43 |
44 | @ceedling[:plugin_reportinator].set_system_objects( @ceedling )
45 | @ceedling[:file_finder].prepare_search_sources
46 | @ceedling[:loginator].setup_log_filepath
47 | @ceedling[:project_config_manager].config_hash = config_hash
48 | end
49 |
50 | def reset_defaults(config_hash)
51 | @ceedling[:configurator].reset_defaults( config_hash )
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/stream_wrapper.rb:
--------------------------------------------------------------------------------
1 |
2 | class StreamWrapper
3 |
4 | def stdout_puts(string)
5 | $stdout.puts(string)
6 | end
7 |
8 | def stdout_flush
9 | $stdout.flush
10 | end
11 |
12 | def stderr_puts(string)
13 | $stderr.puts(string)
14 | end
15 |
16 | def stderr_flush
17 | $stderr.flush
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/streaminator.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 | class Streaminator
4 |
5 | constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper
6 |
7 | # for those objects for whom the configurator has already been instantiated,
8 | # Streaminator is a convenience object for handling verbosity and writing to the std streams
9 |
10 | def stdout_puts(string, verbosity=Verbosity::NORMAL)
11 | if (@verbosinator.should_output?(verbosity))
12 | @stream_wrapper.stdout_puts(string)
13 | @stream_wrapper.stdout_flush
14 | end
15 |
16 | # write to log as though Verbosity::OBNOXIOUS
17 | @loginator.log( string, @streaminator_helper.extract_name($stdout) )
18 | end
19 |
20 | def stderr_puts(string, verbosity=Verbosity::NORMAL)
21 | if (@verbosinator.should_output?(verbosity))
22 | @stream_wrapper.stderr_puts(string)
23 | @stream_wrapper.stderr_flush
24 | end
25 |
26 | # write to log as though Verbosity::OBNOXIOUS
27 | @loginator.log( string, @streaminator_helper.extract_name($stderr) )
28 | end
29 |
30 | def stream_puts(stream, string, verbosity=Verbosity::NORMAL)
31 | if (@verbosinator.should_output?(verbosity))
32 | stream.puts(string)
33 | stream.flush
34 | end
35 |
36 | # write to log as though Verbosity::OBNOXIOUS
37 | @loginator.log( string, @streaminator_helper.extract_name(stream) )
38 | end
39 |
40 | end
41 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/streaminator_helper.rb:
--------------------------------------------------------------------------------
1 |
2 | class StreaminatorHelper
3 |
4 | def extract_name(stream)
5 | name = case (stream.fileno)
6 | when 0 then '#'
7 | when 1 then '#'
8 | when 2 then '#'
9 | else stream.inspect
10 | end
11 |
12 | return name
13 | end
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/system_utils.rb:
--------------------------------------------------------------------------------
1 |
2 | class Object
3 | def deep_clone
4 | Marshal::load(Marshal.dump(self))
5 | end
6 | end
7 |
8 |
9 | ##
10 | # Class containing system utility funcions.
11 | class SystemUtils
12 |
13 | constructor :system_wrapper
14 |
15 | ##
16 | # Sets up the class.
17 | def setup
18 | @tcsh_shell = nil
19 | end
20 |
21 | ##
22 | # Checks the system shell to see if it a tcsh shell.
23 | def tcsh_shell?
24 | # once run a single time, return state determined at that execution
25 | return @tcsh_shell if not @tcsh_shell.nil?
26 |
27 | result = @system_wrapper.shell_backticks('echo $version')
28 |
29 | if ((result[:exit_code] == 0) and (result[:output].strip =~ /^tcsh/))
30 | @tcsh_shell = true
31 | else
32 | @tcsh_shell = false
33 | end
34 |
35 | return @tcsh_shell
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/system_wrapper.rb:
--------------------------------------------------------------------------------
1 | require 'rbconfig'
2 |
3 | class SystemWrapper
4 |
5 | # static method for use in defaults
6 | def self.windows?
7 | return ((RbConfig::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) if defined?(RbConfig)
8 | return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false)
9 | end
10 |
11 | # class method so as to be mockable for tests
12 | def windows?
13 | return SystemWrapper.windows?
14 | end
15 |
16 | def module_eval(string)
17 | return Object.module_eval("\"" + string + "\"")
18 | end
19 |
20 | def eval(string)
21 | return eval(string)
22 | end
23 |
24 | def search_paths
25 | return ENV['PATH'].split(File::PATH_SEPARATOR)
26 | end
27 |
28 | def cmdline_args
29 | return ARGV
30 | end
31 |
32 | def env_set(name, value)
33 | ENV[name] = value
34 | end
35 |
36 | def env_get(name)
37 | return ENV[name]
38 | end
39 |
40 | def time_now
41 | return Time.now.asctime
42 | end
43 |
44 | def shell_backticks(command, boom = true)
45 | retval = `#{command}`.freeze
46 | $exit_code = ($?.exitstatus).freeze if boom
47 | return {
48 | :output => retval.freeze,
49 | :exit_code => ($?.exitstatus).freeze
50 | }
51 | end
52 |
53 | def shell_system(command, boom = true)
54 | system( command )
55 | $exit_code = ($?.exitstatus).freeze if boom
56 | return {
57 | :output => "".freeze,
58 | :exit_code => ($?.exitstatus).freeze
59 | }
60 | end
61 |
62 | def add_load_path(path)
63 | $LOAD_PATH.unshift(path)
64 | end
65 |
66 | def require_file(path)
67 | require(path)
68 | end
69 |
70 | def ruby_success
71 | # We are successful if we've never had an exit code that went boom (either because it's empty or it was 0)
72 | return ($exit_code.nil? || ($exit_code == 0)) && ($!.nil? || $!.is_a?(SystemExit) && $!.success?)
73 | end
74 |
75 | def constants_include?(item)
76 | # forcing to strings provides consistency across Ruby versions
77 | return Object.constants.map{|constant| constant.to_s}.include?(item.to_s)
78 | end
79 |
80 | end
81 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/target_loader.rb:
--------------------------------------------------------------------------------
1 | module TargetLoader
2 | class NoTargets < Exception; end
3 | class NoDirectory < Exception; end
4 | class NoDefault < Exception; end
5 | class NoSuchTarget < Exception; end
6 |
7 | class RequestReload < Exception; end
8 |
9 | def self.inspect(config, target_name=nil)
10 | unless config[:targets]
11 | raise NoTargets
12 | end
13 |
14 | targets = config[:targets]
15 | unless targets[:targets_directory]
16 | raise NoDirectory.new("No targets directory specified.")
17 | end
18 | unless targets[:default_target]
19 | raise NoDefault.new("No default target specified.")
20 | end
21 |
22 | target_path = lambda {|name| File.join(targets[:targets_directory], name + ".yml")}
23 |
24 | target = if target_name
25 | target_path.call(target_name)
26 | else
27 | target_path.call(targets[:default_target])
28 | end
29 |
30 | unless File.exists? target
31 | raise NoSuchTarget.new("No such target: #{target}")
32 | end
33 |
34 | ENV['CEEDLING_MAIN_PROJECT_FILE'] = target
35 |
36 | raise RequestReload
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/task_invoker.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/par_map'
2 |
3 | class TaskInvoker
4 |
5 | constructor :dependinator, :rake_utils, :rake_wrapper
6 |
7 | def setup
8 | @test_regexs = [/^#{TEST_ROOT_NAME}:/]
9 | @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/]
10 | end
11 |
12 | def add_test_task_regex(regex)
13 | @test_regexs << regex
14 | end
15 |
16 | def add_release_task_regex(regex)
17 | @release_regexs << regex
18 | end
19 |
20 | def test_invoked?
21 | invoked = false
22 |
23 | @test_regexs.each do |regex|
24 | invoked = true if (@rake_utils.task_invoked?(regex))
25 | break if invoked
26 | end
27 |
28 | return invoked
29 | end
30 |
31 | def release_invoked?
32 | invoked = false
33 |
34 | @release_regexs.each do |regex|
35 | invoked = true if (@rake_utils.task_invoked?(regex))
36 | break if invoked
37 | end
38 |
39 | return invoked
40 | end
41 |
42 | def invoked?(regex)
43 | return @rake_utils.task_invoked?(regex)
44 | end
45 |
46 |
47 | def invoke_test_mocks(mocks)
48 | @dependinator.enhance_mock_dependencies( mocks )
49 | mocks.each { |mock| @rake_wrapper[mock].invoke }
50 | end
51 |
52 | def invoke_test_runner(runner)
53 | @dependinator.enhance_runner_dependencies( runner )
54 | @rake_wrapper[runner].invoke
55 | end
56 |
57 | def invoke_test_shallow_include_lists(files)
58 | @dependinator.enhance_shallow_include_lists_dependencies( files )
59 | files.each { |file| @rake_wrapper[file].invoke }
60 | end
61 |
62 | def invoke_test_preprocessed_files(files)
63 | @dependinator.enhance_preprocesed_file_dependencies( files )
64 | files.each { |file| @rake_wrapper[file].invoke }
65 | end
66 |
67 | def invoke_test_dependencies_files(files)
68 | @dependinator.enhance_dependencies_dependencies( files )
69 | files.each { |file| @rake_wrapper[file].invoke }
70 | end
71 |
72 | def invoke_test_results(result)
73 | @dependinator.enhance_results_dependencies( result )
74 | @rake_wrapper[result].invoke
75 | end
76 |
77 | def invoke_release_dependencies_files(files)
78 | par_map(PROJECT_COMPILE_THREADS, files) do |file|
79 | @rake_wrapper[file].invoke
80 | end
81 | end
82 |
83 | def invoke_release_objects(objects)
84 | par_map(PROJECT_COMPILE_THREADS, objects) do |object|
85 | @rake_wrapper[object].invoke
86 | end
87 | end
88 |
89 | end
90 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/tasks_release.rake:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 | require 'ceedling/file_path_utils'
3 |
4 |
5 | desc "Build release target."
6 | task RELEASE_SYM => [:directories] do
7 | header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'"
8 | @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}")
9 |
10 | begin
11 | @ceedling[:plugin_manager].pre_release
12 |
13 | core_objects = []
14 | extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS )
15 |
16 | @ceedling[:project_config_manager].process_release_config_change
17 | core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) )
18 |
19 | # if assembler use isn't enabled, COLLECTION_ALL_ASSEMBLY is empty array & nothing happens
20 | core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) )
21 |
22 | # if we're using libraries, we need to add those to our collection as well
23 | library_objects = (defined? LIBRARIES_RELEASE && !LIBRARIES_RELEASE.empty?) ? LIBRARIES_RELEASE.flatten.compact : []
24 | file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects + library_objects) )
25 | Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke
26 | ensure
27 | @ceedling[:plugin_manager].post_release
28 | end
29 | end
30 |
31 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/tasks_release_deep_dependencies.rake:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 | namespace REFRESH_SYM do
4 |
5 | task RELEASE_SYM do
6 | @ceedling[:release_invoker].refresh_c_deep_dependencies
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/tasks_tests.rake:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 | task :test => [:directories] do
4 | @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
5 | end
6 |
7 | namespace TEST_SYM do
8 |
9 | desc "Run all unit tests (also just 'test' works)."
10 | task :all => [:directories] do
11 | @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
12 | end
13 |
14 | desc "Run single test ([*] real test or source file name, no path)."
15 | task :* do
16 | message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " +
17 | "Use a real test or source file name (no path) in place of the wildcard.\n" +
18 | "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n"
19 |
20 | @ceedling[:streaminator].stdout_puts( message )
21 | end
22 |
23 | desc "Run tests for changed files."
24 | task :delta => [:directories] do
25 | @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:force_run => false})
26 | end
27 |
28 | desc "Run tests by matching regular expression pattern."
29 | task :pattern, [:regex] => [:directories] do |t, args|
30 | matches = []
31 |
32 | COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) }
33 |
34 | if (matches.size > 0)
35 | @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false})
36 | else
37 | @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.")
38 | end
39 | end
40 |
41 | desc "Run tests whose test path contains [dir] or [dir] substring."
42 | task :path, [:dir] => [:directories] do |t, args|
43 | matches = []
44 |
45 | COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) }
46 |
47 | if (matches.size > 0)
48 | @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false})
49 | else
50 | @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.")
51 | end
52 | end
53 |
54 | end
55 |
56 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/tasks_tests_deep_dependencies.rake:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 |
3 | namespace REFRESH_SYM do
4 |
5 | task TEST_SYM do
6 | @ceedling[:test_invoker].refresh_deep_dependencies
7 | end
8 |
9 | end
10 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/tasks_vendor.rake:
--------------------------------------------------------------------------------
1 | require 'ceedling/constants'
2 | require 'ceedling/file_path_utils'
3 |
4 | # create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions
5 | # forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered
6 |
7 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [
8 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_C_FILE ),
9 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_H_FILE ),
10 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ]
11 | )
12 |
13 |
14 | if (PROJECT_USE_MOCKS)
15 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [
16 | File.join( CMOCK_VENDOR_PATH, CMOCK_LIB_PATH, CMOCK_C_FILE ),
17 | File.join( CMOCK_VENDOR_PATH, CMOCK_LIB_PATH, CMOCK_H_FILE ) ]
18 | )
19 | end
20 |
21 |
22 | if (PROJECT_USE_EXCEPTIONS)
23 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [
24 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ),
25 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ]
26 | )
27 | end
28 |
29 |
30 | if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD)
31 | file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [
32 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ),
33 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ]
34 | )
35 | end
36 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/test_includes_extractor.rb:
--------------------------------------------------------------------------------
1 |
2 | class TestIncludesExtractor
3 |
4 | constructor :configurator, :yaml_wrapper, :file_wrapper
5 |
6 | def setup
7 | @includes = {}
8 | @mocks = {}
9 | end
10 |
11 |
12 | # for includes_list file, slurp up array from yaml file and sort & store includes
13 | def parse_includes_list(includes_list)
14 | gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) )
15 | end
16 |
17 | # open, scan for, and sort & store includes of test file
18 | def parse_test_file(test)
19 | gather_and_store_includes( test, extract_from_file(test) )
20 | end
21 |
22 | # mocks with no file extension
23 | def lookup_raw_mock_list(test)
24 | file_key = form_file_key(test)
25 | return [] if @mocks[file_key].nil?
26 | return @mocks[file_key]
27 | end
28 |
29 | # includes with file extension
30 | def lookup_includes_list(file)
31 | file_key = form_file_key(file)
32 | return [] if (@includes[file_key]).nil?
33 | return @includes[file_key]
34 | end
35 |
36 | private #################################
37 |
38 | def form_file_key(filepath)
39 | return File.basename(filepath).to_sym
40 | end
41 |
42 | def extract_from_file(file)
43 | includes = []
44 | header_extension = @configurator.extension_header
45 |
46 | contents = @file_wrapper.read(file)
47 |
48 | # remove line comments
49 | contents = contents.gsub(/\/\/.*$/, '')
50 | # remove block comments
51 | contents = contents.gsub(/\/\*.*?\*\//m, '')
52 |
53 | contents.split("\n").each do |line|
54 | # look for include statement
55 | scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/)
56 |
57 | includes << scan_results[0][0] if (scan_results.size > 0)
58 |
59 | # look for TEST_FILE statement
60 | scan_results = line.scan(/TEST_FILE\(\s*\"\s*(.+\.\w+)\s*\"\s*\)/)
61 |
62 | includes << scan_results[0][0] if (scan_results.size > 0)
63 | end
64 |
65 | return includes.uniq
66 | end
67 |
68 | def gather_and_store_includes(file, includes)
69 | mock_prefix = @configurator.cmock_mock_prefix
70 | header_extension = @configurator.extension_header
71 | file_key = form_file_key(file)
72 | @mocks[file_key] = []
73 |
74 | # add includes to lookup hash
75 | @includes[file_key] = includes
76 |
77 | includes.each do |include_file|
78 | # check if include is a mock
79 | scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/)
80 | # add mock to lookup hash
81 | @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0)
82 | end
83 | end
84 |
85 | end
86 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/test_invoker_helper.rb:
--------------------------------------------------------------------------------
1 |
2 | class TestInvokerHelper
3 |
4 | constructor :configurator, :task_invoker, :test_includes_extractor, :file_finder, :file_path_utils, :file_wrapper
5 |
6 | def clean_results(results, options)
7 | @file_wrapper.rm_f( results[:fail] )
8 | @file_wrapper.rm_f( results[:pass] ) if (options[:force_run])
9 | end
10 |
11 | def process_deep_dependencies(files)
12 | return if (not @configurator.project_use_deep_dependencies)
13 |
14 | dependencies_list = @file_path_utils.form_test_dependencies_filelist( files )
15 | @task_invoker.invoke_test_dependencies_files( dependencies_list )
16 | yield( dependencies_list ) if block_given?
17 | end
18 |
19 | def extract_sources(test)
20 | sources = []
21 | includes = @test_includes_extractor.lookup_includes_list(test)
22 |
23 | includes.each { |include| sources << @file_finder.find_compilation_input_file(include, :ignore) }
24 |
25 | return sources.compact
26 | end
27 |
28 | end
29 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/verbosinator.rb:
--------------------------------------------------------------------------------
1 |
2 | class Verbosinator
3 |
4 | constructor :configurator
5 |
6 | def should_output?(level)
7 | return (level <= @configurator.project_verbosity)
8 | end
9 |
10 | end
11 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/version.rb:
--------------------------------------------------------------------------------
1 | # @private
2 | module Ceedling
3 | module Version
4 | # @private
5 | GEM = "0.28.2"
6 | # @private
7 | CEEDLING = GEM
8 | # @private
9 | CEXCEPTION = "1.3.1"
10 | # @private
11 | CMOCK = "2.4.5"
12 | # @private
13 | UNITY = "2.4.2"
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/version.rb.erb:
--------------------------------------------------------------------------------
1 | # @private
2 | module Ceedling
3 | module Version
4 | # @private
5 | GEM = "0.27.0"
6 | # @private
7 | CEEDLING = "<%= versions["CEEDLING"] %>"
8 | # @private
9 | CEXCEPTION = "<%= versions["CEXCEPTION"] %>"
10 | # @private
11 | CMOCK = "<%= versions["CMOCK"] %>"
12 | # @private
13 | UNITY = "<%= versions["UNITY"] %>"
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/lib/ceedling/yaml_wrapper.rb:
--------------------------------------------------------------------------------
1 | require 'yaml'
2 | require 'erb'
3 |
4 |
5 | class YamlWrapper
6 |
7 | def load(filepath)
8 | return YAML.load(ERB.new(File.read(filepath)).result)
9 | end
10 |
11 | def dump(filepath, structure)
12 | File.open(filepath, 'w') do |output|
13 | YAML.dump(structure, output)
14 | end
15 | end
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/bullseye/assets/template.erb:
--------------------------------------------------------------------------------
1 | % function_string = hash[:coverage][:functions].to_s
2 | % branch_string = hash[:coverage][:branches].to_s
3 | % format_string = "%#{[function_string.length, branch_string.length].max}i"
4 | <%=@ceedling[:plugin_reportinator].generate_banner("#{hash[:header]}: CODE COVERAGE SUMMARY")%>
5 | % if (!hash[:coverage][:functions].nil?)
6 | FUNCTIONS: <%=sprintf(format_string, hash[:coverage][:functions])%>%
7 | % else
8 | FUNCTIONS: none
9 | % end
10 | % if (!hash[:coverage][:branches].nil?)
11 | BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>%
12 | % else
13 | BRANCHES: none
14 | % end
15 |
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/bullseye/config/defaults.yml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | :paths:
4 | :bullseye_toolchain_include: []
5 |
6 | :tools:
7 | :bullseye_instrumentation:
8 | :executable: covc
9 | :arguments:
10 | - '--file $': ENVIRONMENT_COVFILE
11 | - -q
12 | - ${1}
13 | :bullseye_compiler:
14 | :executable: gcc
15 | :arguments:
16 | - -g
17 | - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR
18 | - -I"$": COLLECTION_PATHS_BULLSEYE_TOOLCHAIN_INCLUDE
19 | - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR
20 | - -DBULLSEYE_COMPILER
21 | - -c "${1}"
22 | - -o "${2}"
23 | :bullseye_linker:
24 | :executable: gcc
25 | :arguments:
26 | - ${1}
27 | - -o ${2}
28 | - -L$: PLUGINS_BULLSEYE_LIB_PATH
29 | - -lcov
30 | :bullseye_fixture:
31 | :executable: ${1}
32 | :bullseye_report_covsrc:
33 | :executable: covsrc
34 | :arguments:
35 | - '--file $': ENVIRONMENT_COVFILE
36 | - -q
37 | - -w140
38 | :bullseye_report_covfn:
39 | :executable: covfn
40 | :stderr_redirect: :auto
41 | :arguments:
42 | - '--file $': ENVIRONMENT_COVFILE
43 | - --width 120
44 | - --no-source
45 | - '"${1}"'
46 | :bullseye_browser:
47 | :executable: CoverageBrowser
48 | :background_exec: :auto
49 | :optional: TRUE
50 | :arguments:
51 | - '"$"': ENVIRONMENT_COVFILE
52 |
53 | ...
54 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/bullseye/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yongxianan/TemperatureControllerMCU/6460de7b13ffb9b3e35abe52c4bea465b93a95bd/vendor/ceedling/plugins/bullseye/readme.txt
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/command_hooks/README.md:
--------------------------------------------------------------------------------
1 | ceedling-command-hooks
2 | ======================
3 |
4 | Plugin for easily calling command line tools at various points in the build process
5 |
6 | Define any of these sections in :tools: to provide additional hooks to be called on demand:
7 |
8 | ```
9 | :pre_mock_generate
10 | :post_mock_generate
11 | :pre_runner_generate
12 | :post_runner_generate
13 | :pre_compile_execute
14 | :post_compile_execute
15 | :pre_link_execute
16 | :post_link_execute
17 | :pre_test_fixture_execute
18 | :pre_test_fixture_execute
19 | :pre_test
20 | :post_test
21 | :pre_release
22 | :post_release
23 | :pre_build
24 | :post_build
25 | ```
26 |
27 | Each of these tools can support an :executable string and an :args list, like so:
28 |
29 | ```
30 | :tools:
31 | :post_link_execute:
32 | :executable: objcopy.exe
33 | :args:
34 | - ${1} #This is replaced with the executable name
35 | - output.srec
36 | - --strip-all
37 | ```
38 |
39 | You may also specify an array of executables to be called in a particular place, like so:
40 |
41 | ```
42 | :tools:
43 | :post_test:
44 | - :executable: echo
45 | :args: "${1} was glorious!"
46 | - :executable: echo
47 | :args:
48 | - it kinda made me cry a little.
49 | - you?
50 | ```
51 |
52 | Happy Tweaking!
53 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rake'
2 | require 'rspec/core/rake_task'
3 |
4 | desc "Run all rspecs"
5 | RSpec::Core::RakeTask.new(:spec) do |t|
6 | t.pattern = Dir.glob('spec/**/*_spec.rb')
7 | t.rspec_opts = '--format documentation'
8 | # t.rspec_opts << ' more options'
9 | end
10 |
11 | desc "Run integration test on example"
12 | task :integration_test do
13 | chdir("./examples/fff_example") do
14 | sh "rake clobber"
15 | sh "rake test:all"
16 | end
17 | end
18 |
19 | task :default => [:spec, :integration_test]
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/project.yml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | # Notes:
4 | # Sample project C code is not presently written to produce a release artifact.
5 | # As such, release build options are disabled.
6 | # This sample, therefore, only demonstrates running a collection of unit tests.
7 |
8 | :project:
9 | :use_exceptions: FALSE
10 | :use_test_preprocessor: TRUE
11 | :use_auxiliary_dependencies: TRUE
12 | :build_root: build
13 | # :release_build: TRUE
14 | :test_file_prefix: test_
15 |
16 | #:release_build:
17 | # :output: MyApp.out
18 | # :use_assembly: FALSE
19 |
20 | :environment:
21 |
22 | :extension:
23 | :executable: .out
24 |
25 | :paths:
26 | :test:
27 | - +:test/**
28 | :source:
29 | - src/**
30 | :support:
31 |
32 | :defines:
33 | # in order to add common defines:
34 | # 1) remove the trailing [] from the :common: section
35 | # 2) add entries to the :common: section (e.g. :test: has TEST defined)
36 | :commmon: &common_defines []
37 | :test:
38 | - *common_defines
39 | - TEST
40 | :test_preprocess:
41 | - *common_defines
42 | - TEST
43 |
44 | :cmock:
45 | :mock_prefix: mock_
46 | :when_no_prototypes: :warn
47 | :enforce_strict_ordering: TRUE
48 | :plugins:
49 | - :ignore
50 | - :callback
51 | :treat_as:
52 | uint8: HEX8
53 | uint16: HEX16
54 | uint32: UINT32
55 | int8: INT8
56 | bool: UINT8
57 |
58 | #:tools:
59 | # Ceedling defaults to using gcc for compiling, linking, etc.
60 | # As [:tools] is blank, gcc will be used (so long as it's in your system path)
61 | # See documentation to configure a given toolchain for use
62 |
63 | :plugins:
64 | :load_paths:
65 | # This change from the default is for running Ceedling out of another folder.
66 | - ../../../../plugins
67 | :enabled:
68 | - stdout_pretty_tests_report
69 | - module_generator
70 | - fake_function_framework
71 | ...
72 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/rakefile.rb:
--------------------------------------------------------------------------------
1 | # This change from the default is for running Ceedling out of another folder.
2 | PROJECT_CEEDLING_ROOT = "../../../.."
3 | load "#{PROJECT_CEEDLING_ROOT}/lib/ceedling.rb"
4 |
5 | Ceedling.load_project
6 |
7 | task :default => %w[ test:all release ]
8 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c:
--------------------------------------------------------------------------------
1 | #include "bar.h"
2 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h:
--------------------------------------------------------------------------------
1 | #ifndef bar_H
2 | #define bar_H
3 |
4 | #include "custom_types.h"
5 |
6 | void bar_turn_on(void);
7 | void bar_print_message(const char * message);
8 | void bar_print_message_formatted(const char * format, ...);
9 | void bar_numbers(int one, int two, char three);
10 | void bar_const_test(const char * a, char * const b, const int c);
11 | custom_t bar_needs_custom_type(void);
12 | const char * bar_return_const_ptr(int one);
13 |
14 | #endif // bar_H
15 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h:
--------------------------------------------------------------------------------
1 | #ifndef custom_types_H
2 | #define custom_types_H
3 |
4 | typedef int custom_t;
5 |
6 | #endif
7 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include "display.h"
3 |
4 | void display_turnOffStatusLed(void)
5 | {
6 | printf("Display: Status LED off");
7 | }
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void display_turnOffStatusLed(void);
4 | void display_turnOnStatusLed(void);
5 | void display_setVolume(int level);
6 | void display_setModeToMinimum(void);
7 | void display_setModeToMaximum(void);
8 | void display_setModeToAverage(void);
9 | bool display_isError(void);
10 | void display_powerDown(void);
11 | void display_updateData(int data, void(*updateCompleteCallback)(void));
12 |
13 | /*
14 | The entry is returned (up to `length` bytes) in the provided `entry` buffer.
15 | */
16 | void display_getKeyboardEntry(char * entry, int length);
17 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c:
--------------------------------------------------------------------------------
1 | /*
2 | This module implements some business logic to test.
3 |
4 | Signal events by calling the functions on the module.
5 | */
6 |
7 | #include
8 | #include
9 | #include "event_processor.h"
10 | #include "display.h"
11 |
12 | void event_deviceReset(void)
13 | {
14 | //printf ("Device reset\n");
15 | display_turnOffStatusLed();
16 | }
17 |
18 | void event_volumeKnobMaxed(void)
19 | {
20 | display_setVolume(11);
21 | }
22 |
23 | void event_powerReadingUpdate(int powerReading)
24 | {
25 | if (powerReading >= 5)
26 | {
27 | display_turnOnStatusLed();
28 | }
29 | }
30 |
31 | void event_modeSelectButtonPressed(void)
32 | {
33 | static int mode = 0;
34 |
35 | if (mode == 0)
36 | {
37 | display_setModeToMinimum();
38 | mode++;
39 | }
40 | else if (mode == 1)
41 | {
42 | display_setModeToMaximum();
43 | mode++;
44 | }
45 | else if (mode == 2)
46 | {
47 | display_setModeToAverage();
48 | mode++;
49 | }
50 | else
51 | {
52 | mode = 0;
53 | }
54 | }
55 |
56 | void event_devicePoweredOn(void)
57 | {
58 | if (display_isError())
59 | {
60 | display_powerDown();
61 | }
62 | }
63 |
64 | void event_keyboardCheckTimerExpired(void)
65 | {
66 | char userEntry[100];
67 |
68 | display_getKeyboardEntry(userEntry, 100);
69 |
70 | if (strcmp(userEntry, "sleep") == 0)
71 | {
72 | display_powerDown();
73 | }
74 | }
75 |
76 | static bool event_lastComplete = false;
77 |
78 | /* Function called when the display update is complete. */
79 | static void displayUpdateComplete(void)
80 | {
81 | event_lastComplete = true;
82 | }
83 |
84 | void event_newDataAvailable(int data)
85 | {
86 | event_lastComplete = false;
87 | display_updateData(data, displayUpdateComplete);
88 | }
89 |
90 | bool eventProcessor_isLastEventComplete(void)
91 | {
92 | return event_lastComplete;
93 | }
94 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void event_deviceReset(void);
4 | void event_volumeKnobMaxed(void);
5 | void event_powerReadingUpdate(int powerReading);
6 | void event_modeSelectButtonPressed(void);
7 | void event_devicePoweredOn(void);
8 | void event_keyboardCheckTimerExpired(void);
9 | void event_newDataAvailable(int data);
10 |
11 | bool eventProcessor_isLastEventComplete(void);
12 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c:
--------------------------------------------------------------------------------
1 | #include "foo.h"
2 | #include "bar.h"
3 | #include "subfolder/zzz.h"
4 |
5 | void foo_turn_on(void) {
6 | bar_turn_on();
7 | zzz_sleep(1, "sleepy");
8 | }
9 |
10 | void foo_print_message(const char * message) {
11 | bar_print_message(message);
12 | }
13 |
14 | void foo_print_special_message(void) {
15 | bar_print_message_formatted("The numbers are %d, %d and %d", 1, 2, 3);
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h:
--------------------------------------------------------------------------------
1 | #ifndef foo_H
2 | #define foo_H
3 |
4 | void foo_turn_on(void);
5 | void foo_print_message(const char * message);
6 | void foo_print_special_message(void);
7 |
8 | #endif // foo_H
9 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c:
--------------------------------------------------------------------------------
1 | #include "zzz.h"
2 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h:
--------------------------------------------------------------------------------
1 | #ifndef zzz_H
2 | #define zzz_H
3 |
4 | int zzz_sleep(int time, char * name);
5 |
6 | #endif // zzz_H
7 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_foo.c:
--------------------------------------------------------------------------------
1 | #include "unity.h"
2 | #include "foo.h"
3 | #include "mock_bar.h"
4 | #include "mock_zzz.h"
5 |
6 | void setUp(void)
7 | {
8 | }
9 |
10 | void tearDown(void)
11 | {
12 | }
13 |
14 | void test_foo(void)
15 | {
16 | //When
17 | foo_turn_on();
18 |
19 | //Then
20 | TEST_ASSERT_EQUAL(1, bar_turn_on_fake.call_count);
21 | TEST_ASSERT_EQUAL(1, zzz_sleep_fake.call_count);
22 | TEST_ASSERT_EQUAL_STRING("sleepy", zzz_sleep_fake.arg1_val);
23 | }
24 |
25 | void test_foo_again(void)
26 | {
27 | //When
28 | foo_turn_on();
29 |
30 | //Then
31 | TEST_ASSERT_EQUAL(1, bar_turn_on_fake.call_count);
32 | }
33 |
34 | void test_foo_mock_with_const(void)
35 | {
36 | foo_print_message("123");
37 |
38 | TEST_ASSERT_EQUAL(1, bar_print_message_fake.call_count);
39 | TEST_ASSERT_EQUAL_STRING("123", bar_print_message_fake.arg0_val);
40 | }
41 |
42 | void test_foo_mock_with_variable_args(void)
43 | {
44 | foo_print_special_message();
45 | TEST_ASSERT_EQUAL(1, bar_print_message_formatted_fake.call_count);
46 | TEST_ASSERT_EQUAL_STRING("The numbers are %d, %d and %d", bar_print_message_formatted_fake.arg0_val);
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/spec/header_generator.rb:
--------------------------------------------------------------------------------
1 | # Create a CMock-style parsed header hash. This the type of hash created by
2 | # CMock when parsing header files for automock generation. It contains all of
3 | # includes, typedefs and functions (with return types and arguments) parsed from
4 | # the header file.
5 | def create_cmock_style_parsed_header(functions, typedefs = nil)
6 | parsed_header = {
7 | :includes => nil,
8 | :functions => [],
9 | :typedefs => []
10 | }
11 |
12 | # Add the typedefs.
13 | if typedefs
14 | typedefs.each do |typedef|
15 | parsed_header[:typedefs] << typedef
16 | end
17 | end
18 |
19 | # Add the functions.
20 | if functions
21 | functions.each do |function|
22 | # Build the array of arguments.
23 | args = []
24 | if function.key?(:args)
25 | function[:args].each do |arg|
26 | args << {
27 | :type => arg
28 | }
29 | end
30 | end
31 | parsed_header[:functions] << {
32 | :name => function[:name],
33 | :modifier => "",
34 | :return => {
35 | :type => function[:return_type],
36 | :name => "cmock_to_return",
37 | :ptr? => false,
38 | :const? => false,
39 | :str => "void cmock_to_return",
40 | :void? => true
41 | },
42 | :var_arg => nil,
43 | :args_string => "void",
44 | :args => args,
45 | :args_call => "",
46 | :contains_ptr? => false
47 | }
48 | end
49 | end
50 | parsed_header
51 | end
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/fake_function_framework/src/fff_unity_helper.h:
--------------------------------------------------------------------------------
1 | #ifndef fff_unity_helper_H
2 | #define fff_unity_helper_H
3 |
4 | /*
5 | FFF helper macros for Unity.
6 | */
7 |
8 | /*
9 | Fail if the function was not called the expected number of times.
10 | */
11 | #define TEST_ASSERT_CALLED_TIMES(times_, function_) \
12 | TEST_ASSERT_EQUAL_MESSAGE(times_, \
13 | function_ ## _fake.call_count, \
14 | "Function " #function_ " called the incorrect number of times.")
15 | /*
16 | Fail if the function was not called exactly once.
17 | */
18 | #define TEST_ASSERT_CALLED(function_) TEST_ASSERT_CALLED_TIMES(1, function_)
19 |
20 | /*
21 | Fail if the function was called 1 or more times.
22 | */
23 | #define TEST_ASSERT_NOT_CALLED(function_) TEST_ASSERT_CALLED_TIMES(0, function_)
24 |
25 | /*
26 | Fail if the function was not called in this particular order.
27 | */
28 | #define TEST_ASSERT_CALLED_IN_ORDER(order_, function_) \
29 | TEST_ASSERT_EQUAL_PTR_MESSAGE((void *) function_, \
30 | fff.call_history[order_], \
31 | "Function " #function_ " not called in order " #order_ )
32 |
33 | #endif
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/gcov/README.md:
--------------------------------------------------------------------------------
1 | ceedling-gcov
2 | =============
3 |
4 | Plugin for integrating GNU GCov code coverage tool into Ceedling projects
5 |
6 | # To-Do list
7 |
8 | - Generate overall report (combined statistics from all files with coverage)
9 | - Generate coverage output files
10 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/gcov/assets/template.erb:
--------------------------------------------------------------------------------
1 | % function_string = hash[:coverage][:functions].to_s
2 | % branch_string = hash[:coverage][:branches].to_s
3 | % format_string = "%#{[function_string.length, branch_string.length].max}i"
4 | <%=@ceedling[:plugin_reportinator].generate_banner("#{GCOV_ROOT_NAME.upcase}: CODE COVERAGE SUMMARY")%>
5 | % if (!hash[:coverage][:functions].nil?)
6 | FUNCTIONS: <%=sprintf(format_string, hash[:coverage][:functions])%>%
7 | % else
8 | FUNCTIONS: none
9 | % end
10 | % if (!hash[:coverage][:branches].nil?)
11 | BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>%
12 | % else
13 | BRANCHES: none
14 | % end
15 |
16 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/gcov/config/defaults.yml:
--------------------------------------------------------------------------------
1 | ---
2 |
3 | :tools:
4 | :gcov_compiler:
5 | :executable: gcc
6 | :arguments:
7 | - -g
8 | - -fprofile-arcs
9 | - -ftest-coverage
10 | - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR
11 | - -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE
12 | - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR
13 | - -DGCOV_COMPILER
14 | - -c "${1}"
15 | - -o "${2}"
16 | :gcov_linker:
17 | :executable: gcc
18 | :arguments:
19 | - -fprofile-arcs
20 | - -ftest-coverage
21 | - ${1}
22 | - -o ${2}
23 | :gcov_fixture:
24 | :executable: ${1}
25 | :gcov_report:
26 | :executable: gcov
27 | :arguments:
28 | - -n
29 | - -p
30 | - -b
31 | - -o "$": GCOV_BUILD_OUTPUT_PATH
32 | - "\"${1}\""
33 | :gcov_post_report:
34 | :executable: gcovr
35 | :optional: TRUE
36 | :arguments:
37 | - -p
38 | - -b
39 | - -e "'^vendor.*|^build.*|^test.*|^lib.*'"
40 | - --html
41 | - -r .
42 | - -o GcovCoverageResults.html
43 | :gcov_post_report_basic:
44 | :executable: gcovr
45 | :optional: TRUE
46 | :arguments:
47 | - -p
48 | - -b
49 | - -e "'^vendor.*|^build.*|^test.*|^lib.*'"
50 | - --html
51 | - -r .
52 | - -o "$": GCOV_ARTIFACTS_FILE
53 | :gcov_post_report_advanced:
54 | :executable: gcovr
55 | :optional: TRUE
56 | :arguments:
57 | - -p
58 | - -b
59 | - -e "'^vendor.*|^build.*|^test.*|^lib.*'"
60 | - --html
61 | - --html-details
62 | - -r .
63 | - -o "$": GCOV_ARTIFACTS_FILE
64 |
65 |
66 | ...
67 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/gcov/lib/gcov_constants.rb:
--------------------------------------------------------------------------------
1 |
2 | GCOV_ROOT_NAME = 'gcov'.freeze
3 | GCOV_TASK_ROOT = GCOV_ROOT_NAME + ':'
4 | GCOV_SYM = GCOV_ROOT_NAME.to_sym
5 |
6 | GCOV_BUILD_PATH = File.join(PROJECT_BUILD_ROOT, GCOV_ROOT_NAME)
7 | GCOV_BUILD_OUTPUT_PATH = File.join(GCOV_BUILD_PATH, "out")
8 | GCOV_RESULTS_PATH = File.join(GCOV_BUILD_PATH, "results")
9 | GCOV_DEPENDENCIES_PATH = File.join(GCOV_BUILD_PATH, "dependencies")
10 | GCOV_ARTIFACTS_PATH = File.join(PROJECT_BUILD_ARTIFACTS_ROOT, GCOV_ROOT_NAME)
11 |
12 | GCOV_ARTIFACTS_FILE = File.join(GCOV_ARTIFACTS_PATH, "GcovCoverageResults.html")
13 |
14 | GCOV_IGNORE_SOURCES = %w(unity cmock cexception).freeze
15 |
16 |
17 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/module_generator/config/module_generator.yml:
--------------------------------------------------------------------------------
1 | :module_generator:
2 | :project_root: ./
3 | :source_root: src/
4 | :test_root: test/
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/module_generator/lib/module_generator.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/constants'
3 | require 'erb'
4 | require 'fileutils'
5 |
6 | class ModuleGenerator < Plugin
7 |
8 | attr_reader :config
9 |
10 | def create(module_name, optz={})
11 |
12 | require "generate_module.rb" #From Unity Scripts
13 |
14 | if ((!optz.nil?) && (optz[:destroy]))
15 | UnityModuleGenerator.new( divine_options(optz) ).destroy(module_name)
16 | else
17 | UnityModuleGenerator.new( divine_options(optz) ).generate(module_name)
18 | end
19 | end
20 |
21 | private
22 |
23 | def divine_options(optz={})
24 | {
25 | :path_src => ((defined? MODULE_GENERATOR_SOURCE_ROOT ) ? MODULE_GENERATOR_SOURCE_ROOT.gsub('\\', '/').sub(/^\//, '').sub(/\/$/, '') : "src" ),
26 | :path_inc => ((defined? MODULE_GENERATOR_SOURCE_ROOT ) ? MODULE_GENERATOR_SOURCE_ROOT.gsub('\\', '/').sub(/^\//, '').sub(/\/$/, '') : "src" ),
27 | :path_tst => ((defined? MODULE_GENERATOR_TEST_ROOT ) ? MODULE_GENERATOR_TEST_ROOT.gsub( '\\', '/').sub(/^\//, '').sub(/\/$/, '') : "test" ),
28 | :pattern => optz[:pattern],
29 | :test_prefix => ((defined? PROJECT_TEST_FILE_PREFIX ) ? PROJECT_TEST_FILE_PREFIX : "Test" ),
30 | :mock_prefix => ((defined? CMOCK_MOCK_PREFIX ) ? CMOCK_MOCK_PREFIX : "Mock" ),
31 | :includes => ((defined? MODULE_GENERATOR_INCLUDES ) ? MODULE_GENERATOR_INCLUDES : {} ),
32 | :boilerplates => ((defined? MODULE_GENERATOR_BOILERPLATES) ? MODULE_GENERATOR_BOILERPLATES : {} ),
33 | :naming => ((defined? MODULE_GENERATOR_NAMING ) ? MODULE_GENERATOR_NAMING : nil ),
34 | :update_svn => ((defined? MODULE_GENERATOR_UPDATE_SVN ) ? MODULE_GENERATOR_UPDATE_SVN : false ),
35 | }
36 | end
37 |
38 | end
39 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/module_generator/module_generator.rake:
--------------------------------------------------------------------------------
1 |
2 | namespace :module do
3 |
4 | desc "Generate module (source, header and test files)"
5 | task :create, :module_path do |t, args|
6 | files = [args[:module_path]] + (args.extras || [])
7 | optz = {}
8 | ["dh", "dih", "mch", "mvp", "src", "test"].each do |pat|
9 | p = files.delete(pat)
10 | optz[:pattern] = p unless p.nil?
11 | end
12 | files.each {|v| @ceedling[:module_generator].create(v, optz) }
13 | end
14 |
15 | desc "Destroy module (source, header and test files)"
16 | task :destroy, :module_path do |t, args|
17 | files = [args[:module_path]] + (args.extras || [])
18 | optz = { :destroy => true }
19 | ["dh", "dih", "mch", "mvp", "src", "test"].each do |pat|
20 | p = files.delete(pat)
21 | optz[:pattern] = p unless p.nil?
22 | end
23 | files.each {|v| @ceedling[:module_generator].create(v, optz) }
24 | end
25 |
26 | end
27 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_gtestlike_tests_report/assets/template.erb copy:
--------------------------------------------------------------------------------
1 | % ignored = hash[:results][:counts][:ignored]
2 | % failed = hash[:results][:counts][:failed]
3 | % stdout_count = hash[:results][:counts][:stdout]
4 | % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '')
5 | % banner_width = 25 + header_prepend.length # widest message
6 |
7 |
8 | % if (stdout_count > 0)
9 | [==========] Running <%=hash[:results][:counts][:total].to_s%> tests from <%=hash[:results][:stdout].length.to_s%> test cases.
10 | [----------] Global test environment set-up.
11 | % end
12 | % if (failed > 0)
13 | % hash[:results][:failures].each do |failure|
14 | [----------] <%=failure[:collection].length.to_s%> tests from <%=failure[:source][:file]%>
15 | % failure[:collection].each do |item|
16 | [ RUN ] <%=failure[:source][:file]%>.<%=item[:test]%>
17 | % if (not item[:message].empty?)
18 | <%=failure[:source][:file]%>(<%=item[:line]%>): error: <%=item[:message]%>
19 |
20 | % m = item[:message].match(/Expected\s+(.*)\s+Was\s+([^\.]*)\./)
21 | % if m.nil?
22 | Actual: FALSE
23 | Expected: TRUE
24 | % else
25 | Actual: <%=m[2]%>
26 | Expected: <%=m[1]%>
27 | % end
28 | % else
29 | <%=failure[:source][:file]%>(<%=item[:line]%>): fail: <%=item[:message]%>
30 | Actual: FALSE
31 | Expected: TRUE
32 | % end
33 | [ FAILED ] <%=failure[:source][:file]%>.<%=item[:test]%> (0 ms)
34 | % end
35 | [----------] <%=failure[:collection].length.to_s%> tests from <%=failure[:source][:file]%> (0 ms total)
36 | % end
37 | % end
38 | % if (hash[:results][:counts][:total] > 0)
39 | [----------] Global test environment tear-down.
40 | [==========] <%=hash[:results][:counts][:total].to_s%> tests from <%=hash[:results][:stdout].length.to_s%> test cases ran.
41 | [ PASSED ] <%=hash[:results][:counts][:passed].to_s%> tests.
42 | % if (failed == 0)
43 | [ FAILED ] 0 tests.
44 |
45 | 0 FAILED TESTS
46 | % else
47 | [ FAILED ] <%=failed.to_s%> tests, listed below:
48 | % hash[:results][:failures].each do |failure|
49 | % failure[:collection].each do |item|
50 | [ FAILED ] <%=failure[:source][:file]%>.<%=item[:test]%>
51 | % end
52 | % end
53 |
54 | <%=failed.to_s%> FAILED TESTS
55 | % end
56 | % else
57 |
58 | No tests executed.
59 | % end
60 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml:
--------------------------------------------------------------------------------
1 | ---
2 | :plugins:
3 | # tell Ceedling we got results display taken care of
4 | :display_raw_test_results: FALSE
5 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/defaults'
3 |
4 | class StdoutGtestlikeTestsReport < Plugin
5 |
6 | def setup
7 | @result_list = []
8 | @plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9 | template = @ceedling[:file_wrapper].read(File.join(@plugin_root, 'assets/template.erb'))
10 | @ceedling[:plugin_reportinator].register_test_results_template( template )
11 | end
12 |
13 | def post_test_fixture_execute(arg_hash)
14 | return if not (arg_hash[:context] == TEST_SYM)
15 |
16 | @result_list << arg_hash[:result_file]
17 | end
18 |
19 | def post_build
20 | return if not (@ceedling[:task_invoker].test_invoked?)
21 |
22 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list)
23 | hash = {
24 | :header => '',
25 | :results => results
26 | }
27 |
28 | @ceedling[:plugin_reportinator].run_test_results_report(hash)
29 | end
30 |
31 | def summary
32 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS )
33 |
34 | # get test results for only those tests in our configuration and of those only tests with results on disk
35 | hash = {
36 | :header => '',
37 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false})
38 | }
39 |
40 | @ceedling[:plugin_reportinator].run_test_results_report(hash)
41 | end
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_ide_tests_report/config/stdout_ide_tests_report.yml:
--------------------------------------------------------------------------------
1 | ---
2 | :plugins:
3 | # tell Ceedling we got results display taken care of
4 | :display_raw_test_results: FALSE
5 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/defaults'
3 |
4 | class StdoutIdeTestsReport < Plugin
5 |
6 | def setup
7 | @result_list = []
8 | end
9 |
10 | def post_test_fixture_execute(arg_hash)
11 | return if not (arg_hash[:context] == TEST_SYM)
12 |
13 | @result_list << arg_hash[:result_file]
14 | end
15 |
16 | def post_build
17 | return if (not @ceedling[:task_invoker].test_invoked?)
18 |
19 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list)
20 | hash = {
21 | :header => '',
22 | :results => results
23 | }
24 |
25 | @ceedling[:plugin_reportinator].run_test_results_report(hash) do
26 | message = ''
27 | message = 'Unit test failures.' if (hash[:results][:counts][:failed] > 0)
28 | message
29 | end
30 | end
31 |
32 | def summary
33 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS )
34 |
35 | # get test results for only those tests in our configuration and of those only tests with results on disk
36 | hash = {
37 | :header => '',
38 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false})
39 | }
40 |
41 | @ceedling[:plugin_reportinator].run_test_results_report(hash)
42 | end
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_pretty_tests_report/assets/template.erb:
--------------------------------------------------------------------------------
1 | % ignored = hash[:results][:counts][:ignored]
2 | % failed = hash[:results][:counts][:failed]
3 | % stdout_count = hash[:results][:counts][:stdout]
4 | % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '')
5 | % banner_width = 25 + header_prepend.length # widest message
6 |
7 | % if (stdout_count > 0)
8 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'TEST OUTPUT')%>
9 | % hash[:results][:stdout].each do |string|
10 | [<%=string[:source][:file]%>]
11 | % string[:collection].each do |item|
12 | - "<%=item%>"
13 | % end
14 |
15 | % end
16 | % end
17 | % if (ignored > 0)
18 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED TEST SUMMARY')%>
19 | % hash[:results][:ignores].each do |ignore|
20 | [<%=ignore[:source][:file]%>]
21 | % ignore[:collection].each do |item|
22 | Test: <%=item[:test]%>
23 | % if (not item[:message].empty?)
24 | At line (<%=item[:line]%>): "<%=item[:message]%>"
25 | % else
26 | At line (<%=item[:line]%>)
27 | % end
28 |
29 | % end
30 | % end
31 | % end
32 | % if (failed > 0)
33 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED TEST SUMMARY')%>
34 | % hash[:results][:failures].each do |failure|
35 | [<%=failure[:source][:file]%>]
36 | % failure[:collection].each do |item|
37 | Test: <%=item[:test]%>
38 | % if (not item[:message].empty?)
39 | At line (<%=item[:line]%>): "<%=item[:message]%>"
40 | % else
41 | At line (<%=item[:line]%>)
42 | % end
43 |
44 | % end
45 | % end
46 | % end
47 | % total_string = hash[:results][:counts][:total].to_s
48 | % format_string = "%#{total_string.length}i"
49 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL TEST SUMMARY')%>
50 | % if (hash[:results][:counts][:total] > 0)
51 | TESTED: <%=hash[:results][:counts][:total].to_s%>
52 | PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%>
53 | FAILED: <%=sprintf(format_string, failed)%>
54 | IGNORED: <%=sprintf(format_string, ignored)%>
55 | % else
56 |
57 | No tests executed.
58 | % end
59 |
60 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml:
--------------------------------------------------------------------------------
1 | ---
2 | :plugins:
3 | # tell Ceedling we got results display taken care of
4 | :display_raw_test_results: FALSE
5 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/defaults'
3 |
4 | class StdoutPrettyTestsReport < Plugin
5 |
6 | def setup
7 | @result_list = []
8 | @plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9 | template = @ceedling[:file_wrapper].read(File.join(@plugin_root, 'assets/template.erb'))
10 | @ceedling[:plugin_reportinator].register_test_results_template( template )
11 | end
12 |
13 | def post_test_fixture_execute(arg_hash)
14 | return if not (arg_hash[:context] == TEST_SYM)
15 |
16 | @result_list << arg_hash[:result_file]
17 | end
18 |
19 | def post_build
20 | return if not (@ceedling[:task_invoker].test_invoked?)
21 |
22 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list)
23 | hash = {
24 | :header => '',
25 | :results => results
26 | }
27 |
28 | @ceedling[:plugin_reportinator].run_test_results_report(hash) do
29 | message = ''
30 | message = 'Unit test failures.' if (results[:counts][:failed] > 0)
31 | message
32 | end
33 | end
34 |
35 | def summary
36 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS )
37 |
38 | # get test results for only those tests in our configuration and of those only tests with results on disk
39 | hash = {
40 | :header => '',
41 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false})
42 | }
43 |
44 | @ceedling[:plugin_reportinator].run_test_results_report(hash)
45 | end
46 |
47 | end
48 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/subprojects/README.md:
--------------------------------------------------------------------------------
1 | ceedling-subprojects
2 | ====================
3 |
4 | Plugin for supporting subprojects that are built as static libraries. It continues to support
5 | dependency tracking, without getting confused between your main project files and your
6 | subproject files. It accepts different compiler flags and linker flags, allowing you to
7 | optimize for your situation.
8 |
9 | First, you're going to want to add the extension to your list of known extensions:
10 |
11 | ```
12 | :extension:
13 | :subprojects: '.a'
14 | ```
15 |
16 | Define a new section called :subprojects. There, you can list as many subprojects
17 | as you may need under the :paths key. For each, you specify a unique place to build
18 | and a unique name.
19 |
20 | ```
21 | :subprojects:
22 | :paths:
23 | - :name: libprojectA
24 | :source:
25 | - ./subprojectA/first/dir
26 | - ./subprojectA/second/dir
27 | :include:
28 | - ./subprojectA/include/dir
29 | :build_root: ./subprojectA/build/dir
30 | :defines:
31 | - DEFINE_JUST_FOR_THIS_FILE
32 | - AND_ANOTHER
33 | - :name: libprojectB
34 | :source:
35 | - ./subprojectB/only/dir
36 | :include:
37 | - ./subprojectB/first/include/dir
38 | - ./subprojectB/second/include/dir
39 | :build_root: ./subprojectB/build/dir
40 | :defines: [] #none for this one
41 | ```
42 |
43 | You can specify the compiler and linker, just as you would a release build:
44 |
45 | ```
46 | :tools:
47 | :subprojects_compiler:
48 | :executable: gcc
49 | :arguments:
50 | - -g
51 | - -I"$": COLLECTION_PATHS_SUBPROJECTS
52 | - -D$: COLLECTION_DEFINES_SUBPROJECTS
53 | - -c "${1}"
54 | - -o "${2}"
55 | :subprojects_linker:
56 | :executable: ar
57 | :arguments:
58 | - rcs
59 | - ${2}
60 | - ${1}
61 | ```
62 |
63 | That's all there is to it! Happy Hacking!
64 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/subprojects/config/defaults.yml:
--------------------------------------------------------------------------------
1 | ---
2 | #:extension:
3 | # :subprojects: '.a'
4 |
5 | :subprojects:
6 | :paths: []
7 | # - :name: subprojectA
8 | # :source:
9 | # - ./first/subproject/dir
10 | # - ./second/subproject/dir
11 | # :include:
12 | # - ./first/include/dir
13 | # :build_root: ./subproject/build/dir
14 | # :defines:
15 | # - FIRST_DEFINE
16 |
17 | :tools:
18 | :subprojects_compiler:
19 | :executable: gcc
20 | :arguments:
21 | - -g
22 | - -I"$": COLLECTION_PATHS_SUBPROJECTS
23 | - -D$: COLLECTION_DEFINES_SUBPROJECTS
24 | - -c "${1}"
25 | - -o "${2}"
26 | :subprojects_linker:
27 | :executable: ar
28 | :arguments:
29 | - rcs
30 | - ${2}
31 | - ${1}
32 |
33 | ...
34 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/teamcity_tests_report/config/teamcity_tests_report.yml:
--------------------------------------------------------------------------------
1 | ---
2 | :plugins:
3 | # tell Ceedling we got results display taken care of
4 | :display_raw_test_results: FALSE
5 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/defaults'
3 |
4 | class TeamcityTestsReport < Plugin
5 |
6 | def setup
7 | @suite_started = nil
8 | @output_enabled = !defined?(TEAMCITY_BUILD) || TEAMCITY_BUILD
9 | end
10 |
11 | def escape(string)
12 | string.gsub(/['|\[\]]/, '|\0').gsub('\r', '|r').gsub('\n', '|n')
13 | end
14 |
15 | def pre_test(test)
16 | teamcity_message "testSuiteStarted name='#{File.basename(test, '.c')}'"
17 | @suite_started = Time.now
18 | end
19 |
20 | def post_test(test)
21 | teamcity_message "testSuiteFinished name='#{File.basename(test, '.c')}'"
22 | end
23 |
24 | def post_test_fixture_execute(arg_hash)
25 | duration = (Time.now - @suite_started) * 1000
26 | results = @ceedling[:plugin_reportinator].assemble_test_results([arg_hash[:result_file]])
27 | avg_duration = (duration / [1, results[:counts][:passed] + results[:counts][:failed]].max).round
28 |
29 | results[:successes].each do |success|
30 | success[:collection].each do |test|
31 | teamcity_message "testStarted name='#{test[:test]}'"
32 | teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'"
33 | end
34 | end
35 |
36 | results[:failures].each do |failure|
37 | failure[:collection].each do |test|
38 | teamcity_message "testStarted name='#{test[:test]}'"
39 | teamcity_message "testFailed name='#{test[:test]}' message='#{escape(test[:message])}' details='File: #{failure[:source][:path]}/#{failure[:source][:file]} Line: #{test[:line]}'"
40 | teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'"
41 | end
42 | end
43 |
44 | results[:ignores].each do |failure|
45 | failure[:collection].each do |test|
46 | teamcity_message "testIgnored name='#{test[:test]}' message='#{escape(test[:message])}'"
47 | end
48 | end
49 |
50 | # We ignore stdout
51 | end
52 |
53 | def teamcity_message(content)
54 | puts "##teamcity[#{content}]" unless !@output_enabled
55 | end
56 |
57 | end
58 |
--------------------------------------------------------------------------------
/vendor/ceedling/plugins/warnings_report/lib/warnings_report.rb:
--------------------------------------------------------------------------------
1 | require 'ceedling/plugin'
2 | require 'ceedling/constants'
3 |
4 | class WarningsReport < Plugin
5 | def setup
6 | @stderr_redirect = nil
7 | @log_paths = {}
8 | end
9 |
10 | def pre_compile_execute(arg_hash)
11 | # at beginning of compile, override tool's stderr_redirect so we can parse $stderr + $stdout
12 | set_stderr_redirect(arg_hash)
13 | end
14 |
15 | def post_compile_execute(arg_hash)
16 | # after compilation, grab output for parsing/logging, restore stderr_redirect, log warning if it exists
17 | output = arg_hash[:shell_result][:output]
18 | restore_stderr_redirect(arg_hash)
19 | write_warning_log(arg_hash[:context], output)
20 | end
21 |
22 | def pre_link_execute(arg_hash)
23 | # at beginning of link, override tool's stderr_redirect so we can parse $stderr + $stdout
24 | set_stderr_redirect(arg_hash)
25 | end
26 |
27 | def post_link_execute(arg_hash)
28 | # after linking, grab output for parsing/logging, restore stderr_redirect, log warning if it exists
29 | output = arg_hash[:shell_result][:output]
30 | restore_stderr_redirect(arg_hash)
31 | write_warning_log(arg_hash[:context], output)
32 | end
33 |
34 | private
35 |
36 | def set_stderr_redirect(hash)
37 | @stderr_redirect = hash[:tool][:stderr_redirect]
38 | hash[:tool][:stderr_redirect] = StdErrRedirect::AUTO
39 | end
40 |
41 | def restore_stderr_redirect(hash)
42 | hash[:tool][:stderr_redirect] = @stderr_redirect
43 | end
44 |
45 | def write_warning_log(context, output)
46 | # if $stderr/$stdout contain "warning", log it
47 | if output =~ /warning/i
48 | # generate a log path & file io write flags
49 | logging = generate_log_path(context)
50 | @ceedling[:file_wrapper].write(logging[:path], output + "\n", logging[:flags]) unless logging.nil?
51 | end
52 | end
53 |
54 | def generate_log_path(context)
55 | # if path has already been generated, return it & 'append' file io flags (append to log)
56 | return { path: @log_paths[context], flags: 'a' } unless @log_paths[context].nil?
57 |
58 | # first time through, generate path & 'write' file io flags (create new log)
59 | base_path = File.join(PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s)
60 | file_path = File.join(base_path, 'warnings.log')
61 |
62 | if @ceedling[:file_wrapper].exist?(base_path)
63 | @log_paths[context] = file_path
64 | return { path: file_path, flags: 'w' }
65 | end
66 |
67 | nil
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/c_exception/release/build.info:
--------------------------------------------------------------------------------
1 | 18
2 |
3 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/c_exception/release/version.info:
--------------------------------------------------------------------------------
1 | 1.3.1
2 |
3 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/config/production_environment.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | # Setup our load path:
8 | [
9 | 'lib',
10 | ].each do |dir|
11 | $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) )
12 | end
13 |
14 |
15 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/config/test_environment.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | # Setup our load path:
8 | [
9 | './lib',
10 | './vendor/behaviors/lib',
11 | './vendor/hardmock/lib',
12 | './vendor/unity/auto/',
13 | './test/system/'
14 | ].each do |dir|
15 | $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) )
16 | end
17 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | [ "../config/production_environment",
8 | "cmock_header_parser",
9 | "cmock_generator",
10 | "cmock_file_writer",
11 | "cmock_config",
12 | "cmock_plugin_manager",
13 | "cmock_generator_utils",
14 | "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"}
15 |
16 | class CMock
17 |
18 | def initialize(options=nil)
19 | cm_config = CMockConfig.new(options)
20 | cm_unityhelper = CMockUnityHelperParser.new(cm_config)
21 | cm_writer = CMockFileWriter.new(cm_config)
22 | cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper})
23 | cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils)
24 | @cm_parser = CMockHeaderParser.new(cm_config)
25 | @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins)
26 | @silent = (cm_config.verbosity < 2)
27 | end
28 |
29 | def setup_mocks(files)
30 | [files].flatten.each do |src|
31 | generate_mock src
32 | end
33 | end
34 |
35 | private ###############################
36 |
37 | def generate_mock(src)
38 | name = File.basename(src, '.h')
39 | puts "Creating mock for #{name}..." unless @silent
40 | @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src)))
41 | end
42 | end
43 |
44 | def option_maker(options, key, val)
45 | options = options || {}
46 | options[key.to_sym] =
47 | if val.chr == ":"
48 | val[1..-1].to_sym
49 | elsif val.include? ";"
50 | val.split(';')
51 | elsif val == 'true'
52 | true
53 | elsif val == 'false'
54 | false
55 | elsif val =~ /^\d+$/
56 | val.to_i
57 | else
58 | val
59 | end
60 | options
61 | end
62 |
63 | # Command Line Support ###############################
64 |
65 | if ($0 == __FILE__)
66 | usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock"
67 |
68 | if (!ARGV[0])
69 | puts usage
70 | exit 1
71 | end
72 |
73 | options = {}
74 | filelist = []
75 | ARGV.each do |arg|
76 | if (arg =~ /^-o\"?([a-zA-Z0-9._\\\/:\s]+)\"?/)
77 | options.merge! CMockConfig.load_config_file_from_yaml( arg.gsub(/^-o/,'') )
78 | elsif (arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)=\"?([a-zA-Z0-9._\-\\\/:\s\;]+)\"?/)
79 | options = option_maker(options, $1, $2)
80 | else
81 | filelist << arg
82 | end
83 | end
84 |
85 | CMock.new(options).setup_mocks(filelist)
86 | end
87 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_file_writer.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | class CMockFileWriter
8 |
9 | attr_reader :config
10 |
11 | def initialize(config)
12 | @config = config
13 | end
14 |
15 | def create_subdir(subdir)
16 | if !Dir.exists?("#{@config.mock_path}/")
17 | require 'fileutils'
18 | FileUtils.mkdir_p "#{@config.mock_path}/"
19 | end
20 | if subdir && !Dir.exists?("#{@config.mock_path}/#{subdir+'/' if subdir}")
21 | require 'fileutils'
22 | FileUtils.mkdir_p "#{@config.mock_path}/#{subdir+'/' if subdir}"
23 | end
24 | end
25 |
26 | def create_file(filename, subdir)
27 | raise "Where's the block of data to create?" unless block_given?
28 | full_file_name_temp = "#{@config.mock_path}/#{subdir+'/' if subdir}#{filename}.new"
29 | full_file_name_done = "#{@config.mock_path}/#{subdir+'/' if subdir}#{filename}"
30 | File.open(full_file_name_temp, 'w') do |file|
31 | yield(file, filename)
32 | end
33 | update_file(full_file_name_done, full_file_name_temp)
34 | end
35 |
36 | private ###################################
37 |
38 | def update_file(dest, src)
39 | require 'fileutils'
40 | FileUtils.rm(dest) if (File.exist?(dest))
41 | FileUtils.cp(src, dest)
42 | FileUtils.rm(src)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | class CMockGeneratorPluginCexception
8 |
9 | attr_reader :priority
10 | attr_reader :config, :utils
11 |
12 | def initialize(config, utils)
13 | @config = config
14 | @utils = utils
15 | @priority = 7
16 | end
17 |
18 | def include_files
19 | return "#include \"CException.h\"\n"
20 | end
21 |
22 | def instance_typedefs(function)
23 | " CEXCEPTION_T ExceptionToThrow;\n"
24 | end
25 |
26 | def mock_function_declarations(function)
27 | if (function[:args_string] == "void")
28 | return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" +
29 | "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n"
30 | else
31 | return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" +
32 | "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n"
33 | end
34 | end
35 |
36 | def mock_implementation(function)
37 | " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" +
38 | " UNITY_CLR_DETAILS();\n" +
39 | " Throw(cmock_call_instance->ExceptionToThrow);\n }\n"
40 | end
41 |
42 | def mock_interfaces(function)
43 | arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, "
44 | call_string = function[:args].map{|m| m[:name]}.join(', ')
45 | [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n",
46 | @utils.code_add_base_expectation(function[:name]),
47 | @utils.code_call_argument_loader(function),
48 | " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n",
49 | "}\n\n" ].join
50 | end
51 |
52 | end
53 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | class CMockGeneratorPluginExpectAnyArgs
8 |
9 | attr_reader :priority
10 | attr_reader :config, :utils
11 |
12 | def initialize(config, utils)
13 | @config = config
14 | @utils = utils
15 | @priority = 3
16 | end
17 |
18 | def instance_structure(function)
19 | if (function[:return][:void?]) || (@config.plugins.include? :ignore)
20 | ""
21 | else
22 | " #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
23 | end
24 | end
25 |
26 | def instance_typedefs(function)
27 | " CMOCK_ARG_MODE IgnoreMode;\n"
28 | end
29 |
30 | def mock_function_declarations(function)
31 | if (function[:return][:void?])
32 | return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" +
33 | "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n"
34 | else
35 | return "#define #{function[:name]}_ExpectAnyArgsAndReturn(cmock_retval) #{function[:name]}_CMockExpectAnyArgsAndReturn(__LINE__, cmock_retval)\n" +
36 | "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
37 | end
38 | end
39 |
40 | def mock_interfaces(function)
41 | lines = ""
42 | if (function[:return][:void?])
43 | lines << "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n{\n"
44 | else
45 | lines << "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
46 | end
47 | lines << @utils.code_add_base_expectation(function[:name], true)
48 | unless (function[:return][:void?])
49 | lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
50 | end
51 | lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_NONE;\n"
52 | lines << "}\n\n"
53 | end
54 | end
55 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb:
--------------------------------------------------------------------------------
1 | class CMockGeneratorPluginIgnoreArg
2 | attr_reader :priority
3 | attr_accessor :utils
4 |
5 | def initialize(config, utils)
6 | @utils = utils
7 | @priority = 10
8 | end
9 |
10 | def instance_typedefs(function)
11 | lines = ""
12 | function[:args].each do |arg|
13 | lines << " int IgnoreArg_#{arg[:name]};\n"
14 | end
15 | lines
16 | end
17 |
18 | def mock_function_declarations(function)
19 | lines = ""
20 | function[:args].each do |arg|
21 | lines << "#define #{function[:name]}_IgnoreArg_#{arg[:name]}()"
22 | lines << " #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(__LINE__)\n"
23 | lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line);\n"
24 | end
25 | lines
26 | end
27 |
28 | def mock_interfaces(function)
29 | lines = []
30 | func_name = function[:name]
31 | function[:args].each do |arg|
32 | arg_name = arg[:name]
33 | arg_type = arg[:type]
34 | lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
35 | lines << "{\n"
36 | lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
37 | "(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
38 | lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n"
39 | lines << " cmock_call_instance->IgnoreArg_#{arg_name} = 1;\n"
40 | lines << "}\n\n"
41 | end
42 | lines
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | require 'thread'
8 |
9 | class CMockPluginManager
10 |
11 | attr_accessor :plugins
12 |
13 | def initialize(config, utils)
14 | @plugins = []
15 | plugins_to_load = [:expect, config.plugins].flatten.uniq.compact
16 | plugins_to_load.each do |plugin|
17 | plugin_name = plugin.to_s
18 | object_name = "CMockGeneratorPlugin" + camelize(plugin_name)
19 | self.class.plugin_require_mutex.synchronize { load_plugin(plugin_name, object_name, config, utils) }
20 | end
21 | @plugins.sort! {|a,b| a.priority <=> b.priority }
22 | end
23 |
24 | def run(method, args=nil)
25 | if args.nil?
26 | return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join
27 | else
28 | return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join
29 | end
30 | end
31 |
32 | def camelize(lower_case_and_underscored_word)
33 | lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
34 | end
35 |
36 | private
37 |
38 | def self.plugin_require_mutex
39 | @mutex ||= Mutex.new
40 | end
41 |
42 | def load_plugin(plugin_name, object_name, config, utils)
43 | begin
44 | unless (Object.const_defined? object_name)
45 | file_name = "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb"
46 | require file_name
47 | end
48 | class_name = Object.const_get(object_name)
49 | @plugins << class_name.new(config, utils)
50 | rescue
51 | file_name = "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb"
52 | raise "ERROR: CMock unable to load plugin '#{plugin_name}' '#{object_name}' #{file_name}"
53 | end
54 | end
55 | end
56 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # CMock Project - Automatic Mock Generation for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | class CMockUnityHelperParser
8 |
9 | attr_accessor :c_types
10 |
11 | def initialize(config)
12 | @config = config
13 | @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
14 | @c_types = map_C_types.merge(import_source)
15 | end
16 |
17 | def get_helper(ctype)
18 | lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_')
19 | return [@c_types[lookup], ''] if (@c_types[lookup])
20 | if (lookup =~ /\*$/)
21 | lookup = lookup.gsub(/\*$/,'')
22 | return [@c_types[lookup], '*'] if (@c_types[lookup])
23 | else
24 | lookup = lookup + '*'
25 | return [@c_types[lookup], '&'] if (@c_types[lookup])
26 | end
27 | return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/)
28 | raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown
29 | return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, '']
30 | end
31 |
32 | private ###########################
33 |
34 | def map_C_types
35 | c_types = {}
36 | @config.treat_as.each_pair do |ctype, expecttype|
37 | c_type = ctype.gsub(/\s+/,'_')
38 | if (expecttype =~ /\*/)
39 | c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY"
40 | else
41 | c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}"
42 | c_types[c_type+'*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
43 | end
44 | end
45 | c_types
46 | end
47 |
48 | def import_source
49 | source = @config.load_unity_helper
50 | return {} if source.nil?
51 | c_types = {}
52 | source = source.gsub(/\/\/.*$/, '') #remove line comments
53 | source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments
54 |
55 | #scan for comparison helpers
56 | match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)')
57 | pairs = source.scan(match_regex).flatten.compact
58 | (pairs.size/2).times do |i|
59 | expect = pairs[i*2]
60 | ctype = pairs[(i*2)+1]
61 | c_types[ctype] = expect unless expect.include?("_ARRAY")
62 | end
63 |
64 | #scan for array variants of those helpers
65 | match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)')
66 | pairs = source.scan(match_regex).flatten.compact
67 | (pairs.size/2).times do |i|
68 | expect = pairs[i*2]
69 | ctype = pairs[(i*2)+1]
70 | c_types[ctype.gsub('_ARRAY','*')] = expect
71 | end
72 |
73 | c_types
74 | end
75 | end
76 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/release/build.info:
--------------------------------------------------------------------------------
1 | 215
2 |
3 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/release/version.info:
--------------------------------------------------------------------------------
1 | 2.4.4
2 |
3 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/cmock/src/cmock.h:
--------------------------------------------------------------------------------
1 | /* ==========================================
2 | CMock Project - Automatic Mock Generation for C
3 | Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | [Released under MIT License. Please refer to license.txt for details]
5 | ========================================== */
6 |
7 | #ifndef CMOCK_FRAMEWORK_H
8 | #define CMOCK_FRAMEWORK_H
9 |
10 | #include "cmock_internals.h"
11 |
12 | //should be big enough to index full range of CMOCK_MEM_MAX
13 | #ifndef CMOCK_MEM_INDEX_TYPE
14 | #define CMOCK_MEM_INDEX_TYPE unsigned int
15 | #endif
16 |
17 | #define CMOCK_GUTS_NONE (0)
18 |
19 | #define CMOCK_ARG_MODE CMOCK_MEM_INDEX_TYPE
20 | #define CMOCK_ARG_ALL 0
21 | #define CMOCK_ARG_NONE ((CMOCK_MEM_INDEX_TYPE)(~0U))
22 |
23 | //-------------------------------------------------------
24 | // Memory API
25 | //-------------------------------------------------------
26 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size);
27 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index);
28 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index);
29 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemEndOfChain(CMOCK_MEM_INDEX_TYPE root_index);
30 |
31 | void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index);
32 |
33 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void);
34 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void);
35 | void CMock_Guts_MemFreeAll(void);
36 | void CMock_Guts_MemFreeFinal(void);
37 |
38 | #endif //CMOCK_FRAMEWORK
39 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/diy/lib/diy/factory.rb:
--------------------------------------------------------------------------------
1 | module DIY #:nodoc:#
2 | class FactoryDef #:nodoc:
3 | attr_accessor :name, :target, :class_name, :library
4 |
5 | def initialize(opts)
6 | @name, @target, @library, @auto_require =
7 | opts[:name], opts[:target], opts[:library], opts[:auto_require]
8 |
9 | @class_name = Infl.camelize(@target)
10 | @library ||= Infl.underscore(@class_name) if @auto_require
11 | end
12 | end
13 |
14 | class Context
15 | def construct_factory(key)
16 | factory_def = @defs[key]
17 | # puts "requiring #{factory_def.library}"
18 | require factory_def.library if factory_def.library
19 |
20 | big_c = get_class_for_name_with_module_delimeters(factory_def.class_name)
21 |
22 | FactoryFactory.new(big_c)
23 | end
24 | end
25 |
26 | class FactoryFactory
27 | def initialize(clazz)
28 | @class_to_create = clazz
29 | end
30 |
31 | def create(*args)
32 | @class_to_create.new(*args)
33 | end
34 | end
35 | end
36 |
37 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/auto/colour_reporter.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # Unity Project - A Test Framework for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
8 |
9 | $colour_output = true
10 |
11 | def report(message)
12 | if !$colour_output
13 | $stdout.puts(message)
14 | else
15 | message = message.join('\n') if message.class == Array
16 | message.each_line do |line|
17 | line.chomp!
18 | colour = case line
19 | when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i
20 | Regexp.last_match(1).to_i.zero? ? :green : :red
21 | when /PASS/
22 | :green
23 | when /^OK$/
24 | :green
25 | when /(?:FAIL|ERROR)/
26 | :red
27 | when /IGNORE/
28 | :yellow
29 | when /^(?:Creating|Compiling|Linking)/
30 | :white
31 | else
32 | :silver
33 | end
34 | colour_puts(colour, line)
35 | end
36 | end
37 | $stdout.flush
38 | $stderr.flush
39 | end
40 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/auto/generate_config.yml:
--------------------------------------------------------------------------------
1 | #this is a sample configuration file for generate_module
2 | #you would use it by calling generate_module with the -ygenerate_config.yml option
3 | #files like this are useful for customizing generate_module to your environment
4 | :generate_module:
5 | :defaults:
6 | #these defaults are used in place of any missing options at the command line
7 | :path_src: ../src/
8 | :path_inc: ../src/
9 | :path_tst: ../test/
10 | :update_svn: true
11 | :includes:
12 | #use [] for no additional includes, otherwise list the includes on separate lines
13 | :src:
14 | - Defs.h
15 | - Board.h
16 | :inc: []
17 | :tst:
18 | - Defs.h
19 | - Board.h
20 | - Exception.h
21 | :boilerplates:
22 | #these are inserted at the top of generated files.
23 | #just comment out or remove if not desired.
24 | #use %1$s where you would like the file name to appear (path/extension not included)
25 | :src: |
26 | //-------------------------------------------
27 | // %1$s.c
28 | //-------------------------------------------
29 | :inc: |
30 | //-------------------------------------------
31 | // %1$s.h
32 | //-------------------------------------------
33 | :tst: |
34 | //-------------------------------------------
35 | // Test%1$s.c : Units tests for %1$s.c
36 | //-------------------------------------------
37 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/auto/test_file_filter.rb:
--------------------------------------------------------------------------------
1 | # ==========================================
2 | # Unity Project - A Test Framework for C
3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4 | # [Released under MIT License. Please refer to license.txt for details]
5 | # ==========================================
6 |
7 | require'yaml'
8 |
9 | module RakefileHelpers
10 | class TestFileFilter
11 | def initialize(all_files = false)
12 | @all_files = all_files
13 |
14 | return false unless @all_files
15 | return false unless File.exist?('test_file_filter.yml')
16 |
17 | filters = YAML.load_file('test_file_filter.yml')
18 | @all_files = filters[:all_files]
19 | @only_files = filters[:only_files]
20 | @exclude_files = filters[:exclude_files]
21 | end
22 |
23 | attr_accessor :all_files, :only_files, :exclude_files
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/auto/type_sanitizer.rb:
--------------------------------------------------------------------------------
1 | module TypeSanitizer
2 | def self.sanitize_c_identifier(unsanitized)
3 | # convert filename to valid C identifier by replacing invalid chars with '_'
4 | unsanitized.gsub(/[-\/\\\.\,\s]/, '_')
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/release/build.info:
--------------------------------------------------------------------------------
1 | 120
2 |
3 |
--------------------------------------------------------------------------------
/vendor/ceedling/vendor/unity/release/version.info:
--------------------------------------------------------------------------------
1 | 2.4.1
2 |
3 |
--------------------------------------------------------------------------------