From 6906b97ba01322105435655d7ac1c0ffcb38ff8d Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 21 Jun 2016 16:20:19 -0500 Subject: [PATCH 01/83] Adds a simple text file report format Should resolve #1583 --- tools/singletest.py | 1 + tools/test_api.py | 10 +++++++ tools/test_exporters.py | 60 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/tools/singletest.py b/tools/singletest.py index 058b96d4d1..4142878b0b 100644 --- a/tools/singletest.py +++ b/tools/singletest.py @@ -230,6 +230,7 @@ if __name__ == '__main__': _opts_report_html_file_name=opts.report_html_file_name, _opts_report_junit_file_name=opts.report_junit_file_name, _opts_report_build_file_name=opts.report_build_file_name, + _opts_report_text_file_name=opts.report_text_file_name, _test_spec=test_spec, _opts_goanna_for_mbed_sdk=opts.goanna_for_mbed_sdk, _opts_goanna_for_tests=opts.goanna_for_tests, diff --git a/tools/test_api.py b/tools/test_api.py index 745bce563f..2fec9b3108 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -166,6 +166,7 @@ class SingleTestRunner(object): _opts_report_html_file_name=None, _opts_report_junit_file_name=None, _opts_report_build_file_name=None, + _opts_report_text_file_name=None, _opts_build_report={}, _opts_build_properties={}, _test_spec={}, @@ -224,6 +225,7 @@ class SingleTestRunner(object): self.opts_report_html_file_name = _opts_report_html_file_name self.opts_report_junit_file_name = _opts_report_junit_file_name self.opts_report_build_file_name = _opts_report_build_file_name + self.opts_report_text_file_name = _opts_report_text_file_name self.opts_goanna_for_mbed_sdk = _opts_goanna_for_mbed_sdk self.opts_goanna_for_tests = _opts_goanna_for_tests self.opts_shuffle_test_order = _opts_shuffle_test_order @@ -1513,6 +1515,10 @@ def singletest_in_cli_mode(single_test): # Export results in form of JUnit XML report to separate file report_exporter = ReportExporter(ResultExporterType.JUNIT) report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext) + if single_test.opts_report_text_file_name: + # Export results in form of a text file + report_exporter = ReportExporter(ResultExporterType.TEXT) + report_exporter.report_to_file(test_summary_ext, single_test.opts_report_text_file_name, test_suite_properties=test_suite_properties_ext) if single_test.opts_report_build_file_name: # Export build results as html report to sparate file report_exporter = ReportExporter(ResultExporterType.JUNIT, package="build") @@ -1926,6 +1932,10 @@ def get_default_test_options_parser(): dest="report_build_file_name", help="Output the build results to a junit xml file") + parser.add_option("", "--report-text", + dest="report_text_file_name", + help="Output the build results to a text file") + parser.add_option('', '--verbose-skipped', dest='verbose_skipped_tests', default=False, diff --git a/tools/test_exporters.py b/tools/test_exporters.py index 6a5aba466e..40a24544e2 100644 --- a/tools/test_exporters.py +++ b/tools/test_exporters.py @@ -18,12 +18,14 @@ Author: Przemyslaw Wirkus """ from tools.utils import construct_enum, mkdir +from prettytable import PrettyTable import os ResultExporterType = construct_enum(HTML='Html_Exporter', JUNIT='JUnit_Exporter', JUNIT_OPER='JUnit_Exporter_Interoperability', BUILD='Build_Exporter', + TEXT='Text_Exporter', PRINT='Print_Exporter') @@ -88,6 +90,8 @@ class ReportExporter(): elif self.result_exporter_type == ResultExporterType.PRINT: # JUNIT exporter for interoperability test return self.exporter_print(test_summary_ext, print_log_for_failures=print_log_for_failures) + elif self.result_exporter_type == ResultExporterType.TEXT: + return self.exporter_text(test_summary_ext) return None def report_to_file(self, test_summary_ext, file_name, test_suite_properties=None): @@ -351,3 +355,59 @@ class ReportExporter(): return False else: return True + + def exporter_text(self, test_result_ext): + """ Prints well-formed summary with results (SQL table like) + table shows target x test results matrix across + """ + success_code = 0 # Success code that can be leter returned to + # Pretty table package is used to print results + pt = PrettyTable(["Result", "Target", "Toolchain", "Test ID", "Test Description", + "Elapsed Time (sec)", "Timeout (sec)"]) + pt.align["Result"] = "l" # Left align + pt.align["Target"] = "l" # Left align + pt.align["Toolchain"] = "l" # Left align + pt.align["Test ID"] = "l" # Left align + pt.align["Test Description"] = "l" # Left align + pt.padding_width = 1 # One space between column edges and contents (default) + + result_dict = {"OK" : 0, + "FAIL" : 0, + "ERROR" : 0, + "UNDEF" : 0, + "IOERR_COPY" : 0, + "IOERR_DISK" : 0, + "IOERR_SERIAL" : 0, + "TIMEOUT" : 0, + "NO_IMAGE" : 0, + "MBED_ASSERT" : 0, + "BUILD_FAILED" : 0, + "NOT_SUPPORTED" : 0 + } + unique_test_ids = self.get_all_unique_test_ids(test_result_ext) + targets = sorted(test_result_ext.keys()) + for target in targets: + toolchains = sorted(test_result_ext[target].keys()) + for toolchain in toolchains: + test_cases = [] + tests = sorted(test_result_ext[target][toolchain].keys()) + for test in tests: + test_results = test_result_ext[target][toolchain][test] + for test_res in test_results: + test_ids = sorted(test_res.keys()) + for test_no in test_ids: + test_result = test_res[test_no] + result_dict[test_result['result']] += 1 + pt.add_row([test_result['result'], + test_result['target_name'], + test_result['toolchain_name'], + test_result['id'], + test_result['description'], + test_result['elapsed_time'], + test_result['duration']]) + result = pt.get_string() + result += "\n" + + # Print result count + result += "Result: " + ' / '.join(['%s %s' % (value, key) for (key, value) in {k: v for k, v in result_dict.items() if v != 0}.iteritems()]) + return result From 65517d6513e6904f54bd70fb176846b0350ebc83 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 21 Jun 2016 16:30:29 -0500 Subject: [PATCH 02/83] Removes units to make the table fit without scrolling on github --- tools/test_exporters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test_exporters.py b/tools/test_exporters.py index 40a24544e2..599c24a186 100644 --- a/tools/test_exporters.py +++ b/tools/test_exporters.py @@ -363,7 +363,7 @@ class ReportExporter(): success_code = 0 # Success code that can be leter returned to # Pretty table package is used to print results pt = PrettyTable(["Result", "Target", "Toolchain", "Test ID", "Test Description", - "Elapsed Time (sec)", "Timeout (sec)"]) + "Elapsed Time", "Timeout"]) pt.align["Result"] = "l" # Left align pt.align["Target"] = "l" # Left align pt.align["Toolchain"] = "l" # Left align From 53ff006f53ea0feaa0e460f782e14f7fc51998a5 Mon Sep 17 00:00:00 2001 From: adustm Date: Mon, 27 Jun 2016 16:20:49 +0200 Subject: [PATCH 03/83] Add timeinfo.tm_isdst = -1 to pass MBED_16 test with IAR. --- hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c index 2f40051381..2a34e5c834 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c @@ -182,6 +182,7 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + timeinfo.tm_isdst = -1; // Convert to timestamp time_t t = mktime(&timeinfo); From 941eca961f833a232075e8f96b7dc98a43a7d69c Mon Sep 17 00:00:00 2001 From: adustm Date: Tue, 28 Jun 2016 11:11:58 +0200 Subject: [PATCH 04/83] Bug fix for MBED_16 on STM32F7 family --- hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c index 2293faba5e..5788544ef2 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c @@ -182,6 +182,7 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + timeinfo.tm_isdst = -1; // Convert to timestamp time_t t = mktime(&timeinfo); From fb43e6c825f33e55a6f30501ff1cff6f81c350f1 Mon Sep 17 00:00:00 2001 From: adustm Date: Fri, 1 Jul 2016 16:36:13 +0200 Subject: [PATCH 05/83] Add missing families : F1 / F3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c | 1 + hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c | 1 + 4 files changed, 6 insertions(+) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c index 50cb7286f5..f2b15f2e98 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c @@ -163,6 +163,8 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + // Daylight Saving Time information is not available + timeinfo.tm_isdst = -1; // Convert to timestamp time_t t = mktime(&timeinfo); diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c index 838eb4083c..f49eb05025 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c @@ -182,6 +182,8 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + // Daylight Saving Time information is not available + timeinfo.tm_isdst = -1; // Convert to timestamp time_t t = mktime(&timeinfo); diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c index 2a34e5c834..5506e3ea35 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c @@ -182,6 +182,7 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + // Daylight Saving Time information is not available timeinfo.tm_isdst = -1; // Convert to timestamp diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c index 5788544ef2..c7d4ba36c2 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c @@ -182,6 +182,7 @@ time_t rtc_read(void) timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; + // Daylight Saving Time information is not available timeinfo.tm_isdst = -1; // Convert to timestamp From 99471ec1ee3a0becf6be0fe4f573f86ae2e987b2 Mon Sep 17 00:00:00 2001 From: Marcelo Salazar Date: Mon, 4 Jul 2016 14:20:24 +0100 Subject: [PATCH 06/83] Install correct version of tools --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c87fa25d27..9a28e6f308 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,6 @@ project-generator>=0.9.3,<0.10.0 junit-xml pyYAML requests -mbed-ls -mbed-greentea +mbed-ls>=0.2.13 +mbed-host-tests>=0.2.18 +mbed-greentea>=0.2.24 From fd4941f3f424b443f437f17620b50d874ca6c50d Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 16:16:58 +0200 Subject: [PATCH 07/83] [STM32F3] Fix for pmw period change The new period needs to be saved before the duty cycle is updated as the period is used in pwmout_write function. Also presclaer shall better be initiliazed properly. --- hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c index c538e6474a..abd28ca2b0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c @@ -69,6 +69,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -188,12 +189,12 @@ void pwmout_period_us(pwmout_t* obj, int us) error("Cannot initialize PWM"); } - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From 3046e5b7fea6394a6f439feebad855ff9de50331 Mon Sep 17 00:00:00 2001 From: Michel JAOUEN Date: Fri, 1 Jul 2016 17:08:00 +0200 Subject: [PATCH 08/83] [STM32F3]: Hal update release cube V1.6.0 HAL V1.3.0 --- .../TARGET_STM32F3/stm32_hal_legacy.h | 15 +- .../TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.c | 10 +- .../TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_adc.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_adc.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_adc_ex.c | 77 ++-- .../TARGET_STM32F3/stm32f3xx_hal_adc_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_can.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_can.h | 8 +- .../TARGET_STM32F3/stm32f3xx_hal_cec.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_cec.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_comp.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_comp.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_comp_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_conf.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_cortex.c | 53 +-- .../TARGET_STM32F3/stm32f3xx_hal_cortex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_crc.c | 9 +- .../TARGET_STM32F3/stm32f3xx_hal_crc.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_crc_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_crc_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dac.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dac.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dac_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dac_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_def.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dma.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dma.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_dma_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_flash.c | 6 +- .../TARGET_STM32F3/stm32f3xx_hal_flash.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_flash_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_flash_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_gpio.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_gpio.h | 7 +- .../TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_hrtim.c | 84 +++- .../TARGET_STM32F3/stm32f3xx_hal_hrtim.h | 8 +- .../TARGET_STM32F3/stm32f3xx_hal_i2c.c | 64 +-- .../TARGET_STM32F3/stm32f3xx_hal_i2c.h | 6 +- .../TARGET_STM32F3/stm32f3xx_hal_i2c_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_i2c_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_i2s.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_i2s.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_i2s_ex.c | 40 +- .../TARGET_STM32F3/stm32f3xx_hal_i2s_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_irda.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_irda.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_irda_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_iwdg.c | 350 +++++------------ .../TARGET_STM32F3/stm32f3xx_hal_iwdg.h | 122 ++---- .../TARGET_STM32F3/stm32f3xx_hal_nand.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_nand.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_nor.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_nor.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_opamp.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_opamp.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_opamp_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_opamp_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pccard.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pccard.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pcd.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pcd.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pcd_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pcd_ex.h | 2 +- .../TARGET_STM32F3/stm32f3xx_hal_pwr.c | 24 +- .../TARGET_STM32F3/stm32f3xx_hal_pwr.h | 43 +-- .../TARGET_STM32F3/stm32f3xx_hal_pwr_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_rcc.c | 16 +- .../TARGET_STM32F3/stm32f3xx_hal_rcc.h | 22 +- .../TARGET_STM32F3/stm32f3xx_hal_rcc_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_rcc_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_rtc.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_rtc.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_rtc_ex.c | 8 +- .../TARGET_STM32F3/stm32f3xx_hal_rtc_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_sdadc.c | 6 +- .../TARGET_STM32F3/stm32f3xx_hal_sdadc.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_smartcard.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_smartcard.h | 4 +- .../stm32f3xx_hal_smartcard_ex.c | 4 +- .../stm32f3xx_hal_smartcard_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_smbus.c | 16 +- .../TARGET_STM32F3/stm32f3xx_hal_smbus.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_spi.c | 12 +- .../TARGET_STM32F3/stm32f3xx_hal_spi.h | 28 +- .../TARGET_STM32F3/stm32f3xx_hal_spi_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_spi_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_sram.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_sram.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_tim.c | 6 +- .../TARGET_STM32F3/stm32f3xx_hal_tim.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_tim_ex.c | 365 +++++++++--------- .../TARGET_STM32F3/stm32f3xx_hal_tim_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_tsc.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_tsc.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_uart.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_uart.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_uart_ex.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_uart_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_usart.c | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_usart.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_usart_ex.h | 4 +- .../TARGET_STM32F3/stm32f3xx_hal_wwdg.c | 330 +++++----------- .../TARGET_STM32F3/stm32f3xx_hal_wwdg.h | 152 +++----- 106 files changed, 971 insertions(+), 1226 deletions(-) diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32_hal_legacy.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32_hal_legacy.h index d01656d14e..fe303a459b 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32_hal_legacy.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32_hal_legacy.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32_hal_legacy.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file contains aliases definition for the STM32Cube HAL constants * macros and functions maintained for legacy purpose. ****************************************************************************** @@ -150,6 +150,9 @@ #define COMP_NONINVERTINGINPUT_IO1 COMP_INPUT_PLUS_IO1 #define COMP_NONINVERTINGINPUT_IO2 COMP_INPUT_PLUS_IO2 #define COMP_NONINVERTINGINPUT_IO3 COMP_INPUT_PLUS_IO3 +#define COMP_NONINVERTINGINPUT_IO4 COMP_INPUT_PLUS_IO4 +#define COMP_NONINVERTINGINPUT_IO5 COMP_INPUT_PLUS_IO5 +#define COMP_NONINVERTINGINPUT_IO6 COMP_INPUT_PLUS_IO6 #define COMP_INVERTINGINPUT_1_4VREFINT COMP_INPUT_MINUS_1_4VREFINT #define COMP_INVERTINGINPUT_1_2VREFINT COMP_INPUT_MINUS_1_2VREFINT @@ -160,8 +163,16 @@ #define COMP_INVERTINGINPUT_DAC1 COMP_INPUT_MINUS_DAC1_CH1 #define COMP_INVERTINGINPUT_DAC2 COMP_INPUT_MINUS_DAC1_CH2 #define COMP_INVERTINGINPUT_IO1 COMP_INPUT_MINUS_IO1 +#if defined(STM32L0) +/* Issue fixed on STM32L0 COMP driver: only 2 dedicated IO (IO1 and IO2), */ +/* IO2 was wrongly assigned to IO shared with DAC and IO3 was corresponding */ +/* to the second dedicated IO (only for COMP2). */ +#define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_DAC1_CH2 +#define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO2 +#else #define COMP_INVERTINGINPUT_IO2 COMP_INPUT_MINUS_IO2 #define COMP_INVERTINGINPUT_IO3 COMP_INPUT_MINUS_IO3 +#endif #define COMP_INVERTINGINPUT_IO4 COMP_INPUT_MINUS_IO4 #define COMP_INVERTINGINPUT_IO5 COMP_INPUT_MINUS_IO5 diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.c index 8cea52cb08..536c99a6b2 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief HAL module driver. * This is the common part of the HAL initialization * @@ -70,11 +70,11 @@ * @{ */ /** - * @brief STM32F3xx HAL Driver version number V1.2.1 + * @brief STM32F3xx HAL Driver version number V1.3.0 */ #define __STM32F3xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */ -#define __STM32F3xx_HAL_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ -#define __STM32F3xx_HAL_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ +#define __STM32F3xx_HAL_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ +#define __STM32F3xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ #define __STM32F3xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F3xx_HAL_VERSION ((__STM32F3xx_HAL_VERSION_MAIN << 24)\ |(__STM32F3xx_HAL_VERSION_SUB1 << 16)\ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.h index 53ec02f065..08e3baca72 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file contains all the functions prototypes for the HAL * module driver. ****************************************************************************** diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.c index 048b8f4659..cec4304ffb 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_adc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file provides firmware functions to manage the following * functionalities of the Analog to Digital Convertor (ADC) * peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.h index 1aaa090f0e..7e079daec4 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_adc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file containing functions prototypes of ADC HAL library. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.c index 969757dece..9b8df1c9ac 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_adc_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file provides firmware functions to manage the following * functionalities of the Analog to Digital Convertor (ADC) * peripheral: @@ -6941,8 +6941,11 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_ /* Check the parameters */ assert_param(IS_ADC_MULTIMODE_MASTER_INSTANCE(hadc->Instance)); assert_param(IS_ADC_MODE(multimode->Mode)); - assert_param(IS_ADC_DMA_ACCESS_MODE(multimode->DMAAccessMode)); - assert_param(IS_ADC_SAMPLING_DELAY(multimode->TwoSamplingDelay)); + if(multimode->Mode != ADC_MODE_INDEPENDENT) + { + assert_param(IS_ADC_DMA_ACCESS_MODE(multimode->DMAAccessMode)); + assert_param(IS_ADC_SAMPLING_DELAY(multimode->TwoSamplingDelay)); + } /* Process locked */ __HAL_LOCK(hadc); @@ -6964,31 +6967,22 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_ /* control registers) */ tmpADC_Common = ADC_COMMON_REGISTER(hadc); - /* Configuration of ADC common group ADC1&ADC2, ADC3&ADC4 if available */ - /* (ADC2, ADC3, ADC4 availability depends on STM32 product) */ - /* - DMA access mode */ - MODIFY_REG(tmpADC_Common->CCR , - ADC_CCR_MDMA | - ADC_CCR_DMACFG , - multimode->DMAAccessMode | - ADC_CCR_MULTI_DMACONTREQ(hadc->Init.DMAContinuousRequests) ); - - /* Parameters that can be updated only when ADC is disabled: */ - /* - Multimode mode selection */ - /* - Multimode delay */ - /* Note: If ADC is not in the appropriate state to modify these */ - /* parameters, their setting is bypassed without error reporting */ - /* (as it can be the expected behaviour in case of intended action */ - /* to update parameter above (which fulfills the ADC state */ - /* condition: no conversion on going on group regular) */ - /* on the fly). */ - if ((ADC_IS_ENABLE(hadc) == RESET) && - (ADC_IS_ENABLE(&tmphadcSharingSameCommonRegister) == RESET) ) + /* If multimode is selected, configure all multimode paramaters. */ + /* Otherwise, reset multimode parameters (can be used in case of */ + /* transition from multimode to independent mode). */ + if(multimode->Mode != ADC_MODE_INDEPENDENT) { /* Configuration of ADC common group ADC1&ADC2, ADC3&ADC4 if available */ /* (ADC2, ADC3, ADC4 availability depends on STM32 product) */ - /* - set the selected multimode */ /* - DMA access mode */ + MODIFY_REG(tmpADC_Common->CCR , + ADC_CCR_MDMA | + ADC_CCR_DMACFG , + multimode->DMAAccessMode | + ADC_CCR_MULTI_DMACONTREQ(hadc->Init.DMAContinuousRequests) ); + + /* Parameters that can be updated only when ADC is disabled: */ + /* - Multimode mode selection */ /* - Set delay between two sampling phases */ /* Note: Delay range depends on selected resolution: */ /* from 1 to 12 clock cycles for 12 bits */ @@ -6997,11 +6991,34 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_ /* from 1 to 6 clock cycles for 6 bits */ /* If a higher delay is selected, it will be clamped to maximum delay */ /* range */ - MODIFY_REG(tmpADC_Common->CCR , - ADC_CCR_MULTI | - ADC_CCR_DELAY , - multimode->Mode | - multimode->TwoSamplingDelay ); + /* Note: If ADC is not in the appropriate state to modify these */ + /* parameters, their setting is bypassed without error reporting */ + /* (as it can be the expected behaviour in case of intended action */ + /* to update parameter above (which fulfills the ADC state */ + /* condition: no conversion on going on group regular) */ + /* on the fly). */ + if ((ADC_IS_ENABLE(hadc) == RESET) && + (ADC_IS_ENABLE(&tmphadcSharingSameCommonRegister) == RESET) ) + { + MODIFY_REG(tmpADC_Common->CCR , + ADC_CCR_MULTI | + ADC_CCR_DELAY , + multimode->Mode | + multimode->TwoSamplingDelay ); + } + } + else /* ADC_MODE_INDEPENDENT */ + { + CLEAR_BIT(tmpADC_Common->CCR, ADC_CCR_MDMA | ADC_CCR_DMACFG); + + /* Parameters that can be updated only when ADC is disabled: */ + /* - Multimode mode selection */ + /* - Multimode delay */ + if ((ADC_IS_ENABLE(hadc) == RESET) && + (ADC_IS_ENABLE(&tmphadcSharingSameCommonRegister) == RESET) ) + { + CLEAR_BIT(tmpADC_Common->CCR, ADC_CCR_MULTI | ADC_CCR_DELAY); + } } } /* If one of the ADC sharing the same common group is enabled, no update */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.h index 328340bf27..ee14413ffe 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_adc_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_adc_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file containing functions prototypes of ADC HAL library. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.c index bf6212709e..32755a68a1 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_can.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief CAN HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Controller Area Network (CAN) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.h index dd6f07f344..f5650a4b20 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_can.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_can.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of CAN HAL module. ****************************************************************************** * @attention @@ -239,7 +239,7 @@ typedef struct __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ __IO uint32_t ErrorCode; /*!< CAN Error code - This parameter can be a value of @ref HAL_CAN_Error_Code */ + This parameter can be a value of @ref CAN_Error_Code */ }CAN_HandleTypeDef; /** @@ -252,7 +252,7 @@ typedef struct * @{ */ -/** @defgroup HAL_CAN_Error_Code CAN Error Code +/** @defgroup CAN_Error_Code CAN Error Code * @{ */ #define HAL_CAN_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.c index df6acb4257..d66898c9b0 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_cec.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief CEC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the High Definition Multimedia Interface diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.h index f9569fe8c8..24892a5f12 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cec.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_cec.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of CEC HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.c index 2f80df57f8..f5a7cbc2f1 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_comp.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief COMP HAL module driver. * This file provides firmware functions to manage the following * functionalities of the COMP peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.h index 61eff111fd..5041ce9733 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_comp.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of COMP HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp_ex.h index 8bb83cc6cd..b621a5ece1 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_comp_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_comp_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of COMP HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_conf.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_conf.h index 7e3f231249..310db53d91 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_conf.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_conf.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_conf.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief HAL configuration file. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.c index bf07e4be43..2f86ddfdf2 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_cortex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief CORTEX HAL module driver. * This file provides firmware functions to manage the following * functionalities of the CORTEX: @@ -22,30 +22,8 @@ This section provides functions allowing to configure the NVIC interrupts (IRQ). The Cortex-M4 exceptions are managed by CMSIS functions. - (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() - function according to the following table. + (#) Configure the NVIC Priority Grouping using HAL_NVIC_SetPriorityGrouping() function - @brief CORTEX_NVIC_Priority_Table - The table below gives the allowed values of the pre-emption priority and subpriority according - to the Priority Grouping configuration performed by HAL_NVIC_SetPriorityGrouping() function - ========================================================================================================================== - NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description - ========================================================================================================================== - NVIC_PRIORITYGROUP_0 | 0 | 0-15 | 0 bits for pre-emption priority - | | | 4 bits for subpriority - -------------------------------------------------------------------------------------------------------------------------- - NVIC_PRIORITYGROUP_1 | 0-1 | 0-7 | 1 bits for pre-emption priority - | | | 3 bits for subpriority - -------------------------------------------------------------------------------------------------------------------------- - NVIC_PRIORITYGROUP_2 | 0-3 | 0-3 | 2 bits for pre-emption priority - | | | 2 bits for subpriority - -------------------------------------------------------------------------------------------------------------------------- - NVIC_PRIORITYGROUP_3 | 0-7 | 0-1 | 3 bits for pre-emption priority - | | | 1 bits for subpriority - -------------------------------------------------------------------------------------------------------------------------- - NVIC_PRIORITYGROUP_4 | 0-15 | 0 | 4 bits for pre-emption priority - | | | 0 bits for subpriority - ========================================================================================================================== (#) Configure the priority of the selected IRQ Channels using HAL_NVIC_SetPriority() (#) Enable the selected IRQ Channels using HAL_NVIC_EnableIRQ() @@ -120,6 +98,31 @@ ****************************************************************************** */ +/* + Additional Tables: CORTEX_NVIC_Priority_Table + The table below gives the allowed values of the pre-emption priority and subpriority according + to the Priority Grouping configuration performed by HAL_NVIC_SetPriorityGrouping() function + ========================================================================================================================== + NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description + ========================================================================================================================== + NVIC_PRIORITYGROUP_0 | 0 | 0-15 | 0 bits for pre-emption priority + | | | 4 bits for subpriority + -------------------------------------------------------------------------------------------------------------------------- + NVIC_PRIORITYGROUP_1 | 0-1 | 0-7 | 1 bits for pre-emption priority + | | | 3 bits for subpriority + -------------------------------------------------------------------------------------------------------------------------- + NVIC_PRIORITYGROUP_2 | 0-3 | 0-3 | 2 bits for pre-emption priority + | | | 2 bits for subpriority + -------------------------------------------------------------------------------------------------------------------------- + NVIC_PRIORITYGROUP_3 | 0-7 | 0-1 | 3 bits for pre-emption priority + | | | 1 bits for subpriority + -------------------------------------------------------------------------------------------------------------------------- + NVIC_PRIORITYGROUP_4 | 0-15 | 0 | 4 bits for pre-emption priority + | | | 0 bits for subpriority + ========================================================================================================================== + +*/ + /* Includes ------------------------------------------------------------------*/ #include "stm32f3xx_hal.h" diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.h index b00b6c9bb9..da687cb9c9 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_cortex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_cortex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of CORTEX HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.c index e076117ca3..55572a924a 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_crc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief CRC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Cyclic Redundancy Check (CRC) peripheral: @@ -214,9 +214,12 @@ HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc) /* Change CRC peripheral state */ hcrc->State = HAL_CRC_STATE_BUSY; - + /* Reset CRC calculation unit */ __HAL_CRC_DR_RESET(hcrc); + + /* Reset IDR register content */ + CLEAR_BIT(hcrc->Instance->IDR, CRC_IDR_IDR) ; /* DeInit the low level hardware */ HAL_CRC_MspDeInit(hcrc); diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.h index 9203e11d98..db70dee6fd 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_crc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of CRC HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.c index b3f2ffc10f..d45b34d289 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_crc_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended CRC HAL module driver. * This file provides firmware functions to manage the extended * functionalities of the CRC peripheral. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.h index a37e35df6c..5cc4f5bf08 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_crc_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_crc_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of CRC HAL extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.c index a65bfc4763..8b1858a133 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dac.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief DAC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Digital to Analog Converter (DAC) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.h index f4c9174e0c..de1a7bc2c2 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dac.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of DAC HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.c index 8f896c3e9b..6b0de964a5 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dac_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief DACEx HAL module driver. * This file provides firmware functions to manage the extended * functionalities of the DAC peripheral. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.h index f7c56ab643..05bd228bc8 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dac_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dac_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of DAC HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_def.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_def.h index 7dae63f6f1..760b04dd45 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_def.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_def.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_def.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file contains HAL common defines, enumeration, macros and * structures definitions. ****************************************************************************** diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.c index 8507b695d6..e8199fb813 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dma.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief DMA HAL module driver. * * This file provides firmware functions to manage the following diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.h index e67e2a86db..2f4e4a46a7 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dma.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of DMA HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma_ex.h index 2af71cc9b0..f8e1ddb3c6 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_dma_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_dma_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of DMA HAL extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.c index 70e70b1205..ee98bd9e6c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_flash.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief FLASH HAL module driver. * This file provides firmware functions to manage the following * functionalities of the internal FLASH memory: @@ -578,7 +578,7 @@ HAL_StatusTypeDef HAL_FLASH_OB_Launch(void) * @verbatim =============================================================================== - ##### Peripheral errors functions ##### + ##### Peripheral Errors functions ##### =============================================================================== [..] This subsection permit to get in run-time errors of the FLASH peripheral. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.h index 4dd8a41a41..8ac517a197 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_flash.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of Flash HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.c index e331f081ec..2b6718f530 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_flash_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended FLASH HAL module driver. * * This file provides firmware functions to manage the following diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.h index e4017da8e4..c596850cf7 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_flash_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_flash_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of Flash HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.c index 8ad4def37a..4701849bbe 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_gpio.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief GPIO HAL module driver. * This file provides firmware functions to manage the following * functionalities of the General Purpose Input/Output (GPIO) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.h index 9bb5f44479..744ba6eca6 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_gpio.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of GPIO HAL module. ****************************************************************************** * @attention @@ -229,7 +229,8 @@ typedef enum */ #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) -#define IS_GPIO_PIN(__PIN__) (((__PIN__) & GPIO_PIN_MASK) != (uint32_t)0x00) +#define IS_GPIO_PIN(__PIN__) ((((__PIN__) & GPIO_PIN_MASK) != (uint32_t)0x00) &&\ + (((__PIN__) & ~GPIO_PIN_MASK) == (uint32_t)0x00)) #define IS_GPIO_MODE(__MODE__) (((__MODE__) == GPIO_MODE_INPUT) ||\ ((__MODE__) == GPIO_MODE_OUTPUT_PP) ||\ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h index 41eb5d71cb..94becc8e59 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_gpio_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of GPIO HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.c index ebc0d78bbe..f4f063f4dd 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_hrtim.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief TIM HAL module driver. * This file provides firmware functions to manage the following * functionalities of the High Resolution Timer (HRTIM) peripheral: @@ -1258,6 +1258,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCChannelConfig(HRTIM_HandleTypeDef * hhrtim, CompareUnit = HRTIM_COMPAREUNIT_2; } break; + default: + break; } CompareCfg.CompareValue = pSimpleOCChannelCfg->Pulse; @@ -1318,6 +1320,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCChannelConfig(HRTIM_HandleTypeDef * hhrtim, OutputCfg.SetSource = HRTIM_OUTPUTSET_NONE; } break; + default: + break; } HRTIM_OutputConfig(hhrtim, @@ -1822,6 +1826,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMChannelConfig(HRTIM_HandleTypeDef * hhrtim, CompareUnit = HRTIM_COMPAREUNIT_2; } break; + default: + break; } CompareCfg.CompareValue = pSimplePWMChannelCfg->Pulse; @@ -2030,6 +2036,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); } break; + default: + break; } /* Enable the timer counter */ @@ -2104,6 +2112,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); } break; + default: + break; } /* Disable the timer counter */ @@ -2213,6 +2223,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP2); } break; + default: + break; } /* Enable the timer counter */ @@ -2295,6 +2307,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_DMA(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP2); } break; + default: + break; } /* Disable the timer counter */ @@ -2452,6 +2466,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger2; } break; + default: + break; } /* Enable the timer counter */ @@ -2507,6 +2523,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = HRTIM_CAPTURETRIGGER_NONE; } break; + default: + break; } /* Disable the timer counter */ @@ -2573,6 +2591,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2); } break; + default: + break; } /* Enable the timer counter */ @@ -2635,6 +2655,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2); } break; + default: + break; } /* Disable the timer counter */ @@ -2722,7 +2744,9 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_DMA(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT2); } break; - } + default: + break; + } /* Enable the timer counter */ __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); @@ -2793,6 +2817,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_DMA(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT2); } break; + default: + break; } /* Disable the timer counter */ @@ -2924,6 +2950,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseChannelConfig(HRTIM_HandleTypeDef * hh CompareUnit = HRTIM_COMPAREUNIT_2; } break; + default: + break; } CompareCfg.CompareValue = pSimpleOnePulseChannelCfg->Pulse; @@ -3143,6 +3171,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStart_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); } break; + default: + break; } /* Enable the timer counter */ @@ -3217,6 +3247,8 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStop_IT(HRTIM_HandleTypeDef * hhrtim, __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); } break; + default: + break; } /* Disable the timer counter */ @@ -3709,6 +3741,8 @@ HAL_StatusTypeDef HAL_HRTIM_ADCTriggerConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sCommonRegs.ADC4R = pADCTriggerCfg->Trigger; } break; + default: + break; } /* Update the HRTIM registers */ @@ -3995,6 +4029,8 @@ HAL_StatusTypeDef HAL_HRTIM_TimerEventFilteringConfig(HRTIM_HandleTypeDef * hhrt hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; } break; + default: + break; } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -4218,6 +4254,8 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMAConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sCommonRegs.BDMUPR = RegistersToUpdate; } break; + default: + break; } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -4298,6 +4336,8 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCompareConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sMasterRegs.MCMP4R = pCompareCfg->CompareValue; } break; + default: + break; } } else @@ -4372,6 +4412,8 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCompareConfig(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -4431,6 +4473,8 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCaptureConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = pCaptureCfg->Trigger; } break; + default: + break; } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -4594,6 +4638,8 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformSetOutputLevel(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -5175,6 +5221,8 @@ HAL_StatusTypeDef HAL_HRTIM_SoftwareCapture(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR |= HRTIM_CPT2CR_SWCPT; } break; + default: + break; } hhrtim->State = HAL_HRTIM_STATE_READY; @@ -5492,6 +5540,8 @@ uint32_t HAL_HRTIM_GetCapturedValue(HRTIM_HandleTypeDef * hhrtim, captured_value = hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xR; } break; + default: + break; } return captured_value; @@ -5567,6 +5617,8 @@ uint32_t HAL_HRTIM_WaveformGetOutputLevel(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } return output_level; @@ -5659,6 +5711,8 @@ uint32_t HAL_HRTIM_WaveformGetOutputState(HRTIM_HandleTypeDef * hhrtim, output_bit = HRTIM_OENR_TE2OEN; } break; + default: + break; } if ((hhrtim->Instance->sCommonRegs.OENR & output_bit) != RESET) @@ -5756,6 +5810,8 @@ uint32_t HAL_HRTIM_GetDelayedProtectionStatus(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } return delayed_protection_status; @@ -6702,6 +6758,8 @@ static void HRTIM_TimingUnitWaveform_Config(HRTIM_HandleTypeDef * hhrtim, hrtim_bmcr |= ( pTimerCfg->BurstMode << 5); } break; + default: + break; } /* Update the HRTIM registers */ @@ -6750,6 +6808,8 @@ static void HRTIM_CompareUnitConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sMasterRegs.MCMP4R = pCompareCfg->CompareValue; } break; + default: + break; } } else @@ -6777,6 +6837,8 @@ static void HRTIM_CompareUnitConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].CMP4xR = pCompareCfg->CompareValue; } break; + default: + break; } } } @@ -6848,6 +6910,8 @@ static void HRTIM_CaptureUnitConfig(HRTIM_HandleTypeDef * hhrtim, CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_10; } break; + default: + break; } switch (CaptureUnit) @@ -6862,6 +6926,8 @@ static void HRTIM_CaptureUnitConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->TimerParam[TimerIdx].CaptureTrigger2 = CaptureTrigger; } break; + default: + break; } } @@ -6914,6 +6980,8 @@ static void HRTIM_OutputConfig(HRTIM_HandleTypeDef * hhrtim, shift = 16; } break; + default: + break; } /* Clear output config */ @@ -7176,6 +7244,8 @@ static void HRTIM_TIM_ResetConfig(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_10; } break; + default: + break; } } @@ -7268,6 +7338,8 @@ static uint32_t HRTIM_GetITFromOCMode(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } return interrupt; @@ -7362,6 +7434,8 @@ static uint32_t HRTIM_GetDMAFromOCMode(HRTIM_HandleTypeDef * hhrtim, } } break; + default: + break; } return dma_request; @@ -7404,6 +7478,8 @@ static DMA_HandleTypeDef * HRTIM_GetDMAHandleFromTimerIdx(HRTIM_HandleTypeDef * hdma = hhrtim->hdmaTimerE; } break; + default: + break; } return hdma; @@ -7483,6 +7559,8 @@ static void HRTIM_ForceRegistersUpdate(HRTIM_HandleTypeDef * hhrtim, hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TESWU; } break; + default: + break; } } diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.h index ed9f58c85d..cb5eedce3f 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_hrtim.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_hrtim.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of HRTIM HAL module. ****************************************************************************** * @attention @@ -2116,8 +2116,8 @@ typedef struct { ((TIMDELAYEDPROTECTION) == HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_DELAYEDBOTH_EEV7)) \ || \ (((TIMPUSHPULLMODE) == HRTIM_TIMPUSHPULLMODE_ENABLED) && \ - ((TIMDELAYEDPROTECTION) == HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV6) || \ - ((TIMDELAYEDPROTECTION) == HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7))) + (((TIMDELAYEDPROTECTION) == HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV6) || \ + ((TIMDELAYEDPROTECTION) == HRTIM_TIMER_A_B_C_DELAYEDPROTECTION_BALANCED_EEV7)))) #define IS_HRTIM_TIMUPDATETRIGGER(TIMUPDATETRIGGER) (((TIMUPDATETRIGGER) & 0xFE07FFFFU) == 0x00000000) diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.c index 2c2b2330b2..9855ff27e9 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2c.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief I2C HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Inter Integrated Circuit (I2C) peripheral: @@ -88,7 +88,7 @@ *** Interrupt mode IO sequential operation *** - =================================== + ============================================== [..] (@) These interfaces allow to manage a sequential transfer with a repeated start condition when a direction change during transfer @@ -115,8 +115,6 @@ (++) Abort a master I2C process communication with Interrupt using HAL_I2C_Master_Abort_IT() (+++) End of abort process, HAL_I2C_AbortCpltCallback() is executed and user can add his own code by customization of function pointer HAL_I2C_AbortCpltCallback() - (+++) mean HAL_I2C_MasterTxCpltCallback() in case of previous state was master transmit - (+++) mean HAL_I2c_MasterRxCpltCallback() in case of previous state was master receive (++) Enable/disable the Address listen mode in slave I2C mode using HAL_I2C_EnableListen_IT() HAL_I2C_DisableListen_IT() (+++) When address slave I2C match, HAL_I2C_AddrCallback() is executed and user can add his own code to check the Address Match Code and the transmission direction request by master (Write/Read). @@ -613,7 +611,8 @@ HAL_StatusTypeDef HAL_I2C_DeInit(I2C_HandleTypeDef *hi2c) * @brief Transmits in master mode an amount of data in blocking mode. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param Timeout Timeout duration @@ -736,7 +735,8 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevA * @brief Receives in master mode an amount of data in blocking mode. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param Timeout Timeout duration @@ -1131,7 +1131,8 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, * @brief Transmit in master mode an amount of data in non-blocking mode with Interrupt * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @retval HAL status @@ -1199,7 +1200,8 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t D * @brief Receive in master mode an amount of data in non-blocking mode with Interrupt * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @retval HAL status @@ -1365,7 +1367,8 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pDa * @brief Transmit in master mode an amount of data in non-blocking mode with DMA * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @retval HAL status @@ -1472,7 +1475,8 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t * @brief Receive in master mode an amount of data in non-blocking mode with DMA * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @retval HAL status @@ -1709,7 +1713,8 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pD * @brief Write an amount of data in blocking mode to a specific memory address * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -1860,7 +1865,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress * @brief Read an amount of data in blocking mode from a specific memory address * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -2003,7 +2009,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, * @brief Write an amount of data in non-blocking mode with Interrupt to a specific memory address * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -2101,7 +2108,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddr * @brief Read an amount of data in non-blocking mode with Interrupt from a specific memory address * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -2198,7 +2206,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddre * @brief Write an amount of data in non-blocking mode with DMA to a specific memory address * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -2313,7 +2322,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAdd * @brief Reads an amount of data in non-blocking mode with DMA from a specific memory address. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param pData Pointer to data buffer @@ -2428,7 +2438,8 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddr * @note This function is used with Memory devices * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param Trials Number of trials * @param Timeout Timeout duration * @retval HAL status @@ -2545,7 +2556,8 @@ HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAdd * @note This interface allow to manage repeated start condition when a direction change during transfer * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param XferOptions Options of Transfer, value of @ref I2C_XFEROPTIONS @@ -2618,7 +2630,8 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, * @note This interface allow to manage repeated start condition when a direction change during transfer * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param XferOptions Options of Transfer, value of @ref I2C_XFEROPTIONS @@ -2876,7 +2889,8 @@ HAL_StatusTypeDef HAL_I2C_DisableListen_IT(I2C_HandleTypeDef *hi2c) * @brief Abort a master I2C IT or DMA process communication with Interrupt. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @retval HAL status */ HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress) @@ -3054,7 +3068,7 @@ __weak void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c) * @brief Slave Address Match callback. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param TransferDirection: Master request Transfer Direction (Write/Read), value of @ref I2C_XFEROPTIONS + * @param TransferDirection: Master request Transfer Direction (Write/Read), value of @ref I2C_XFERDIRECTION * @param AddrMatchCode: Address Match Code * @retval None */ @@ -3593,7 +3607,8 @@ static HAL_StatusTypeDef I2C_Slave_ISR_DMA(struct __I2C_HandleTypeDef *hi2c, uin * @brief Master sends target device address followed by internal memory address for write request. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param Timeout Timeout duration @@ -3659,7 +3674,8 @@ return HAL_OK; * @brief Master sends target device address followed by internal memory address for read request. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains * the configuration information for the specified I2C. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param MemAddress Internal memory address * @param MemAddSize Size of internal memory address * @param Timeout Timeout duration diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.h index c62fbc1569..53607046f9 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2c.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of I2C HAL module. ****************************************************************************** * @attention @@ -314,7 +314,7 @@ typedef struct __I2C_HandleTypeDef * @} */ -/** @defgroup I2C_XferDirection I2C Transfer Direction +/** @defgroup I2C_XFERDIRECTION I2C Transfer Direction Master Point of View * @{ */ #define I2C_DIRECTION_TRANSMIT (0x00000000U) diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.c index b09352190f..1e89a9fefc 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2c_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief I2C Extended HAL module driver. * This file provides firmware functions to manage the following * functionalities of I2C Extended peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.h index 98504d3c61..409f71a0eb 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2c_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2c_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of I2C HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.c index 01cd2e0f04..95efe4e06e 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2s.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief I2S HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Integrated Interchip Sound (I2S) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.h index 491773e31f..30e636f4fc 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2s.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of I2S HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.c index 4cddbc6f5e..b6b5a3d16c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2s_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief I2S Extended HAL module driver. * This file provides firmware functions to manage the following * functionalities of I2S Extended peripheral: @@ -19,21 +19,7 @@ called I2Sxext ie. I2S2ext for SPI2 and I2S3ext for SPI3). (#) The Extended block is not a full SPI IP, it is used only as I2S slave to implement full duplex mode. The Extended block uses the same clock sources - as its master (refer to the following Figure). - - +-----------------------+ - I2Sx_SCK | | - ----------+-->| I2Sx |------------------->I2Sx_SD(in/out) - +--|-->| | - | | +-----------------------+ - | | - I2S_WS | | - ------>| | - | | +-----------------------+ - | +-->| | - | | I2Sx_ext |------------------->I2Sx_extSD(in/out) - +----->| | - +-----------------------+ + as its master. (#) Both I2Sx and I2Sx_ext can be configured as transmitters or receivers. @@ -115,6 +101,26 @@ ****************************************************************************** */ +/* + Additional Figure: The Extended block uses the same clock sources as its master. + (refer to the following Figure). + + +-----------------------+ + I2Sx_SCK | | + ----------+-->| I2Sx |------------------->I2Sx_SD(in/out) + +--|-->| | + | | +-----------------------+ + | | + I2S_WS | | + ------>| | + | | +-----------------------+ + | +-->| | + | | I2Sx_ext |------------------->I2Sx_extSD(in/out) + +----->| | + +-----------------------+ + +*/ + /* Includes ------------------------------------------------------------------*/ #include "stm32f3xx_hal.h" diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.h index e8d6ec919c..d5de540a20 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_i2s_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_i2s_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of I2S HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.c index 3a1a0d91e9..2abf5312b0 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_irda.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief IRDA HAL module driver. * This file provides firmware functions to manage the following * functionalities of the IrDA (Infrared Data Association) Peripheral diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.h index 3e80be0a91..8f3a47bd64 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_irda.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file contains all the functions prototypes for the IRDA * firmware library. ****************************************************************************** diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda_ex.h index f818f227a6..b9ff375d7c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_irda_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_irda_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of IRDA HAL Extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.c index 690e99b790..c70273a7b7 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.c @@ -2,37 +2,43 @@ ****************************************************************************** * @file stm32f3xx_hal_iwdg.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 - * @brief IWDG HAL module driver. + * @version V1.3.0 + * @date 01-July-2016 + * @brief IWDG HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Independent Watchdog (IWDG) peripheral: - * + Initialization and de-initialization functions + * + Initialization and Start functions * + IO operation functions - * + Peripheral State functions - * + * @verbatim ============================================================================== ##### IWDG Generic features ##### ============================================================================== - [..] + [..] (+) The IWDG can be started by either software or hardware (configurable - through option byte). + through option byte). - (+) The IWDG is clocked by its own dedicated Low-Speed clock (LSI) and - thus stays active even if the main clock fails. - Once the IWDG is started, the LSI is forced ON and cannot be disabled - (LSI cannot be disabled too), and the counter starts counting down from - the reset value of 0xFFF. When it reaches the end of count value (0x000) - a system reset is generated. + (+) The IWDG is clocked by Low-Speed clock (LSI) and thus stays active even + if the main clock fails. - (+) The IWDG counter should be refreshed at regular intervals, otherwise the - watchdog generates an MCU reset when the counter reaches 0. + (+) Once the IWDG is started, the LSI is forced ON and both can not be + disabled. The counter starts counting down from the reset value (0xFFF). + When it reaches the end of count value (0x000) a reset signal is + generated (IWDG reset). + + (+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register, + the IWDG_RLR value is reloaded in the counter and the watchdog reset is + prevented. (+) The IWDG is implemented in the VDD voltage domain that is still functional - in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY). - IWDGRST flag in RCC_CSR register can be used to inform when an IWDG - reset occurs. + in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY). + IWDGRST flag in RCC_CSR register can be used to inform when an IWDG + reset occurs. + + (+) Debug mode : When the microcontroller enters debug mode (core halted), + the IWDG counter either continues to work normally or stops, depending + on DBG_IWDG_STOP configuration bit in DBG module, accessible through + __HAL_DBGMCU_FREEZE_IWDG() and __HAL_DBGMCU_UNFREEZE_IWDG() macros [..] Min-max timeout value @41KHz (LSI): ~0.1ms / ~25.5s The IWDG timeout may vary due to LSI frequency dispersion. STM32L4xx @@ -40,44 +46,37 @@ connected internally to TIM16 CH1 input capture). The measured value can be used to have an IWDG timeout with an acceptable accuracy. - ##### How to use this driver ##### ============================================================================== - [..] - If Window option is disabled - - (+) Use IWDG using HAL_IWDG_Init() function to : - (++) Enable write access to IWDG_PR, IWDG_RLR. - (++) Configure the IWDG prescaler, counter reload value. - This reload value will be loaded in the IWDG counter each time the counter - is reloaded, then the IWDG will start counting down from this value. - (+) Use IWDG using HAL_IWDG_Start() function to : - (++) Reload IWDG counter with value defined in the IWDG_RLR register. - (++) Start the IWDG, when the IWDG is used in software mode (no need - to enable the LSI, it will be enabled by hardware). - (+) Then the application program must refresh the IWDG counter at regular - intervals during normal operation to prevent an MCU reset, using - HAL_IWDG_Refresh() function. - [..] - if Window option is enabled: - - (+) Use IWDG using HAL_IWDG_Start() function to enable IWDG downcounter - (+) Use IWDG using HAL_IWDG_Init() function to : - (++) Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. - (++) Configure the IWDG prescaler, reload value and window value. - (+) Then the application program must refresh the IWDG counter at regular - intervals during normal operation to prevent an MCU reset, using - HAL_IWDG_Refresh() function. + [..] + (#) Use IWDG using HAL_IWDG_Init() function to : + (++) Enable instance by writing Start keyword in IWDG_KEY register. LSI + clock is forced ON and IWDG counter starts downcounting. + (++) Enable write access to configuration register: IWDG_PR, IWDG_RLR & + IWDG_WINR. + (++) Configure the IWDG prescaler and counter reload value. This reload + value will be loaded in the IWDG counter each time the watchdog is + reloaded, then the IWDG will start counting down from this value. + (++) wait for status flags to be reset" + (++) Depending on window parameter: + (+++) If Window Init parameter is same as Window register value, + nothing more is done but reload counter value in order to exit + function withy exact time base. + (+++) Else modify Window register. This will automatically reload + watchdog counter. + + (#) Then the application program must refresh the IWDG counter at regular + intervals during normal operation to prevent an MCU reset, using + HAL_IWDG_Refresh() function. *** IWDG HAL driver macros list *** ==================================== [..] - Below the list of most used macros in IWDG HAL driver. - + Below the list of most used macros in IWDG HAL driver: (+) __HAL_IWDG_START: Enable the IWDG peripheral - (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in the reload register - (+) __HAL_IWDG_GET_FLAG: Get the selected IWDG's flag status - + (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in + the reload register + @endverbatim ****************************************************************************** * @attention @@ -116,63 +115,63 @@ * @{ */ -/** @defgroup IWDG IWDG +#ifdef HAL_IWDG_MODULE_ENABLED +/** @addtogroup IWDG * @brief IWDG HAL module driver. * @{ */ -#ifdef HAL_IWDG_MODULE_ENABLED - /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /** @defgroup IWDG_Private_Defines IWDG Private Defines * @{ */ - -#define HAL_IWDG_DEFAULT_TIMEOUT (uint32_t)1000 -/* Local define used to check the SR status register */ -#define IWDG_SR_FLAGS (IWDG_FLAG_PVU | IWDG_FLAG_RVU | IWDG_FLAG_WVU) - +/* Status register need 5 RC LSI divided by prescaler clock to be updated. With + higher prescaler (256), and according to HSI variation, we need to wait at + least 6 cycles so 48 ms. */ +#define HAL_IWDG_DEFAULT_TIMEOUT 48u /** * @} */ + /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Exported functions --------------------------------------------------------*/ -/** @defgroup IWDG_Exported_Functions IWDG Exported Functions +/** @addtogroup IWDG_Exported_Functions * @{ */ -/** @defgroup IWDG_Exported_Functions_Group1 Initialization and de-initialization functions - * @brief Initialization and Configuration functions. +/** @addtogroup IWDG_Exported_Functions_Group1 + * @brief Initialization and Start functions. * @verbatim =============================================================================== - ##### Initialization and de-initialization functions ##### + ##### Initialization and Start functions ##### =============================================================================== - [..] This section provides functions allowing to: - (+) Initialize the IWDG according to the specified parameters - in the IWDG_InitTypeDef and create the associated handle - (+) Manage Window option - (+) Initialize the IWDG MSP - (+) DeInitialize the IWDG MSP + [..] This section provides functions allowing to: + (+) Initialize the IWDG according to the specified parameters in the + IWDG_InitTypeDef of associated handle. + (+) Manage Window option. + (+) Once initialization is performed in HAL_IWDG_Init function, Watchdog + is reloaded in order to exit function with correct time base. @endverbatim * @{ */ /** - * @brief Initialize the IWDG according to the specified - * parameters in the IWDG_InitTypeDef and initialize the associated handle. - * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains + * @brief Initialize the IWDG according to the specified parameters in the + * IWDG_InitTypeDef and start watchdog. Before exiting function, + * watchdog is refreshed in order to have correct time base. + * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains * the configuration information for the specified IWDG module. * @retval HAL status */ HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg) { - uint32_t tickstart = 0; + uint32_t tickstart; /* Check the IWDG handle allocation */ if(hiwdg == NULL) @@ -181,227 +180,88 @@ HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg) } /* Check the parameters */ + assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance)); assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler)); assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload)); assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window)); - /* Check pending flag, if previous update not done, return error */ - if(((hiwdg->Instance->SR) & IWDG_SR_FLAGS) != 0) - { - return HAL_ERROR; - } + /* Enable IWDG. LSI is turned on automaticaly */ + __HAL_IWDG_START(hiwdg); - if(hiwdg->State == HAL_IWDG_STATE_RESET) - { - /* Allocate lock resource and initialize it */ - hiwdg->Lock = HAL_UNLOCKED; - - /* Init the low level hardware */ - HAL_IWDG_MspInit(hiwdg); - } - - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_BUSY; - - /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers */ - /* by writing 0x5555 in KR */ + /* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing + 0x5555 in KR */ IWDG_ENABLE_WRITE_ACCESS(hiwdg); - /* Write to IWDG registers the IWDG_Prescaler & IWDG_Reload values to work with */ - MODIFY_REG(hiwdg->Instance->PR, IWDG_PR_PR, hiwdg->Init.Prescaler); - MODIFY_REG(hiwdg->Instance->RLR, IWDG_RLR_RL, hiwdg->Init.Reload); + /* Write to IWDG registers the Prescaler & Reload values to work with */ + hiwdg->Instance->PR = hiwdg->Init.Prescaler; + hiwdg->Instance->RLR = hiwdg->Init.Reload; - /* check if window option is enabled */ - if (((hiwdg->Init.Window) != IWDG_WINDOW_DISABLE) || ((hiwdg->Instance->WINR) != IWDG_WINDOW_DISABLE)) + /* Check pending flag, if previous update not done, return timeout */ + tickstart = HAL_GetTick(); + + /* Wait for register to be updated */ + while(hiwdg->Instance->SR != RESET) { - tickstart = HAL_GetTick(); - - /* Wait for register to be updated */ - while(((hiwdg->Instance->SR) & IWDG_SR_FLAGS) != 0) + if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT) { - if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT) - { - /* Set IWDG state */ - hiwdg->State = HAL_IWDG_STATE_TIMEOUT; - return HAL_TIMEOUT; - } + return HAL_TIMEOUT; } - - /* Write to IWDG WINR the IWDG_Window value to compare with */ - MODIFY_REG(hiwdg->Instance->WINR, IWDG_WINR_WIN, hiwdg->Init.Window); } - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_READY; + /* If window parameter is different than current value, modify window + register */ + if(hiwdg->Instance->WINR != hiwdg->Init.Window) + { + /* Write to IWDG WINR the IWDG_Window value to compare with. In any case, + even if window feature is disabled, Watchdog will be reloaded by writing + windows register */ + hiwdg->Instance->WINR = hiwdg->Init.Window; + } + else + { + /* Reload IWDG counter with value defined in the reload register */ + __HAL_IWDG_RELOAD_COUNTER(hiwdg); + } /* Return function status */ return HAL_OK; } -/** - * @brief Initialize the IWDG MSP. - * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains - * the configuration information for the specified IWDG module. - * @retval None - */ -__weak void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg) -{ - /* Prevent unused argument(s) compilation warning */ - UNUSED(hiwdg); - - /* NOTE : This function should not be modified, when the callback is needed, - the HAL_IWDG_MspInit could be implemented in the user file - */ -} - /** * @} */ -/** @defgroup IWDG_Exported_Functions_Group2 IO operation functions - * @brief IO operation functions + +/** @addtogroup IWDG_Exported_Functions_Group2 + * @brief IO operation functions * @verbatim =============================================================================== ##### IO operation functions ##### =============================================================================== - [..] This section provides functions allowing to: - (+) Start the IWDG. + [..] This section provides functions allowing to: (+) Refresh the IWDG. @endverbatim * @{ */ -/** - * @brief Start the IWDG. - * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains - * the configuration information for the specified IWDG module. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_IWDG_Start(IWDG_HandleTypeDef *hiwdg) -{ - uint32_t tickstart = 0; - - /* Process locked */ - __HAL_LOCK(hiwdg); - - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_BUSY; - - /* Reload IWDG counter with value defined in the RLR register */ - if ((hiwdg->Init.Window) == IWDG_WINDOW_DISABLE) - { - __HAL_IWDG_RELOAD_COUNTER(hiwdg); - } - - /* Start the IWDG peripheral */ - __HAL_IWDG_START(hiwdg); - - tickstart = HAL_GetTick(); - - /* Wait until PVU, RVU, WVU flag are RESET */ - while(((hiwdg->Instance->SR) & IWDG_SR_FLAGS) != 0) - { - - if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT) - { - /* Set IWDG state */ - hiwdg->State = HAL_IWDG_STATE_TIMEOUT; - - /* Process unlocked */ - __HAL_UNLOCK(hiwdg); - - return HAL_TIMEOUT; - } - } - - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_READY; - - /* Process Unlocked */ - __HAL_UNLOCK(hiwdg); - - /* Return function status */ - return HAL_OK; -} /** * @brief Refresh the IWDG. - * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains + * @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains * the configuration information for the specified IWDG module. * @retval HAL status */ HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg) { - uint32_t tickstart = 0; - - /* Process Locked */ - __HAL_LOCK(hiwdg); - - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_BUSY; - - tickstart = HAL_GetTick(); - - /* Wait until RVU flag is RESET */ - while(__HAL_IWDG_GET_FLAG(hiwdg, IWDG_FLAG_RVU) != RESET) - { - if((HAL_GetTick() - tickstart ) > HAL_IWDG_DEFAULT_TIMEOUT) - { - /* Set IWDG state */ - hiwdg->State = HAL_IWDG_STATE_TIMEOUT; - - /* Process unlocked */ - __HAL_UNLOCK(hiwdg); - - return HAL_TIMEOUT; - } - } - /* Reload IWDG counter with value defined in the reload register */ __HAL_IWDG_RELOAD_COUNTER(hiwdg); - /* Change IWDG peripheral state */ - hiwdg->State = HAL_IWDG_STATE_READY; - - /* Process Unlocked */ - __HAL_UNLOCK(hiwdg); - /* Return function status */ return HAL_OK; } -/** - * @} - */ - -/** @defgroup IWDG_Exported_Functions_Group3 Peripheral State functions - * @brief Peripheral State functions. - * -@verbatim - =============================================================================== - ##### Peripheral State functions ##### - =============================================================================== - [..] - This subsection permits to get in run-time the status of the peripheral. - -@endverbatim - * @{ - */ - -/** - * @brief Return the IWDG handle state. - * @param hiwdg: pointer to a IWDG_HandleTypeDef structure that contains - * the configuration information for the specified IWDG module. - * @retval HAL state - */ -HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg) -{ - /* Return IWDG handle state */ - return hiwdg->State; -} - /** * @} */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.h index 2ee43eb24e..a493d1cf85 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_iwdg.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_iwdg.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of IWDG HAL module. ****************************************************************************** * @attention @@ -50,7 +50,7 @@ * @{ */ -/** @addtogroup IWDG +/** @defgroup IWDG IWDG * @{ */ @@ -59,19 +59,6 @@ * @{ */ -/** - * @brief IWDG HAL State Structure definition - */ -typedef enum -{ - HAL_IWDG_STATE_RESET = 0x00, /*!< IWDG not yet initialized or disabled */ - HAL_IWDG_STATE_READY = 0x01, /*!< IWDG initialized and ready for use */ - HAL_IWDG_STATE_BUSY = 0x02, /*!< IWDG internal process is ongoing */ - HAL_IWDG_STATE_TIMEOUT = 0x03, /*!< IWDG timeout state */ - HAL_IWDG_STATE_ERROR = 0x04 /*!< IWDG error state */ - -}HAL_IWDG_StateTypeDef; - /** * @brief IWDG Init structure definition */ @@ -97,10 +84,6 @@ typedef struct IWDG_InitTypeDef Init; /*!< IWDG required parameters */ - HAL_LockTypeDef Lock; /*!< IWDG Locking object */ - - __IO HAL_IWDG_StateTypeDef State; /*!< IWDG communication state */ - }IWDG_HandleTypeDef; /** @@ -115,21 +98,21 @@ typedef struct /** @defgroup IWDG_Prescaler IWDG Prescaler * @{ */ -#define IWDG_PRESCALER_4 ((uint8_t)0x00) /*!< IWDG prescaler set to 4 */ -#define IWDG_PRESCALER_8 ((uint8_t)(IWDG_PR_PR_0)) /*!< IWDG prescaler set to 8 */ -#define IWDG_PRESCALER_16 ((uint8_t)(IWDG_PR_PR_1)) /*!< IWDG prescaler set to 16 */ -#define IWDG_PRESCALER_32 ((uint8_t)(IWDG_PR_PR_1 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 32 */ -#define IWDG_PRESCALER_64 ((uint8_t)(IWDG_PR_PR_2)) /*!< IWDG prescaler set to 64 */ -#define IWDG_PRESCALER_128 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_0)) /*!< IWDG prescaler set to 128 */ -#define IWDG_PRESCALER_256 ((uint8_t)(IWDG_PR_PR_2 | IWDG_PR_PR_1)) /*!< IWDG prescaler set to 256 */ +#define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */ +#define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ +#define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ +#define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ +#define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ +#define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ +#define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ /** * @} */ -/** @defgroup IWDG_Window IWDG Window +/** @defgroup IWDG_Window_option IWDG Window option * @{ */ -#define IWDG_WINDOW_DISABLE ((uint32_t)0x00000FFF) +#define IWDG_WINDOW_DISABLE IWDG_WINR_WIN /** * @} */ @@ -143,124 +126,89 @@ typedef struct * @{ */ -/** @brief Reset IWDG handle state. - * @param __HANDLE__: IWDG handle. - * @retval None - */ -#define __HAL_IWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_IWDG_STATE_RESET) - /** * @brief Enable the IWDG peripheral. - * @param __HANDLE__: IWDG handle + * @param __HANDLE__ IWDG handle * @retval None */ #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) /** - * @brief Reload IWDG counter with value defined in the reload register. - * @param __HANDLE__: IWDG handle + * @brief Reload IWDG counter with value defined in the reload register + * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled). + * @param __HANDLE__ IWDG handle * @retval None */ #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) -/** - * @brief Get the selected IWDG flag status. - * @param __HANDLE__: IWDG handle - * @param __FLAG__: specifies the flag to check. - * This parameter can be one of the following values: - * @arg IWDG_FLAG_PVU: Watchdog counter reload value update flag - * @arg IWDG_FLAG_RVU: Watchdog counter prescaler value flag - * @arg IWDG_FLAG_WVU: Watchdog counter window value flag - * @retval The new state of __FLAG__ (TRUE or FALSE) . - */ -#define __HAL_IWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) - /** * @} */ /* Exported functions --------------------------------------------------------*/ -/** @addtogroup IWDG_Exported_Functions +/** @defgroup IWDG_Exported_Functions IWDG Exported Functions * @{ */ -/** @addtogroup IWDG_Exported_Functions_Group1 +/** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions * @{ */ -/* Initialization/de-initialization functions ********************************/ +/* Initialization/Start functions ********************************************/ HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); -void HAL_IWDG_MspInit(IWDG_HandleTypeDef *hiwdg); /** * @} */ -/** @addtogroup IWDG_Exported_Functions_Group2 +/** @defgroup IWDG_Exported_Functions_Group2 IO operation functions * @{ */ /* I/O operation functions ****************************************************/ -HAL_StatusTypeDef HAL_IWDG_Start(IWDG_HandleTypeDef *hiwdg); HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); /** * @} */ -/** @addtogroup IWDG_Exported_Functions_Group3 - * @{ - */ -/* Peripheral State functions ************************************************/ -HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg); -/** - * @} - */ - /** * @} */ /* Private constants ---------------------------------------------------------*/ -/** @addtogroup IWDG_Private_Defines +/** @defgroup IWDG_Private_Constants IWDG Private Constants * @{ */ /** * @brief IWDG Key Register BitMask */ -#define IWDG_KEY_RELOAD ((uint32_t)0x0000AAAA) /*!< IWDG Reload Counter Enable */ -#define IWDG_KEY_ENABLE ((uint32_t)0x0000CCCC) /*!< IWDG Peripheral Enable */ -#define IWDG_KEY_WRITE_ACCESS_ENABLE ((uint32_t)0x00005555) /*!< IWDG KR Write Access Enable */ -#define IWDG_KEY_WRITE_ACCESS_DISABLE ((uint32_t)0x00000000) /*!< IWDG KR Write Access Disable */ - -/** - * @brief IWDG Flag definition - */ -#define IWDG_FLAG_PVU ((uint32_t)IWDG_SR_PVU) /*!< Watchdog counter prescaler value update flag */ -#define IWDG_FLAG_RVU ((uint32_t)IWDG_SR_RVU) /*!< Watchdog counter reload value update flag */ -#define IWDG_FLAG_WVU ((uint32_t)IWDG_SR_WVU) /*!< Watchdog counter window value update flag */ +#define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */ +#define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */ +#define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */ +#define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */ /** * @} */ /* Private macros ------------------------------------------------------------*/ -/** @defgroup IWDG_Private_Macro IWDG Private Macros +/** @defgroup IWDG_Private_Macros IWDG Private Macros * @{ */ /** - * @brief Enables write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. - * @param __HANDLE__: IWDG handle + * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. + * @param __HANDLE__ IWDG handle * @retval None */ #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) /** - * @brief Disables write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. - * @param __HANDLE__: IWDG handle + * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. + * @param __HANDLE__ IWDG handle * @retval None */ #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) /** * @brief Check IWDG prescaler value. - * @param __PRESCALER__: IWDG prescaler value + * @param __PRESCALER__ IWDG prescaler value * @retval None */ #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ @@ -273,17 +221,17 @@ HAL_IWDG_StateTypeDef HAL_IWDG_GetState(IWDG_HandleTypeDef *hiwdg); /** * @brief Check IWDG reload value. - * @param __RELOAD__: IWDG reload value + * @param __RELOAD__ IWDG reload value * @retval None */ -#define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= 0xFFF) +#define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) /** * @brief Check IWDG window value. - * @param __WINDOW__: IWDG window value + * @param __WINDOW__ IWDG window value * @retval None */ -#define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= 0xFFF) +#define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) /** * @} diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.c index 9757ac4a21..5835f44f6f 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_nand.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief NAND HAL module driver. * This file provides a generic firmware to drive NAND memories mounted * as external device. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.h index b172a1b197..4b19b04518 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nand.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_nand.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of NAND HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.c index f2f5695565..fd59e32dc3 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_nor.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief NOR HAL module driver. * This file provides a generic firmware to drive NOR memories mounted * as external device. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.h index e15f65cf61..6da375c017 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_nor.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_nor.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of NOR HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.c index c7032a8362..8a31442da8 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_opamp.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief OPAMP HAL module driver. * This file provides firmware functions to manage the following * functionalities of the operational amplifiers (OPAMP1,...OPAMP4) diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.h index 67b6c05d1f..2ef1c065de 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_opamp.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of OPAMP HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.c index 1ea97f757f..4de9132387 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_opamp_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended OPAMP HAL module driver. * * This file provides firmware functions to manage the following diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.h index adb6060d7e..68274e9d1c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_opamp_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_opamp_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of OPAMP HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.c index 4cadbe0474..a8dc5e6d88 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pccard.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief PCCARD HAL module driver. * This file provides a generic firmware to drive PCCARD memories mounted * as external device. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.h index 51f2f96b50..608c833eda 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pccard.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pccard.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of PCCARD HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.c index 81af8b62a0..d0ed066a82 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pcd.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief PCD HAL module driver. * This file provides firmware functions to manage the following * functionalities of the USB Peripheral Controller: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.h index 7e09aeea13..131be217ad 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pcd.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of PCD HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.c index 23317292e3..4127cda932 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pcd_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended PCD HAL module driver. * This file provides firmware functions to manage the following * functionalities of the USB Peripheral Controller: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.h index 837db2ec57..4b75cc91ac 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd_ex.h @@ -3,7 +3,7 @@ * @file stm32f3xx_hal_pcd_ex.h * @author MCD Application Team * @version V1.3.0 - * @date 26-June-2015 + * @date 01-July-2016 * @brief Header file of PCD HAL Extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.c index 90eebd4acb..b6e8abb283 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pwr.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief PWR HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Power Controller (PWR) peripheral: @@ -254,35 +254,31 @@ void HAL_PWR_DisableBkUpAccess(void) /** * @brief Enables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to enable. - * This parameter can be one of the following values: - * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3 + * This parameter can be value of : + * @ref PWREx_WakeUp_Pins * @retval None */ void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx) { - __IO uint32_t tmp = 0; - /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); - tmp = CSR_EWUP1_BB + (WakeUpPinx << 2); - *(__IO uint32_t *) (tmp) = (uint32_t)ENABLE; + /* Enable the EWUPx pin */ + SET_BIT(PWR->CSR, WakeUpPinx); } /** * @brief Disables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. - * This parameter can be one of the following values: - * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3 + * This parameter can be values of : + * @ref PWREx_WakeUp_Pins * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { - __IO uint32_t tmp = 0; - /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); - tmp = CSR_EWUP1_BB + (WakeUpPinx << 2); - *(__IO uint32_t *) (tmp) = (uint32_t)DISABLE; + /* Disable the EWUPx pin */ + CLEAR_BIT(PWR->CSR, WakeUpPinx); } /** diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.h index 81c897f288..a5945ec0c1 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pwr.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of PWR HAL module. ****************************************************************************** * @attention @@ -56,39 +56,6 @@ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ -/** @defgroup PWR_Alias_Exported_Constants PWR Alias Exported Constants - * @{ - */ -/* ------------- PWR registers bit address in the alias region ---------------*/ -#define PWR_OFFSET (PWR_BASE - PERIPH_BASE) - -/* --- CR Register ---*/ -#define CR_OFFSET (PWR_OFFSET + 0x00) -/* Alias word address of DBP bit */ -#define DBP_BIT_NUMBER POSITION_VAL(PWR_CR_DBP) -#define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BIT_NUMBER * 4)) - -/* Alias word address of PVDE bit */ -#define PVDE_BIT_NUMBER POSITION_VAL(PWR_CR_PVDE) -#define CR_PVDE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PVDE_BIT_NUMBER * 4)) - -/* --- CSR Register ---*/ -#define CSR_OFFSET (PWR_OFFSET + 0x04) -/* Alias word address of EWUP1 bit */ -#define EWUP1_BitNumber POSITION_VAL(PWR_CSR_EWUP1) -#define CSR_EWUP1_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP1_BitNumber * 4)) - -/* Alias word address of EWUP2 bit */ -#define EWUP2_BitNumber POSITION_VAL(PWR_CSR_EWUP2) -#define CSR_EWUP2_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP2_BitNumber * 4)) - -/* Alias word address of EWUP3 bit */ -#define EWUP3_BitNumber POSITION_VAL(PWR_CSR_EWUP3) -#define CSR_EWUP3_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP3_BitNumber * 4)) -/** - * @} - */ - /** @defgroup PWR_Exported_Constants PWR Exported Constants * @{ */ @@ -97,9 +64,9 @@ * @{ */ -#define PWR_WAKEUP_PIN1 ((uint32_t)0x00) /*!< Wakeup pin 1 */ -#define PWR_WAKEUP_PIN2 ((uint32_t)0x01) /*!< Wakeup pin 2 */ -#define PWR_WAKEUP_PIN3 ((uint32_t)0x02) /*!< Wakeup pin 3 */ +#define PWR_WAKEUP_PIN1 ((uint32_t)PWR_CSR_EWUP1) /*!< Wakeup pin 1 */ +#define PWR_WAKEUP_PIN2 ((uint32_t)PWR_CSR_EWUP2) /*!< Wakeup pin 2 */ +#define PWR_WAKEUP_PIN3 ((uint32_t)PWR_CSR_EWUP3) /*!< Wakeup pin 3 */ /** * @} */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.c index cb811a244b..beaac486a9 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pwr_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended PWR HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Power Controller (PWR) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h index 09e49c50c2..b4a4bda75b 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pwr_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_pwr_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of PWR HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.c index f879a52713..e9d3e71a25 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rcc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief RCC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Reset and Clock Control (RCC) peripheral: @@ -76,7 +76,7 @@ * ****************************************************************************** */ - + /* Includes ------------------------------------------------------------------*/ #include "stm32f3xx_hal.h" @@ -244,7 +244,7 @@ void HAL_RCC_DeInit(void) /* Reset HSEBYP bit */ CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); - + /* Reset CFGR register */ CLEAR_REG(RCC->CFGR); @@ -277,18 +277,18 @@ void HAL_RCC_DeInit(void) */ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) { - uint32_t tickstart = 0; + uint32_t tickstart = 0U; /* Check the parameters */ assert_param(RCC_OscInitStruct != NULL); assert_param(IS_RCC_OSCILLATORTYPE(RCC_OscInitStruct->OscillatorType)); - + /*------------------------------- HSE Configuration ------------------------*/ if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) { /* Check the parameters */ assert_param(IS_RCC_HSE(RCC_OscInitStruct->HSEState)); - + /* When the HSE is used as system clock or clock source for PLL in these cases it is not allowed to be disabled */ if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSE) || ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE))) @@ -627,7 +627,7 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) */ HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency) { - uint32_t tickstart = 0; + uint32_t tickstart = 0U; /* Check the parameters */ assert_param(RCC_ClkInitStruct != NULL); diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.h index aba70a7155..c4097e803c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rcc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of RCC HAL module. ****************************************************************************** * @attention @@ -63,14 +63,14 @@ */ /* Disable Backup domain write protection state change timeout */ -#define RCC_DBP_TIMEOUT_VALUE ((uint32_t)100) /* 100 ms */ +#define RCC_DBP_TIMEOUT_VALUE (100U) /* 100 ms */ /* LSE state change timeout */ #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT -#define CLOCKSWITCH_TIMEOUT_VALUE ((uint32_t)5000) /* 5 s */ +#define CLOCKSWITCH_TIMEOUT_VALUE (5000U) /* 5 s */ #define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT -#define HSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ -#define LSI_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ -#define PLL_TIMEOUT_VALUE ((uint32_t)2) /* 2 ms (minimum Tick + 1) */ +#define HSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */ +#define LSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */ +#define PLL_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1) */ /** * @} */ @@ -1004,7 +1004,7 @@ typedef struct #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOFRST)) #define __HAL_RCC_TSC_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_TSCRST)) -#define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00) +#define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00000000U) #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOARST)) #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOBRST)) #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOCRST)) @@ -1029,7 +1029,7 @@ typedef struct #define __HAL_RCC_PWR_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST)) #define __HAL_RCC_DAC1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DAC1RST)) -#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00) +#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00000000U) #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST)) #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST)) #define __HAL_RCC_WWDG_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_WWDGRST)) @@ -1053,7 +1053,7 @@ typedef struct #define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM17RST)) #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST)) -#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00) +#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00000000U) #define __HAL_RCC_SYSCFG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SYSCFGRST)) #define __HAL_RCC_TIM15_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM15RST)) #define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM16RST)) @@ -1520,7 +1520,7 @@ typedef struct * access is denied to this domain after reset, you have to enable write * access using the Power Backup Access macro before to configure * the RTC clock source (to be done once after reset). - * @note Once the RTC clock is configured it can't be changed unless the + * @note Once the RTC clock is configured it cannot be changed unless the * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by * a Power On Reset (POR). * diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.c index eb10d63546..21fc725c7e 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rcc_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended RCC HAL module driver. * This file provides firmware functions to manage the following * functionalities RCC extension peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.h index 454248542f..82c925ca15 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rcc_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rcc_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of RCC HAL Extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.c index da92c6e760..45f707f4ed 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rtc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief RTC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Real-Time Clock (RTC) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.h index 75a191dfc1..8c29564118 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rtc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of RTC HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.c index 9b1f420eab..fa50fdf198 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rtc_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended RTC HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Real Time Clock (RTC) Extended peripheral: @@ -895,8 +895,12 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t } } + /* Disable the Wake-Up timer */ __HAL_RTC_WAKEUPTIMER_DISABLE(hrtc); + /* Clear flag Wake-Up */ + __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(hrtc, RTC_FLAG_WUTF); + tickstart = HAL_GetTick(); /* Wait till RTC WUTWF flag is set and if Time out is reached exit */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.h index d65246cf9b..a7a71cc748 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_rtc_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_rtc_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of RTC HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.c index 5eff01bb6c..151c58db3f 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_sdadc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file provides firmware functions to manage the following * functionalities of the Sigma-Delta Analog to Digital Converter * (SDADC) peripherals: @@ -535,7 +535,7 @@ HAL_StatusTypeDef HAL_SDADC_AssociateChannelConfig(SDADC_HandleTypeDef *hsdadc, channelnum = (uint32_t)(Channel>>16); /* Set the channel configuration */ - hsdadc->Instance->CONFCHR1 &= (uint32_t) ~(SDADC_CONFCHR1_CONFCH0 << (channelnum << 2)); + hsdadc->Instance->CONFCHR1 &= (uint32_t) ~((uint32_t)SDADC_CONFCHR1_CONFCH0 << (channelnum << 2)); hsdadc->Instance->CONFCHR1 |= (uint32_t) (ConfIndex << (channelnum << 2)); } else diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.h index 78ca0d0224..c2af156cd4 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sdadc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_sdadc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file contains all the functions prototypes for the SDADC * firmware library. ****************************************************************************** diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.c index 342260ad9a..4e109a1ed6 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smartcard.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief SMARTCARD HAL module driver. * This file provides firmware functions to manage the following * functionalities of the SMARTCARD peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.h index c115154827..2e0415e671 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smartcard.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SMARTCARD HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.c index 0c09e2ee03..06ebbcc601 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smartcard_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief SMARTCARD HAL module driver. * * This file provides extended firmware functions to manage the following diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.h index 21b93d8359..f6333d3f84 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smartcard_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smartcard_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SMARTCARD HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.c index f750926be9..046bf4dde2 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smbus.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief SMBUS HAL module driver. * This file provides firmware functions to manage the following * functionalities of the System Management Bus (SMBus) peripheral, @@ -438,7 +438,8 @@ HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus) * @brief Transmit in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt. * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains * the configuration information for the specified SMBUS. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition @@ -526,7 +527,8 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint * @brief Receive in master/host SMBUS mode an amount of data in non-blocking mode with Interrupt. * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains * the configuration information for the specified SMBUS. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param pData Pointer to data buffer * @param Size Amount of data to be sent * @param XferOptions Options of Transfer, value of @ref SMBUS_XferOptions_definition @@ -608,7 +610,8 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint1 * @note This abort can be called only if state is ready * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains * the configuration information for the specified SMBUS. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @retval HAL status */ HAL_StatusTypeDef HAL_SMBUS_Master_Abort_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress) @@ -911,7 +914,8 @@ HAL_StatusTypeDef HAL_SMBUS_DisableAlert_IT(SMBUS_HandleTypeDef *hsmbus) * @brief Check if target device is ready for communication. * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains * the configuration information for the specified SMBUS. - * @param DevAddress Target device address + * @param DevAddress Target device address: The device 7 bits address value + * in datasheet must be shift at right before call interface * @param Trials Number of trials * @param Timeout Timeout duration * @retval HAL status diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.h index 65dd2bf6e8..59618955c6 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_smbus.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_smbus.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SMBUS HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.c index 24d4052de3..edf3a6215e 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_spi.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief SPI HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Serial Peripheral Interface (SPI) peripheral: @@ -2295,7 +2295,9 @@ static void SPI_2linesTxISR_8BIT(struct __SPI_HandleTypeDef *hspi) { if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE) { - hspi->Instance->CR1 |= SPI_CR1_CRCNEXT; + SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT); + __HAL_SPI_DISABLE_IT(hspi, SPI_IT_TXE); + return; } /* Disable TXE interrupt */ __HAL_SPI_DISABLE_IT(hspi, SPI_IT_TXE); @@ -2375,7 +2377,9 @@ static void SPI_2linesTxISR_16BIT(struct __SPI_HandleTypeDef *hspi) { if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE) { - hspi->Instance->CR1 |= SPI_CR1_CRCNEXT; + SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT); + __HAL_SPI_DISABLE_IT(hspi, SPI_IT_TXE); + return; } /* Disable TXE interrupt */ __HAL_SPI_DISABLE_IT(hspi, SPI_IT_TXE); diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.h index 52bca96521..3866d91d7d 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_spi.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SPI HAL module. ****************************************************************************** * @attention @@ -140,13 +140,13 @@ typedef struct __SPI_HandleTypeDef uint16_t TxXferSize; /*!< SPI Tx Transfer size */ - uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */ + __IO uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */ uint8_t *pRxBuffPtr; /*!< Pointer to SPI Rx transfer Buffer */ uint16_t RxXferSize; /*!< SPI Rx Transfer size */ - uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */ + __IO uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */ uint32_t CRCSize; /*!< SPI CRC size used for the transfer */ @@ -470,10 +470,10 @@ typedef struct __SPI_HandleTypeDef */ #define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \ do{ \ - __IO uint32_t tmpreg; \ - tmpreg = (__HANDLE__)->Instance->SR; \ + __IO uint32_t tmpreg_modf; \ + tmpreg_modf = (__HANDLE__)->Instance->SR; \ (__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE); \ - UNUSED(tmpreg); \ + UNUSED(tmpreg_modf); \ } while(0) /** @brief Clear the SPI OVR pending flag. @@ -484,10 +484,10 @@ typedef struct __SPI_HandleTypeDef */ #define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \ do{ \ - __IO uint32_t tmpreg; \ - tmpreg = (__HANDLE__)->Instance->DR; \ - tmpreg = (__HANDLE__)->Instance->SR; \ - UNUSED(tmpreg); \ + __IO uint32_t tmpreg_ovr; \ + tmpreg_ovr = (__HANDLE__)->Instance->DR; \ + tmpreg_ovr = (__HANDLE__)->Instance->SR; \ + UNUSED(tmpreg_ovr); \ } while(0) /** @brief Clear the SPI FRE pending flag. @@ -498,9 +498,9 @@ typedef struct __SPI_HandleTypeDef */ #define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) \ do{ \ - __IO uint32_t tmpreg; \ - tmpreg = (__HANDLE__)->Instance->SR; \ - UNUSED(tmpreg); \ + __IO uint32_t tmpreg_fre; \ + tmpreg_fre = (__HANDLE__)->Instance->SR; \ + UNUSED(tmpreg_fre); \ } while(0) /** @brief Enable the SPI peripheral. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.c index 450ed8809b..944b996406 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_spi_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended SPI HAL module driver. * This file provides firmware functions to manage the following * SPI peripheral extended functionalities : diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.h index d9e03006fd..bea8657169 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_spi_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_spi_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SPI HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.c index 17d472f4d2..814e63a4c3 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_sram.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief SRAM HAL module driver. * This file provides a generic firmware to drive SRAM memories * mounted as external device. diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.h index e01c442f5e..1fa98ad550 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_sram.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_sram.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of SRAM HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.c index 3d0997746d..0e266e80ed 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tim.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief TIM HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Timer (TIM) peripheral: @@ -1143,7 +1143,7 @@ HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel) /** * @brief Starts the PWM signal generation in interrupt mode. * @param htim: TIM handle - * @param Channel: TIM Channel to be disabled + * @param Channel: TIM Channels to be enabled * This parameter can be one of the following values: * @arg TIM_CHANNEL_1: TIM Channel 1 selected * @arg TIM_CHANNEL_2: TIM Channel 2 selected diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.h index 2801de98b1..5f1ba43a44 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tim.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of TIM HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.c index a5c56be6cc..e79b337a8c 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tim_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief TIM HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Timer Extended peripheral: @@ -1883,179 +1883,6 @@ HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, return HAL_OK; } -/** - * @brief Configures the OCRef clear feature - * @param htim: TIM handle - * @param sClearInputConfig: pointer to a TIM_ClearInputConfigTypeDef structure that - * contains the OCREF clear feature and parameters for the TIM peripheral. - * @param Channel: specifies the TIM Channel - * This parameter can be one of the following values: - * @arg TIM_CHANNEL_1: TIM Channel 1 - * @arg TIM_CHANNEL_2: TIM Channel 2 - * @arg TIM_CHANNEL_3: TIM Channel 3 - * @arg TIM_CHANNEL_4: TIM Channel 4 - * @arg TIM_Channel_5: TIM Channel 5 - * @arg TIM_Channel_6: TIM Channel 6 - * @note For STM32F302xC, STM32F302xE, STM32F303xC, STM32F303xE, STM32F358xx, - * STM32F398xx and STM32F303x8 up to 6 OC channels can be configured - * @retval None - */ -HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, - TIM_ClearInputConfigTypeDef *sClearInputConfig, - uint32_t Channel) -{ - uint32_t tmpsmcr = 0; - - /* Check the parameters */ - assert_param(IS_TIM_OCXREF_CLEAR_INSTANCE(htim->Instance)); - assert_param(IS_TIM_CLEARINPUT_SOURCE(sClearInputConfig->ClearInputSource)); - - /* Check input state */ - __HAL_LOCK(htim); - - htim->State = HAL_TIM_STATE_BUSY; - - switch (sClearInputConfig->ClearInputSource) - { - case TIM_CLEARINPUTSOURCE_NONE: - { - /* Get the TIMx SMCR register value */ - tmpsmcr = htim->Instance->SMCR; - - /* Clear the OCREF clear selection bit */ - tmpsmcr &= ~TIM_SMCR_OCCS; - - /* Clear the ETR Bits */ - tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); - - /* Set TIMx_SMCR */ - htim->Instance->SMCR = tmpsmcr; - } - break; - - case TIM_CLEARINPUTSOURCE_OCREFCLR: - { - /* Clear the OCREF clear selection bit */ - htim->Instance->SMCR &= ~TIM_SMCR_OCCS; - } - break; - - case TIM_CLEARINPUTSOURCE_ETR: - { - /* Check the parameters */ - assert_param(IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity)); - assert_param(IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler)); - assert_param(IS_TIM_CLEARINPUT_FILTER(sClearInputConfig->ClearInputFilter)); - - TIM_ETR_SetConfig(htim->Instance, - sClearInputConfig->ClearInputPrescaler, - sClearInputConfig->ClearInputPolarity, - sClearInputConfig->ClearInputFilter); - - /* Set the OCREF clear selection bit */ - htim->Instance->SMCR |= TIM_SMCR_OCCS; - } - break; - default: - break; - } - - switch (Channel) - { - case TIM_CHANNEL_1: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR1 |= TIM_CCMR1_OC1CE; - } - else - { - /* Disable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1CE; - } - } - break; - case TIM_CHANNEL_2: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 2 */ - htim->Instance->CCMR1 |= TIM_CCMR1_OC2CE; - } - else - { - /* Disable the Ocref clear feature for Channel 2 */ - htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2CE; - } - } - break; - case TIM_CHANNEL_3: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 3 */ - htim->Instance->CCMR2 |= TIM_CCMR2_OC3CE; - } - else - { - /* Disable the Ocref clear feature for Channel 3 */ - htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3CE; - } - } - break; - case TIM_CHANNEL_4: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 4 */ - htim->Instance->CCMR2 |= TIM_CCMR2_OC4CE; - } - else - { - /* Disable the Ocref clear feature for Channel 4 */ - htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4CE; - } - } - break; - case TIM_CHANNEL_5: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR3 |= TIM_CCMR3_OC5CE; - } - else - { - /* Disable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR3 &= ~TIM_CCMR3_OC5CE; - } - } - break; - case TIM_CHANNEL_6: - { - if(sClearInputConfig->ClearInputState != RESET) - { - /* Enable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR3 |= TIM_CCMR3_OC6CE; - } - else - { - /* Disable the Ocref clear feature for Channel 1 */ - htim->Instance->CCMR3 &= ~TIM_CCMR3_OC6CE; - } - } - break; - default: - break; - } - - htim->State = HAL_TIM_STATE_READY; - - __HAL_UNLOCK(htim); - - return HAL_OK; -} /** * @brief Configures the TIM in master mode. @@ -2507,6 +2334,194 @@ HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Chan * @} */ +/** @addtogroup TIM_Exported_Functions_Group8 + * @{ + */ +#if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \ + defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \ + defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \ + defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) +/** + * @brief Configures the OCRef clear feature + * @param htim: TIM handle + * @param sClearInputConfig: pointer to a TIM_ClearInputConfigTypeDef structure that + * contains the OCREF clear feature and parameters for the TIM peripheral. + * @param Channel: specifies the TIM Channel + * This parameter can be one of the following values: + * @arg TIM_CHANNEL_1: TIM Channel 1 + * @arg TIM_CHANNEL_2: TIM Channel 2 + * @arg TIM_CHANNEL_3: TIM Channel 3 + * @arg TIM_CHANNEL_4: TIM Channel 4 + * @arg TIM_Channel_5: TIM Channel 5 + * @arg TIM_Channel_6: TIM Channel 6 + * @note For STM32F302xC, STM32F302xE, STM32F303xC, STM32F303xE, STM32F358xx, + * STM32F398xx and STM32F303x8 up to 6 OC channels can be configured + * @retval None + */ +HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, + TIM_ClearInputConfigTypeDef *sClearInputConfig, + uint32_t Channel) +{ + uint32_t tmpsmcr = 0; + + /* Check the parameters */ + assert_param(IS_TIM_OCXREF_CLEAR_INSTANCE(htim->Instance)); + assert_param(IS_TIM_CLEARINPUT_SOURCE(sClearInputConfig->ClearInputSource)); + + /* Check input state */ + __HAL_LOCK(htim); + + htim->State = HAL_TIM_STATE_BUSY; + + switch (sClearInputConfig->ClearInputSource) + { + case TIM_CLEARINPUTSOURCE_NONE: + { + /* Get the TIMx SMCR register value */ + tmpsmcr = htim->Instance->SMCR; + + /* Clear the OCREF clear selection bit */ + tmpsmcr &= ~TIM_SMCR_OCCS; + + /* Clear the ETR Bits */ + tmpsmcr &= ~(TIM_SMCR_ETF | TIM_SMCR_ETPS | TIM_SMCR_ECE | TIM_SMCR_ETP); + + /* Set TIMx_SMCR */ + htim->Instance->SMCR = tmpsmcr; + } + break; + + case TIM_CLEARINPUTSOURCE_OCREFCLR: + { + /* Clear the OCREF clear selection bit */ + htim->Instance->SMCR &= ~TIM_SMCR_OCCS; + } + break; + + case TIM_CLEARINPUTSOURCE_ETR: + { + /* Check the parameters */ + assert_param(IS_TIM_CLEARINPUT_POLARITY(sClearInputConfig->ClearInputPolarity)); + assert_param(IS_TIM_CLEARINPUT_PRESCALER(sClearInputConfig->ClearInputPrescaler)); + assert_param(IS_TIM_CLEARINPUT_FILTER(sClearInputConfig->ClearInputFilter)); + + TIM_ETR_SetConfig(htim->Instance, + sClearInputConfig->ClearInputPrescaler, + sClearInputConfig->ClearInputPolarity, + sClearInputConfig->ClearInputFilter); + + /* Set the OCREF clear selection bit */ + htim->Instance->SMCR |= TIM_SMCR_OCCS; + } + break; + default: + break; + } + + switch (Channel) + { + case TIM_CHANNEL_1: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC1CE; + } + else + { + /* Disable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1CE; + } + } + break; + case TIM_CHANNEL_2: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 2 */ + htim->Instance->CCMR1 |= TIM_CCMR1_OC2CE; + } + else + { + /* Disable the Ocref clear feature for Channel 2 */ + htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2CE; + } + } + break; + case TIM_CHANNEL_3: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 3 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC3CE; + } + else + { + /* Disable the Ocref clear feature for Channel 3 */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3CE; + } + } + break; + case TIM_CHANNEL_4: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 4 */ + htim->Instance->CCMR2 |= TIM_CCMR2_OC4CE; + } + else + { + /* Disable the Ocref clear feature for Channel 4 */ + htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4CE; + } + } + break; + case TIM_CHANNEL_5: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR3 |= TIM_CCMR3_OC5CE; + } + else + { + /* Disable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR3 &= ~TIM_CCMR3_OC5CE; + } + } + break; + case TIM_CHANNEL_6: + { + if(sClearInputConfig->ClearInputState != RESET) + { + /* Enable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR3 |= TIM_CCMR3_OC6CE; + } + else + { + /* Disable the Ocref clear feature for Channel 1 */ + htim->Instance->CCMR3 &= ~TIM_CCMR3_OC6CE; + } + } + break; + default: + break; + } + + htim->State = HAL_TIM_STATE_READY; + + __HAL_UNLOCK(htim); + + return HAL_OK; +} +#endif /* STM32F302xE || STM32F303xE || STM32F398xx || */ + /* STM32F302xC || STM32F303xC || STM32F358xx || */ + /* STM32F303x8 || STM32F334x8 || STM32F328xx || */ + /* STM32F301x8 || STM32F302x8 || STM32F318xx */ +/** + * @} + */ + /** @defgroup TIMEx_Exported_Functions_Group6 Extension Callbacks functions * @brief Extension Callbacks functions * diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.h index 9439fc95af..9312d4cbd7 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tim_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tim_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of TIM HAL Extended module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.c index ddd264c61d..3ccbbed234 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tsc.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief This file provides firmware functions to manage the following * functionalities of the Touch Sensing Controller (TSC) peripheral: * + Initialization and De-initialization diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.h index 63f25c9fec..59a43ee1a9 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_tsc.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_tsc.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of TSC HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.c index 396d54c350..c539592d8a 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_uart.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief UART HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Universal Asynchronous Receiver Transmitter (UART) peripheral: diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.h index 9654641129..97c38c6e31 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_uart.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of UART HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.c index 2801fbb49a..433ee44138 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_uart_ex.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Extended UART HAL module driver. * This file provides firmware functions to manage the following extended * functionalities of the Universal Asynchronous Receiver Transmitter Peripheral (UART). diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.h index 32a4956301..06db7373c1 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_uart_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_uart_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of UART HAL Extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.c index 9551147a26..855bf0a892 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.c @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_usart.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief USART HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Universal Synchronous Asynchronous Receiver Transmitter diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.h index f036bfbd7f..6f73def3e7 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_usart.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of USART HAL module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart_ex.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart_ex.h index 55f291511a..85023c978a 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart_ex.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_usart_ex.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_usart_ex.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of USART HAL Extension module. ****************************************************************************** * @attention diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.c b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.c index 72903488b5..78165f57bc 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.c +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.c @@ -2,19 +2,18 @@ ****************************************************************************** * @file stm32f3xx_hal_wwdg.c * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief WWDG HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Window Watchdog (WWDG) peripheral: - * + Initialization and de-initialization functions + * + Initialization and Configuration function * + IO operation functions - * + Peripheral State functions @verbatim ============================================================================== ##### WWDG specific features ##### ============================================================================== - [..] + [..] Once enabled the WWDG generates a system reset on expiry of a programmed time period, unless the program refreshes the counter (T[6;0] downcounter) before reaching 0x3F value (i.e. a reset is generated when the counter @@ -23,49 +22,75 @@ (+) An MCU reset is also generated if the counter value is refreshed before the counter has reached the refresh window value. This implies that the counter must be refreshed in a limited window. + (+) Once enabled the WWDG cannot be disabled except by a system reset. + (+) WWDGRST flag in RCC_CSR register informs when a WWDG reset has - occurred (check available with __HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)). - (+) The WWDG counter input clock is derived from the APB clock divided + occurred (check available with __HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)). + + (+) The WWDG downcounter input clock is derived from the APB clock divided by a programmable prescaler. - (+) WWDG clock (Hz) = PCLK1 / (4096 * Prescaler) - (+) WWDG timeout (mS) = 1000 * (T[5;0] + 1) / WWDG clock - where T[5;0] are the lowest 6 bits of Counter. + + (+) WWDG downcounter clock (Hz) = PCLK1 / (4096 * Prescaler) + + (+) WWDG timeout (ms) = (1000 * (T[5;0] + 1)) / (WWDG downcounter clock) + where T[5;0] are the lowest 6 bits of downcounter. + (+) WWDG Counter refresh is allowed between the following limits : - (++) min time (mS) = 1000 * (Counter - Window) / WWDG clock - (++) max time (mS) = 1000 * (Counter - 0x40) / WWDG clock + (++) min time (ms) = (1000 * (T[5;0] - Window)) / (WWDG downcounter clock) + (++) max time (ms) = (1000 * (T[5;0] - 0x40)) / (WWDG downcounter clock) + (+) Min-max timeout value @42 MHz(PCLK1): ~97.5 us / ~49.9 ms + (+) The Early Wakeup Interrupt (EWI) can be used if specific safety + operations or data logging must be performed before the actual reset is + generated. When the downcounter reaches the value 0x40, an EWI interrupt + is generated and the corresponding interrupt service routine (ISR) can + be used to trigger specific actions (such as communications or data + logging), before resetting the device. + In some applications, the EWI interrupt can be used to manage a software + system check and/or system recovery/graceful degradation, without + generating a WWDG reset. In this case, the corresponding interrupt + service routine (ISR) should reload the WWDG counter to avoid the WWDG + reset, then trigger the required actions. + Note:When the EWI interrupt cannot be served, e.g. due to a system lock + in a higher priority task, the WWDG reset will eventually be generated. + + (+) Debug mode : When the microcontroller enters debug mode (core halted), + the WWDG counter either continues to work normally or stops, depending + on DBG_WWDG_STOP configuration bit in DBG module, accessible through + __HAL_DBGMCU_FREEZE_WWDG() and __HAL_DBGMCU_UNFREEZE_WWDG() macros ##### How to use this driver ##### ============================================================================== [..] (+) Enable WWDG APB1 clock using __HAL_RCC_WWDG_CLK_ENABLE(). - (+) Set the WWDG prescaler, refresh window and counter value - using HAL_WWDG_Init() function. - (+) Start the WWDG using HAL_WWDG_Start() function. - When the WWDG is enabled the counter value should be configured to - a value greater than 0x40 to prevent generating an immediate reset. - (+) Optionally you can enable the Early Wakeup Interrupt (EWI) which is - generated when the counter reaches 0x40, and then start the WWDG using - HAL_WWDG_Start_IT(). At EWI HAL_WWDG_WakeupCallback() is executed and user can - add his own code by customization of function pointer HAL_WWDG_WakeupCallback(). - Once enabled, EWI interrupt cannot be disabled except by a system reset. + + (+) Set the WWDG prescaler, refresh window, counter value and Early Wakeup + Interrupt mode using using HAL_WWDG_Init() function. + This enables WWDG peripheral and the downcounter starts downcounting + from given counter value. + Init function can be called again to modify all watchdog parameters, + however if EWI mode has been set once, it can't be clear until next + reset. + (+) The application program must refresh the WWDG counter at regular intervals during normal operation to prevent an MCU reset using HAL_WWDG_Refresh() function. This operation must occur only when - the counter is lower than the refresh window value already programmed. + the counter is lower than the window value already programmed. + + (+) if Early Wakeup Interrupt mode is enable an interrupt is generated when + the counter reaches 0x40. User can add his own code in weak function + HAL_WWDG_EarlyWakeupCallback(). *** WWDG HAL driver macros list *** ================================== [..] Below the list of most used macros in WWDG HAL driver. - - (+) __HAL_WWDG_ENABLE: Enable the WWDG peripheral - (+) __HAL_WWDG_ENABLE_IT: Enable the WWDG early wakeup interrupt - (+) __HAL_WWDG_GET_IT_SOURCE: Check the selected WWDG's interrupt source - (+) __HAL_WWDG_GET_FLAG: Get the selected WWDG's flag status - (+) __HAL_WWDG_CLEAR_FLAG: Clear the WWDG's pending flags + + (+) __HAL_WWDG_GET_IT_SOURCE: Check the selected WWDG's interrupt source. + (+) __HAL_WWDG_GET_FLAG: Get the selected WWDG's flag status. + (+) __HAL_WWDG_CLEAR_FLAG: Clear the WWDG's pending flags. @endverbatim ****************************************************************************** @@ -105,13 +130,12 @@ * @{ */ +#ifdef HAL_WWDG_MODULE_ENABLED /** @defgroup WWDG WWDG * @brief WWDG HAL module driver. * @{ */ -#ifdef HAL_WWDG_MODULE_ENABLED - /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ @@ -123,30 +147,28 @@ * @{ */ -/** @defgroup WWDG_Exported_Functions_Group1 Initialization and de-initialization functions - * @brief Initialization and Configuration functions. +/** @defgroup WWDG_Exported_Functions_Group1 Initialization and Configuration functions + * @brief Initialization and Configuration functions. * @verbatim ============================================================================== - ##### Initialization and de-initialization functions ##### + ##### Initialization and Configuration functions ##### ============================================================================== [..] This section provides functions allowing to: - (+) Initialize the WWDG according to the specified parameters - in the WWDG_InitTypeDef and initialize the associated handle. - (+) DeInitialize the WWDG peripheral. + (+) Initialize and start the WWDG according to the specified parameters + in the WWDG_InitTypeDef of associated handle. (+) Initialize the WWDG MSP. - (+) DeInitialize the WWDG MSP. @endverbatim * @{ */ /** - * @brief Initialize the WWDG according to the specified - * parameters in the WWDG_InitTypeDef and initialize the associated handle. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. + * @brief Initialize the WWDG according to the specified. + * parameters in the WWDG_InitTypeDef of associated handle. + * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains + * the configuration information for the specified WWDG module. * @retval HAL status */ HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg) @@ -162,78 +184,29 @@ HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg) assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler)); assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window)); assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter)); - - if(hwwdg->State == HAL_WWDG_STATE_RESET) - { - /* Allocate lock resource and initialize it */ - hwwdg->Lock = HAL_UNLOCKED; + assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode)); - /* Init the low level hardware */ - HAL_WWDG_MspInit(hwwdg); - } + /* Init the low level hardware */ + HAL_WWDG_MspInit(hwwdg); - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_BUSY; + /* Set WWDG Counter */ + WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter)); /* Set WWDG Prescaler and Window */ - MODIFY_REG(hwwdg->Instance->CFR, (WWDG_CFR_WDGTB | WWDG_CFR_W), (hwwdg->Init.Prescaler | hwwdg->Init.Window)); - - /* Set WWDG Counter */ - MODIFY_REG(hwwdg->Instance->CR, WWDG_CR_T, hwwdg->Init.Counter); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_READY; + WRITE_REG(hwwdg->Instance->CFR, (hwwdg->Init.EWIMode | hwwdg->Init.Prescaler | hwwdg->Init.Window)); /* Return function status */ return HAL_OK; } -/** - * @brief DeInitialize the WWDG peripheral. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg) -{ - /* Check the WWDG handle allocation */ - if(hwwdg == NULL) - { - return HAL_ERROR; - } - - /* Check the parameters */ - assert_param(IS_WWDG_ALL_INSTANCE(hwwdg->Instance)); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_BUSY; - - /* DeInit the low level hardware */ - HAL_WWDG_MspDeInit(hwwdg); - - /* Reset WWDG Control register */ - hwwdg->Instance->CR = (uint32_t)0x0000007F; - - /* Reset WWDG Configuration register */ - hwwdg->Instance->CFR = (uint32_t)0x0000007F; - - /* Reset WWDG Status register */ - hwwdg->Instance->SR = 0; - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_RESET; - - /* Release Lock */ - __HAL_UNLOCK(hwwdg); - - /* Return function status */ - return HAL_OK; -} /** * @brief Initialize the WWDG MSP. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. + * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains + * the configuration information for the specified WWDG module. + * @note When rewriting this function in user file, mechanism may be added + * to avoid multiple initialize when HAL_WWDG_Init function is called + * again to change parameters. * @retval None */ __weak void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg) @@ -246,22 +219,6 @@ __weak void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg) */ } -/** - * @brief DeInitialize the WWDG MSP. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @retval None - */ -__weak void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg) -{ - /* Prevent unused argument(s) compilation warning */ - UNUSED(hwwdg); - - /* NOTE: This function should not be modified, when the callback is needed, - the HAL_WWDG_MspDeInit could be implemented in the user file - */ -} - /** * @} */ @@ -273,93 +230,25 @@ __weak void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg) ============================================================================== ##### IO operation functions ##### ============================================================================== - [..] + [..] This section provides functions allowing to: - (+) Start the WWDG. (+) Refresh the WWDG. (+) Handle WWDG interrupt request and associated function callback. -@endverbatim +@endverbatim * @{ */ -/** - * @brief Start the WWDG. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg) -{ - /* Process Locked */ - __HAL_LOCK(hwwdg); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_BUSY; - - /* Enable the peripheral */ - __HAL_WWDG_ENABLE(hwwdg); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_READY; - - /* Process Unlocked */ - __HAL_UNLOCK(hwwdg); - - /* Return function status */ - return HAL_OK; -} - -/** - * @brief Start the WWDG with interrupt enabled. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg) -{ - /* Process Locked */ - __HAL_LOCK(hwwdg); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_BUSY; - - /* Enable the Early Wakeup Interrupt */ - __HAL_WWDG_ENABLE_IT(hwwdg, WWDG_IT_EWI); - - /* Enable the peripheral */ - __HAL_WWDG_ENABLE(hwwdg); - - /* Return function status */ - return HAL_OK; -} - /** * @brief Refresh the WWDG. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @param Counter: value of counter to put in WWDG counter + * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains + * the configuration information for the specified WWDG module. * @retval HAL status */ -HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter) +HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg) { - /* Process Locked */ - __HAL_LOCK(hwwdg); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_BUSY; - - /* Check the parameters */ - assert_param(IS_WWDG_COUNTER(Counter)); - /* Write to WWDG CR the WWDG Counter value to refresh with */ - MODIFY_REG(hwwdg->Instance->CR, WWDG_CR_T, Counter); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_READY; - - /* Process Unlocked */ - __HAL_UNLOCK(hwwdg); + WRITE_REG(hwwdg->Instance->CR, (hwwdg->Init.Counter)); /* Return function status */ return HAL_OK; @@ -369,13 +258,14 @@ HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter) * @brief Handle WWDG interrupt request. * @note The Early Wakeup Interrupt (EWI) can be used if specific safety operations * or data logging must be performed before the actual reset is generated. - * The EWI interrupt is enabled when calling HAL_WWDG_Start_IT function. + * The EWI interrupt is enabled by calling HAL_WWDG_Init function with + * EWIMode set to WWDG_EWI_ENABLE. * When the downcounter reaches the value 0x40, and EWI interrupt is * generated and the corresponding Interrupt Service Routine (ISR) can * be used to trigger specific actions (such as communications or data * logging), before resetting the device. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. + * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains + * the configuration information for the specified WWDG module. * @retval None */ void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg) @@ -386,67 +276,31 @@ void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg) /* Check if WWDG Early Wakeup Interrupt occurred */ if(__HAL_WWDG_GET_FLAG(hwwdg, WWDG_FLAG_EWIF) != RESET) { - /* Early Wakeup callback */ - HAL_WWDG_WakeupCallback(hwwdg); - - /* Change WWDG peripheral state */ - hwwdg->State = HAL_WWDG_STATE_READY; - /* Clear the WWDG Early Wakeup flag */ __HAL_WWDG_CLEAR_FLAG(hwwdg, WWDG_FLAG_EWIF); - /* Process Unlocked */ - __HAL_UNLOCK(hwwdg); + /* Early Wakeup callback */ + HAL_WWDG_EarlyWakeupCallback(hwwdg); } } } /** - * @brief Early Wakeup WWDG callback. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. + * @brief WWDG Early Wakeup callback. + * @param hwwdg pointer to a WWDG_HandleTypeDef structure that contains + * the configuration information for the specified WWDG module. * @retval None */ -__weak void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg) +__weak void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg) { /* Prevent unused argument(s) compilation warning */ UNUSED(hwwdg); /* NOTE: This function should not be modified, when the callback is needed, - the HAL_WWDG_WakeupCallback could be implemented in the user file + the HAL_WWDG_EarlyWakeupCallback could be implemented in the user file */ } -/** - * @} - */ - -/** @defgroup WWDG_Exported_Functions_Group3 Peripheral State functions - * @brief Peripheral State functions. - * -@verbatim - ============================================================================== - ##### Peripheral State functions ##### - ============================================================================== - [..] - This subsection permits to get in run-time the status of the peripheral - and the data flow. - -@endverbatim - * @{ - */ - -/** - * @brief Return the WWDG handle state. - * @param hwwdg: pointer to a WWDG_HandleTypeDef structure that contains - * the configuration information for the specified WWDG module. - * @retval HAL state - */ -HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg) -{ - return hwwdg->State; -} - /** * @} */ diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.h b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.h index 75b07f4422..e17d681676 100644 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.h +++ b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_wwdg.h @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32f3xx_hal_wwdg.h * @author MCD Application Team - * @version V1.2.1 - * @date 29-April-2015 + * @version V1.3.0 + * @date 01-July-2016 * @brief Header file of WWDG HAL module. ****************************************************************************** * @attention @@ -60,31 +60,22 @@ * @{ */ -/** - * @brief WWDG HAL State Structure definition - */ -typedef enum -{ - HAL_WWDG_STATE_RESET = 0x00, /*!< WWDG not yet initialized or disabled */ - HAL_WWDG_STATE_READY = 0x01, /*!< WWDG initialized and ready for use */ - HAL_WWDG_STATE_BUSY = 0x02, /*!< WWDG internal process is ongoing */ - HAL_WWDG_STATE_TIMEOUT = 0x03, /*!< WWDG timeout state */ - HAL_WWDG_STATE_ERROR = 0x04 /*!< WWDG error state */ -}HAL_WWDG_StateTypeDef; - /** * @brief WWDG Init structure definition */ typedef struct { - uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG. - This parameter can be a value of @ref WWDG_Prescaler */ + uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG. + This parameter can be a value of @ref WWDG_Prescaler */ - uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter. - This parameter must be a number lower than Max_Data = 0x80 */ + uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter. + This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */ - uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. - This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ + uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. + This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ + + uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interupt is enable or not. + This parameter can be a value of @ref WWDG_EWI_Mode */ }WWDG_InitTypeDef; @@ -97,10 +88,6 @@ typedef struct WWDG_InitTypeDef Init; /*!< WWDG required parameters */ - HAL_LockTypeDef Lock; /*!< WWDG locking object */ - - __IO HAL_WWDG_StateTypeDef State; /*!< WWDG communication state */ - }WWDG_HandleTypeDef; /** * @} @@ -115,7 +102,7 @@ typedef struct /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition * @{ */ -#define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */ +#define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */ /** * @} */ @@ -124,19 +111,27 @@ typedef struct * @brief WWDG Flag definition * @{ */ -#define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */ +#define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */ /** * @} */ /** @defgroup WWDG_Prescaler WWDG Prescaler * @{ - */ -#define WWDG_PRESCALER_1 ((uint32_t)0x00000000) /*!< WWDG counter clock = (PCLK1/4096)/1 */ -#define WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ -#define WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ -#define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ + */ +#define WWDG_PRESCALER_1 0x00000000u /*!< WWDG counter clock = (PCLK1/4096)/1 */ +#define WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ +#define WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ +#define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ +/** + * @} + */ +/** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode + * @{ + */ +#define WWDG_EWI_DISABLE 0x00000000u /*!< EWI Disable */ +#define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */ /** * @} */ @@ -150,14 +145,17 @@ typedef struct /** @defgroup WWDG_Private_Macros WWDG Private Macros * @{ */ -#define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ - ((__PRESCALER__) == WWDG_PRESCALER_2) || \ - ((__PRESCALER__) == WWDG_PRESCALER_4) || \ - ((__PRESCALER__) == WWDG_PRESCALER_8)) +#define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ + ((__PRESCALER__) == WWDG_PRESCALER_2) || \ + ((__PRESCALER__) == WWDG_PRESCALER_4) || \ + ((__PRESCALER__) == WWDG_PRESCALER_8)) -#define IS_WWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= 0x7F) +#define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) -#define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= 0x40) && ((__COUNTER__) <= 0x7F)) +#define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T)) + +#define IS_WWDG_EWI_MODE(__MODE__) (((__MODE__) == WWDG_EWI_ENABLE) || \ + ((__MODE__) == WWDG_EWI_DISABLE)) /** * @} */ @@ -169,93 +167,66 @@ typedef struct * @{ */ -/** @brief Reset WWDG handle state. - * @param __HANDLE__: WWDG handle - * @retval None - */ -#define __HAL_WWDG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_WWDG_STATE_RESET) - /** * @brief Enable the WWDG peripheral. - * @param __HANDLE__: WWDG handle + * @param __HANDLE__ WWDG handle * @retval None */ -#define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) - -/** - * @brief Disable the WWDG peripheral. - * @param __HANDLE__: WWDG handle - * @note WARNING: This is a dummy macro for HAL code alignment. - * Once enable, WWDG Peripheral cannot be disabled except by a system reset. - * @retval None - */ -#define __HAL_WWDG_DISABLE(__HANDLE__) /* dummy macro */ +#define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) /** * @brief Enable the WWDG early wakeup interrupt. * @param __HANDLE__: WWDG handle - * @param __INTERRUPT__: specifies the interrupt to enable. + * @param __INTERRUPT__ specifies the interrupt to enable. * This parameter can be one of the following values: * @arg WWDG_IT_EWI: Early wakeup interrupt * @note Once enabled this interrupt cannot be disabled except by a system reset. * @retval None */ -#define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) - -/** - * @brief Disable the WWDG early wakeup interrupt. - * @param __HANDLE__: WWDG handle - * @param __INTERRUPT__: specifies the interrupt to disable. - * This parameter can be one of the following values: - * @arg WWDG_IT_EWI: Early wakeup interrupt - * @note WARNING: This is a dummy macro for HAL code alignment. - * Once enabled this interrupt cannot be disabled except by a system reset. - * @retval None - */ -#define __HAL_WWDG_DISABLE_IT(__HANDLE__, __INTERRUPT__) /* dummy macro */ +#define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) /** * @brief Check whether the selected WWDG interrupt has occurred or not. - * @param __HANDLE__: WWDG handle - * @param __INTERRUPT__: specifies the it to check. + * @param __HANDLE__ WWDG handle + * @param __INTERRUPT__ specifies the it to check. * This parameter can be one of the following values: * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT * @retval The new state of WWDG_FLAG (SET or RESET). */ -#define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) +#define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) /** @brief Clear the WWDG interrupt pending bits. * bits to clear the selected interrupt pending bits. - * @param __HANDLE__: WWDG handle - * @param __INTERRUPT__: specifies the interrupt pending bit to clear. + * @param __HANDLE__ WWDG handle + * @param __INTERRUPT__ specifies the interrupt pending bit to clear. * This parameter can be one of the following values: * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag */ -#define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) +#define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) /** * @brief Check whether the specified WWDG flag is set or not. - * @param __HANDLE__: WWDG handle - * @param __FLAG__: specifies the flag to check. + * @param __HANDLE__ WWDG handle + * @param __FLAG__ specifies the flag to check. * This parameter can be one of the following values: * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag * @retval The new state of WWDG_FLAG (SET or RESET). */ -#define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) +#define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) /** * @brief Clear the WWDG's pending flags. - * @param __HANDLE__: WWDG handle - * @param __FLAG__: specifies the flag to clear. + * @param __HANDLE__ WWDG handle + * @param __FLAG__ specifies the flag to clear. * This parameter can be one of the following values: * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag * @retval None */ -#define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) +#define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) /** @brief Check whether the specified WWDG interrupt source is enabled or not. - * @param __HANDLE__: WWDG Handle. - * @param __INTERRUPT__: specifies the WWDG interrupt source to check. + * @param __HANDLE__ WWDG Handle. + * @param __INTERRUPT__ specifies the WWDG interrupt source to check. * This parameter can be one of the following values: * @arg WWDG_IT_EWI: Early Wakeup Interrupt * @retval state of __INTERRUPT__ (TRUE or FALSE). @@ -277,9 +248,7 @@ typedef struct */ /* Initialization/de-initialization functions **********************************/ HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); -HAL_StatusTypeDef HAL_WWDG_DeInit(WWDG_HandleTypeDef *hwwdg); void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); -void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg); /** * @} */ @@ -288,20 +257,9 @@ void HAL_WWDG_MspDeInit(WWDG_HandleTypeDef *hwwdg); * @{ */ /* I/O operation functions ******************************************************/ -HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg); -HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg); -HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t Counter); +HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg); void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg); -void HAL_WWDG_WakeupCallback(WWDG_HandleTypeDef* hwwdg); -/** - * @} - */ - -/** @addtogroup WWDG_Exported_Functions_Group3 - * @{ - */ -/* Peripheral State functions **************************************************/ -HAL_WWDG_StateTypeDef HAL_WWDG_GetState(WWDG_HandleTypeDef *hwwdg); +void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg); /** * @} */ From 24ac9fd49dabb69ef1450e2f87f61a5a0881da4c Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:17:13 +0200 Subject: [PATCH 09/83] [STM32F4] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_STM32F4/TARGET_ARCH_MAX/objects.h | 10 +--- .../TARGET_B96B_F446VE/objects.h | 10 +--- .../TARGET_DISCO_F401VC/objects.h | 10 +--- .../TARGET_DISCO_F407VG/objects.h | 10 +--- .../TARGET_DISCO_F429ZI/objects.h | 10 +--- .../TARGET_DISCO_F469NI/objects.h | 10 +--- .../TARGET_ELMO_F411RE/objects.h | 10 +--- .../TARGET_MTS_DRAGONFLY_F411RE/objects.h | 10 +--- .../TARGET_MTS_MDOT_F405RG/objects.h | 10 +--- .../TARGET_MTS_MDOT_F411RE/objects.h | 10 +--- .../TARGET_NUCLEO_F401RE/objects.h | 10 +--- .../TARGET_NUCLEO_F410RB/objects.h | 10 +--- .../TARGET_NUCLEO_F411RE/objects.h | 10 +--- .../TARGET_NUCLEO_F429ZI/objects.h | 10 +--- .../TARGET_NUCLEO_F446RE/objects.h | 10 +--- .../TARGET_NUCLEO_F446ZE/objects.h | 10 +--- .../TARGET_UBLOX_C029/objects.h | 10 +--- .../TARGET_STM32F4/common_objects.h | 58 +++++++++++++++++++ 18 files changed, 75 insertions(+), 153 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/objects.h index 4fad3e8a78..910e7ab28a 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ARCH_MAX/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/objects.h index 56b4b03811..fcff50792a 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/objects.h @@ -102,20 +102,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; // Used by irq }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/objects.h index d8b93568f7..85ca7538c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F401VC/objects.h @@ -90,15 +90,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/objects.h index 4fad3e8a78..910e7ab28a 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F407VG/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/objects.h index 53c87d6ecb..8907aeb0c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/objects.h @@ -95,20 +95,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h index c18281de29..98a6603e5b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h @@ -95,20 +95,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/objects.h index d8b93568f7..85ca7538c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/objects.h @@ -90,15 +90,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/objects.h index d8b93568f7..85ca7538c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/objects.h @@ -90,15 +90,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/objects.h index f0b6d09b21..5e4b9377be 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/objects.h index d8b93568f7..85ca7538c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/objects.h @@ -90,15 +90,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/objects.h index 5961960e8f..1dfee74a3b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/objects.h index f0b6d09b21..5e4b9377be 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/objects.h index d8b93568f7..85ca7538c0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/objects.h @@ -90,15 +90,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/objects.h index a971994663..24203df462 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/objects.h @@ -95,21 +95,13 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; #include "gpio_object.h" +#include "common_objects.h" #ifdef __cplusplus } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/objects.h index c18281de29..98a6603e5b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/objects.h @@ -95,20 +95,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/objects.h index c18281de29..98a6603e5b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/objects.h @@ -95,20 +95,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/objects.h index f0b6d09b21..5e4b9377be 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/objects.h @@ -95,15 +95,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h new file mode 100644 index 0000000000..69a0cb6add --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h @@ -0,0 +1,58 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; + uint8_t channel; + uint8_t inverted; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From baa95ec5b27933ddf44fc8a36e5ea4e1e9d0f408 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:44:30 +0200 Subject: [PATCH 10/83] [STM32F0] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_DISCO_F051R8/objects.h | 8 +-- .../TARGET_NUCLEO_F030R8/objects.h | 8 +-- .../TARGET_NUCLEO_F031K6/objects.h | 8 +-- .../TARGET_NUCLEO_F042K6/objects.h | 8 +-- .../TARGET_NUCLEO_F070RB/objects.h | 8 +-- .../TARGET_NUCLEO_F072RB/objects.h | 8 +-- .../TARGET_NUCLEO_F091RC/objects.h | 8 +-- .../TARGET_STM32F0/common_objects.h | 56 +++++++++++++++++++ 8 files changed, 63 insertions(+), 49 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/objects.h index aa9b7908a3..c2f6a00208 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/objects.h @@ -93,13 +93,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/objects.h index 162117e03d..a8238b5f01 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/objects.h @@ -88,13 +88,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/objects.h index d28f670c7e..10fab3cee3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/objects.h @@ -88,13 +88,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h index a62fd46b54..c1bddd3bf2 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h @@ -88,18 +88,12 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/objects.h index 162117e03d..a8238b5f01 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/objects.h @@ -88,13 +88,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/objects.h index c92f1d2cde..59af910c59 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/objects.h @@ -93,18 +93,12 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/objects.h index c92f1d2cde..59af910c59 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/objects.h @@ -93,18 +93,12 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h new file mode 100644 index 0000000000..f2d09cd2a4 --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h @@ -0,0 +1,56 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From f6164f34cd6f9a31ed1b35d6ca90d56d25d73a28 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:56:32 +0200 Subject: [PATCH 11/83] [STM32F1] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_BLUEPILL_F103C8/objects.h | 8 +-- .../TARGET_DISCO_F100RB/objects.h | 8 +-- .../TARGET_NUCLEO_F103RB/objects.h | 8 +-- .../TARGET_STM32F1/common_objects.h | 56 +++++++++++++++++++ 4 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/objects.h index 5b2e45b553..d8d35edee7 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/objects.h @@ -89,19 +89,13 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - struct can_s { CANName can; int index; }; #include "gpio_object.h" +#include "common_objects.h" #ifdef __cplusplus } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/objects.h index a75a3e96b1..d2f6bd8420 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/objects.h @@ -89,13 +89,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h index 5b2e45b553..8e18b767ea 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h @@ -89,18 +89,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h new file mode 100644 index 0000000000..f2d09cd2a4 --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h @@ -0,0 +1,56 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From 2b178a5c9978b4098ea07cca43bd2b767a3ad575 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:56:58 +0200 Subject: [PATCH 12/83] [STM32F3] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_DISCO_F303VC/objects.h | 11 +--- .../TARGET_DISCO_F334C8/objects.h | 11 +--- .../TARGET_NUCLEO_F302R8/objects.h | 11 +--- .../TARGET_NUCLEO_F303K8/objects.h | 11 +--- .../TARGET_NUCLEO_F303RE/objects.h | 11 +--- .../TARGET_NUCLEO_F334R8/objects.h | 11 +--- .../TARGET_STM32F3/common_objects.h | 59 +++++++++++++++++++ 7 files changed, 65 insertions(+), 60 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32F3/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/objects.h index a1cba7d583..e1456e9591 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/objects.h @@ -96,16 +96,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/objects.h index a1cba7d583..e1456e9591 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/objects.h @@ -96,16 +96,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/objects.h index 81ebc1d371..f1038bf33b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/objects.h @@ -96,21 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/objects.h index 81ebc1d371..f1038bf33b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/objects.h @@ -96,21 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/objects.h index 81ebc1d371..f1038bf33b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/objects.h @@ -96,21 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/objects.h index 81ebc1d371..f1038bf33b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/objects.h @@ -96,21 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/common_objects.h new file mode 100644 index 0000000000..a3c3410cb3 --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/common_objects.h @@ -0,0 +1,59 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t prescaler; + uint32_t period; + uint32_t pulse; + uint8_t channel; + uint8_t inverted; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From 42498e9f7cfb6c11f0b0c32cd86d4228e7085742 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:57:08 +0200 Subject: [PATCH 13/83] [STM32F7] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_DISCO_F746NG/objects.h | 10 +--- .../TARGET_NUCLEO_F746ZG/objects.h | 10 +--- .../TARGET_NUCLEO_F767ZI/objects.h | 10 +--- .../TARGET_STM32F7/common_objects.h | 58 +++++++++++++++++++ 4 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/objects.h index b262283fd3..a476a90ee8 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/objects.h @@ -96,20 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/objects.h index f71d96f84a..f4dc2b5376 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/objects.h @@ -101,20 +101,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h index b5beed24ba..31d8c73cb8 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h @@ -101,16 +101,8 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - #include "gpio_object.h" +#include "common_objects.h" #ifdef __cplusplus } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h new file mode 100644 index 0000000000..69a0cb6add --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h @@ -0,0 +1,58 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; + uint8_t channel; + uint8_t inverted; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From f77155f6b60bfad6748792802d3e7e941db6a158 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:57:21 +0200 Subject: [PATCH 14/83] [STM32L0] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_DISCO_L053C8/objects.h | 10 +--- .../TARGET_NUCLEO_L011K4/objects.h | 10 +--- .../TARGET_NUCLEO_L031K6/objects.h | 10 +--- .../TARGET_NUCLEO_L053R8/objects.h | 10 +--- .../TARGET_NUCLEO_L073RZ/objects.h | 10 +--- .../TARGET_STM32L0/common_objects.h | 58 +++++++++++++++++++ 6 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/objects.h index 0ffa12d50a..f5bdba6293 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/objects.h @@ -95,15 +95,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/objects.h index 71b8bdbc30..f736408276 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/objects.h @@ -89,15 +89,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/objects.h index 71b8bdbc30..f736408276 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/objects.h @@ -89,15 +89,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/objects.h index 0ffa12d50a..f5bdba6293 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/objects.h @@ -95,15 +95,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/objects.h index 0ffa12d50a..f5bdba6293 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/objects.h @@ -95,15 +95,7 @@ struct i2c_s { I2CName i2c; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h new file mode 100644 index 0000000000..69a0cb6add --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h @@ -0,0 +1,58 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; + uint8_t channel; + uint8_t inverted; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From e71a164682890de124286c3e5b28112d1f8c6192 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:57:30 +0200 Subject: [PATCH 15/83] [STM32L1] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_MOTE_L152RC/objects.h | 8 +-- .../TARGET_NUCLEO_L152RE/objects.h | 8 +-- .../TARGET_NZ32_SC151/objects.h | 8 +-- .../TARGET_STM32L1/common_objects.h | 56 +++++++++++++++++++ 4 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/objects.h index c6048cfcbd..302eeb7dc9 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/objects.h @@ -94,13 +94,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/objects.h index c6048cfcbd..302eeb7dc9 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/objects.h @@ -94,13 +94,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/objects.h index 471e5a76a8..c28cf5c585 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/objects.h @@ -94,13 +94,7 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; -}; - +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h new file mode 100644 index 0000000000..f2d09cd2a4 --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h @@ -0,0 +1,56 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From 7dc0ce3c2bd23fb3dea1e178d43f6c44752b98a3 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:57:39 +0200 Subject: [PATCH 16/83] [STM32L4] place holder for common object definition Some of the objects in object.h are the same for all targets. Create a place where to define those common definitions, and start using it for pwm object. --- .../TARGET_DISCO_L476VG/objects.h | 11 +--- .../TARGET_NUCLEO_L432KC/objects.h | 10 +--- .../TARGET_NUCLEO_L476RG/objects.h | 10 +--- .../TARGET_STM32L4/common_objects.h | 58 +++++++++++++++++++ 4 files changed, 61 insertions(+), 28 deletions(-) create mode 100644 hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/objects.h index 4e2846b9bb..6d361e628b 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/objects.h @@ -96,21 +96,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/objects.h index 1a4e7eb660..43e61671dd 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/objects.h @@ -101,21 +101,13 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; #include "gpio_object.h" +#include "common_objects.h" #ifdef __cplusplus } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/objects.h index 1a4e7eb660..659d50e97a 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/objects.h @@ -101,20 +101,12 @@ struct i2c_s { uint32_t slave; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t period; - uint32_t pulse; - uint32_t channel; - uint32_t inverted; -}; - struct can_s { CANName can; int index; }; +#include "common_objects.h" #include "gpio_object.h" #ifdef __cplusplus diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h new file mode 100644 index 0000000000..69a0cb6add --- /dev/null +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h @@ -0,0 +1,58 @@ +/* mbed Microcontroller Library + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#ifndef MBED_COMMON_OBJECTS_H +#define MBED_COMMON_OBJECTS_H + +#include "cmsis.h" +#include "PortNames.h" +#include "PeripheralNames.h" +#include "PinNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct pwmout_s { + PWMName pwm; + PinName pin; + uint32_t period; + uint32_t pulse; + uint8_t channel; + uint8_t inverted; +}; + +#include "gpio_object.h" + +#ifdef __cplusplus +} +#endif + +#endif + From 00e51f4fe22561da43d119fdb931d39b7371b028 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 10:59:59 +0200 Subject: [PATCH 17/83] [STM32F0] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32F0/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32F0/pwmout_api.c | 34 +++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h index f2d09cd2a4..e2e7903613 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; }; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c index d2504ec910..ccb1ec593c 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c @@ -75,6 +75,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) { obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -101,7 +102,7 @@ void pwmout_write(pwmout_t* obj, float value) { // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_DISABLE; @@ -265,18 +266,39 @@ void pwmout_period_us(pwmout_t* obj, int us) { // Update the SystemCoreClock variable SystemCoreClockUpdate(); - TimHandle.Init.Period = us - 1; - TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + TimHandle.Init.Prescaler = ((SystemCoreClock / 1000000) * obj->prescaler) - 1; + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; - HAL_TIM_PWM_Init(&TimHandle); - // Set duty cycle again - pwmout_write(obj, dc); + if (HAL_TIM_PWM_Init(&TimHandle) != HAL_OK) { + error("Cannot initialize PWM"); + } // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From ce5ee179cda341b8fc78e4d6d557c523ee0a0fd9 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 11:00:20 +0200 Subject: [PATCH 18/83] [STM32F1] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32F1/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32F1/pwmout_api.c | 32 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h index f2d09cd2a4..e2e7903613 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; }; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c index 94ccb409de..90fd7c42e8 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c @@ -58,6 +58,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -86,7 +87,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_DISABLE; @@ -193,18 +194,37 @@ void pwmout_period_us(pwmout_t* obj, int us) // Update the SystemCoreClock variable SystemCoreClockUpdate(); - TimHandle.Init.Period = us - 1; - TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 us tick + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + + TimHandle.Init.Prescaler = ((SystemCoreClock / 1000000) * obj->prescaler) - 1; + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; HAL_TIM_PWM_Init(&TimHandle); - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From ab45ef0378d3afe461bbbec0d2c77b56fce52e5f Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 28 Jun 2016 18:19:58 +0200 Subject: [PATCH 19/83] [STM32F4] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32F4/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32F4/pwmout_api.c | 39 ++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h index 69a0cb6add..a3c3410cb3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; uint8_t channel; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/pwmout_api.c index 6bddceda80..b908c5a0af 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/pwmout_api.c @@ -94,6 +94,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -121,7 +122,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_DISABLE; @@ -240,26 +241,45 @@ void pwmout_period_us(pwmout_t* obj, int us) default: return; } - - TimHandle.Init.Period = us - 1; + + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + // TIMxCLK = PCLKx when the APB prescaler = 1 else TIMxCLK = 2 * PCLKx if (APBxCLKDivider == RCC_HCLK_DIV1) - TimHandle.Init.Prescaler = (uint16_t)((PclkFreq) / 1000000) - 1; // 1 us tick + TimHandle.Init.Prescaler = (uint16_t)(((PclkFreq) / 1000000) * obj->prescaler) - 1; // 1 us tick else - TimHandle.Init.Prescaler = (uint16_t)((PclkFreq * 2) / 1000000) - 1; // 1 us tick + TimHandle.Init.Prescaler = (uint16_t)(((PclkFreq * 2) / 1000000) * obj->prescaler) - 1; // 1 us tick + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; - + if (HAL_TIM_PWM_Init(&TimHandle) != HAL_OK) { error("Cannot initialize PWM\n"); } - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } @@ -276,6 +296,7 @@ void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) void pwmout_pulsewidth_us(pwmout_t* obj, int us) { float value = (float)us / (float)obj->period; + printf("pwmout_pulsewidth_us: period=%d, us=%d, dc=%d%%\r\n", obj->period, us, (int) (value*100)); pwmout_write(obj, value); } From 0cdcb9bafa287157d93816906c86622e158b8067 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 11:02:54 +0200 Subject: [PATCH 20/83] [STM32F7] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32F7/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32F7/pwmout_api.c | 34 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h index 69a0cb6add..a3c3410cb3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; uint8_t channel; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/pwmout_api.c index 8a88b9d839..1e95b476fb 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/pwmout_api.c @@ -69,6 +69,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -96,7 +97,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_DISABLE; @@ -192,12 +193,31 @@ void pwmout_period_us(pwmout_t* obj, int us) return; } - TimHandle.Init.Period = us - 1; + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + // TIMxCLK = PCLKx when the APB prescaler = 1 else TIMxCLK = 2 * PCLKx if (APBxCLKDivider == RCC_HCLK_DIV1) - TimHandle.Init.Prescaler = (uint16_t)((PclkFreq) / 1000000) - 1; // 1 µs tick + TimHandle.Init.Prescaler = (uint16_t)(((PclkFreq) / 1000000) * obj->prescaler) - 1; // 1 us tick else - TimHandle.Init.Prescaler = (uint16_t)((PclkFreq * 2) / 1000000) - 1; // 1 µs tick + TimHandle.Init.Prescaler = (uint16_t)(((PclkFreq * 2) / 1000000) * obj->prescaler) - 1; // 1 us tick + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; @@ -205,12 +225,12 @@ void pwmout_period_us(pwmout_t* obj, int us) error("Cannot initialize PWM\n"); } - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From 332660eb1bb4a042dcfee5d122bf597931d394c9 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 11:03:13 +0200 Subject: [PATCH 21/83] [STM32L0] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32L0/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32L0/pwmout_api.c | 31 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h index 69a0cb6add..a3c3410cb3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; uint8_t channel; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/pwmout_api.c index 8c6cd99b96..4f2ef410c9 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/pwmout_api.c @@ -66,6 +66,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -93,7 +94,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_ENABLE; @@ -148,8 +149,26 @@ void pwmout_period_us(pwmout_t* obj, int us) __HAL_TIM_DISABLE(&TimHandle); - TimHandle.Init.Period = us - 1; - TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 us tick + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + TimHandle.Init.Prescaler = ((SystemCoreClock / 1000000) * obj->prescaler) - 1; + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; @@ -157,12 +176,12 @@ void pwmout_period_us(pwmout_t* obj, int us) error("Cannot initialize PWM"); } - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From 6eab29cc099765632d6eb2402ff2108c675920b7 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 11:03:30 +0200 Subject: [PATCH 22/83] [STM32L1] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32L1/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32L1/pwmout_api.c | 34 +++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h index f2d09cd2a4..e2e7903613 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; }; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c index f6733c20a1..bbbcbb3567 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c @@ -62,6 +62,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -89,7 +90,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_ENABLE; @@ -167,18 +168,39 @@ void pwmout_period_us(pwmout_t* obj, int us) SystemCoreClockUpdate(); - TimHandle.Init.Period = us - 1; - TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 us tick + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + TimHandle.Init.Prescaler = ((SystemCoreClock / 1000000) * obj->prescaler) - 1; + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; - HAL_TIM_PWM_Init(&TimHandle); - // Set duty cycle again - pwmout_write(obj, dc); + if (HAL_TIM_PWM_Init(&TimHandle) != HAL_OK) { + error("Cannot initialize PWM"); + } // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From 6dc9501153e48a32b12829404c897c56cd410c0b Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 29 Jun 2016 11:03:53 +0200 Subject: [PATCH 23/83] [STM32L4] Handle higher range pwm periods As first reported on STM32F3 family in #1682, we need to cope with periods in the seconds range as well. This is fixed here in the same way as was done for STM32F3 by using the pre-scaler. --- .../TARGET_STM32L4/common_objects.h | 1 + .../TARGET_STM/TARGET_STM32L4/pwmout_api.c | 36 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h index 69a0cb6add..a3c3410cb3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/common_objects.h @@ -42,6 +42,7 @@ extern "C" { struct pwmout_s { PWMName pwm; PinName pin; + uint32_t prescaler; uint32_t period; uint32_t pulse; uint8_t channel; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c index 901f256059..8d12141400 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c @@ -77,6 +77,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) obj->pin = pin; obj->period = 0; obj->pulse = 0; + obj->prescaler = 1; pwmout_period_us(obj, 20000); // 20 ms per default } @@ -104,7 +105,7 @@ void pwmout_write(pwmout_t* obj, float value) // Configure channels sConfig.OCMode = TIM_OCMODE_PWM1; - sConfig.Pulse = obj->pulse; + sConfig.Pulse = obj->pulse / obj->prescaler; sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfig.OCFastMode = TIM_OCFAST_ENABLE; @@ -168,22 +169,39 @@ void pwmout_period_us(pwmout_t* obj, int us) SystemCoreClockUpdate(); - TimHandle.Init.Period = us - 1; - TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 us tick - TimHandle.Init.ClockDivision = 0; - TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; - TimHandle.Init.RepetitionCounter = 0; + /* To make it simple, we use to possible prescaler values which lead to: + * pwm unit = 1us, period/pulse can be from 1us to 65535us + * or + * pwm unit = 500us, period/pulse can be from 500us to ~32.76sec + * Be careful that all the channels of a PWM shares the same prescaler + */ + if (us > 0xFFFF) { + obj->prescaler = 500; + } else { + obj->prescaler = 1; + } + TimHandle.Init.Prescaler = ((SystemCoreClock / 1000000) * obj->prescaler) - 1; + + if (TimHandle.Init.Prescaler > 0xFFFF) + error("PWM: out of range prescaler"); + + TimHandle.Init.Period = (us - 1) / obj->prescaler; + if (TimHandle.Init.Period > 0xFFFF) + error("PWM: out of range period"); + + TimHandle.Init.ClockDivision = 0; + TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; if (HAL_TIM_PWM_Init(&TimHandle) != HAL_OK) { error("Cannot initialize PWM\n"); } - // Set duty cycle again - pwmout_write(obj, dc); - // Save for future use obj->period = us; + // Set duty cycle again + pwmout_write(obj, dc); + __HAL_TIM_ENABLE(&TimHandle); } From cf6f8e33fb175fc838108535f9294e12f6269c2f Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 25 Jun 2016 10:58:08 -0500 Subject: [PATCH 24/83] Added cas instrinsics for pointer values - core_util_atomic_cas - core_util_atomic_incr - core_util_atomic_decr --- hal/api/critical.h | 69 +++++++++++++++++++++++++++++++++++++++++++ hal/common/critical.c | 15 ++++++++++ 2 files changed, 84 insertions(+) diff --git a/hal/api/critical.h b/hal/api/critical.h index 2c288a5430..5df657e0d2 100644 --- a/hal/api/critical.h +++ b/hal/api/critical.h @@ -221,6 +221,59 @@ bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uin */ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue); +/** + * Atomic compare and set. It compares the contents of a memory location to a + * given value and, only if they are the same, modifies the contents of that + * memory location to a given new value. This is done as a single atomic + * operation. The atomicity guarantees that the new value is calculated based on + * up-to-date information; if the value had been updated by another thread in + * the meantime, the write would fail due to a mismatched expectedCurrentValue. + * + * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect + * you to the article on compare-and swap]. + * + * @param ptr The target memory location. + * @param[in,out] expectedCurrentValue A pointer to some location holding the + * expected current value of the data being set atomically. + * The computed 'desiredValue' should be a function of this current value. + * @Note: This is an in-out parameter. In the + * failure case of atomic_cas (where the + * destination isn't set), the pointee of expectedCurrentValue is + * updated with the current value. + * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. + * + * @return true if the memory location was atomically + * updated with the desired value (after verifying + * that it contained the expectedCurrentValue), + * false otherwise. In the failure case, + * exepctedCurrentValue is updated with the new + * value of the target memory location. + * + * pseudocode: + * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { + * if *p != *old { + * *old = *p + * return false + * } + * *p = new + * return true + * } + * + * @Note: In the failure case (where the destination isn't set), the value + * pointed to by expectedCurrentValue is still updated with the current value. + * This property helps writing concise code for the following incr: + * + * function incr(p : pointer to int, a : int) returns int { + * done = false + * *value = *p // This fetch operation need not be atomic. + * while not done { + * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success + * } + * return value + a + * } + */ +bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue); + /** * Atomic increment. * @param valuePtr Target memory location being incremented. @@ -245,6 +298,14 @@ uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta); */ uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta); +/** + * Atomic increment. + * @param valuePtr Target memory location being incremented. + * @param delta The amount being incremented. + * @return The new incremented value. + */ +void *core_util_atomic_incr_ptr(void **valuePtr, unsigned delta); + /** * Atomic decrement. * @param valuePtr Target memory location being decremented. @@ -269,6 +330,14 @@ uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta); */ uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta); +/** + * Atomic decrement. + * @param valuePtr Target memory location being decremented. + * @param delta The amount being decremented. + * @return The new decremented value. + */ +void *core_util_atomic_decr_ptr(void **valuePtr, unsigned delta); + #ifdef __cplusplus } // extern "C" #endif diff --git a/hal/common/critical.c b/hal/common/critical.c index 47bfd23b12..7007e5c67e 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -236,6 +236,13 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin return success; } +bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue) { + return core_util_atomic_cas_u32( + (unsigned *)ptr, + (unsigned *)expectedCurrentValue, + (unsigned)desiredValue); +} + uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) { uint8_t newValue; @@ -266,6 +273,10 @@ uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta) return newValue; } +void *core_util_atomic_incr_ptr(void **valuePtr, unsigned delta) { + return core_util_atomic_incr((unsigned)valuePtr, delta); +} + uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta) { @@ -297,5 +308,9 @@ uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta) return newValue; } +void *core_util_atomic_decr_ptr(void **valuePtr, unsigned delta) { + return core_util_atomic_decr((unsigned)valuePtr, delta); +} + #endif From 26726cc170f9450afb52f39d66065bb506d3536b Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 5 Jul 2016 11:44:06 -0500 Subject: [PATCH 25/83] Added proper usage of standard types for critical pointer functions --- hal/api/critical.h | 6 ++++-- hal/common/critical.c | 22 +++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hal/api/critical.h b/hal/api/critical.h index 5df657e0d2..676db94031 100644 --- a/hal/api/critical.h +++ b/hal/api/critical.h @@ -19,6 +19,8 @@ #define __MBED_UTIL_CRITICAL_H__ #include +#include +#include #ifdef __cplusplus extern "C" { @@ -304,7 +306,7 @@ uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta); * @param delta The amount being incremented. * @return The new incremented value. */ -void *core_util_atomic_incr_ptr(void **valuePtr, unsigned delta); +void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta); /** * Atomic decrement. @@ -336,7 +338,7 @@ uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta); * @param delta The amount being decremented. * @return The new decremented value. */ -void *core_util_atomic_decr_ptr(void **valuePtr, unsigned delta); +void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta); #ifdef __cplusplus } // extern "C" diff --git a/hal/common/critical.c b/hal/common/critical.c index 7007e5c67e..ef68069d3f 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -15,15 +15,11 @@ * limitations under the License. */ -#define __STDC_LIMIT_MACROS -#include -#include +#include "critical.h" + #include "cmsis.h" #include "mbed_assert.h" -// Module include -#include "critical.h" - #define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS)) static volatile uint32_t interrupt_enable_counter = 0; @@ -238,9 +234,9 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue) { return core_util_atomic_cas_u32( - (unsigned *)ptr, - (unsigned *)expectedCurrentValue, - (unsigned)desiredValue); + (uintptr_t *)ptr, + (uintptr_t *)expectedCurrentValue, + (uintptr_t)desiredValue); } uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) @@ -273,8 +269,8 @@ uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta) return newValue; } -void *core_util_atomic_incr_ptr(void **valuePtr, unsigned delta) { - return core_util_atomic_incr((unsigned)valuePtr, delta); +void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { + return core_util_atomic_incr((uintptr_t)valuePtr, (uintptr_t)delta); } @@ -308,8 +304,8 @@ uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta) return newValue; } -void *core_util_atomic_decr_ptr(void **valuePtr, unsigned delta) { - return core_util_atomic_decr((unsigned)valuePtr, delta); +void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta) { + return core_util_atomic_decr((uintptr_t)valuePtr, (uintptr_t)delta); } #endif From 906714861836d5ae9d274f7d7bb67c5a2c7b0119 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 5 Jul 2016 12:05:10 -0500 Subject: [PATCH 26/83] Standardized style of critical.h per @0xc0170 --- hal/api/critical.h | 16 ++++++++-------- hal/common/critical.c | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/hal/api/critical.h b/hal/api/critical.h index 676db94031..77108a8600 100644 --- a/hal/api/critical.h +++ b/hal/api/critical.h @@ -49,7 +49,7 @@ bool core_util_are_interrupts_enabled(void); * section) will be preserved on exit from the section. * 4) This implementation will currently only work on code running in privileged mode. */ -void core_util_critical_section_enter(); +void core_util_critical_section_enter(void); /** Mark the end of a critical section * @@ -62,7 +62,7 @@ void core_util_critical_section_enter(); * section) will be preserved on exit from the section. * 4) This implementation will currently only work on code running in privileged mode. */ -void core_util_critical_section_exit(); +void core_util_critical_section_exit(void); /** * Atomic compare and set. It compares the contents of a memory location to a @@ -282,7 +282,7 @@ bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *des * @param delta The amount being incremented. * @return The new incremented value. */ -uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta); +uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta); /** * Atomic increment. @@ -290,7 +290,7 @@ uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta); * @param delta The amount being incremented. * @return The new incremented value. */ -uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta); +uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta); /** * Atomic increment. @@ -298,7 +298,7 @@ uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta); * @param delta The amount being incremented. * @return The new incremented value. */ -uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta); +uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta); /** * Atomic increment. @@ -314,7 +314,7 @@ void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta); * @param delta The amount being decremented. * @return The new decremented value. */ -uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta); +uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta); /** * Atomic decrement. @@ -322,7 +322,7 @@ uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta); * @param delta The amount being decremented. * @return The new decremented value. */ -uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta); +uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta); /** * Atomic decrement. @@ -330,7 +330,7 @@ uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta); * @param delta The amount being decremented. * @return The new decremented value. */ -uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta); +uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta); /** * Atomic decrement. diff --git a/hal/common/critical.c b/hal/common/critical.c index ef68069d3f..f4ec8eb2f1 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -34,7 +34,7 @@ bool core_util_are_interrupts_enabled(void) #endif } -void core_util_critical_section_enter() +void core_util_critical_section_enter(void) { bool interrupts_disabled = !core_util_are_interrupts_enabled(); __disable_irq(); @@ -59,7 +59,7 @@ void core_util_critical_section_enter() interrupt_enable_counter++; } -void core_util_critical_section_exit() +void core_util_critical_section_exit(void) { /* If critical_section_enter has not previously been called, do nothing */ if (interrupt_enable_counter) { @@ -123,7 +123,7 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin return !__STREXW(desiredValue, (volatile uint32_t*)ptr); } -uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) +uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta) { uint8_t newValue; do { @@ -132,7 +132,7 @@ uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) return newValue; } -uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta) +uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta) { uint16_t newValue; do { @@ -141,7 +141,7 @@ uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta) return newValue; } -uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta) +uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta) { uint32_t newValue; do { @@ -151,7 +151,7 @@ uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta) } -uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta) +uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta) { uint8_t newValue; do { @@ -160,7 +160,7 @@ uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta) return newValue; } -uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta) +uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta) { uint16_t newValue; do { @@ -169,7 +169,7 @@ uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta) return newValue; } -uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta) +uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta) { uint32_t newValue; do { @@ -239,7 +239,7 @@ bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *des (uintptr_t)desiredValue); } -uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) +uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta) { uint8_t newValue; core_util_critical_section_enter(); @@ -249,7 +249,7 @@ uint8_t core_util_atomic_incr_u8(uint8_t * valuePtr, uint8_t delta) return newValue; } -uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta) +uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta) { uint16_t newValue; core_util_critical_section_enter(); @@ -259,7 +259,7 @@ uint16_t core_util_atomic_incr_u16(uint16_t * valuePtr, uint16_t delta) return newValue; } -uint32_t core_util_atomic_incr_u32(uint32_t * valuePtr, uint32_t delta) +uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta) { uint32_t newValue; core_util_critical_section_enter(); @@ -274,7 +274,7 @@ void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { } -uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta) +uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta) { uint8_t newValue; core_util_critical_section_enter(); @@ -284,7 +284,7 @@ uint8_t core_util_atomic_decr_u8(uint8_t * valuePtr, uint8_t delta) return newValue; } -uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta) +uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta) { uint16_t newValue; core_util_critical_section_enter(); @@ -294,7 +294,7 @@ uint16_t core_util_atomic_decr_u16(uint16_t * valuePtr, uint16_t delta) return newValue; } -uint32_t core_util_atomic_decr_u32(uint32_t * valuePtr, uint32_t delta) +uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta) { uint32_t newValue; core_util_critical_section_enter(); From 946199183c9da323b0480d78d91d5347a74d8089 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 5 Jul 2016 12:14:20 -0500 Subject: [PATCH 27/83] Minor documentation updates for critical - extra dereference in cas example - clarification of incr/decr --- hal/api/critical.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hal/api/critical.h b/hal/api/critical.h index 77108a8600..df60f11f0f 100644 --- a/hal/api/critical.h +++ b/hal/api/critical.h @@ -108,7 +108,7 @@ void core_util_critical_section_exit(void); * * function incr(p : pointer to int, a : int) returns int { * done = false - * *value = *p // This fetch operation need not be atomic. + * value = *p // This fetch operation need not be atomic. * while not done { * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success * } @@ -161,7 +161,7 @@ bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_ * * function incr(p : pointer to int, a : int) returns int { * done = false - * *value = *p // This fetch operation need not be atomic. + * value = *p // This fetch operation need not be atomic. * while not done { * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success * } @@ -214,7 +214,7 @@ bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uin * * function incr(p : pointer to int, a : int) returns int { * done = false - * *value = *p // This fetch operation need not be atomic. + * value = *p // This fetch operation need not be atomic. * while not done { * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success * } @@ -267,7 +267,7 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin * * function incr(p : pointer to int, a : int) returns int { * done = false - * *value = *p // This fetch operation need not be atomic. + * value = *p // This fetch operation need not be atomic. * while not done { * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success * } @@ -303,8 +303,11 @@ uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta); /** * Atomic increment. * @param valuePtr Target memory location being incremented. - * @param delta The amount being incremented. + * @param delta The amount being incremented in bytes. * @return The new incremented value. + * + * @note The type of the pointer argument is not taken into account + * and the pointer is incremented by bytes. */ void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta); @@ -335,8 +338,11 @@ uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta); /** * Atomic decrement. * @param valuePtr Target memory location being decremented. - * @param delta The amount being decremented. + * @param delta The amount being decremented in bytes. * @return The new decremented value. + * + * @note The type of the pointer argument is not taken into account + * and the pointer is decremented by bytes */ void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta); From 12a01f61cac64666e69fcd612acae2b63a4b8a2e Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Tue, 28 Jun 2016 16:34:28 +0100 Subject: [PATCH 28/83] Add summary for test building When users are building tests with `mbed compile --tests` whey will by default get memory map breakdown report. This can be suppresed in the future with command line switch. For now it is visible each time users build test cases. List is sorted by project name created with `build_project` API. Changes: * `build_project` now returns tuple (this breaks build_api.build_project API!) * Memmap script got a aggregation function to print summary from small 'JSON' partial reports. * Report is generated by `test_api.build_tests` function only! Example: ``` +----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+ | name | target | toolchain | total_flash | static_ram | stack | heap | total_ram | +----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+ | features-feature_ipv4-tests-mbedmicro-net-nist_internet_time_service | K64F | GCC_ARM | 132136 | 62288 | 32768 | 65536 | 160592 | | features-feature_ipv4-tests-mbedmicro-net-tcp_client_echo | K64F | GCC_ARM | 125613 | 62448 | 32768 | 65540 | 160756 | | features-feature_ipv4-tests-mbedmicro-net-tcp_client_hello_world | K64F | GCC_ARM | 125949 | 62448 | 32768 | 65540 | 160756 | | features-feature_ipv4-tests-mbedmicro-net-udp_echo_client | K64F | GCC_ARM | 123613 | 62276 | 32768 | 65536 | 160580 | | features-storage-tests-cfstore-add_del | K64F | GCC_ARM | 96080 | 13052 | 32768 | 65540 | 111360 | | features-storage-tests-cfstore-close | K64F | GCC_ARM | 95520 | 12004 | 32768 | 65540 | 110312 | | features-storage-tests-cfstore-create | K64F | GCC_ARM | 99144 | 13036 | 32768 | 65540 | 111344 | | features-storage-tests-cfstore-example1 | K64F | GCC_ARM | 98592 | 12368 | 32768 | 65536 | 110672 | | features-storage-tests-cfstore-example2 | K64F | GCC_ARM | 95232 | 12012 | 32768 | 65540 | 110320 | | features-storage-tests-cfstore-example3 | K64F | GCC_ARM | 95264 | 11856 | 32768 | 65536 | 110160 | | features-storage-tests-cfstore-example4 | K64F | GCC_ARM | 92632 | 12012 | 32768 | 65540 | 110320 | | features-storage-tests-cfstore-example5 | K64F | GCC_ARM | 92344 | 11856 | 32768 | 65536 | 110160 | | features-storage-tests-cfstore-find | K64F | GCC_ARM | 96344 | 13028 | 32768 | 65540 | 111336 | | features-storage-tests-cfstore-find2 | K64F | GCC_ARM | 93192 | 12004 | 32768 | 65540 | 110312 | | features-storage-tests-cfstore-flash | K64F | GCC_ARM | 97784 | 12532 | 32768 | 65540 | 110840 | | features-storage-tests-cfstore-flush | K64F | GCC_ARM | 96464 | 12012 | 32768 | 65540 | 110320 | | features-storage-tests-cfstore-flush2 | K64F | GCC_ARM | 95056 | 12004 | 32768 | 65540 | 110312 | | features-storage-tests-cfstore-init | K64F | GCC_ARM | 93120 | 12012 | 32768 | 65540 | 110320 | | features-storage-tests-cfstore-misc | K64F | GCC_ARM | 96808 | 12516 | 32768 | 65540 | 110824 | | features-storage-tests-cfstore-open | K64F | GCC_ARM | 98632 | 12540 | 32768 | 65540 | 110848 | | features-storage-tests-cfstore-read | K64F | GCC_ARM | 94112 | 12540 | 32768 | 65540 | 110848 | | features-storage-tests-cfstore-write | K64F | GCC_ARM | 94488 | 12004 | 32768 | 65540 | 110312 | | features-storage-tests-flash_journal-basicapi | K64F | GCC_ARM | 104712 | 21236 | 32768 | 65540 | 119544 | | frameworks-utest-tests-unit_tests-basic_test | K64F | GCC_ARM | 71534 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-case_async_validate | K64F | GCC_ARM | 74598 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-case_control_async | K64F | GCC_ARM | 74630 | 11476 | 32768 | 65540 | 109784 | | frameworks-utest-tests-unit_tests-case_control_repeat | K64F | GCC_ARM | 72790 | 11452 | 32768 | 65540 | 109760 | | frameworks-utest-tests-unit_tests-case_selection | K64F | GCC_ARM | 72302 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-case_setup_failure | K64F | GCC_ARM | 72630 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-case_teardown_failure | K64F | GCC_ARM | 72790 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-control_type | K64F | GCC_ARM | 82462 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-minimal_async_scheduler | K64F | GCC_ARM | 72182 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-minimal_scheduler | K64F | GCC_ARM | 71998 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-test_assertion_failure_test_setup | K64F | GCC_ARM | 71710 | 11460 | 32768 | 65540 | 109768 | | frameworks-utest-tests-unit_tests-test_setup_case_selection_failure | K64F | GCC_ARM | 71702 | 11468 | 32768 | 65540 | 109776 | | frameworks-utest-tests-unit_tests-test_setup_failure | K64F | GCC_ARM | 71710 | 11468 | 32768 | 65540 | 109776 | | tests-integration-basic | K64F | GCC_ARM | 67566 | 10780 | 32768 | 65540 | 109088 | | tests-integration-threaded_blinky | K64F | GCC_ARM | 68326 | 10780 | 32768 | 65540 | 109088 | | tests-mbed_drivers-c_strings | K64F | GCC_ARM | 74438 | 11468 | 32768 | 65540 | 109776 | | tests-mbed_drivers-callback | K64F | GCC_ARM | 88310 | 11972 | 32768 | 65540 | 110280 | | tests-mbed_drivers-dev_null | K64F | GCC_ARM | 90213 | 10784 | 32768 | 65540 | 109092 | | tests-mbed_drivers-echo | K64F | GCC_ARM | 71918 | 11468 | 32768 | 65540 | 109776 | | tests-mbed_drivers-generic_tests | K64F | GCC_ARM | 77624 | 11468 | 32768 | 65540 | 109776 | | tests-mbed_drivers-rtc | K64F | GCC_ARM | 85854 | 11308 | 32768 | 65540 | 109616 | | tests-mbed_drivers-stl_features | K64F | GCC_ARM | 80726 | 11476 | 32768 | 65540 | 109784 | | tests-mbed_drivers-ticker | K64F | GCC_ARM | 70974 | 11308 | 32768 | 65540 | 109616 | | tests-mbed_drivers-ticker_2 | K64F | GCC_ARM | 70790 | 11308 | 32768 | 65540 | 109616 | | tests-mbed_drivers-ticker_3 | K64F | GCC_ARM | 71038 | 11308 | 32768 | 65540 | 109616 | | tests-mbed_drivers-timeout | K64F | GCC_ARM | 70886 | 11308 | 32768 | 65540 | 109616 | | tests-mbed_drivers-wait_us | K64F | GCC_ARM | 70414 | 11308 | 32768 | 65540 | 109616 | | tests-mbedmicro-mbed-attributes | K64F | GCC_ARM | 71534 | 11460 | 32768 | 65540 | 109768 | | tests-mbedmicro-mbed-call_before_main | K64F | GCC_ARM | 73112 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-mbed-cpp | K64F | GCC_ARM | 73400 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-mbed-div | K64F | GCC_ARM | 73176 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-basic | K64F | GCC_ARM | 68390 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-isr | K64F | GCC_ARM | 74480 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-mail | K64F | GCC_ARM | 74992 | 11300 | 32768 | 65540 | 109608 | | tests-mbedmicro-rtos-mbed-mutex | K64F | GCC_ARM | 74048 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-queue | K64F | GCC_ARM | 74912 | 11300 | 32768 | 65540 | 109608 | | tests-mbedmicro-rtos-mbed-semaphore | K64F | GCC_ARM | 74296 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-signals | K64F | GCC_ARM | 74328 | 10780 | 32768 | 65540 | 109088 | | tests-mbedmicro-rtos-mbed-threads | K64F | GCC_ARM | 75214 | 11460 | 32768 | 65540 | 109768 | | tests-mbedmicro-rtos-mbed-timer | K64F | GCC_ARM | 68430 | 10780 | 32768 | 65540 | 109088 | | tests-storage_abstraction-basicapi | K64F | GCC_ARM | 107808 | 28908 | 32768 | 65540 | 127216 | +----------------------------------------------------------------------+--------+-----------+-------------+------------+-------+-------+-----------+ ``` Refactored after code review Refactored parse() function Polishing Moved memory usage reporting function call to test.py to group all reporters in one place Bug-fix: on ARM toolchain we were not fetching statistics from last element of memap result list --- tools/build_api.py | 68 +++++++++++++++++++++++------ tools/memap.py | 84 +++++++++++++++++++++--------------- tools/test.py | 52 ++++++++++++---------- tools/test_api.py | 39 +++++++++-------- tools/toolchains/__init__.py | 52 +++++++++++++--------- 5 files changed, 186 insertions(+), 109 deletions(-) diff --git a/tools/build_api.py b/tools/build_api.py index f8afdc513b..f9700e86ee 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -176,7 +176,7 @@ def build_project(src_path, build_path, target, toolchain_name, if report != None: start = time() - + # If project_id is specified, use that over the default name id_name = project_id.upper() if project_id else name.upper() description = project_description if project_description else name @@ -232,6 +232,7 @@ def build_project(src_path, build_path, target, toolchain_name, cur_result["elapsed_time"] = end - start cur_result["output"] = toolchain.get_output() cur_result["result"] = "OK" + cur_result["memory_usage"] = toolchain.map_outputs add_result_to_report(report, cur_result) @@ -294,7 +295,7 @@ def build_library(src_paths, build_path, target, toolchain_name, if report != None: start = time() - + # If project_id is specified, use that over the default name id_name = project_id.upper() if project_id else name.upper() description = name @@ -377,7 +378,7 @@ def build_library(src_paths, build_path, target, toolchain_name, toolchain.copy_files(resources.libraries, build_path, resources=resources) if resources.linker_script: toolchain.copy_files(resources.linker_script, build_path, resources=resources) - + if resource.hex_files: toolchain.copy_files(resources.hex_files, build_path, resources=resources) @@ -399,12 +400,12 @@ def build_library(src_paths, build_path, target, toolchain_name, except Exception, e: if report != None: end = time() - + if isinstance(e, ToolException): cur_result["result"] = "FAIL" elif isinstance(e, NotSupportedException): cur_result["result"] = "NOT_SUPPORTED" - + cur_result["elapsed_time"] = end - start toolchain_output = toolchain.get_output() @@ -428,7 +429,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean if not lib.is_supported(target, toolchain_name): print 'Library "%s" is not yet supported on target %s with toolchain %s' % (lib_id, target.name, toolchain) return False - + # We need to combine macros from parameter list with macros from library definition MACROS = lib.macros if lib.macros else [] if macros: @@ -441,7 +442,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean dependencies_paths = lib.dependencies inc_dirs = lib.inc_dirs inc_dirs_ext = lib.inc_dirs_ext - + """ src_path: the path of the source directory build_path: the path of the build directory target: ['LPC1768', 'LPC11U24', 'LPC2368'] @@ -522,7 +523,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean # Copy Headers for resource in resources: toolchain.copy_files(resource.headers, build_path, resources=resource) - + dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs) # Compile Sources @@ -716,7 +717,7 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None): perm_counter += 1 else: text = "-" - + row.append(text) pt.add_row(row) @@ -942,6 +943,49 @@ def print_build_results(result_list, build_name): result += "\n" return result +def print_build_memory_usage_results(report): + """ Generate result table with memory usage values for build results + Agregates (puts together) reports obtained from self.get_memory_summary() + @param report Report generated during build procedure. See + """ + from prettytable import PrettyTable + columns_text = ['name', 'target', 'toolchain'] + columns_int = ['static_ram', 'stack', 'heap', 'total_ram', 'total_flash'] + table = PrettyTable(columns_text + columns_int) + + for col in columns_text: + table.align[col] = 'l' + + for col in columns_int: + table.align[col] = 'r' + + for target in report: + for toolchain in report[target]: + for name in report[target][toolchain]: + for dlist in report[target][toolchain][name]: + for dlistelem in dlist: + # Get 'memory_usage' record and build table with statistics + record = dlist[dlistelem] + if 'memory_usage' in record and record['memory_usage']: + # Note that summary should be in the last record of + # 'memory_usage' section. This is why we are grabbing + # last "[-1]" record. + row = [ + record['description'], + record['target_name'], + record['toolchain_name'], + record['memory_usage'][-1]['summary']['static_ram'], + record['memory_usage'][-1]['summary']['stack'], + record['memory_usage'][-1]['summary']['heap'], + record['memory_usage'][-1]['summary']['total_ram'], + record['memory_usage'][-1]['summary']['total_flash'], + ] + table.add_row(row) + + result = "Memory map breakdown for built projects (values in Bytes):\n" + result += table.get_string(sortby='name') + return result + def write_build_report(build_report, template_filename, filename): build_report_failing = [] build_report_passing = [] @@ -963,14 +1007,14 @@ def write_build_report(build_report, template_filename, filename): def scan_for_source_paths(path, exclude_paths=None): ignorepatterns = [] paths = [] - + def is_ignored(file_path): for pattern in ignorepatterns: if fnmatch.fnmatch(file_path, pattern): return True return False - - + + """ os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) When topdown is True, the caller can modify the dirnames list in-place (perhaps using del or slice assignment), and walk() will only recurse into diff --git a/tools/memap.py b/tools/memap.py index beb2cfe207..a5441fdd96 100644 --- a/tools/memap.py +++ b/tools/memap.py @@ -26,9 +26,9 @@ class MemapParser(object): self.misc_flash_sections = ('.interrupts', '.flash_config') - self.other_sections = ('.interrupts_ram', '.init', '.ARM.extab', \ - '.ARM.exidx', '.ARM.attributes', '.eh_frame', \ - '.init_array', '.fini_array', '.jcr', '.stab', \ + self.other_sections = ('.interrupts_ram', '.init', '.ARM.extab', + '.ARM.exidx', '.ARM.attributes', '.eh_frame', + '.init_array', '.fini_array', '.jcr', '.stab', '.stabstr', '.ARM.exidx', '.ARM') # sections to print info (generic for all toolchains) @@ -43,6 +43,9 @@ class MemapParser(object): # list of all object files and mappting to module names self.object_to_module = dict() + # Memory usage summary structure + self.mem_summary = dict() + def module_add(self, module_name, size, section): """ Adds a module / section to the list @@ -67,7 +70,7 @@ class MemapParser(object): return i # should name of the section (assuming it's a known one) if line.startswith('.'): - return 'unknown' # all others are clasified are unknown + return 'unknown' # all others are classified are unknown else: return False # everything else, means no change in section @@ -363,11 +366,12 @@ class MemapParser(object): # Create table columns = ['Module'] - for i in list(self.print_sections): - columns.append(i) + columns.extend(self.print_sections) table = PrettyTable(columns) table.align["Module"] = "l" + for col in self.print_sections: + table.align[col] = 'r' for i in list(self.print_sections): table.align[i] = 'r' @@ -388,8 +392,12 @@ class MemapParser(object): for k in self.print_sections: row.append(self.modules[i][k]) - json_obj.append({"module":i, "size":{\ - k:self.modules[i][k] for k in self.print_sections}}) + json_obj.append({ + "module":i, + "size":{ + k:self.modules[i][k] for k in self.print_sections + } + }) table.add_row(row) @@ -399,16 +407,19 @@ class MemapParser(object): table.add_row(subtotal_row) - if export_format == 'json': - json_obj.append({\ - 'summary':{\ - 'total_static_ram':(subtotal['.data']+subtotal['.bss']),\ - 'allocated_heap':(subtotal['.heap']),\ - 'allocated_stack':(subtotal['.stack']),\ - 'total_ram':(subtotal['.data']+subtotal['.bss']+subtotal['.heap']+subtotal['.stack']),\ - 'total_flash':(subtotal['.text']+subtotal['.data']+misc_flash_mem),}}) + summary = { + 'summary':{ + 'static_ram':(subtotal['.data']+subtotal['.bss']), + 'heap':(subtotal['.heap']), + 'stack':(subtotal['.stack']), + 'total_ram':(subtotal['.data']+subtotal['.bss']+subtotal['.heap']+subtotal['.stack']), + 'total_flash':(subtotal['.text']+subtotal['.data']+misc_flash_mem), + } + } - file_desc.write(json.dumps(json_obj, indent=4)) + if export_format == 'json': + json_to_file = json_obj + [summary] + file_desc.write(json.dumps(json_to_file, indent=4)) file_desc.write('\n') elif export_format == 'csv-ci': # CSV format for the CI system @@ -467,33 +478,38 @@ class MemapParser(object): if file_desc is not sys.stdout: file_desc.close() + self.mem_summary = json_obj + [summary] + return True + def get_memory_summary(self): + """! Object is available only after self.generate_output('json') is called + @return Return memory summary object + """ + return self.mem_summary + def parse(self, mapfile, toolchain): """ Parse and decode map file depending on the toolchain """ + result = True try: - file_input = open(mapfile, 'rt') + with open(mapfile, 'rt') as file_input: + if toolchain == "ARM" or toolchain == "ARM_STD" or toolchain == "ARM_MICRO": + self.search_objects(os.path.abspath(mapfile), "ARM") + self.parse_map_file_armcc(file_input) + elif toolchain == "GCC_ARM": + self.parse_map_file_gcc(file_input) + elif toolchain == "IAR": + self.search_objects(os.path.abspath(mapfile), toolchain) + self.parse_map_file_iar(file_input) + else: + result = False except IOError as error: print "I/O error({0}): {1}".format(error.errno, error.strerror) - return False - - if toolchain == "ARM" or toolchain == "ARM_STD" or toolchain == "ARM_MICRO": - self.search_objects(os.path.abspath(mapfile), "ARM") - self.parse_map_file_armcc(file_input) - elif toolchain == "GCC_ARM": - self.parse_map_file_gcc(file_input) - elif toolchain == "IAR": - self.search_objects(os.path.abspath(mapfile), toolchain) - self.parse_map_file_iar(file_input) - else: - return False - - file_input.close() - - return True + result = False + return result def main(): diff --git a/tools/test.py b/tools/test.py index 4189650286..62dc6e74e3 100644 --- a/tools/test.py +++ b/tools/test.py @@ -29,6 +29,7 @@ sys.path.insert(0, ROOT) from tools.test_api import test_path_to_name, find_tests, print_tests, build_tests, test_spec_from_test_builds from tools.options import get_default_options_parser from tools.build_api import build_project, build_library +from tools.build_api import print_build_memory_usage_results from tools.targets import TARGET_MAP from tools.utils import mkdir, ToolException, NotSupportedException from tools.test_exporters import ReportExporter, ResultExporterType @@ -37,12 +38,12 @@ if __name__ == '__main__': try: # Parse Options parser = get_default_options_parser() - + parser.add_option("-D", "", action="append", dest="macros", help="Add a macro definition") - + parser.add_option("-j", "--jobs", type="int", dest="jobs", @@ -60,25 +61,25 @@ if __name__ == '__main__': parser.add_option("-p", "--paths", dest="paths", default=None, help="Limit the tests to those within the specified comma separated list of paths") - + format_choices = ["list", "json"] format_default_choice = "list" format_help = "Change the format in which tests are listed. Choices include: %s. Default: %s" % (", ".join(format_choices), format_default_choice) parser.add_option("-f", "--format", type="choice", dest="format", choices=format_choices, default=format_default_choice, help=format_help) - + parser.add_option("--continue-on-build-fail", action="store_true", dest="continue_on_build_fail", default=None, help="Continue trying to build all tests if a build failure occurs") parser.add_option("-n", "--names", dest="names", default=None, help="Limit the tests to a comma separated list of names") - + parser.add_option("--test-spec", dest="test_spec", default=None, help="Destination path for a test spec file that can be used by the Greentea automated test tool") - + parser.add_option("--build-report-junit", dest="build_report_junit", default=None, help="Destination path for a build report in the JUnit xml format") - + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", @@ -87,24 +88,24 @@ if __name__ == '__main__': (options, args) = parser.parse_args() - # Filter tests by path if specified + # Filter tests by path if specified if options.paths: all_paths = options.paths.split(",") else: all_paths = ["."] - + all_tests = {} tests = {} - + # Find all tests in the relevant paths for path in all_paths: all_tests.update(find_tests(path)) - + # Filter tests by name if specified if options.names: all_names = options.names.split(",") all_names = [x.lower() for x in all_names] - + for name in all_names: if any(fnmatch.fnmatch(testname, name) for testname in all_tests): for testname, test in all_tests.items(): @@ -124,16 +125,16 @@ if __name__ == '__main__': if not options.build_dir: print "[ERROR] You must specify a build path" sys.exit(1) - + base_source_paths = options.source_dir - + # Default base source path is the current directory if not base_source_paths: base_source_paths = ['.'] target = options.mcu - + build_report = {} build_properties = {} @@ -150,7 +151,7 @@ if __name__ == '__main__': macros=options.macros, verbose=options.verbose, archive=False) - + library_build_success = True except ToolException, e: # ToolException output is handled by the build log @@ -161,7 +162,7 @@ if __name__ == '__main__': except Exception, e: # Some other exception occurred, print the error message print e - + if not library_build_success: print "Failed to build library" else: @@ -175,32 +176,37 @@ if __name__ == '__main__': verbose=options.verbose, jobs=options.jobs, continue_on_build_fail=options.continue_on_build_fail) - + # If a path to a test spec is provided, write it to a file if options.test_spec: test_spec_data = test_spec_from_test_builds(test_build) - + # Create the target dir for the test spec if necessary # mkdir will not create the dir if it already exists test_spec_dir = os.path.dirname(options.test_spec) if test_spec_dir: mkdir(test_spec_dir) - + try: with open(options.test_spec, 'w') as f: f.write(json.dumps(test_spec_data, indent=2)) except IOError, e: print "[ERROR] Error writing test spec to file" print e - + # If a path to a JUnit build report spec is provided, write it to a file if options.build_report_junit: report_exporter = ReportExporter(ResultExporterType.JUNIT, package="build") report_exporter.report_to_file(build_report, options.build_report_junit, test_suite_properties=build_properties) - + + # Print memory map summary on screen + if build_report: + print + print print_build_memory_usage_results(build_report) + print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build") status = print_report_exporter.report(build_report) - + if status: sys.exit(0) else: diff --git a/tools/test_api.py b/tools/test_api.py index 2c4432fa0a..fc28f67fd0 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -46,6 +46,7 @@ from tools.paths import HOST_TESTS from tools.utils import ToolException from tools.utils import NotSupportedException from tools.utils import construct_enum +from tools.memap import MemapParser from tools.targets import TARGET_MAP from tools.test_db import BaseDBAccess from tools.build_api import build_project, build_mbed_libs, build_lib @@ -1970,12 +1971,12 @@ def test_path_to_name(path): while (tail and tail != "."): name_parts.insert(0, tail) head, tail = os.path.split(head) - + return "-".join(name_parts).lower() def find_tests(base_dir): """Given any directory, walk through the subdirectories and find all tests""" - + def find_test_in_directory(directory, tests_path): """Given a 'TESTS' directory, return a dictionary of test names and test paths. The formate of the dictionary is {"test-name": "./path/to/test"}""" @@ -1989,20 +1990,20 @@ def find_tests(base_dir): "name": test_path_to_name(directory), "path": directory } - + return test tests_path = 'TESTS' tests = {} dirs = scan_for_source_paths(base_dir) - + for directory in dirs: test = find_test_in_directory(directory, tests_path) if test: tests[test['name']] = test['path'] - + return tests - + def print_tests(tests, format="list", sort=True): """Given a dictionary of tests (as returned from "find_tests"), print them in the specified format""" @@ -2033,12 +2034,11 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name, continue_on_build_fail=False): """Given the data structure from 'find_tests' and the typical build parameters, build all the tests - + Returns a tuple of the build result (True or False) followed by the test build data structure""" - - execution_directory = "." + execution_directory = "." base_path = norm_relative_path(build_path, execution_directory) target_name = target if isinstance(target, str) else target.name @@ -2051,9 +2051,10 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name, "binary_type": "bootable", "tests": {} } - + result = True - + + map_outputs_total = list() for test_name, test_path in tests.iteritems(): test_build_path = os.path.join(build_path, test_path) src_path = base_source_paths + [test_path] @@ -2072,21 +2073,21 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name, except Exception, e: if not isinstance(e, NotSupportedException): result = False - + if continue_on_build_fail: continue else: break - + # If a clean build was carried out last time, disable it for the next build. # Otherwise the previously built test will be deleted. if clean: clean = False - + # Normalize the path if bin_file: bin_file = norm_relative_path(bin_file, execution_directory) - + test_build['tests'][test_name] = { "binaries": [ { @@ -2094,15 +2095,15 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name, } ] } - + print 'Image: %s'% bin_file - + test_builds = {} test_builds["%s-%s" % (target_name, toolchain_name)] = test_build - + return result, test_builds - + def test_spec_from_test_builds(test_builds): return { diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index 5595294506..97c73e0379 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -233,28 +233,28 @@ class mbedToolchain: def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): self.target = target self.name = self.__class__.__name__ - + # compile/assemble/link/binary hooks self.hook = hooks.Hook(target, self) # Toolchain flags self.flags = deepcopy(self.DEFAULT_FLAGS) - + # User-defined macros self.macros = macros or [] - + # Macros generated from toolchain and target rules/features self.symbols = None - + # Labels generated from toolchain and target rules/features (used for selective build) self.labels = None - + # This will hold the configuration data (as returned by Config.get_config_data()) self.config_data = None # Non-incremental compile self.build_all = False - + # Build output dir self.build_dir = None self.timestamp = time() @@ -265,7 +265,7 @@ class mbedToolchain: # Number of concurrent build jobs. 0 means auto (based on host system cores) self.jobs = 0 - self.CHROOT = None + self.CHROOT = None # Ignore patterns from .mbedignore files self.ignore_patterns = [] @@ -280,12 +280,13 @@ class mbedToolchain: self.notify_fun = self.print_notify_verbose else: self.notify_fun = self.print_notify - + # Silent builds (no output) self.silent = silent - + # Print output buffer - self.output = "" + self.output = str() + self.map_outputs = list() # Place to store memmap scan results in JSON like data structures # Build options passed by -o flag self.options = options if options is not None else [] @@ -295,7 +296,7 @@ class mbedToolchain: if self.options: self.info("Build Options: %s" % (', '.join(self.options))) - + # uVisor spepcific rules if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels: self.target.core = re.sub(r"F$", '', self.target.core) @@ -310,10 +311,10 @@ class mbedToolchain: if not self.VERBOSE and event['type'] == 'tool_error': msg = event['message'] - + elif event['type'] in ['info', 'debug']: msg = event['message'] - + elif event['type'] == 'cc': event['severity'] = event['severity'].title() event['file'] = basename(event['file']) @@ -615,7 +616,7 @@ class mbedToolchain: def relative_object_path(self, build_path, base_dir, source): source_dir, name, _ = split_path(source) - + obj_dir = join(build_path, relpath(source_dir, base_dir)) mkdir(obj_dir) return join(obj_dir, name + '.o') @@ -627,7 +628,7 @@ class mbedToolchain: cmd_list = [] for c in includes: if c: - cmd_list.append(('-I%s' % c).replace("\\", "/")) + cmd_list.append(('-I%s' % c).replace("\\", "/")) string = " ".join(cmd_list) f.write(string) return include_file @@ -822,12 +823,12 @@ class mbedToolchain: if self.target.OUTPUT_NAMING == "8.3": name = name[0:8] ext = ext[0:3] - + # Create destination directory head, tail = split(name) new_path = join(tmp_path, head) mkdir(new_path) - + filename = name+'.'+ext elf = join(tmp_path, name + '.elf') bin = join(tmp_path, filename) @@ -844,7 +845,7 @@ class mbedToolchain: self.binary(r, elf, bin) - self.mem_stats(map) + self.map_outputs = self.mem_stats(map) self.var("compile_succeded", True) self.var("binary", filename) @@ -900,7 +901,11 @@ class mbedToolchain: self.notify({'type': 'var', 'key': key, 'val': value}) def mem_stats(self, map): - # Creates parser object + """! Creates parser object + @param map Path to linker map file to parse and decode + @return Memory summary structure with memory usage statistics + None if map file can't be opened and processed + """ toolchain = self.__class__.__name__ # Create memap object @@ -909,7 +914,7 @@ class mbedToolchain: # Parse and decode a map file if memap.parse(abspath(map), toolchain) is False: self.info("Unknown toolchain for memory statistics %s" % toolchain) - return + return None # Write output to stdout in text (pretty table) format memap.generate_output('table') @@ -917,11 +922,16 @@ class mbedToolchain: # Write output to file in JSON format map_out = splitext(map)[0] + "_map.json" memap.generate_output('json', map_out) - + # Write output to file in CSV format for the CI map_csv = splitext(map)[0] + "_map.csv" memap.generate_output('csv-ci', map_csv) + # Here we return memory statistics structure (constructed after + # call to generate_output) which contains raw data in bytes + # about sections + summary + return memap.get_memory_summary() + # Set the configuration data def set_config_data(self, config_data): self.config_data = config_data From d60021ca3ea4f6c04b43fbc596a21294f9803aad Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 6 Jul 2016 15:52:22 +0100 Subject: [PATCH 29/83] remove the call to FLASH_Init() --- .../TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index 09f151e988..347ff572a0 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -126,7 +126,6 @@ /*! @brief Access to FTFx->FCCOB */ extern volatile uint32_t *const kFCCOBx; -static flash_config_t privateDeviceConfig; #endif /* #ifdef USING_KSDK2 */ /* @@ -754,13 +753,6 @@ static int32_t initialize(ARM_Storage_Callback_t callback) return 1; /* synchronous completion. */ } -#ifdef USING_KSDK2 - status_t rc = FLASH_Init(&privateDeviceConfig); - if (rc != kStatus_FLASH_Success) { - return ARM_DRIVER_ERROR; - } -#endif /* ifdef USING_KSDK2 */ - if (controllerCurrentlyBusy()) { /* The user cannot initiate any further FTFE commands until notified that the * current command has completed.*/ From 53def564267c1123adb155aed8616557b3d20ccb Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 7 Jul 2016 08:35:28 +0100 Subject: [PATCH 30/83] get rid of an un-necessary call to NVIC_ClearPendingIRQ --- .../TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index 347ff572a0..65e863fb37 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -611,7 +611,6 @@ static int32_t executeCommand(void) static void ftfe_ccie_irq_handler(void) { - NVIC_ClearPendingIRQ(FTFE_IRQn); disbleCommandCompletionInterrupt(); /* check for errors */ From a2b683677df9d7c8ebeadcdfe5cb00e7878c46b2 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 7 Jul 2016 08:02:31 +0100 Subject: [PATCH 31/83] introduce a context structure to encompass global state --- .../TARGET_K64F/storage_driver.c | 231 ++++++++++-------- 1 file changed, 124 insertions(+), 107 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index 65e863fb37..af92d966c7 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -128,25 +128,6 @@ extern volatile uint32_t *const kFCCOBx; #endif /* #ifdef USING_KSDK2 */ -/* - * forward declarations - */ -static int32_t getBlock(uint64_t addr, ARM_STORAGE_BLOCK *blockP); -static int32_t nextBlock(const ARM_STORAGE_BLOCK* prevP, ARM_STORAGE_BLOCK *nextP); - -/* - * Global state for the driver. - */ -ARM_Storage_Callback_t commandCompletionCallback; -static bool initialized = false; -ARM_POWER_STATE powerState = ARM_POWER_OFF; - -ARM_STORAGE_OPERATION currentCommand; -uint64_t currentOperatingStorageAddress; -size_t sizeofCurrentOperation; -size_t amountLeftToOperate; -const uint8_t *currentOperatingData; - #ifdef USING_KSDK2 #define ERASE_UNIT (FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE) #define BLOCK1_START_ADDR (FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE) @@ -165,22 +146,44 @@ const uint8_t *currentOperatingData; #define SIZEOF_DOUBLE_PHRASE (16) #endif /* #ifdef USING_KSDK2 */ + +/* + * forward declarations + */ +static int32_t getBlock(uint64_t addr, ARM_STORAGE_BLOCK *blockP); +static int32_t nextBlock(const ARM_STORAGE_BLOCK* prevP, ARM_STORAGE_BLOCK *nextP); + +/* + * Global state for the driver. + */ +struct mtd_k64f_data { + ARM_Storage_Callback_t commandCompletionCallback; + bool initialized; + ARM_POWER_STATE powerState; + + ARM_STORAGE_OPERATION currentCommand; + uint64_t currentOperatingStorageAddress; + size_t sizeofCurrentOperation; + size_t amountLeftToOperate; + const uint8_t *currentOperatingData; +} mtd_k64f_data; + /* * Static configuration. */ static const ARM_STORAGE_BLOCK blockTable[] = { { /**< This is the start address of the flash block. */ -#ifdef YOTTA_CFG_CONFIG_HARDWARE_MTD_START_ADDR - .addr = YOTTA_CFG_CONFIG_HARDWARE_MTD_START_ADDR, +#ifdef CONFIG_HARDWARE_MTD_START_ADDR + .addr = CONFIG_HARDWARE_MTD_START_ADDR, #else .addr = BLOCK1_START_ADDR, #endif /**< This is the size of the flash block, in units of bytes. * Together with addr, it describes a range [addr, addr+size). */ -#ifdef YOTTA_CFG_CONFIG_HARDWARE_MTD_SIZE - .size = YOTTA_CFG_CONFIG_HARDWARE_MTD_SIZE, +#ifdef CONFIG_HARDWARE_MTD_SIZE + .size = CONFIG_HARDWARE_MTD_SIZE, #else .size = BLOCK1_SIZE, #endif @@ -211,15 +214,15 @@ static const ARM_STORAGE_CAPABILITIES caps = { * 1, drivers may still complete asynchronous operations synchronously as * necessary--in which case they return a positive error code to indicate * synchronous completion. */ -#ifndef YOTTA_CFG_CONFIG_HARDWARE_MTD_ASYNC_OPS +#ifndef CONFIG_HARDWARE_MTD_ASYNC_OPS .asynchronous_ops = 1, #else - .asynchronous_ops = YOTTA_CFG_CONFIG_HARDWARE_MTD_ASYNC_OPS, + .asynchronous_ops = CONFIG_HARDWARE_MTD_ASYNC_OPS, #endif /* Enable chip-erase functionality if we own all of block-1. */ - #if ((!defined (YOTTA_CFG_CONFIG_HARDWARE_MTD_START_ADDR) || (YOTTA_CFG_CONFIG_HARDWARE_MTD_START_ADDR == BLOCK1_START_ADDR)) && \ - (!defined (YOTTA_CFG_CONFIG_HARDWARE_MTD_SIZE) || (YOTTA_CFG_CONFIG_HARDWARE_MTD_SIZE == BLOCK1_SIZE))) + #if ((!defined (CONFIG_HARDWARE_MTD_START_ADDR) || (CONFIG_HARDWARE_MTD_START_ADDR == BLOCK1_START_ADDR)) && \ + (!defined (CONFIG_HARDWARE_MTD_SIZE) || (CONFIG_HARDWARE_MTD_SIZE == BLOCK1_SIZE))) .erase_all = 1, /**< Supports EraseChip operation. */ #else .erase_all = 0, /**< Supports EraseChip operation. */ @@ -227,7 +230,11 @@ static const ARM_STORAGE_CAPABILITIES caps = { }; static const ARM_STORAGE_INFO info = { +#ifdef CONFIG_HARDWARE_MTD_SIZE + .total_storage = CONFIG_HARDWARE_MTD_SIZE, /**< Total available storage, in units of octets. */ +#else .total_storage = BLOCK1_SIZE, /**< Total available storage, in units of octets. By default, BLOCK0 is reserved to hold program code. */ +#endif .program_unit = PROGRAM_UNIT, .optimal_program_unit = OPTIMAL_PROGRAM_UNIT, @@ -510,22 +517,22 @@ static inline size_t sizeofLargestProgramSection(uint64_t addr, size_t size) * Advance the state machine for program-data. This function is called only if * amountLeftToOperate is non-zero. */ -static inline void setupNextProgramData(void) +static inline void setupNextProgramData(struct mtd_k64f_data *context) { - if ((amountLeftToOperate == PROGRAM_PHRASE_SIZEOF_INLINE_DATA) || - ((currentOperatingStorageAddress % SIZEOF_DOUBLE_PHRASE) == PROGRAM_PHRASE_SIZEOF_INLINE_DATA)) { - setup8ByteWrite(currentOperatingStorageAddress, currentOperatingData); + if ((context->amountLeftToOperate == PROGRAM_PHRASE_SIZEOF_INLINE_DATA) || + ((context->currentOperatingStorageAddress % SIZEOF_DOUBLE_PHRASE) == PROGRAM_PHRASE_SIZEOF_INLINE_DATA)) { + setup8ByteWrite(context->currentOperatingStorageAddress, context->currentOperatingData); - amountLeftToOperate -= PROGRAM_PHRASE_SIZEOF_INLINE_DATA; - currentOperatingStorageAddress += PROGRAM_PHRASE_SIZEOF_INLINE_DATA; - currentOperatingData += PROGRAM_PHRASE_SIZEOF_INLINE_DATA; + context->amountLeftToOperate -= PROGRAM_PHRASE_SIZEOF_INLINE_DATA; + context->currentOperatingStorageAddress += PROGRAM_PHRASE_SIZEOF_INLINE_DATA; + context->currentOperatingData += PROGRAM_PHRASE_SIZEOF_INLINE_DATA; } else { - size_t amount = sizeofLargestProgramSection(currentOperatingStorageAddress, amountLeftToOperate); - setupProgramSection(currentOperatingStorageAddress, currentOperatingData, amount); + size_t amount = sizeofLargestProgramSection(context->currentOperatingStorageAddress, context->amountLeftToOperate); + setupProgramSection(context->currentOperatingStorageAddress, context->currentOperatingData, amount); - amountLeftToOperate -= amount; - currentOperatingStorageAddress += amount; - currentOperatingData += amount; + context->amountLeftToOperate -= amount; + context->currentOperatingStorageAddress += amount; + context->currentOperatingData += amount; } } @@ -533,15 +540,15 @@ static inline void setupNextProgramData(void) * Advance the state machine for erase. This function is called only if * amountLeftToOperate is non-zero. */ -static inline void setupNextErase(void) +static inline void setupNextErase(struct mtd_k64f_data *context) { - setupEraseSector(currentOperatingStorageAddress); /* Program FCCOB to load the required command parameters. */ + setupEraseSector(context->currentOperatingStorageAddress); /* Program FCCOB to load the required command parameters. */ - amountLeftToOperate -= ERASE_UNIT; - currentOperatingStorageAddress += ERASE_UNIT; + context->amountLeftToOperate -= ERASE_UNIT; + context->currentOperatingStorageAddress += ERASE_UNIT; } -static int32_t executeCommand(void) +static int32_t executeCommand(struct mtd_k64f_data *context) { launchCommand(); @@ -580,24 +587,24 @@ static int32_t executeCommand(void) } /* signal synchronous completion. */ - switch (currentCommand) { + switch (context->currentCommand) { case ARM_STORAGE_OPERATION_PROGRAM_DATA: - if (amountLeftToOperate == 0) { - return sizeofCurrentOperation; + if (context->amountLeftToOperate == 0) { + return context->sizeofCurrentOperation; } /* start the successive program operation */ - setupNextProgramData(); + setupNextProgramData(context); launchCommand(); /* continue on to the next iteration of the parent loop */ break; case ARM_STORAGE_OPERATION_ERASE: - if (amountLeftToOperate == 0) { - return sizeofCurrentOperation; + if (context->amountLeftToOperate == 0) { + return context->sizeofCurrentOperation; } - setupNextErase(); /* start the successive erase operation */ + setupNextErase(context); /* start the successive erase operation */ launchCommand(); /* continue on to the next iteration of the parent loop */ break; @@ -613,39 +620,40 @@ static void ftfe_ccie_irq_handler(void) { disbleCommandCompletionInterrupt(); + struct mtd_k64f_data *context = &mtd_k64f_data; /* check for errors */ if (failedWithAccessError() || failedWithProtectionError()) { clearErrorStatusBits(); - if (commandCompletionCallback) { - commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, currentCommand); + if (context->commandCompletionCallback) { + context->commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, context->currentCommand); } return; } if (failedWithRunTimeError()) { - if (commandCompletionCallback) { - commandCompletionCallback(ARM_DRIVER_ERROR, currentCommand); + if (context->commandCompletionCallback) { + context->commandCompletionCallback(ARM_DRIVER_ERROR, context->currentCommand); } return; } - switch (currentCommand) { + switch (context->currentCommand) { case ARM_STORAGE_OPERATION_PROGRAM_DATA: - if (amountLeftToOperate == 0) { - if (commandCompletionCallback) { - commandCompletionCallback(sizeofCurrentOperation, ARM_STORAGE_OPERATION_PROGRAM_DATA); + if (context->amountLeftToOperate == 0) { + if (context->commandCompletionCallback) { + context->commandCompletionCallback(context->sizeofCurrentOperation, ARM_STORAGE_OPERATION_PROGRAM_DATA); } return; } /* start the successive program operation */ - setupNextProgramData(); + setupNextProgramData(context); launchCommand(); while (!controllerCurrentlyBusy() && !failedWithAccessError() && !failedWithProtectionError()); if (failedWithAccessError() || failedWithProtectionError()) { clearErrorStatusBits(); - if (commandCompletionCallback) { - commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, ARM_STORAGE_OPERATION_PROGRAM_DATA); + if (context->commandCompletionCallback) { + context->commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, ARM_STORAGE_OPERATION_PROGRAM_DATA); } return; } @@ -654,21 +662,21 @@ static void ftfe_ccie_irq_handler(void) break; case ARM_STORAGE_OPERATION_ERASE: - if (amountLeftToOperate == 0) { - if (commandCompletionCallback) { - commandCompletionCallback(sizeofCurrentOperation, ARM_STORAGE_OPERATION_ERASE); + if (context->amountLeftToOperate == 0) { + if (context->commandCompletionCallback) { + context->commandCompletionCallback(context->sizeofCurrentOperation, ARM_STORAGE_OPERATION_ERASE); } return; } - setupNextErase(); + setupNextErase(context); launchCommand(); while (!controllerCurrentlyBusy() && !failedWithAccessError() && !failedWithProtectionError()); if (failedWithAccessError() || failedWithProtectionError()) { clearErrorStatusBits(); - if (commandCompletionCallback) { - commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, ARM_STORAGE_OPERATION_ERASE); + if (context->commandCompletionCallback) { + context->commandCompletionCallback(ARM_DRIVER_ERROR_PARAMETER, ARM_STORAGE_OPERATION_ERASE); } return; } @@ -677,8 +685,8 @@ static void ftfe_ccie_irq_handler(void) break; default: - if (commandCompletionCallback) { - commandCompletionCallback(ARM_DRIVER_OK, currentCommand); + if (context->commandCompletionCallback) { + context->commandCompletionCallback(ARM_DRIVER_OK, context->currentCommand); } break; } @@ -705,7 +713,6 @@ static int32_t checkForEachBlockInRange(uint64_t startAddr, uint32_t size, int32 return rc; } - /* move on to the following block */ if (nextBlock(&block, &block) != ARM_DRIVER_OK) { break; @@ -744,10 +751,12 @@ static ARM_STORAGE_CAPABILITIES getCapabilities(void) static int32_t initialize(ARM_Storage_Callback_t callback) { - currentCommand = ARM_STORAGE_OPERATION_INITIALIZE; + struct mtd_k64f_data *context = &mtd_k64f_data; + memset(context, 0, sizeof(mtd_k64f_data)); + context->currentCommand = ARM_STORAGE_OPERATION_INITIALIZE; - if (initialized) { - commandCompletionCallback = callback; + if (context->initialized) { + context->commandCompletionCallback = callback; return 1; /* synchronous completion. */ } @@ -760,7 +769,7 @@ static int32_t initialize(ARM_Storage_Callback_t callback) clearErrorStatusBits(); - commandCompletionCallback = callback; + context->commandCompletionCallback = callback; /* Enable the command-completion interrupt. */ if (asyncOperationsEnabled()) { @@ -769,15 +778,16 @@ static int32_t initialize(ARM_Storage_Callback_t callback) NVIC_EnableIRQ(FTFE_IRQn); } - initialized = true; + context->initialized = true; return 1; /* synchronous completion. */ } static int32_t uninitialize(void) { - currentCommand = ARM_STORAGE_OPERATION_UNINITIALIZE; + struct mtd_k64f_data *context = &mtd_k64f_data; + context->currentCommand = ARM_STORAGE_OPERATION_UNINITIALIZE; - if (!initialized) { + if (!context->initialized) { return ARM_DRIVER_ERROR; } @@ -788,24 +798,26 @@ static int32_t uninitialize(void) { NVIC_ClearPendingIRQ(FTFE_IRQn); } - commandCompletionCallback = NULL; - initialized = false; + context->commandCompletionCallback = NULL; + context->initialized = false; return 1; /* synchronous completion. */ } static int32_t powerControl(ARM_POWER_STATE state) { - currentCommand = ARM_STORAGE_OPERATION_POWER_CONTROL; + struct mtd_k64f_data *context = &mtd_k64f_data; + context->currentCommand = ARM_STORAGE_OPERATION_POWER_CONTROL; - powerState = state; + context->powerState = state; return 1; /* signal synchronous completion. */ } static int32_t readData(uint64_t addr, void *data, uint32_t size) { - currentCommand = ARM_STORAGE_OPERATION_READ_DATA; + struct mtd_k64f_data *context = &mtd_k64f_data; + context->currentCommand = ARM_STORAGE_OPERATION_READ_DATA; - if (!initialized) { + if (!context->initialized) { return ARM_DRIVER_ERROR; /* illegal */ } @@ -817,13 +829,15 @@ static int32_t readData(uint64_t addr, void *data, uint32_t size) return ARM_DRIVER_ERROR_PARAMETER; /* illegal address range */ } + context->currentCommand = ARM_STORAGE_OPERATION_READ_DATA; memcpy(data, (const void *)(uintptr_t)addr, size); return size; /* signal synchronous completion. */ } static int32_t programData(uint64_t addr, const void *data, uint32_t size) { - if (!initialized) { + struct mtd_k64f_data *context = &mtd_k64f_data; + if (!context->initialized) { return (int32_t)ARM_DRIVER_ERROR; /* illegal */ } @@ -844,27 +858,28 @@ static int32_t programData(uint64_t addr, const void *data, uint32_t size) return ARM_STORAGE_ERROR_NOT_PROGRAMMABLE; } - currentCommand = ARM_STORAGE_OPERATION_PROGRAM_DATA; - if (controllerCurrentlyBusy()) { /* The user cannot initiate any further FTFE commands until notified that the * current command has completed.*/ return ARM_DRIVER_ERROR_BUSY; } - sizeofCurrentOperation = size; - amountLeftToOperate = size; - currentOperatingData = data; - currentOperatingStorageAddress = addr; + context->currentCommand = ARM_STORAGE_OPERATION_PROGRAM_DATA; + context->sizeofCurrentOperation = size; + context->amountLeftToOperate = size; + context->currentOperatingData = data; + context->currentOperatingStorageAddress = addr; clearErrorStatusBits(); - setupNextProgramData(); - return executeCommand(); + setupNextProgramData(context); + return executeCommand(context); } static int32_t erase(uint64_t addr, uint32_t size) { - if (!initialized) { + struct mtd_k64f_data *context = &mtd_k64f_data; + + if (!context->initialized) { return (int32_t)ARM_DRIVER_ERROR; /* illegal */ } /* argument validation */ @@ -884,28 +899,27 @@ static int32_t erase(uint64_t addr, uint32_t size) return ARM_STORAGE_ERROR_NOT_ERASABLE; } - currentCommand = ARM_STORAGE_OPERATION_ERASE; - - currentOperatingStorageAddress = addr; - sizeofCurrentOperation = size; - amountLeftToOperate = size; - if (controllerCurrentlyBusy()) { /* The user cannot initiate any further FTFE commands until notified that the * current command has completed.*/ return (int32_t)ARM_DRIVER_ERROR_BUSY; } + context->currentCommand = ARM_STORAGE_OPERATION_ERASE; + context->currentOperatingStorageAddress = addr; + context->sizeofCurrentOperation = size; + context->amountLeftToOperate = size; + clearErrorStatusBits(); - setupNextErase(); - return executeCommand(); + setupNextErase(context); + return executeCommand(context); } static int32_t eraseAll(void) { - currentCommand = ARM_STORAGE_OPERATION_ERASE_ALL; + struct mtd_k64f_data *context = &mtd_k64f_data; - if (!initialized) { + if (!context->initialized) { return (int32_t)ARM_DRIVER_ERROR; /* illegal */ } @@ -923,22 +937,25 @@ static int32_t eraseAll(void) return (int32_t)ARM_DRIVER_ERROR_BUSY; } + context->currentCommand = ARM_STORAGE_OPERATION_ERASE_ALL; + clearErrorStatusBits(); /* Program FCCOB to load the required command parameters. */ setupEraseBlock(BLOCK1_START_ADDR); - - return executeCommand(); + return executeCommand(context); } static ARM_STORAGE_STATUS getStatus(void) { + struct mtd_k64f_data *context = &mtd_k64f_data; + ARM_STORAGE_STATUS status = { .busy = 0, .error = 0, }; - if (!initialized) { + if (!context->initialized) { status.error = 1; return status; } From 14a14a07dc3b630991a4c6699cd5e8e84c493200 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 7 Jul 2016 08:16:44 +0100 Subject: [PATCH 32/83] make compile-time decision about async. vs. sync. operation --- .../TARGET_K64F/storage_driver.c | 128 +++++++++--------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index af92d966c7..f737430901 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -204,6 +204,13 @@ static const ARM_DRIVER_VERSION version = { .drv = ARM_DRIVER_VERSION_MAJOR_MINOR(1,00) }; + +#if (!defined(CONFIG_HARDWARE_MTD_ASYNC_OPS) || CONFIG_HARDWARE_MTD_ASYNC_OPS) +#define ASYNC_OPS 1 +#else +#define ASYNC_OPS 0 +#endif + static const ARM_STORAGE_CAPABILITIES caps = { /**< Signal Flash Ready event. In other words, can APIs like initialize, * read, erase, program, etc. operate in asynchronous mode? @@ -214,11 +221,7 @@ static const ARM_STORAGE_CAPABILITIES caps = { * 1, drivers may still complete asynchronous operations synchronously as * necessary--in which case they return a positive error code to indicate * synchronous completion. */ -#ifndef CONFIG_HARDWARE_MTD_ASYNC_OPS - .asynchronous_ops = 1, -#else - .asynchronous_ops = CONFIG_HARDWARE_MTD_ASYNC_OPS, -#endif + .asynchronous_ops = ASYNC_OPS, /* Enable chip-erase functionality if we own all of block-1. */ #if ((!defined (CONFIG_HARDWARE_MTD_START_ADDR) || (CONFIG_HARDWARE_MTD_START_ADDR == BLOCK1_START_ADDR)) && \ @@ -271,7 +274,6 @@ enum FlashCommandOps { SETRAM = (uint8_t)0x81, /* Set FlexRAM. (unused for now) */ }; - /** * Read out the CCIF (Command Complete Interrupt Flag) to ensure all previous * operations have completed. @@ -394,11 +396,6 @@ static inline bool commandCompletionInterruptEnabled(void) #endif } -static inline bool asyncOperationsEnabled(void) -{ - return caps.asynchronous_ops; -} - /** * Once all relevant command parameters have been loaded, the user launches the * command by clearing the FSTAT[CCIF] bit by writing a '1' to it. The CCIF flag @@ -556,66 +553,68 @@ static int32_t executeCommand(struct mtd_k64f_data *context) * parameter checks and protection checks, if applicable, which are unique * to each command. */ - if (asyncOperationsEnabled()) { - /* Asynchronous operation */ +#if ASYNC_OPS + /* Asynchronous operation */ - /* Spin waiting for the command execution to begin. */ - while (!controllerCurrentlyBusy() && !failedWithAccessError() && !failedWithProtectionError()); + (void)context; /* avoid compiler warning about un-used variables */ + + /* Spin waiting for the command execution to begin. */ + while (!controllerCurrentlyBusy() && !failedWithAccessError() && !failedWithProtectionError()); + if (failedWithAccessError() || failedWithProtectionError()) { + clearErrorStatusBits(); + return ARM_DRIVER_ERROR_PARAMETER; + } + + enableCommandCompletionInterrupt(); + + return ARM_DRIVER_OK; /* signal asynchronous completion. An interrupt will signal completion later. */ +#else /* #if ASYNC_OPS */ + /* Synchronous operation. */ + + while (1) { + /* Spin waiting for the command execution to complete. */ + while (controllerCurrentlyBusy()); + + /* Execution may result in failure. Check for errors */ if (failedWithAccessError() || failedWithProtectionError()) { clearErrorStatusBits(); return ARM_DRIVER_ERROR_PARAMETER; } + if (failedWithRunTimeError()) { + return ARM_DRIVER_ERROR; /* unspecified runtime error. */ + } - enableCommandCompletionInterrupt(); + /* signal synchronous completion. */ + switch (context->currentCommand) { + case ARM_STORAGE_OPERATION_PROGRAM_DATA: + if (context->amountLeftToOperate == 0) { + return context->sizeofCurrentOperation; + } - return ARM_DRIVER_OK; /* signal asynchronous completion. An interrupt will signal completion later. */ - } else { - /* Synchronous operation. */ + /* start the successive program operation */ + setupNextProgramData(context); + launchCommand(); + /* continue on to the next iteration of the parent loop */ + break; - while (1) { + case ARM_STORAGE_OPERATION_ERASE: + if (context->amountLeftToOperate == 0) { + return context->sizeofCurrentOperation; + } - /* Spin waiting for the command execution to complete. */ - while (controllerCurrentlyBusy()); + setupNextErase(context); /* start the successive erase operation */ + launchCommand(); + /* continue on to the next iteration of the parent loop */ + break; - /* Execution may result in failure. Check for errors */ - if (failedWithAccessError() || failedWithProtectionError()) { - clearErrorStatusBits(); - return ARM_DRIVER_ERROR_PARAMETER; - } - if (failedWithRunTimeError()) { - return ARM_DRIVER_ERROR; /* unspecified runtime error. */ - } - - /* signal synchronous completion. */ - switch (context->currentCommand) { - case ARM_STORAGE_OPERATION_PROGRAM_DATA: - if (context->amountLeftToOperate == 0) { - return context->sizeofCurrentOperation; - } - - /* start the successive program operation */ - setupNextProgramData(context); - launchCommand(); - /* continue on to the next iteration of the parent loop */ - break; - - case ARM_STORAGE_OPERATION_ERASE: - if (context->amountLeftToOperate == 0) { - return context->sizeofCurrentOperation; - } - - setupNextErase(context); /* start the successive erase operation */ - launchCommand(); - /* continue on to the next iteration of the parent loop */ - break; - - default: - return 1; - } + default: + return 1; } } +#endif /* #ifdef ASYNC_OPS */ } +#if ASYNC_OPS static void ftfe_ccie_irq_handler(void) { disbleCommandCompletionInterrupt(); @@ -691,6 +690,7 @@ static void ftfe_ccie_irq_handler(void) break; } } +#endif /* #if ASYNC_OPS */ /** * This is a helper function which can be used to do arbitrary sanity checking @@ -772,11 +772,11 @@ static int32_t initialize(ARM_Storage_Callback_t callback) context->commandCompletionCallback = callback; /* Enable the command-completion interrupt. */ - if (asyncOperationsEnabled()) { - NVIC_SetVector(FTFE_IRQn, (uint32_t)ftfe_ccie_irq_handler); - NVIC_ClearPendingIRQ(FTFE_IRQn); - NVIC_EnableIRQ(FTFE_IRQn); - } +#if ASYNC_OPS + NVIC_SetVector(FTFE_IRQn, (uint32_t)ftfe_ccie_irq_handler); + NVIC_ClearPendingIRQ(FTFE_IRQn); + NVIC_EnableIRQ(FTFE_IRQn); +#endif context->initialized = true; @@ -792,11 +792,13 @@ static int32_t uninitialize(void) { } /* Disable the command-completion interrupt. */ - if (asyncOperationsEnabled() && commandCompletionInterruptEnabled()) { +#if ASYNC_OPS + if (commandCompletionInterruptEnabled()) { disbleCommandCompletionInterrupt(); NVIC_DisableIRQ(FTFE_IRQn); NVIC_ClearPendingIRQ(FTFE_IRQn); } +#endif context->commandCompletionCallback = NULL; context->initialized = false; From 8331d5641c26ff3f447cc027649ebad0b188eb50 Mon Sep 17 00:00:00 2001 From: tomoyuki yamanaka Date: Thu, 7 Jul 2016 21:58:01 +0900 Subject: [PATCH 33/83] Modify the timing at which mbed_main() is called in IAR compiler. Renesas modified the timing at which mbed_main() is called in IAR compiler. Because we fail about test "mbed call before main" in IAR compiler. --- rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h b/rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h index f7e6e2efd4..aff785d909 100644 --- a/rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h +++ b/rtos/rtx/TARGET_CORTEX_A/RTX_CM_lib.h @@ -523,12 +523,15 @@ extern __weak void __iar_init_core( void ); extern __weak void __iar_init_vfp( void ); extern void __iar_dynamic_initialization(void); extern void mbed_sdk_init(void); +extern void mbed_main(void); +extern int main(void); static uint8_t low_level_init_needed; void pre_main(void) { if (low_level_init_needed) { __iar_dynamic_initialization(); } + mbed_main(); main(); } From 887aa833b3a0481e548556636d4fe257f9fa6791 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 7 Jul 2016 14:55:56 +0100 Subject: [PATCH 34/83] rename CONFIG_HARDWARE... to have a prefix of DEVICE_STORAGE_ --- .../TARGET_K64F/storage_driver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index f737430901..b955784eeb 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -174,16 +174,16 @@ struct mtd_k64f_data { static const ARM_STORAGE_BLOCK blockTable[] = { { /**< This is the start address of the flash block. */ -#ifdef CONFIG_HARDWARE_MTD_START_ADDR - .addr = CONFIG_HARDWARE_MTD_START_ADDR, +#ifdef DEVICE_STORAGE_CONFIG_HARDWARE_MTD_START_ADDR + .addr = DEVICE_STORAGE_CONFIG_HARDWARE_MTD_START_ADDR, #else .addr = BLOCK1_START_ADDR, #endif /**< This is the size of the flash block, in units of bytes. * Together with addr, it describes a range [addr, addr+size). */ -#ifdef CONFIG_HARDWARE_MTD_SIZE - .size = CONFIG_HARDWARE_MTD_SIZE, +#ifdef DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE + .size = DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE, #else .size = BLOCK1_SIZE, #endif @@ -205,7 +205,7 @@ static const ARM_DRIVER_VERSION version = { }; -#if (!defined(CONFIG_HARDWARE_MTD_ASYNC_OPS) || CONFIG_HARDWARE_MTD_ASYNC_OPS) +#if (!defined(DEVICE_STORAGE_CONFIG_HARDWARE_MTD_ASYNC_OPS) || DEVICE_STORAGE_CONFIG_HARDWARE_MTD_ASYNC_OPS) #define ASYNC_OPS 1 #else #define ASYNC_OPS 0 @@ -224,8 +224,8 @@ static const ARM_STORAGE_CAPABILITIES caps = { .asynchronous_ops = ASYNC_OPS, /* Enable chip-erase functionality if we own all of block-1. */ - #if ((!defined (CONFIG_HARDWARE_MTD_START_ADDR) || (CONFIG_HARDWARE_MTD_START_ADDR == BLOCK1_START_ADDR)) && \ - (!defined (CONFIG_HARDWARE_MTD_SIZE) || (CONFIG_HARDWARE_MTD_SIZE == BLOCK1_SIZE))) + #if ((!defined (DEVICE_STORAGE_CONFIG_HARDWARE_MTD_START_ADDR) || (DEVICE_STORAGE_CONFIG_HARDWARE_MTD_START_ADDR == BLOCK1_START_ADDR)) && \ + (!defined (DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE) || (DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE == BLOCK1_SIZE))) .erase_all = 1, /**< Supports EraseChip operation. */ #else .erase_all = 0, /**< Supports EraseChip operation. */ @@ -233,8 +233,8 @@ static const ARM_STORAGE_CAPABILITIES caps = { }; static const ARM_STORAGE_INFO info = { -#ifdef CONFIG_HARDWARE_MTD_SIZE - .total_storage = CONFIG_HARDWARE_MTD_SIZE, /**< Total available storage, in units of octets. */ +#ifdef DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE + .total_storage = DEVICE_STORAGE_CONFIG_HARDWARE_MTD_SIZE, /**< Total available storage, in units of octets. */ #else .total_storage = BLOCK1_SIZE, /**< Total available storage, in units of octets. By default, BLOCK0 is reserved to hold program code. */ #endif From 0ec8199c552e41393a3624c58a50e6471749d010 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Fri, 24 Jun 2016 17:15:01 -0500 Subject: [PATCH 35/83] Revert "Revert "Generalize flag handling"" This reverts commit 33cec194c6e222fd26c340c6046c0ef9216a5cbd. --- tools/build.py | 69 +++----- tools/detect_targets.py | 8 +- tools/get_config.py | 17 +- tools/make.py | 112 +++++------- tools/memap.py | 18 +- tools/options.py | 26 +-- tools/project.py | 113 +++++------- tools/singletest.py | 8 +- tools/test.py | 63 +++---- tools/test_api.py | 377 +++++++++++++++++++++------------------- tools/test_webapi.py | 17 +- tools/tests.py | 23 +++ tools/utils.py | 49 ++++++ 13 files changed, 464 insertions(+), 436 deletions(-) diff --git a/tools/build.py b/tools/build.py index e47cd6a411..e388ebd7ae 100644 --- a/tools/build.py +++ b/tools/build.py @@ -35,6 +35,7 @@ from tools.build_api import mcu_toolchain_matrix from tools.build_api import static_analysis_scan, static_analysis_scan_lib, static_analysis_scan_library from tools.build_api import print_build_results from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT +from utils import argparse_filestring_type if __name__ == '__main__': start = time() @@ -42,115 +43,115 @@ if __name__ == '__main__': # Parse Options parser = get_default_options_parser() - parser.add_option("--source", dest="source_dir", - default=None, help="The source (input) directory", action="append") + parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, + default=None, help="The source (input) directory", nargs="*") - parser.add_option("--build", dest="build_dir", + parser.add_argument("--build", dest="build_dir", type=argparse_filestring_type, default=None, help="The build (output) directory") - parser.add_option("--no-archive", dest="no_archive", action="store_true", + parser.add_argument("--no-archive", dest="no_archive", action="store_true", default=False, help="Do not produce archive (.ar) file, but rather .o") # Extra libraries - parser.add_option("-r", "--rtos", + parser.add_argument("-r", "--rtos", action="store_true", dest="rtos", default=False, help="Compile the rtos") - parser.add_option("--rpc", + parser.add_argument("--rpc", action="store_true", dest="rpc", default=False, help="Compile the rpc library") - parser.add_option("-e", "--eth", + parser.add_argument("-e", "--eth", action="store_true", dest="eth", default=False, help="Compile the ethernet library") - parser.add_option("-U", "--usb_host", + parser.add_argument("-U", "--usb_host", action="store_true", dest="usb_host", default=False, help="Compile the USB Host library") - parser.add_option("-u", "--usb", + parser.add_argument("-u", "--usb", action="store_true", dest="usb", default=False, help="Compile the USB Device library") - parser.add_option("-d", "--dsp", + parser.add_argument("-d", "--dsp", action="store_true", dest="dsp", default=False, help="Compile the DSP library") - parser.add_option("-F", "--fat", + parser.add_argument("-F", "--fat", action="store_true", dest="fat", default=False, help="Compile FS and SD card file system library") - parser.add_option("-b", "--ublox", + parser.add_argument("-b", "--ublox", action="store_true", dest="ublox", default=False, help="Compile the u-blox library") - parser.add_option("", "--cpputest", + parser.add_argument( "--cpputest", action="store_true", dest="cpputest_lib", default=False, help="Compiles 'cpputest' unit test library (library should be on the same directory level as mbed repository)") - parser.add_option("-D", "", - action="append", + parser.add_argument("-D", + nargs="*", dest="macros", help="Add a macro definition") - parser.add_option("-S", "--supported-toolchains", + parser.add_argument("-S", "--supported-toolchains", action="store_true", dest="supported_toolchains", default=False, help="Displays supported matrix of MCUs and toolchains") - parser.add_option('-f', '--filter', + parser.add_argument('-f', '--filter', dest='general_filter_regex', default=None, help='For some commands you can use filter to filter out results') - parser.add_option("", "--cppcheck", + parser.add_argument("--cppcheck", action="store_true", dest="cppcheck_validation", default=False, help="Forces 'cppcheck' static code analysis") - parser.add_option("-j", "--jobs", type="int", dest="jobs", + parser.add_argument("-j", "--jobs", type=int, dest="jobs", default=0, help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)") - parser.add_option("-N", "--artifact-name", dest="artifact_name", + parser.add_argument("-N", "--artifact-name", dest="artifact_name", default=None, help="The built project's name") - parser.add_option("-v", "--verbose", + parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") - parser.add_option("--silent", + parser.add_argument("--silent", action="store_true", dest="silent", default=False, help="Silent diagnostic output (no copy, compile notification)") - parser.add_option("-x", "--extra-verbose-notifications", + parser.add_argument("-x", "--extra-verbose-notifications", action="store_true", dest="extra_verbose_notify", default=False, help="Makes compiler more verbose, CI friendly.") - (options, args) = parser.parse_args() + options = parser.parse_args() # Only prints matrix of supported toolchains if options.supported_toolchains: @@ -158,26 +159,10 @@ if __name__ == '__main__': exit(0) # Get target list - if options.mcu: - mcu_list = (options.mcu).split(",") - for mcu in mcu_list: - if mcu not in TARGET_NAMES: - print "Given MCU '%s' not into the supported list:\n%s" % (mcu, TARGET_NAMES) - sys.exit(1) - targets = mcu_list - else: - targets = TARGET_NAMES + targets = options.mcu if options.mcu else TARGET_NAMES # Get toolchains list - if options.tool: - toolchain_list = (options.tool).split(",") - for tc in toolchain_list: - if tc not in TOOLCHAINS: - print "Given toolchain '%s' not into the supported list:\n%s" % (tc, TOOLCHAINS) - sys.exit(1) - toolchains = toolchain_list - else: - toolchains = TOOLCHAINS + toolchains = options.tool if options.tool else TOOLCHAINS # Get libraries list libraries = [] diff --git a/tools/detect_targets.py b/tools/detect_targets.py index 1cf288dede..dd7be0ab91 100644 --- a/tools/detect_targets.py +++ b/tools/detect_targets.py @@ -42,24 +42,24 @@ if __name__ == '__main__': # Parse Options parser = get_default_options_parser() - parser.add_option("-S", "--supported-toolchains", + parser.add_argument("-S", "--supported-toolchains", action="store_true", dest="supported_toolchains", default=False, help="Displays supported matrix of targets and toolchains") - parser.add_option('-f', '--filter', + parser.add_argument('-f', '--filter', dest='general_filter_regex', default=None, help='Filter targets') - parser.add_option("-v", "--verbose", + parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") - (options, args) = parser.parse_args() + options = parser.parse_args() # Only prints matrix of supported toolchains if options.supported_toolchains: diff --git a/tools/get_config.py b/tools/get_config.py index 9d9e7dc5fa..91dbccf548 100644 --- a/tools/get_config.py +++ b/tools/get_config.py @@ -28,6 +28,7 @@ from tools.utils import args_error from tools.options import get_default_options_parser from tools.build_api import get_config from config import Config +from utils import argparse_filestring_type try: import tools.private_settings as ps except: @@ -36,19 +37,15 @@ except: if __name__ == '__main__': # Parse Options parser = get_default_options_parser(add_clean=False, add_options=False) - parser.add_option("--source", dest="source_dir", - default=None, help="The source (input) directory", action="append") - parser.add_option("--prefix", dest="prefix", action="append", - default=None, help="Restrict listing to parameters that have this prefix") - parser.add_option("-v", "--verbose", action="store_true", dest="verbose", + parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, + default=[], help="The source (input) directory", nargs="*") + parser.add_argument("--prefix", dest="prefix", nargs="*", + default=[], help="Restrict listing to parameters that have this prefix") + parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") - (options, args) = parser.parse_args() + options = parser.parse_args() - for path in options.source_dir : - if not isdir(path) : - args_error(parser, "[ERROR] you passed \"{}\" to --source, which does not exist". - format(path)) # Target if options.mcu is None : args_error(parser, "[ERROR] You should specify an MCU") diff --git a/tools/make.py b/tools/make.py index 200a2b336a..8a817e3d42 100644 --- a/tools/make.py +++ b/tools/make.py @@ -38,157 +38,153 @@ from tools.paths import FS_LIBRARY from tools.paths import UBLOX_LIBRARY from tools.tests import TESTS, Test, TEST_MAP from tools.tests import TEST_MBED_LIB +from tools.tests import test_known, test_name_known from tools.targets import TARGET_MAP from tools.options import get_default_options_parser from tools.build_api import build_project from tools.build_api import mcu_toolchain_matrix -try: - import tools.private_settings as ps -except: - ps = object() +from utils import argparse_filestring_type +from argparse import ArgumentTypeError if __name__ == '__main__': # Parse Options parser = get_default_options_parser() - parser.add_option("-p", - type="int", + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("-p", + type=test_known, dest="program", help="The index of the desired test program: [0-%d]" % (len(TESTS)-1)) - parser.add_option("-n", - dest="program_name", + group.add_argument("-n", + type=test_name_known, + dest="program", help="The name of the desired test program") - parser.add_option("-j", "--jobs", - type="int", + parser.add_argument("-j", "--jobs", + type=int, dest="jobs", default=0, help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)") - parser.add_option("-v", "--verbose", + parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") - parser.add_option("--silent", + parser.add_argument("--silent", action="store_true", dest="silent", default=False, help="Silent diagnostic output (no copy, compile notification)") - parser.add_option("-D", "", - action="append", + parser.add_argument("-D", + nargs="*", dest="macros", help="Add a macro definition") - parser.add_option("-S", "--supported-toolchains", + group.add_argument("-S", "--supported-toolchains", action="store_true", dest="supported_toolchains", default=False, help="Displays supported matrix of MCUs and toolchains") - parser.add_option('-f', '--filter', + parser.add_argument('-f', '--filter', dest='general_filter_regex', default=None, help='For some commands you can use filter to filter out results') # Local run - parser.add_option("--automated", action="store_true", dest="automated", + parser.add_argument("--automated", action="store_true", dest="automated", default=False, help="Automated test") - parser.add_option("--host", dest="host_test", + parser.add_argument("--host", dest="host_test", default=None, help="Host test") - parser.add_option("--extra", dest="extra", + parser.add_argument("--extra", dest="extra", default=None, help="Extra files") - parser.add_option("--peripherals", dest="peripherals", + parser.add_argument("--peripherals", dest="peripherals", default=None, help="Required peripherals") - parser.add_option("--dep", dest="dependencies", + parser.add_argument("--dep", dest="dependencies", default=None, help="Dependencies") - parser.add_option("--source", dest="source_dir", - default=None, help="The source (input) directory", action="append") - parser.add_option("--duration", type="int", dest="duration", + group.add_argument("--source", dest="source_dir", type=argparse_filestring_type, + default=None, help="The source (input) directory", nargs="*") + parser.add_argument("--duration", type=int, dest="duration", default=None, help="Duration of the test") - parser.add_option("--build", dest="build_dir", + parser.add_argument("--build", dest="build_dir", default=None, help="The build (output) directory") - parser.add_option("-N", "--artifact-name", dest="artifact_name", + parser.add_argument("-N", "--artifact-name", dest="artifact_name", default=None, help="The built project's name") - parser.add_option("-d", "--disk", dest="disk", + parser.add_argument("-d", "--disk", dest="disk", default=None, help="The mbed disk") - parser.add_option("-s", "--serial", dest="serial", + parser.add_argument("-s", "--serial", dest="serial", default=None, help="The mbed serial port") - parser.add_option("-b", "--baud", type="int", dest="baud", + parser.add_argument("-b", "--baud", type=int, dest="baud", default=None, help="The mbed serial baud rate") - parser.add_option("-L", "--list-tests", action="store_true", dest="list_tests", + group.add_argument("-L", "--list-tests", action="store_true", dest="list_tests", default=False, help="List available tests in order and exit") # Ideally, all the tests with a single "main" thread can be run with, or # without the rtos, eth, usb_host, usb, dsp, fat, ublox - parser.add_option("--rtos", + parser.add_argument("--rtos", action="store_true", dest="rtos", default=False, help="Link with RTOS library") - parser.add_option("--rpc", + parser.add_argument("--rpc", action="store_true", dest="rpc", default=False, help="Link with RPC library") - parser.add_option("--eth", + parser.add_argument("--eth", action="store_true", dest="eth", default=False, help="Link with Ethernet library") - parser.add_option("--usb_host", + parser.add_argument("--usb_host", action="store_true", dest="usb_host", default=False, help="Link with USB Host library") - parser.add_option("--usb", + parser.add_argument("--usb", action="store_true", dest="usb", default=False, help="Link with USB Device library") - parser.add_option("--dsp", + parser.add_argument("--dsp", action="store_true", dest="dsp", default=False, help="Link with DSP library") - parser.add_option("--fat", + parser.add_argument("--fat", action="store_true", dest="fat", default=False, help="Link with FS ad SD card file system library") - parser.add_option("--ublox", + parser.add_argument("--ublox", action="store_true", dest="ublox", default=False, help="Link with U-Blox library") - parser.add_option("--testlib", + parser.add_argument("--testlib", action="store_true", dest="testlib", default=False, help="Link with mbed test library") # Specify a different linker script - parser.add_option("-l", "--linker", dest="linker_script", + parser.add_argument("-l", "--linker", dest="linker_script", + type=argparse_filestring_type, default=None, help="use the specified linker script") - (options, args) = parser.parse_args() + options = parser.parse_args() # Only prints matrix of supported toolchains if options.supported_toolchains: print mcu_toolchain_matrix(platform_filter=options.general_filter_regex) exit(0) - if options.source_dir: - for path in options.source_dir : - if not isfile(path) and not isdir(path) : - args_error(parser, "[ERROR] you passed \"{}\" to --source, which does not exist". - format(path)) - # Print available tests in order and exit if options.list_tests is True: print '\n'.join(map(str, sorted(TEST_MAP.values()))) @@ -197,25 +193,9 @@ if __name__ == '__main__': # force program to "0" if a source dir is specified if options.source_dir is not None: p = 0 - n = None else: # Program Number or name - p, n = options.program, options.program_name - - if n is not None and p is not None: - args_error(parser, "[ERROR] specify either '-n' or '-p', not both") - if n: - # We will transform 'n' to list of 'p' (integers which are test numbers) - nlist = n.split(',') - for test_id in nlist: - if test_id not in TEST_MAP.keys(): - args_error(parser, "[ERROR] Program with name '%s' not found"% test_id) - - p = [TEST_MAP[n].n for n in nlist] - elif p is None or (p < 0) or (p > (len(TESTS)-1)): - message = "[ERROR] You have to specify one of the following tests:\n" - message += '\n'.join(map(str, sorted(TEST_MAP.values()))) - args_error(parser, message) + p = options.program # If 'p' was set via -n to list of numbers make this a single element integer list if type(p) != type([]): @@ -224,12 +204,12 @@ if __name__ == '__main__': # Target if options.mcu is None : args_error(parser, "[ERROR] You should specify an MCU") - mcu = options.mcu + mcu = options.mcu[0] # Toolchain if options.tool is None: args_error(parser, "[ERROR] You should specify a TOOLCHAIN") - toolchain = options.tool + toolchain = options.tool[0] # Test for test_no in p: diff --git a/tools/memap.py b/tools/memap.py index a5441fdd96..e7a178583e 100644 --- a/tools/memap.py +++ b/tools/memap.py @@ -10,6 +10,7 @@ import re import csv import json import argparse +from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type from prettytable import PrettyTable debug = False @@ -339,6 +340,8 @@ class MemapParser(object): else: self.object_to_module.update({object_name:module_name}) + export_formats = ["json", "csv-ci", "table"] + def generate_output(self, export_format, file_output=None): """ Generates summary of memory map data @@ -488,6 +491,8 @@ class MemapParser(object): """ return self.mem_summary + toolchains = ["ARM", "ARM_STD", "ARM_MICRO", "GCC_ARM", "IAR"] + def parse(self, mapfile, toolchain): """ Parse and decode map file depending on the toolchain @@ -520,13 +525,13 @@ def main(): parser.add_argument('file', help='memory map file') - parser.add_argument('-t', '--toolchain', dest='toolchain', help='select a toolchain used to build the memory map file (ARM, GCC_ARM, IAR)',\ - required=True) + parser.add_argument('-t', '--toolchain', dest='toolchain', help='select a toolchain used to build the memory map file (%s)' % ", ".join(MemapParser.toolchains),\ + required=True, type=argparse_uppercase_type(MemapParser.toolchains, "toolchain")) parser.add_argument('-o', '--output', help='output file name', required=False) - parser.add_argument('-e', '--export', dest='export', required=False,\ - help="export format (examples: 'json', 'csv-ci', 'table': default)") + parser.add_argument('-e', '--export', dest='export', required=False, default='table', type=argparse_lowercase_hyphen_type(MemapParser.export_formats,'export format'),\ + help="export format (examples: %s: default)" % ", ".join(MemapParser.export_formats)) parser.add_argument('-v', '--version', action='version', version=version) @@ -544,13 +549,8 @@ def main(): # Parse and decode a map file if args.file and args.toolchain: if memap.parse(args.file, args.toolchain) is False: - print "Unknown toolchain for memory statistics %s" % args.toolchain sys.exit(0) - # default export format is table - if not args.export: - args.export = 'table' - # Write output in file if args.output != None: memap.generate_output(args.export, args.output) diff --git a/tools/options.py b/tools/options.py index 250e8e1948..1585323b14 100644 --- a/tools/options.py +++ b/tools/options.py @@ -14,33 +14,37 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ -from optparse import OptionParser +from argparse import ArgumentParser from tools.toolchains import TOOLCHAINS from tools.targets import TARGET_NAMES +from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type, argparse_many def get_default_options_parser(add_clean=True, add_options=True): - parser = OptionParser() + parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = list(TOOLCHAINS) toolchainlist.sort() - parser.add_option("-m", "--mcu", - help="build for the given MCU (%s)" % ', '.join(targetnames), - metavar="MCU") + parser.add_argument("-m", "--mcu", + help="build for the given MCU (%s)" % ', '.join(targetnames), + metavar="MCU", + type=argparse_many(argparse_uppercase_type(targetnames, "MCU"))) - parser.add_option("-t", "--tool", - help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist), - metavar="TOOLCHAIN") + parser.add_argument("-t", "--tool", + help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist), + metavar="TOOLCHAIN", + type=argparse_many(argparse_uppercase_type(toolchainlist, "toolchain"))) if add_clean: - parser.add_option("-c", "--clean", action="store_true", default=False, + parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the build directory") if add_options: - parser.add_option("-o", "--options", action="append", - help='Add a build option ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")') + parser.add_argument("-o", "--options", nargs="*", + help='Add a build argument ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")', + type=argparse_lowercase_hyphen_type(['save-asm', 'debug-info', 'analyze'], "build option")) return parser diff --git a/tools/project.py b/tools/project.py index 239507aea3..c0ed8c156b 100644 --- a/tools/project.py +++ b/tools/project.py @@ -4,7 +4,7 @@ ROOT = abspath(join(dirname(__file__), "..")) sys.path.insert(0, ROOT) from shutil import move, rmtree -from optparse import OptionParser +from argparse import ArgumentParser from os import path from tools.paths import EXPORT_DIR, EXPORT_WORKSPACE, EXPORT_TMP @@ -12,84 +12,89 @@ from tools.paths import MBED_BASE, MBED_LIBRARIES from tools.export import export, setup_user_prj, EXPORTERS, mcu_ide_matrix from tools.utils import args_error, mkdir from tools.tests import TESTS, Test, TEST_MAP +from tools.tests import test_known, test_name_known from tools.targets import TARGET_NAMES from tools.libraries import LIBRARIES +from utils import argparse_lowercase_type, argparse_uppercase_type, argparse_filestring_type, argparse_many -try: - import tools.private_settings as ps -except: - ps = object() if __name__ == '__main__': # Parse Options - parser = OptionParser() + parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = EXPORTERS.keys() toolchainlist.sort() - parser.add_option("-m", "--mcu", + parser.add_argument("-m", "--mcu", metavar="MCU", default='LPC1768', + required=True, + type=argparse_many(argparse_uppercase_type(targetnames, "MCU")), help="generate project for the given MCU (%s)"% ', '.join(targetnames)) - parser.add_option("-i", + parser.add_argument("-i", dest="ide", default='uvision', + required=True, + type=argparse_many(argparse_lowercase_type(toolchainlist, "toolchain")), help="The target IDE: %s"% str(toolchainlist)) - parser.add_option("-c", "--clean", + parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the export directory") - parser.add_option("-p", - type="int", + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("-p", + type=test_known, dest="program", help="The index of the desired test program: [0-%d]"% (len(TESTS)-1)) - parser.add_option("-n", - dest="program_name", + group.add_argument("-n", + type=test_name_known, + dest="program", help="The name of the desired test program") - parser.add_option("-b", + parser.add_argument("-b", dest="build", action="store_true", default=False, help="use the mbed library build, instead of the sources") - parser.add_option("-L", "--list-tests", + group.add_argument("-L", "--list-tests", action="store_true", dest="list_tests", default=False, help="list available programs in order and exit") - parser.add_option("-S", "--list-matrix", + group.add_argument("-S", "--list-matrix", action="store_true", dest="supported_ides", default=False, help="displays supported matrix of MCUs and IDEs") - parser.add_option("-E", + parser.add_argument("-E", action="store_true", dest="supported_ides_html", default=False, help="writes tools/export/README.md") - parser.add_option("--source", - action="append", + group.add_argument("--source", + nargs="*", + type=argparse_filestring_type, dest="source_dir", - default=None, + default=[], help="The source (input) directory") - parser.add_option("-D", "", - action="append", + parser.add_argument("-D", + nargs="*", dest="macros", help="Add a macro definition") - (options, args) = parser.parse_args() + options = parser.parse_args() # Print available tests in order and exit if options.list_tests is True: @@ -122,16 +127,6 @@ if __name__ == '__main__': if exists(EXPORT_DIR): rmtree(EXPORT_DIR) - # Target - if options.mcu is None : - args_error(parser, "[ERROR] You should specify an MCU") - mcus = options.mcu - - # IDE - if options.ide is None: - args_error(parser, "[ERROR] You should specify an IDE") - ide = options.ide - # Export results successes = [] failures = [] @@ -141,14 +136,14 @@ if __name__ == '__main__': # source_dir = use relative paths, otherwise sources are copied sources_relative = True if options.source_dir else False - for mcu in mcus.split(','): + for mcu in options.mcu: # Program Number or name - p, n, src, ide = options.program, options.program_name, options.source_dir, options.ide + p, src, ides = options.program, options.source_dir, options.ide - if src is not None: + if src: # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file project_dir = options.source_dir - project_name = n if n else "Unnamed_Project" + project_name = TESTS[p] project_temp = path.join(options.source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu)) mkdir(project_temp) lib_symbols = [] @@ -157,31 +152,6 @@ if __name__ == '__main__': zip = False # don't create zip clean = False # don't cleanup because we use the actual source tree to generate IDE files else: - if n is not None and p is not None: - args_error(parser, "[ERROR] specify either '-n' or '-p', not both") - if n: - if not n in TEST_MAP.keys(): - # Check if there is an alias for this in private_settings.py - if getattr(ps, "test_alias", None) is not None: - alias = ps.test_alias.get(n, "") - if not alias in TEST_MAP.keys(): - args_error(parser, "[ERROR] Program with name '%s' not found" % n) - else: - n = alias - else: - args_error(parser, "[ERROR] Program with name '%s' not found" % n) - p = TEST_MAP[n].n - - if p is None or (p < 0) or (p > (len(TESTS)-1)): - message = "[ERROR] You have to specify one of the following tests:\n" - message += '\n'.join(map(str, sorted(TEST_MAP.values()))) - args_error(parser, message) - - # Project - if p is None or (p < 0) or (p > (len(TESTS)-1)): - message = "[ERROR] You have to specify one of the following tests:\n" - message += '\n'.join(map(str, sorted(TEST_MAP.values()))) - args_error(parser, message) test = Test(p) # Some libraries have extra macros (called by exporter symbols) to we need to pass @@ -210,16 +180,17 @@ if __name__ == '__main__': setup_user_prj(project_dir[0], test.source_dir, test.dependencies) # Export to selected toolchain - tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative) - if report['success']: - if not zip: - zip_path = join(project_temp, project_name) + for ide in ides: + tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative) + if report['success']: + if not zip: + zip_path = join(project_temp, project_name) + else: + zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu)) + move(tmp_path, zip_path) + successes.append("%s::%s\t%s"% (mcu, ide, zip_path)) else: - zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu)) - move(tmp_path, zip_path) - successes.append("%s::%s\t%s"% (mcu, ide, zip_path)) - else: - failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) + failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) # Prints export results print diff --git a/tools/singletest.py b/tools/singletest.py index 4142878b0b..bde208c521 100644 --- a/tools/singletest.py +++ b/tools/singletest.py @@ -100,7 +100,7 @@ if __name__ == '__main__': parser.description = """This script allows you to run mbed defined test cases for particular MCU(s) and corresponding toolchain(s).""" parser.epilog = """Example: singletest.py -i test_spec.json -M muts_all.json""" - (opts, args) = parser.parse_args() + opts = parser.parse_args() # Print scrip version if opts.version: @@ -154,10 +154,10 @@ if __name__ == '__main__': mut['disk']) # Set up parameters for test specification filter function (we need to set toolchains per target here) - use_default_toolchain = 'default' in opts.toolchains_filter.split(',') if opts.toolchains_filter is not None else True - use_supported_toolchains = 'all' in opts.toolchains_filter.split(',') if opts.toolchains_filter is not None else False + use_default_toolchain = 'default' in opts.toolchains_filter if opts.toolchains_filter is not None else True + use_supported_toolchains = 'all' in opts.toolchains_filter if opts.toolchains_filter is not None else False toolchain_filter = opts.toolchains_filter - platform_name_filter = opts.general_filter_regex.split(',') if opts.general_filter_regex is not None else opts.general_filter_regex + platform_name_filter = opts.general_filter_regex if opts.general_filter_regex is not None else opts.general_filter_regex # Test specification with information about each target and associated toolchain test_spec = get_autodetected_TEST_SPEC(MUTs.values(), use_default_toolchain=use_default_toolchain, diff --git a/tools/test.py b/tools/test.py index 62dc6e74e3..acb472691f 100644 --- a/tools/test.py +++ b/tools/test.py @@ -33,64 +33,69 @@ from tools.build_api import print_build_memory_usage_results from tools.targets import TARGET_MAP from tools.utils import mkdir, ToolException, NotSupportedException from tools.test_exporters import ReportExporter, ResultExporterType +from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many if __name__ == '__main__': try: # Parse Options parser = get_default_options_parser() - - parser.add_option("-D", "", - action="append", + + parser.add_argument("-D", + nargs="*", dest="macros", help="Add a macro definition") - - parser.add_option("-j", "--jobs", - type="int", + + parser.add_argument("-j", "--jobs", + type=int, dest="jobs", default=0, help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)") - parser.add_option("--source", dest="source_dir", - default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", action="append") + parser.add_argument("--source", dest="source_dir", + type=argparse_filestring_type, + default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", nargs="*") - parser.add_option("--build", dest="build_dir", + parser.add_argument("--build", dest="build_dir", default=None, help="The build (output) directory") - parser.add_option("-l", "--list", action="store_true", dest="list", + parser.add_argument("-l", "--list", action="store_true", dest="list", default=False, help="List (recursively) available tests in order and exit") - parser.add_option("-p", "--paths", dest="paths", + parser.add_argument("-p", "--paths", dest="paths", + type=argparse_many(argparse_filestring_type), default=None, help="Limit the tests to those within the specified comma separated list of paths") format_choices = ["list", "json"] format_default_choice = "list" format_help = "Change the format in which tests are listed. Choices include: %s. Default: %s" % (", ".join(format_choices), format_default_choice) - parser.add_option("-f", "--format", type="choice", dest="format", - choices=format_choices, default=format_default_choice, help=format_help) - - parser.add_option("--continue-on-build-fail", action="store_true", dest="continue_on_build_fail", + parser.add_argument("-f", "--format", dest="format", + type=argparse_lowercase_type(format_choices, "format"), + default=format_default_choice, help=format_help) + + parser.add_argument("--continue-on-build-fail", action="store_true", dest="continue_on_build_fail", default=None, help="Continue trying to build all tests if a build failure occurs") - parser.add_option("-n", "--names", dest="names", + #TODO validate the names instead of just passing through str + parser.add_argument("-n", "--names", dest="names", type=argparse_many(str), default=None, help="Limit the tests to a comma separated list of names") - - parser.add_option("--test-spec", dest="test_spec", + + parser.add_argument("--test-spec", dest="test_spec", default=None, help="Destination path for a test spec file that can be used by the Greentea automated test tool") - - parser.add_option("--build-report-junit", dest="build_report_junit", + + parser.add_argument("--build-report-junit", dest="build_report_junit", default=None, help="Destination path for a build report in the JUnit xml format") - - parser.add_option("-v", "--verbose", + + parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") - (options, args) = parser.parse_args() + options = parser.parse_args() # Filter tests by path if specified if options.paths: - all_paths = options.paths.split(",") + all_paths = options.paths else: all_paths = ["."] @@ -103,7 +108,7 @@ if __name__ == '__main__': # Filter tests by name if specified if options.names: - all_names = options.names.split(",") + all_names = options.names all_names = [x.lower() for x in all_names] for name in all_names: @@ -133,15 +138,15 @@ if __name__ == '__main__': base_source_paths = ['.'] - target = options.mcu - + target = options.mcu[0] + build_report = {} build_properties = {} library_build_success = False try: # Build sources - build_library(base_source_paths, options.build_dir, target, options.tool, + build_library(base_source_paths, options.build_dir, target, options.tool[0], options=options.options, jobs=options.jobs, clean=options.clean, @@ -167,7 +172,7 @@ if __name__ == '__main__': print "Failed to build library" else: # Build all the tests - test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool, + test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool[0], options=options.options, clean=options.clean, report=build_report, diff --git a/tools/test_api.py b/tools/test_api.py index fc28f67fd0..6797cae924 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -24,7 +24,7 @@ import json import uuid import pprint import random -import optparse +import argparse import datetime import threading import ctypes @@ -59,7 +59,12 @@ from tools.build_api import add_result_to_report from tools.build_api import scan_for_source_paths from tools.libraries import LIBRARIES, LIBRARY_MAP from tools.toolchains import TOOLCHAIN_BIN_PATH +from tools.toolchains import TOOLCHAINS from tools.test_exporters import ReportExporter, ResultExporterType +from tools.utils import argparse_filestring_type +from tools.utils import argparse_uppercase_type +from tools.utils import argparse_lowercase_type +from tools.utils import argparse_many import tools.host_tests.host_tests_plugins as host_tests_plugins @@ -626,7 +631,7 @@ class SingleTestRunner(object): for test_id in test_map_keys: test = TEST_MAP[test_id] - if self.opts_test_by_names and test_id not in self.opts_test_by_names.split(','): + if self.opts_test_by_names and test_id not in self.opts_test_by_names: continue if test_ids and test_id not in test_ids: @@ -637,7 +642,7 @@ class SingleTestRunner(object): print self.logger.log_line(self.logger.LogType.INFO, 'Common test skipped for target %s'% (target)) continue - if self.opts_peripheral_by_names and test.peripherals and not len([i for i in test.peripherals if i in self.opts_peripheral_by_names.split(',')]): + if self.opts_peripheral_by_names and test.peripherals and not len([i for i in test.peripherals if i in self.opts_peripheral_by_names]): # We will skip tests not forced with -p option if self.opts_verbose_skipped_tests: print self.logger.log_line(self.logger.LogType.INFO, 'Common test skipped for target %s'% (target)) @@ -658,7 +663,7 @@ class SingleTestRunner(object): # When users are using 'build only flag' and test do not have # specified peripherals we can allow test building by default pass - elif self.opts_peripheral_by_names and test_id not in self.opts_peripheral_by_names.split(','): + elif self.opts_peripheral_by_names and test_id not in self.opts_peripheral_by_names: # If we force peripheral with option -p we expect test # to pass even if peripheral is not in MUTs file. pass @@ -776,7 +781,7 @@ class SingleTestRunner(object): """ result = {} if test_loops_str: - test_loops = test_loops_str.split(',') + test_loops = test_loops_str for test_loop in test_loops: test_loop_count = test_loop.split('=') if len(test_loop_count) == 2: @@ -1720,7 +1725,7 @@ def get_autodetected_TEST_SPEC(mbeds_list, toolchains += supported_toolchains if toolchain_filter is not None: all_toolchains = supported_toolchains + [default_toolchain] - for toolchain in toolchain_filter.split(','): + for toolchain in toolchain_filter: if toolchain in all_toolchains: toolchains.append(toolchain) @@ -1731,235 +1736,243 @@ def get_autodetected_TEST_SPEC(mbeds_list, def get_default_test_options_parser(): """ Get common test script options used by CLI, web services etc. """ - parser = optparse.OptionParser() - parser.add_option('-i', '--tests', - dest='test_spec_filename', - metavar="FILE", - help='Points to file with test specification') + parser = argparse.ArgumentParser() + parser.add_argument('-i', '--tests', + dest='test_spec_filename', + metavar="FILE", + type=argparse_filestring_type, + help='Points to file with test specification') - parser.add_option('-M', '--MUTS', - dest='muts_spec_filename', - metavar="FILE", - help='Points to file with MUTs specification (overwrites settings.py and private_settings.py)') + parser.add_argument('-M', '--MUTS', + dest='muts_spec_filename', + metavar="FILE", + type=argparse_filestring_type, + help='Points to file with MUTs specification (overwrites settings.py and private_settings.py)') - parser.add_option("-j", "--jobs", - dest='jobs', - metavar="NUMBER", - type="int", - help="Define number of compilation jobs. Default value is 1") + parser.add_argument("-j", "--jobs", + dest='jobs', + metavar="NUMBER", + type=int, + help="Define number of compilation jobs. Default value is 1") if get_module_avail('mbed_lstools'): # Additional features available when mbed_lstools is installed on host and imported # mbed_lstools allow users to detect connected to host mbed-enabled devices - parser.add_option('', '--auto', - dest='auto_detect', - metavar=False, - action="store_true", - help='Use mbed-ls module to detect all connected mbed devices') + parser.add_argument('--auto', + dest='auto_detect', + action="store_true", + help='Use mbed-ls module to detect all connected mbed devices') - parser.add_option('', '--tc', - dest='toolchains_filter', - help="Toolchain filter for --auto option. Use toolchains names separated by comma, 'default' or 'all' to select toolchains") + toolchain_list = list(TOOLCHAINS) + ["DEFAULT", "ALL"] + parser.add_argument('--tc', + dest='toolchains_filter', + type=argparse_many(argparse_uppercase_type(toolchain_list, "toolchains")), + help="Toolchain filter for --auto argument. Use toolchains names separated by comma, 'default' or 'all' to select toolchains") test_scopes = ','.join(["'%s'" % n for n in get_available_oper_test_scopes()]) - parser.add_option('', '--oper', - dest='operability_checks', - help='Perform interoperability tests between host and connected mbed devices. Available test scopes are: %s' % test_scopes) + parser.add_argument('--oper', + dest='operability_checks', + type=argparse_lowercase_type(get_available_oper_test_scopes(), "scopes"), + help='Perform interoperability tests between host and connected mbed devices. Available test scopes are: %s' % test_scopes) - parser.add_option('', '--clean', - dest='clean', - metavar=False, - action="store_true", - help='Clean the build directory') + parser.add_argument('--clean', + dest='clean', + action="store_true", + help='Clean the build directory') - parser.add_option('-P', '--only-peripherals', - dest='test_only_peripheral', - default=False, - action="store_true", - help='Test only peripheral declared for MUT and skip common tests') + parser.add_argument('-P', '--only-peripherals', + dest='test_only_peripheral', + default=False, + action="store_true", + help='Test only peripheral declared for MUT and skip common tests') - parser.add_option('-C', '--only-commons', - dest='test_only_common', - default=False, - action="store_true", - help='Test only board internals. Skip perpherials tests and perform common tests') + parser.add_argument('-C', '--only-commons', + dest='test_only_common', + default=False, + action="store_true", + help='Test only board internals. Skip perpherials tests and perform common tests') - parser.add_option('-n', '--test-by-names', - dest='test_by_names', - help='Runs only test enumerated it this switch. Use comma to separate test case names') + parser.add_argument('-n', '--test-by-names', + dest='test_by_names', + type=argparse_many(str), + help='Runs only test enumerated it this switch. Use comma to separate test case names') - parser.add_option('-p', '--peripheral-by-names', + parser.add_argument('-p', '--peripheral-by-names', dest='peripheral_by_names', + type=argparse_many(str), help='Forces discovery of particular peripherals. Use comma to separate peripheral names') copy_methods = host_tests_plugins.get_plugin_caps('CopyMethod') copy_methods_str = "Plugin support: " + ', '.join(copy_methods) - parser.add_option('-c', '--copy-method', - dest='copy_method', - help="Select binary copy (flash) method. Default is Python's shutil.copy() method. %s"% copy_methods_str) + parser.add_argument('-c', '--copy-method', + dest='copy_method', + type=argparse_uppercase_type(copy_methods, "flash method"), + help="Select binary copy (flash) method. Default is Python's shutil.copy() method. %s"% copy_methods_str) reset_methods = host_tests_plugins.get_plugin_caps('ResetMethod') reset_methods_str = "Plugin support: " + ', '.join(reset_methods) - parser.add_option('-r', '--reset-type', - dest='mut_reset_type', - default=None, - help='Extra reset method used to reset MUT by host test script. %s'% reset_methods_str) + parser.add_argument('-r', '--reset-type', + dest='mut_reset_type', + default=None, + type=argparse_uppercase_type(reset_methods, "reset method"), + help='Extra reset method used to reset MUT by host test script. %s'% reset_methods_str) - parser.add_option('-g', '--goanna-for-tests', - dest='goanna_for_tests', - metavar=False, - action="store_true", - help='Run Goanna static analyse tool for tests. (Project will be rebuilded)') + parser.add_argument('-g', '--goanna-for-tests', + dest='goanna_for_tests', + action="store_true", + help='Run Goanna static analyse tool for tests. (Project will be rebuilded)') - parser.add_option('-G', '--goanna-for-sdk', - dest='goanna_for_mbed_sdk', - metavar=False, - action="store_true", - help='Run Goanna static analyse tool for mbed SDK (Project will be rebuilded)') + parser.add_argument('-G', '--goanna-for-sdk', + dest='goanna_for_mbed_sdk', + action="store_true", + help='Run Goanna static analyse tool for mbed SDK (Project will be rebuilded)') - parser.add_option('-s', '--suppress-summary', - dest='suppress_summary', - default=False, - action="store_true", - help='Suppresses display of wellformatted table with test results') + parser.add_argument('-s', '--suppress-summary', + dest='suppress_summary', + default=False, + action="store_true", + help='Suppresses display of wellformatted table with test results') - parser.add_option('-t', '--test-summary', - dest='test_x_toolchain_summary', - default=False, - action="store_true", - help='Displays wellformatted table with test x toolchain test result per target') + parser.add_argument('-t', '--test-summary', + dest='test_x_toolchain_summary', + default=False, + action="store_true", + help='Displays wellformatted table with test x toolchain test result per target') - parser.add_option('-A', '--test-automation-report', - dest='test_automation_report', - default=False, - action="store_true", - help='Prints information about all tests and exits') + parser.add_argument('-A', '--test-automation-report', + dest='test_automation_report', + default=False, + action="store_true", + help='Prints information about all tests and exits') - parser.add_option('-R', '--test-case-report', - dest='test_case_report', - default=False, - action="store_true", - help='Prints information about all test cases and exits') + parser.add_argument('-R', '--test-case-report', + dest='test_case_report', + default=False, + action="store_true", + help='Prints information about all test cases and exits') - parser.add_option("-S", "--supported-toolchains", - action="store_true", - dest="supported_toolchains", - default=False, - help="Displays supported matrix of MCUs and toolchains") + parser.add_argument("-S", "--supported-toolchains", + action="store_true", + dest="supported_toolchains", + default=False, + help="Displays supported matrix of MCUs and toolchains") - parser.add_option("-O", "--only-build", - action="store_true", - dest="only_build_tests", - default=False, - help="Only build tests, skips actual test procedures (flashing etc.)") + parser.add_argument("-O", "--only-build", + action="store_true", + dest="only_build_tests", + default=False, + help="Only build tests, skips actual test procedures (flashing etc.)") - parser.add_option('', '--parallel', - dest='parallel_test_exec', - default=False, - action="store_true", - help='Experimental, you execute test runners for connected to your host MUTs in parallel (speeds up test result collection)') + parser.add_argument('--parallel', + dest='parallel_test_exec', + default=False, + action="store_true", + help='Experimental, you execute test runners for connected to your host MUTs in parallel (speeds up test result collection)') - parser.add_option('', '--config', - dest='verbose_test_configuration_only', - default=False, - action="store_true", - help='Displays full test specification and MUTs configration and exits') + parser.add_argument('--config', + dest='verbose_test_configuration_only', + default=False, + action="store_true", + help='Displays full test specification and MUTs configration and exits') - parser.add_option('', '--loops', - dest='test_loops_list', - help='Set no. of loops per test. Format: TEST_1=1,TEST_2=2,TEST_3=3') + parser.add_argument('--loops', + dest='test_loops_list', + type=argparse_many(str), + help='Set no. of loops per test. Format: TEST_1=1,TEST_2=2,TEST_3=3') - parser.add_option('', '--global-loops', - dest='test_global_loops_value', - help='Set global number of test loops per test. Default value is set 1') + parser.add_argument('--global-loops', + dest='test_global_loops_value', + type=int, + help='Set global number of test loops per test. Default value is set 1') - parser.add_option('', '--consolidate-waterfall', - dest='consolidate_waterfall_test', - default=False, - action="store_true", - help='Used with --waterfall option. Adds only one test to report reflecting outcome of waterfall test.') + parser.add_argument('--consolidate-waterfall', + dest='consolidate_waterfall_test', + default=False, + action="store_true", + help='Used with --waterfall argument. Adds only one test to report reflecting outcome of waterfall test.') - parser.add_option('-W', '--waterfall', - dest='waterfall_test', - default=False, - action="store_true", - help='Used with --loops or --global-loops options. Tests until OK result occurs and assumes test passed') + parser.add_argument('-W', '--waterfall', + dest='waterfall_test', + default=False, + action="store_true", + help='Used with --loops or --global-loops arguments. Tests until OK result occurs and assumes test passed') - parser.add_option('-N', '--firmware-name', - dest='firmware_global_name', - help='Set global name for all produced projects. Note, proper file extension will be added by buid scripts') + parser.add_argument('-N', '--firmware-name', + dest='firmware_global_name', + help='Set global name for all produced projects. Note, proper file extension will be added by buid scripts') - parser.add_option('-u', '--shuffle', - dest='shuffle_test_order', - default=False, - action="store_true", - help='Shuffles test execution order') + parser.add_argument('-u', '--shuffle', + dest='shuffle_test_order', + default=False, + action="store_true", + help='Shuffles test execution order') - parser.add_option('', '--shuffle-seed', - dest='shuffle_test_seed', - default=None, - help='Shuffle seed (If you want to reproduce your shuffle order please use seed provided in test summary)') + parser.add_argument('--shuffle-seed', + dest='shuffle_test_seed', + default=None, + help='Shuffle seed (If you want to reproduce your shuffle order please use seed provided in test summary)') - parser.add_option('-f', '--filter', - dest='general_filter_regex', - default=None, - help='For some commands you can use filter to filter out results') + parser.add_argument('-f', '--filter', + dest='general_filter_regex', + type=argparse_many(str), + default=None, + help='For some commands you can use filter to filter out results') - parser.add_option('', '--inc-timeout', - dest='extend_test_timeout', - metavar="NUMBER", - type="int", - help='You can increase global timeout for each test by specifying additional test timeout in seconds') + parser.add_argument('--inc-timeout', + dest='extend_test_timeout', + metavar="NUMBER", + type=int, + help='You can increase global timeout for each test by specifying additional test timeout in seconds') - parser.add_option('', '--db', - dest='db_url', - help='This specifies what database test suite uses to store its state. To pass DB connection info use database connection string. Example: \'mysql://username:password@127.0.0.1/db_name\'') + parser.add_argument('--db', + dest='db_url', + help='This specifies what database test suite uses to store its state. To pass DB connection info use database connection string. Example: \'mysql://username:password@127.0.0.1/db_name\'') - parser.add_option('-l', '--log', - dest='log_file_name', - help='Log events to external file (note not all console entries may be visible in log file)') + parser.add_argument('-l', '--log', + dest='log_file_name', + help='Log events to external file (note not all console entries may be visible in log file)') - parser.add_option('', '--report-html', - dest='report_html_file_name', - help='You can log test suite results in form of HTML report') + parser.add_argument('--report-html', + dest='report_html_file_name', + help='You can log test suite results in form of HTML report') - parser.add_option('', '--report-junit', - dest='report_junit_file_name', - help='You can log test suite results in form of JUnit compliant XML report') + parser.add_argument('--report-junit', + dest='report_junit_file_name', + help='You can log test suite results in form of JUnit compliant XML report') - parser.add_option("", "--report-build", - dest="report_build_file_name", - help="Output the build results to a junit xml file") + parser.add_argument("--report-build", + dest="report_build_file_name", + help="Output the build results to a junit xml file") - parser.add_option("", "--report-text", - dest="report_text_file_name", - help="Output the build results to a text file") + parser.add_argument("--report-text", + dest="report_text_file_name", + help="Output the build results to a text file") - parser.add_option('', '--verbose-skipped', - dest='verbose_skipped_tests', - default=False, - action="store_true", - help='Prints some extra information about skipped tests') + parser.add_argument('--verbose-skipped', + dest='verbose_skipped_tests', + default=False, + action="store_true", + help='Prints some extra information about skipped tests') - parser.add_option('-V', '--verbose-test-result', - dest='verbose_test_result_only', - default=False, - action="store_true", - help='Prints test serial output') + parser.add_argument('-V', '--verbose-test-result', + dest='verbose_test_result_only', + default=False, + action="store_true", + help='Prints test serial output') - parser.add_option('-v', '--verbose', - dest='verbose', - default=False, - action="store_true", - help='Verbose mode (prints some extra information)') + parser.add_argument('-v', '--verbose', + dest='verbose', + default=False, + action="store_true", + help='Verbose mode (prints some extra information)') - parser.add_option('', '--version', - dest='version', - default=False, - action="store_true", - help='Prints script version and exits') + parser.add_argument('--version', + dest='version', + default=False, + action="store_true", + help='Prints script version and exits') return parser def test_path_to_name(path): diff --git a/tools/test_webapi.py b/tools/test_webapi.py index ffed0e4624..437a719ade 100644 --- a/tools/test_webapi.py +++ b/tools/test_webapi.py @@ -106,15 +106,16 @@ def get_default_test_webservice_options_parser(): parser = get_default_test_options_parser() # Things related to web services offered by test suite scripts - parser.add_option('', '--rest-api', - dest='rest_api_enabled', - default=False, - action="store_true", - help='Enables REST API.') + parser.add_argument('', '--rest-api', + dest='rest_api_enabled', + default=False, + action="store_true", + help='Enables REST API.') - parser.add_option('', '--rest-api-port', - dest='rest_api_port_no', - help='Sets port for REST API interface') + parser.add_argument('', '--rest-api-port', + dest='rest_api_port_no', + type=int, + help='Sets port for REST API interface') return parser diff --git a/tools/tests.py b/tools/tests.py index a085b001fd..7e485758f8 100644 --- a/tools/tests.py +++ b/tools/tests.py @@ -16,6 +16,13 @@ limitations under the License. """ from tools.paths import * from tools.data.support import * +from argparse import ArgumentTypeError +from utils import columnate + +try: + import tools.private_settings as ps +except: + ps = object() TEST_CMSIS_LIB = join(TEST_DIR, "cmsis", "lib") TEST_MBED_LIB = join(TEST_DIR, "mbed", "env") @@ -1217,3 +1224,19 @@ class Test: return None TEST_MAP = dict([(test['id'], Test(i)) for i, test in enumerate(TESTS)]) + +# parser helpers +def test_known(string): + i = int(string) + if i >= 0 and i < len(TESTS) : return i + else : raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)]))) + +def test_name_known(string): + nlist = string.split(',') + for test_id in nlist: + if test_id not in TEST_MAP.keys(): + if getattr(ps, "test_alias", None) is None or \ + ps.test_alias.get(test_id, "") not in TEST_MAP.keys(): + raise ArgumentTypeError("Program with name '{0}' not found. Supported tests are: \n{1}".format(test_id, columnate([t['id'] for t in TESTS]))) + + return [TEST_MAP[n].n for n in nlist] diff --git a/tools/utils.py b/tools/utils.py index 55752b8750..bce6c64802 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -17,6 +17,8 @@ limitations under the License. import sys import inspect import os +import argparse +import math from os import listdir, remove, makedirs from shutil import copyfile from os.path import isdir, join, exists, split, relpath, splitext @@ -196,3 +198,50 @@ def dict_to_ascii(input): def json_file_to_dict(fname): with open(fname, "rt") as f: return dict_to_ascii(json.load(f, object_pairs_hook=OrderedDict)) + +# Wowza, double closure +def argparse_type(casedness, prefer_hyphen=False) : + def middle(list, type_name): + def parse_type(string): + if prefer_hyphen: newstring = casedness(string).replace("_","-") + else: newstring = casedness(string).replace("-","_") + if string in list: + return string + elif string not in list and newstring in list: + raise argparse.ArgumentTypeError("{0} is not a supported {1}. Did you mean {2}?".format(string, type_name, newstring)) + else: + raise argparse.ArgumentTypeError("{0} is not a supported {1}. Supported {1}s are:\n{2}".format(string, type_name, columnate(list))) + return parse_type + return middle + +argparse_uppercase_type = argparse_type(str.upper, False) +argparse_lowercase_type = argparse_type(str.lower, False) +argparse_uppercase_hyphen_type = argparse_type(str.upper, True) +argparse_lowercase_hyphen_type = argparse_type(str.lower, True) + +def argparse_many(fn): + def wrap(string): + return [fn(s) for s in string.split(",")] + return wrap + +def argparse_filestring_type(string) : + if exists(string) : + return string + else : + raise argparse.ArgumentTypeError("{0}"" does not exist in the filesystem.".format(string)) + +def columnate(strings, seperator=", ", chars=80): + col_width = max(len(s) for s in strings) + total_width = col_width + len(seperator) + columns = math.floor(chars / total_width) + output = "" + for i, s in zip(range(len(strings)), strings): + append = s + if i != len(strings) - 1: + append += seperator + if i % columns == columns - 1: + append += "\n" + else: + append = append.ljust(total_width) + output += append + return output From d6bee561ab442442961c73e8ff6e5c5d755b6b26 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Fri, 24 Jun 2016 17:16:48 -0500 Subject: [PATCH 36/83] Squash weird import bug --- tools/host_tests/host_tests_plugins/module_copy_smart.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/host_tests/host_tests_plugins/module_copy_smart.py b/tools/host_tests/host_tests_plugins/module_copy_smart.py index 1af9eaf70a..486382bada 100644 --- a/tools/host_tests/host_tests_plugins/module_copy_smart.py +++ b/tools/host_tests/host_tests_plugins/module_copy_smart.py @@ -22,7 +22,7 @@ from time import sleep from host_test_plugins import HostTestPluginBase sys.path.append(abspath(join(dirname(__file__), "../../../"))) -from tools.test_api import get_autodetected_MUTS_list +import tools.test_api class HostTestPluginCopyMethod_Smart(HostTestPluginBase): @@ -74,7 +74,7 @@ class HostTestPluginCopyMethod_Smart(HostTestPluginBase): for i in range(0, 60): print('Looking for %s with MBEDLS' % target_mcu) - muts_list = get_autodetected_MUTS_list(platform_name_filter=platform_name_filter) + muts_list = tools.test_api.get_autodetected_MUTS_list(platform_name_filter=platform_name_filter) if 1 in muts_list: mut = muts_list[1] From 59ae690f9bb78ac7b7ee8971821fc77c849360ec Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 28 Jun 2016 19:25:15 -0500 Subject: [PATCH 37/83] Correct style in tests.py --- tools/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tests.py b/tools/tests.py index 7e485758f8..1fe1b8eb04 100644 --- a/tools/tests.py +++ b/tools/tests.py @@ -1228,8 +1228,10 @@ TEST_MAP = dict([(test['id'], Test(i)) for i, test in enumerate(TESTS)]) # parser helpers def test_known(string): i = int(string) - if i >= 0 and i < len(TESTS) : return i - else : raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)]))) + if i >= 0 and i < len(TESTS): + return i + else: + raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)]))) def test_name_known(string): nlist = string.split(',') From 6fda53b8b8fe98307ae94d638b6b223bc6955213 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 28 Jun 2016 19:31:06 -0500 Subject: [PATCH 38/83] Add documentation for the argparser utilities --- tools/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/utils.py b/tools/utils.py index bce6c64802..62227787b4 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -202,6 +202,9 @@ def json_file_to_dict(fname): # Wowza, double closure def argparse_type(casedness, prefer_hyphen=False) : def middle(list, type_name): + # validate that an argument passed in (as string) is a member of the list of possible + # arguments. Offer a suggestion if the case of the string, or the hyphens/underscores + # do not match the expected style of the argument. def parse_type(string): if prefer_hyphen: newstring = casedness(string).replace("_","-") else: newstring = casedness(string).replace("-","_") @@ -214,22 +217,27 @@ def argparse_type(casedness, prefer_hyphen=False) : return parse_type return middle +# short cuts for the argparse_type versions argparse_uppercase_type = argparse_type(str.upper, False) argparse_lowercase_type = argparse_type(str.lower, False) argparse_uppercase_hyphen_type = argparse_type(str.upper, True) argparse_lowercase_hyphen_type = argparse_type(str.lower, True) +# An argument parser combinator that takes in an argument parser and creates a new parser that +# accepts a comma separated list of the same thing. def argparse_many(fn): def wrap(string): return [fn(s) for s in string.split(",")] return wrap +# An argument parser that verifies that a string passed in corresponds to a file def argparse_filestring_type(string) : if exists(string) : return string else : raise argparse.ArgumentTypeError("{0}"" does not exist in the filesystem.".format(string)) +# render a list of strings as a in a bunch of columns def columnate(strings, seperator=", ", chars=80): col_width = max(len(s) for s in strings) total_width = col_width + len(seperator) From 5052e97b17ac7a987af7c5efcc33efd2c58839dd Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 28 Jun 2016 19:46:22 -0500 Subject: [PATCH 39/83] Force conversion of all -i, -m, -t to the correct case --- tools/options.py | 7 +++---- tools/project.py | 5 +++-- tools/utils.py | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/tools/options.py b/tools/options.py index 1585323b14..18861190a6 100644 --- a/tools/options.py +++ b/tools/options.py @@ -17,8 +17,7 @@ limitations under the License. from argparse import ArgumentParser from tools.toolchains import TOOLCHAINS from tools.targets import TARGET_NAMES -from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type, argparse_many - +from utils import argparse_force_uppercase_type, argparse_lowercase_hyphen_type, argparse_many def get_default_options_parser(add_clean=True, add_options=True): parser = ArgumentParser() @@ -31,12 +30,12 @@ def get_default_options_parser(add_clean=True, add_options=True): parser.add_argument("-m", "--mcu", help="build for the given MCU (%s)" % ', '.join(targetnames), metavar="MCU", - type=argparse_many(argparse_uppercase_type(targetnames, "MCU"))) + type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU"))) parser.add_argument("-t", "--tool", help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist), metavar="TOOLCHAIN", - type=argparse_many(argparse_uppercase_type(toolchainlist, "toolchain"))) + type=argparse_many(argparse_force_uppercase_type(toolchainlist, "toolchain"))) if add_clean: parser.add_argument("-c", "--clean", action="store_true", default=False, diff --git a/tools/project.py b/tools/project.py index c0ed8c156b..f0c0003414 100644 --- a/tools/project.py +++ b/tools/project.py @@ -16,6 +16,7 @@ from tools.tests import test_known, test_name_known from tools.targets import TARGET_NAMES from tools.libraries import LIBRARIES from utils import argparse_lowercase_type, argparse_uppercase_type, argparse_filestring_type, argparse_many +from utils import argparse_force_lowercase_type, argparse_force_uppercase_type @@ -32,14 +33,14 @@ if __name__ == '__main__': metavar="MCU", default='LPC1768', required=True, - type=argparse_many(argparse_uppercase_type(targetnames, "MCU")), + type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU")), help="generate project for the given MCU (%s)"% ', '.join(targetnames)) parser.add_argument("-i", dest="ide", default='uvision', required=True, - type=argparse_many(argparse_lowercase_type(toolchainlist, "toolchain")), + type=argparse_many(argparse_force_lowercase_type(toolchainlist, "toolchain")), help="The target IDE: %s"% str(toolchainlist)) parser.add_argument("-c", "--clean", diff --git a/tools/utils.py b/tools/utils.py index 62227787b4..50a985f486 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -223,6 +223,27 @@ argparse_lowercase_type = argparse_type(str.lower, False) argparse_uppercase_hyphen_type = argparse_type(str.upper, True) argparse_lowercase_hyphen_type = argparse_type(str.lower, True) +def argparse_force_type(case): + def middle(list, type_name): + # validate that an argument passed in (as string) is a member of the list of possible + # arguments after converting it's case. Offer a suggestion if the hyphens/underscores + # do not match the expected style of the argument. + def parse_type(string): + string = case(string) + newstring = string.replace("-","_") + if string in list: + return string + elif string not in list and newstring in list: + raise argparse.ArgumentTypeError("{0} is not a supported {1}. Did you mean {2}?".format(string, type_name, newstring)) + else: + raise argparse.ArgumentTypeError("{0} is not a supported {1}. Supported {1}s are:\n{2}".format(string, type_name, columnate(list))) + return parse_type + return middle + +# these two types convert the case of their arguments _before_ validation +argparse_force_uppercase_type = argparse_force_type(str.upper) +argparse_force_lowercase_type = argparse_force_type(str.lower) + # An argument parser combinator that takes in an argument parser and creates a new parser that # accepts a comma separated list of the same thing. def argparse_many(fn): From b4b514ea2f96141727030c9742f6d5cc0bc67516 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 28 Jun 2016 19:58:02 -0500 Subject: [PATCH 40/83] Correct test_name_known, now use argparse_many for lists also updated all consumers of test_name_known --- tools/make.py | 5 +++-- tools/tests.py | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/make.py b/tools/make.py index 8a817e3d42..9b6f17a0e2 100644 --- a/tools/make.py +++ b/tools/make.py @@ -44,6 +44,7 @@ from tools.options import get_default_options_parser from tools.build_api import build_project from tools.build_api import mcu_toolchain_matrix from utils import argparse_filestring_type +from utils import argparse_many from argparse import ArgumentTypeError if __name__ == '__main__': @@ -51,12 +52,12 @@ if __name__ == '__main__': parser = get_default_options_parser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("-p", - type=test_known, + type=argparse_many(test_known), dest="program", help="The index of the desired test program: [0-%d]" % (len(TESTS)-1)) group.add_argument("-n", - type=test_name_known, + type=argparse_many(test_name_known), dest="program", help="The name of the desired test program") diff --git a/tools/tests.py b/tools/tests.py index 1fe1b8eb04..8cc9576f01 100644 --- a/tools/tests.py +++ b/tools/tests.py @@ -1234,11 +1234,9 @@ def test_known(string): raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)]))) def test_name_known(string): - nlist = string.split(',') - for test_id in nlist: - if test_id not in TEST_MAP.keys(): - if getattr(ps, "test_alias", None) is None or \ - ps.test_alias.get(test_id, "") not in TEST_MAP.keys(): - raise ArgumentTypeError("Program with name '{0}' not found. Supported tests are: \n{1}".format(test_id, columnate([t['id'] for t in TESTS]))) + if string not in TEST_MAP.keys() and \ + (getattr(ps, "test_alias", None) is None or \ + ps.test_alias.get(test_id, "") not in TEST_MAP.keys()): + raise ArgumentTypeError("Program with name '{0}' not found. Supported tests are: \n{1}".format(string, columnate([t['id'] for t in TESTS]))) - return [TEST_MAP[n].n for n in nlist] + return TEST_MAP[string].n From 9040d27967a649cb85ba7158cb94b84d6574fcc5 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 10:48:09 -0500 Subject: [PATCH 41/83] Rework the force types to match case for example, argparse_force_uppercase_type will now correctly parse uARM to uARM --- tools/utils.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index 50a985f486..5c64c41e65 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -229,14 +229,10 @@ def argparse_force_type(case): # arguments after converting it's case. Offer a suggestion if the hyphens/underscores # do not match the expected style of the argument. def parse_type(string): - string = case(string) - newstring = string.replace("-","_") - if string in list: - return string - elif string not in list and newstring in list: - raise argparse.ArgumentTypeError("{0} is not a supported {1}. Did you mean {2}?".format(string, type_name, newstring)) - else: - raise argparse.ArgumentTypeError("{0} is not a supported {1}. Supported {1}s are:\n{2}".format(string, type_name, columnate(list))) + for option in list: + if case(string) == case(option): + return option + raise argparse.ArgumentTypeError("{0} is not a supported {1}. Supported {1}s are:\n{2}".format(string, type_name, columnate(list))) return parse_type return middle From 5f1894364187abbcbb2d977d6cbabba015a42405 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 16:17:41 -0500 Subject: [PATCH 42/83] Revert parsing of mutiple ides on command line --- tools/project.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/project.py b/tools/project.py index f0c0003414..3d0155aa64 100644 --- a/tools/project.py +++ b/tools/project.py @@ -40,7 +40,7 @@ if __name__ == '__main__': dest="ide", default='uvision', required=True, - type=argparse_many(argparse_force_lowercase_type(toolchainlist, "toolchain")), + type=argparse_force_lowercase_type(toolchainlist, "toolchain"), help="The target IDE: %s"% str(toolchainlist)) parser.add_argument("-c", "--clean", @@ -139,7 +139,7 @@ if __name__ == '__main__': for mcu in options.mcu: # Program Number or name - p, src, ides = options.program, options.source_dir, options.ide + p, src, ide = options.program, options.source_dir, options.ide if src: # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file @@ -181,17 +181,16 @@ if __name__ == '__main__': setup_user_prj(project_dir[0], test.source_dir, test.dependencies) # Export to selected toolchain - for ide in ides: - tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative) - if report['success']: - if not zip: - zip_path = join(project_temp, project_name) - else: - zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu)) - move(tmp_path, zip_path) - successes.append("%s::%s\t%s"% (mcu, ide, zip_path)) + tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative) + if report['success']: + if not zip: + zip_path = join(project_temp, project_name) else: - failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) + zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu)) + move(tmp_path, zip_path) + successes.append("%s::%s\t%s"% (mcu, ide, zip_path)) + else: + failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) # Prints export results print From 4c5bfaa3d8dac65199f955bf7b0d47a8d325cad9 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 16:18:36 -0500 Subject: [PATCH 43/83] Allow --source with -n and -p, or alone; name projects conditionally --- tools/project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/project.py b/tools/project.py index 3d0155aa64..677b12776f 100644 --- a/tools/project.py +++ b/tools/project.py @@ -48,7 +48,7 @@ if __name__ == '__main__': default=False, help="clean the export directory") - group = parser.add_mutually_exclusive_group(required=True) + group = parser.add_mutually_exclusive_group(required=False) group.add_argument("-p", type=test_known, dest="program", @@ -83,7 +83,7 @@ if __name__ == '__main__': default=False, help="writes tools/export/README.md") - group.add_argument("--source", + parser.add_argument("--source", nargs="*", type=argparse_filestring_type, dest="source_dir", @@ -144,7 +144,7 @@ if __name__ == '__main__': if src: # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file project_dir = options.source_dir - project_name = TESTS[p] + project_name = TESTS[p] if p else "Unnamed_project" project_temp = path.join(options.source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu)) mkdir(project_temp) lib_symbols = [] From bca12206f1e47c0c4d7d2967516938c0ed9f05d0 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 17:00:29 -0500 Subject: [PATCH 44/83] Allow --source to be specified more than once --- tools/make.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/make.py b/tools/make.py index 9b6f17a0e2..4bffa0701f 100644 --- a/tools/make.py +++ b/tools/make.py @@ -106,8 +106,8 @@ if __name__ == '__main__': default=None, help="Required peripherals") parser.add_argument("--dep", dest="dependencies", default=None, help="Dependencies") - group.add_argument("--source", dest="source_dir", type=argparse_filestring_type, - default=None, help="The source (input) directory", nargs="*") + parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, + default=None, help="The source (input) directory", action="append") parser.add_argument("--duration", type=int, dest="duration", default=None, help="Duration of the test") parser.add_argument("--build", dest="build_dir", From 7a4bee8c0e65d2e615c2cf48c4ee4676675dcafa Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 17:13:38 -0500 Subject: [PATCH 45/83] nargs="*" -> action="append" --- tools/build.py | 4 ++-- tools/get_config.py | 4 ++-- tools/make.py | 2 +- tools/options.py | 2 +- tools/project.py | 4 ++-- tools/test.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/build.py b/tools/build.py index e388ebd7ae..7e9bb2e5d9 100644 --- a/tools/build.py +++ b/tools/build.py @@ -44,7 +44,7 @@ if __name__ == '__main__': parser = get_default_options_parser() parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, - default=None, help="The source (input) directory", nargs="*") + default=None, help="The source (input) directory", action="append") parser.add_argument("--build", dest="build_dir", type=argparse_filestring_type, default=None, help="The build (output) directory") @@ -107,7 +107,7 @@ if __name__ == '__main__': help="Compiles 'cpputest' unit test library (library should be on the same directory level as mbed repository)") parser.add_argument("-D", - nargs="*", + action="append", dest="macros", help="Add a macro definition") diff --git a/tools/get_config.py b/tools/get_config.py index 91dbccf548..82cf8acc23 100644 --- a/tools/get_config.py +++ b/tools/get_config.py @@ -38,8 +38,8 @@ if __name__ == '__main__': # Parse Options parser = get_default_options_parser(add_clean=False, add_options=False) parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, - default=[], help="The source (input) directory", nargs="*") - parser.add_argument("--prefix", dest="prefix", nargs="*", + default=[], help="The source (input) directory", action="append") + parser.add_argument("--prefix", dest="prefix", action="append", default=[], help="Restrict listing to parameters that have this prefix") parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Verbose diagnostic output") diff --git a/tools/make.py b/tools/make.py index 4bffa0701f..626ed3801f 100644 --- a/tools/make.py +++ b/tools/make.py @@ -80,7 +80,7 @@ if __name__ == '__main__': help="Silent diagnostic output (no copy, compile notification)") parser.add_argument("-D", - nargs="*", + action="append", dest="macros", help="Add a macro definition") diff --git a/tools/options.py b/tools/options.py index 18861190a6..36789f505a 100644 --- a/tools/options.py +++ b/tools/options.py @@ -42,7 +42,7 @@ def get_default_options_parser(add_clean=True, add_options=True): help="clean the build directory") if add_options: - parser.add_argument("-o", "--options", nargs="*", + parser.add_argument("-o", "--options", action="append", help='Add a build argument ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")', type=argparse_lowercase_hyphen_type(['save-asm', 'debug-info', 'analyze'], "build option")) diff --git a/tools/project.py b/tools/project.py index 677b12776f..c58858d79d 100644 --- a/tools/project.py +++ b/tools/project.py @@ -84,14 +84,14 @@ if __name__ == '__main__': help="writes tools/export/README.md") parser.add_argument("--source", - nargs="*", + action="append", type=argparse_filestring_type, dest="source_dir", default=[], help="The source (input) directory") parser.add_argument("-D", - nargs="*", + action="append", dest="macros", help="Add a macro definition") diff --git a/tools/test.py b/tools/test.py index acb472691f..96ea461aee 100644 --- a/tools/test.py +++ b/tools/test.py @@ -41,7 +41,7 @@ if __name__ == '__main__': parser = get_default_options_parser() parser.add_argument("-D", - nargs="*", + action="append", dest="macros", help="Add a macro definition") @@ -53,7 +53,7 @@ if __name__ == '__main__': parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, - default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", nargs="*") + default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", action="append") parser.add_argument("--build", dest="build_dir", default=None, help="The build (output) directory") From 254dccdad33d0a014b7b1f94dfdd8ab9fbc6d782 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 17:19:17 -0500 Subject: [PATCH 46/83] Remove checking for existance of build directory --- tools/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build.py b/tools/build.py index 7e9bb2e5d9..275d89cdf9 100644 --- a/tools/build.py +++ b/tools/build.py @@ -46,7 +46,7 @@ if __name__ == '__main__': parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, default=None, help="The source (input) directory", action="append") - parser.add_argument("--build", dest="build_dir", type=argparse_filestring_type, + parser.add_argument("--build", dest="build_dir", default=None, help="The build (output) directory") parser.add_argument("--no-archive", dest="no_archive", action="store_true", From 6d0716c69bd170b0496c1d4252a21b1912d3d4ce Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 17:25:53 -0500 Subject: [PATCH 47/83] Ignore extra MCUs and toolchains in get_config.py --- tools/get_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/get_config.py b/tools/get_config.py index 82cf8acc23..c9b2a9bebc 100644 --- a/tools/get_config.py +++ b/tools/get_config.py @@ -49,12 +49,12 @@ if __name__ == '__main__': # Target if options.mcu is None : args_error(parser, "[ERROR] You should specify an MCU") - target = options.mcu + target = options.mcu[0] # Toolchain if options.tool is None: args_error(parser, "[ERROR] You should specify a TOOLCHAIN") - toolchain = options.tool + toolchain = options.tool[0] options.prefix = options.prefix or [""] From 122fa93a70d04594e1769d9d83a67ccb6bc9255b Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 29 Jun 2016 17:28:50 -0500 Subject: [PATCH 48/83] Allow make.py to accpet just --source --- tools/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/make.py b/tools/make.py index 626ed3801f..ba86f5170a 100644 --- a/tools/make.py +++ b/tools/make.py @@ -50,7 +50,7 @@ from argparse import ArgumentTypeError if __name__ == '__main__': # Parse Options parser = get_default_options_parser() - group = parser.add_mutually_exclusive_group(required=True) + group = parser.add_mutually_exclusive_group(required=False) group.add_argument("-p", type=argparse_many(test_known), dest="program", From 61c63b3789e1e2d8c4e4bacd2577a8ba57a79d8f Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 30 Jun 2016 16:49:02 -0500 Subject: [PATCH 49/83] Argument error when memap's input file does not exist --- tools/memap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/memap.py b/tools/memap.py index e7a178583e..94d378024f 100644 --- a/tools/memap.py +++ b/tools/memap.py @@ -10,7 +10,7 @@ import re import csv import json import argparse -from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type +from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type, argparse_filestring_type from prettytable import PrettyTable debug = False @@ -523,7 +523,7 @@ def main(): # Parser handling parser = argparse.ArgumentParser(description="Memory Map File Analyser for ARM mbed\nversion %s" % version) - parser.add_argument('file', help='memory map file') + parser.add_argument('file', type=argparse_filestring_type, help='memory map file') parser.add_argument('-t', '--toolchain', dest='toolchain', help='select a toolchain used to build the memory map file (%s)' % ", ".join(MemapParser.toolchains),\ required=True, type=argparse_uppercase_type(MemapParser.toolchains, "toolchain")) From 2c78dca69cb2ab53460d42c206ce5f31b695b3f6 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 7 Jul 2016 22:51:31 -0500 Subject: [PATCH 50/83] Fixed typo in incr/decr function Result of last minute change, interestingly only emits a warning in gcc. --- hal/common/critical.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hal/common/critical.c b/hal/common/critical.c index f4ec8eb2f1..5a574e4cf5 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -270,7 +270,7 @@ uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta) } void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { - return core_util_atomic_incr((uintptr_t)valuePtr, (uintptr_t)delta); + return core_util_atomic_incr_u32((uintptr_t)valuePtr, (uintptr_t)delta); } @@ -305,8 +305,9 @@ uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta) } void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta) { - return core_util_atomic_decr((uintptr_t)valuePtr, (uintptr_t)delta); + return core_util_atomic_decr_u32((uintptr_t)valuePtr, (uintptr_t)delta); } + #endif From 9c33f70157c8003e5cf82f7f8257f64000048586 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Fri, 8 Jul 2016 09:53:32 +0200 Subject: [PATCH 51/83] [STM32] Serial interrupt TC vs. TXE Reported in Issue #2119 There was some inconsistency in serial interrupt handling accross STM32 serial_api.c implementation. In case application wants to be notified of Tx interrupt, it is mainly interested in transmission complete information, which is the _TC interrupt. The _TXE (Transmit Data REgister Empty) is used only within driver in case SERIAL_ASYNCH is being supported to make the transmission more efficient. --- hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c | 4 ++-- hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c | 2 +- hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c | 2 +- hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c index 27361731aa..d755610c6f 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c @@ -771,7 +771,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) NVIC_EnableIRQ(irq_n); #endif } else { // TxIrq - __HAL_UART_ENABLE_IT(handle, UART_IT_TXE); + __HAL_UART_ENABLE_IT(handle, UART_IT_TC); NVIC_SetVector(irq_n, vector); NVIC_EnableIRQ(irq_n); #if DEVICE_SERIAL_ASYNCH_DMA @@ -788,7 +788,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) // Check if TxIrq is disabled too if ((handle->Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1; } else { // TxIrq - __HAL_UART_DISABLE_IT(handle, UART_IT_TXE); + __HAL_UART_DISABLE_IT(handle, UART_IT_TC); // Check if RxIrq is disabled too if ((handle->Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1; } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c index 00ef41b4f7..c496c3e22d 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c @@ -422,7 +422,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) // Check if TxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1; } else { // TxIrq - __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE); + __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC); // Check if RxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1; } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c index 434bd4344d..77ea301b8e 100755 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c @@ -341,7 +341,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) // Check if TxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1; } else { // TxIrq - __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE); + __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC); // Check if RxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1; } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c index 07b47bea51..d75ae144a8 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c @@ -456,7 +456,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) // Check if TxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1; } else { // TxIrq - __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE); + __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC); // Check if RxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1; } From 6dfb37eafc1b584c2653cbda49d565c711a9f96d Mon Sep 17 00:00:00 2001 From: Michel JAOUEN Date: Thu, 7 Jul 2016 12:36:49 +0200 Subject: [PATCH 52/83] [TARGET_STM] : remove sys.cpp not used in TOOLCHAIN_ARM_MICRO --- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 31 ---------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- .../TOOLCHAIN_ARM_MICRO/sys.cpp | 56 ------------------- 44 files changed, 2439 deletions(-) delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407VG/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/TOOLCHAIN_ARM_MICRO/sys.cpp delete mode 100644 hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/TOOLCHAIN_ARM_MICRO/sys.cpp diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 2ef8774b15..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2016, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 2ef8774b15..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2016, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F334C8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F302R8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F334R8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_ELMO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F405RG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F410RB/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F429ZI/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446ZE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407VG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407VG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 2f1024ace8..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407VG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Copyright (C) 2009-2011 ARM Limited. All rights reserved. - * - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F746ZG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L011K4/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L031K6/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_MOTE_L152RC/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index 4362e30478..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2015, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_DISCO_L476VG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L432KC/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif diff --git a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/TOOLCHAIN_ARM_MICRO/sys.cpp b/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/TOOLCHAIN_ARM_MICRO/sys.cpp deleted file mode 100644 index bb665909b9..0000000000 --- a/hal/targets/cmsis/TARGET_STM/TARGET_STM32L4/TARGET_NUCLEO_L476RG/TOOLCHAIN_ARM_MICRO/sys.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* mbed Microcontroller Library - stackheap - * Setup a fixed single stack/heap memory model, - * between the top of the RW/ZI region and the stackpointer - ******************************************************************************* - * Copyright (c) 2014, STMicroelectronics - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************* - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -extern char Image$$RW_IRAM1$$ZI$$Limit[]; - -extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) { - uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit; - uint32_t sp_limit = __current_sp(); - - zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned - - struct __initial_stackheap r; - r.heap_base = zi_limit; - r.heap_limit = sp_limit; - return r; -} - -#ifdef __cplusplus -} -#endif From a101c4f3d89131db04e5071ed23f82f9b181d753 Mon Sep 17 00:00:00 2001 From: svastm Date: Wed, 6 Jul 2016 17:24:16 +0200 Subject: [PATCH 53/83] [STM32XX] Fix RTC minimum date --- .../hal/TARGET_STM/TARGET_STM32F0/rtc_api.c | 17 ++++++----------- .../hal/TARGET_STM/TARGET_STM32F1/rtc_api.c | 4 ++-- .../hal/TARGET_STM/TARGET_STM32F3/rtc_api.c | 6 +++--- .../hal/TARGET_STM/TARGET_STM32F4/rtc_api.c | 6 +++--- .../hal/TARGET_STM/TARGET_STM32F7/rtc_api.c | 6 +++--- .../hal/TARGET_STM/TARGET_STM32L0/rtc_api.c | 6 +++--- .../hal/TARGET_STM/TARGET_STM32L1/rtc_api.c | 6 +++--- .../hal/TARGET_STM/TARGET_STM32L4/rtc_api.c | 6 +++--- 8 files changed, 26 insertions(+), 31 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/rtc_api.c index 67db9a9990..c58d56deb0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/rtc_api.c @@ -56,7 +56,7 @@ static void rtc_configure_time_and_date() mDate.WeekDay = 1; mDate.Month = 1; mDate.Date = 1; - mDate.Year = 1970; + mDate.Year = 2; if (HAL_RTC_SetDate(&RtcHandle, &mDate, RTC_FORMAT_BIN) != HAL_OK) { error("Date set failed\n"); } @@ -64,7 +64,7 @@ static void rtc_configure_time_and_date() mTime.Hours = 0; mTime.Minutes = 0; mTime.Seconds = 0; - mTime.TimeFormat = RTC_HOURFORMAT12_AM; + mTime.TimeFormat = RTC_HOURFORMAT_24; mTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; mTime.StoreOperation = RTC_STOREOPERATION_RESET; if (HAL_RTC_SetTime(&RtcHandle, &mTime, RTC_FORMAT_BIN) != HAL_OK) { @@ -243,12 +243,7 @@ time_t rtc_read(void) { timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; -#if DEVICE_LOWPOWERTIMER - //We need to add 52 to get the 1970 year - timeinfo.tm_year = dateStruct.Year + 52; -#else - timeinfo.tm_year = dateStruct.Year + 100; -#endif + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -273,11 +268,11 @@ void rtc_write(time_t t) { dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; @@ -295,7 +290,7 @@ void rtc_set_alarm(struct tm *ti, uint32_t subsecs) mAlarm.AlarmTime.Minutes = ti->tm_min; mAlarm.AlarmTime.Seconds = ti->tm_sec; mAlarm.AlarmTime.SubSeconds = subsecs; - mAlarm.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; + mAlarm.AlarmTime.TimeFormat = RTC_HOURFORMAT_24; mAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; mAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE; mAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c index 50cb7286f5..b6fc14b8ec 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c @@ -159,7 +159,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -184,7 +184,7 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c index 838eb4083c..c24c3951c9 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c @@ -178,7 +178,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -203,11 +203,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c index 2f40051381..e3e8db64eb 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c @@ -178,7 +178,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -203,11 +203,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c index 2293faba5e..97766a5d3e 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/rtc_api.c @@ -178,7 +178,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -206,11 +206,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/rtc_api.c index 52b4398b8b..97eff3de6e 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/rtc_api.c @@ -190,7 +190,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -217,11 +217,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/rtc_api.c index cdf2e6976a..79b32432fa 100755 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/rtc_api.c @@ -189,7 +189,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -216,11 +216,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c index 3e70680091..0dd3d45d4d 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c @@ -191,7 +191,7 @@ time_t rtc_read(void) timeinfo.tm_wday = dateStruct.WeekDay; timeinfo.tm_mon = dateStruct.Month - 1; timeinfo.tm_mday = dateStruct.Date; - timeinfo.tm_year = dateStruct.Year + 100; + timeinfo.tm_year = dateStruct.Year + 68; timeinfo.tm_hour = timeStruct.Hours; timeinfo.tm_min = timeStruct.Minutes; timeinfo.tm_sec = timeStruct.Seconds; @@ -218,11 +218,11 @@ void rtc_write(time_t t) dateStruct.WeekDay = timeinfo->tm_wday; dateStruct.Month = timeinfo->tm_mon + 1; dateStruct.Date = timeinfo->tm_mday; - dateStruct.Year = timeinfo->tm_year - 100; + dateStruct.Year = timeinfo->tm_year - 68; timeStruct.Hours = timeinfo->tm_hour; timeStruct.Minutes = timeinfo->tm_min; timeStruct.Seconds = timeinfo->tm_sec; - timeStruct.TimeFormat = RTC_HOURFORMAT12_PM; + timeStruct.TimeFormat = RTC_HOURFORMAT_24; timeStruct.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; timeStruct.StoreOperation = RTC_STOREOPERATION_RESET; From e29aa6a7fab7b9e12804e1649ded42697e33ca6b Mon Sep 17 00:00:00 2001 From: Michel JAOUEN Date: Fri, 8 Jul 2016 12:04:48 +0200 Subject: [PATCH 54/83] Fix issue #2124: IAR no rtos Remove the 2nd call of mbed_sdk_init in __iar_argc_argv --- hal/common/retarget.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index 9fbc27b784..71be1d3801 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -545,7 +545,6 @@ extern "C" int __wrap_main(void) { // code will call a function to setup argc and argv (__iar_argc_argv) if it is defined. // Since mbed doesn't use argc/argv, we use this function to call our mbed_main. extern "C" void __iar_argc_argv() { - mbed_sdk_init(); mbed_main(); } #endif From 70013d03b691d7d9e856c163ea8049f965e9a468 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 7 Jul 2016 23:50:04 -0500 Subject: [PATCH 55/83] Fixed casts around calls to atomic u32 functions - uint32_t -> void * - void ** -> uint32_t * For whatever reason `uintptr_t` and `uint32_t` expand to incompatible types `unsigned int` and `unsigned long int`. This is implicitely casted when passed by value, but causes a warning in gcc and error in iar when passed by pointer. This issue is not present on x86_32 gcc --- hal/common/critical.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hal/common/critical.c b/hal/common/critical.c index 5a574e4cf5..fc952f63c9 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -234,9 +234,9 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue) { return core_util_atomic_cas_u32( - (uintptr_t *)ptr, - (uintptr_t *)expectedCurrentValue, - (uintptr_t)desiredValue); + (uint32_t *)ptr, + (uint32_t *)expectedCurrentValue, + (uint32_t)desiredValue); } uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta) @@ -270,7 +270,7 @@ uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta) } void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { - return core_util_atomic_incr_u32((uintptr_t)valuePtr, (uintptr_t)delta); + return (void *)core_util_atomic_incr_u32((uint32_t *)valuePtr, (uint32_t)delta); } @@ -305,7 +305,7 @@ uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta) } void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta) { - return core_util_atomic_decr_u32((uintptr_t)valuePtr, (uintptr_t)delta); + return (void *)core_util_atomic_decr_u32((uint32_t *)valuePtr, (uint32_t)delta); } From 98d55e71d8b81f078b43aa53d76352bc129940a8 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 8 Jul 2016 14:50:03 -0500 Subject: [PATCH 56/83] Moved core_util_atomic_*_ptr functions out of cortex switch --- hal/common/critical.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/hal/common/critical.c b/hal/common/critical.c index fc952f63c9..0afe0d5ad7 100644 --- a/hal/common/critical.c +++ b/hal/common/critical.c @@ -232,12 +232,6 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin return success; } -bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue) { - return core_util_atomic_cas_u32( - (uint32_t *)ptr, - (uint32_t *)expectedCurrentValue, - (uint32_t)desiredValue); -} uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta) { @@ -269,10 +263,6 @@ uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta) return newValue; } -void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { - return (void *)core_util_atomic_incr_u32((uint32_t *)valuePtr, (uint32_t)delta); -} - uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta) { @@ -304,10 +294,21 @@ uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta) return newValue; } +#endif + + +bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue) { + return core_util_atomic_cas_u32( + (uint32_t *)ptr, + (uint32_t *)expectedCurrentValue, + (uint32_t)desiredValue); +} + +void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta) { + return (void *)core_util_atomic_incr_u32((uint32_t *)valuePtr, (uint32_t)delta); +} + void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta) { return (void *)core_util_atomic_decr_u32((uint32_t *)valuePtr, (uint32_t)delta); } - -#endif - From 4b77054940595f5c4eb1ff65d598461075acb584 Mon Sep 17 00:00:00 2001 From: lrks Date: Sun, 10 Jul 2016 10:34:13 +0900 Subject: [PATCH 57/83] Fix I2C slave address Remove the needless bit shift for I2C slave address. --- .../hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c index e549047c22..84e38993d8 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c @@ -233,7 +233,7 @@ int i2c_slave_write(i2c_t *obj, const char *data, int length) { } void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) { - i2c_addrs[obj->instance]->A1 = ((uint32_t)(address)) << 1U; + i2c_addrs[obj->instance]->A1 = address & 0xfe; } #endif From 7388b446d4613ef63b2c16d2a37eb02b5075b987 Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Sun, 10 Jul 2016 20:58:35 +0200 Subject: [PATCH 58/83] [target.json - progen] changing a wrong config ARCH_MAX has a STM32F407 mcu --- hal/targets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/targets.json b/hal/targets.json index 1c0ead7895..5b26f4b7e4 100644 --- a/hal/targets.json +++ b/hal/targets.json @@ -1013,7 +1013,7 @@ "extra_labels": ["STM", "STM32F4", "STM32F407", "STM32F407VG"], "macros": ["LSI_VALUE=32000"], "inherits": ["Target"], - "progen": {"target": "lpc1768"}, + "progen": {"target": "arch-max"}, "device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"], "release": true }, From 4b94e726c4d853b30a98a0b65e5c2be627c92461 Mon Sep 17 00:00:00 2001 From: Olaf Hagendorf Date: Mon, 11 Jul 2016 10:55:02 +0200 Subject: [PATCH 59/83] adding project_generator_definitions to setup.py and requirements.txt --- requirements.txt | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9a28e6f308..53efae0aef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ PrettyTable>=0.7.2 Jinja2>=2.7.3 IntelHex>=1.3 project-generator>=0.9.3,<0.10.0 +project_generator_definitions>=0.2.26,<0.3.0 junit-xml pyYAML requests diff --git a/setup.py b/setup.py index 3ff7c30d6d..c27a2a8b0e 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ setup(name='mbed-tools', url='https://github.com/mbedmicro/mbed', packages=find_packages(), license=LICENSE, - install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.9.3,<0.10.0", "junit-xml", "requests", "pyYAML"]) + install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.9.3,<0.10.0", "project_generator_definitions>=0.2.26,<0.3.0", "junit-xml", "requests", "pyYAML"]) # Restore previous mbed_settings if needed if backup: From 998af810920acf455848fcbd3324a29208b94fd4 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Mon, 11 Jul 2016 16:41:07 +0300 Subject: [PATCH 60/83] Added flow control for K64F This commit adds hardware flow control capabilities for the K64F family of MCUs. This is a backport of these commits: https://github.com/ARMmbed/mbed-hal-ksdk-mcu/commit/9bfcfd0572d1835a889779515a3b612262785a46 https://github.com/ARMmbed/mbed-hal-frdm-k64f/commit/77042cc9453c91957b04e9bd200a2dd928723e5a with a few changes: - since the current version of KSDK doesn't seem to have APIs for manipulating the flow control settings, we change the peripheral registers directly. - updated pin maps for RTS/CTS in accordance to the K64F datasheet. --- hal/targets.json | 6 ++-- .../TARGET_K64F/TARGET_FRDM/PeripheralPins.c | 34 +++++++++++++++++++ .../TARGET_K64F/serial_api.c | 33 ++++++++++++++++++ .../TARGET_KSDK2_MCUS/api/PeripheralPins.h | 3 +- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/hal/targets.json b/hal/targets.json index 1c0ead7895..f92310cb19 100644 --- a/hal/targets.json +++ b/hal/targets.json @@ -579,7 +579,7 @@ "inherits": ["Target"], "progen": {"target": "frdm-k64f"}, "detect_code": ["0240"], - "device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "STORAGE"], + "device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES", "STORAGE"], "features": ["IPV4"], "release": true }, @@ -592,7 +592,7 @@ "is_disk_virtual": true, "macros": ["CPU_MK64FN1M0VMD12", "FSL_RTOS_MBED", "TARGET_K64F"], "progen": {"target": "mts-gambit"}, - "device_has": ["I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"] + "device_has": ["I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"] }, "HEXIWEAR": { "inherits": ["Target"], @@ -605,7 +605,7 @@ "default_toolchain": "ARM", "detect_code": ["0214"], "progen": {"target": "hexiwear-k64f"}, - "device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"], + "device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"], "default_build": "standard" }, "NUCLEO_F030R8": { diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/TARGET_FRDM/PeripheralPins.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/TARGET_FRDM/PeripheralPins.c index 92009d7241..c2bb8f627e 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/TARGET_FRDM/PeripheralPins.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/TARGET_FRDM/PeripheralPins.c @@ -112,6 +112,40 @@ const PinMap PinMap_UART_RX[] = { {NC , NC , 0} }; +const PinMap PinMap_UART_CTS[] = { + {PTB13, UART_3, 2}, + {PTE2 , UART_1, 3}, + {PTE6 , UART_3, 3}, + {PTE26, UART_4, 3}, + {PTA0 , UART_0, 2}, + {PTA16, UART_0, 3}, + {PTB3 , UART_0, 3}, + {PTB9 , UART_3, 3}, + {PTC2 , UART_1, 3}, + {PTC13, UART_4, 3}, + {PTC19, UART_3, 3}, + {PTD1 , UART_2, 3}, + {PTD5 , UART_0, 3}, + {NC , NC , 0} +}; + +const PinMap PinMap_UART_RTS[] = { + {PTB12, UART_3, 2}, + {PTE3 , UART_1, 3}, + {PTE7 , UART_3, 3}, + {PTE27, UART_4, 3}, + {PTA17, UART_0, 3}, + {PTB8 , UART_3, 3}, + {PTC1 , UART_1, 3}, + {PTC12, UART_4, 3}, + {PTC18, UART_3, 3}, + {PTD0 , UART_2, 3}, + {PTD4 , UART_0, 3}, + {PTA3 , UART_0, 2}, + {PTB2 , UART_0, 3}, + {NC , NC , 0} +}; + /************SPI***************/ const PinMap PinMap_SPI_SCLK[] = { {PTD1 , SPI_0, 2}, diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c index 3ce2c36f3a..7856bd87a3 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c @@ -280,4 +280,37 @@ void serial_break_clear(serial_t *obj) { uart_addrs[obj->index]->C2 &= ~UART_C2_SBK_MASK; } +/* + * Only hardware flow control is implemented in this API. + */ +void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) +{ + switch(type) { + case FlowControlRTS: + pinmap_pinout(rxflow, PinMap_UART_RTS); + uart_addrs[obj->index]->MODEM &= ~UART_MODEM_TXRTSE_MASK; + uart_addrs[obj->index]->MODEM |= UART_MODEM_RXRTSE_MASK; + break; + + case FlowControlCTS: + pinmap_pinout(txflow, PinMap_UART_CTS); + uart_addrs[obj->index]->MODEM &= ~UART_MODEM_RXRTSE_MASK; + uart_addrs[obj->index]->MODEM |= UART_MODEM_TXRTSE_MASK; + break; + + case FlowControlRTSCTS: + pinmap_pinout(rxflow, PinMap_UART_RTS); + pinmap_pinout(txflow, PinMap_UART_CTS); + uart_addrs[obj->index]->MODEM |= UART_MODEM_TXRTSE_MASK | UART_MODEM_RXRTSE_MASK; + break; + + case FlowControlNone: + uart_addrs[obj->index]->MODEM &= ~(UART_MODEM_TXRTSE_MASK | UART_MODEM_RXRTSE_MASK); + break; + + default: + break; + } +} + #endif diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/PeripheralPins.h b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/PeripheralPins.h index 6cff2fed82..97ef45eb62 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/PeripheralPins.h +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/PeripheralPins.h @@ -36,7 +36,8 @@ extern const PinMap PinMap_I2C_SCL[]; /************UART***************/ extern const PinMap PinMap_UART_TX[]; extern const PinMap PinMap_UART_RX[]; - +extern const PinMap PinMap_UART_CTS[]; +extern const PinMap PinMap_UART_RTS[]; /************SPI***************/ extern const PinMap PinMap_SPI_SCLK[]; extern const PinMap PinMap_SPI_MOSI[]; From f4254c4feef5f80b1cc23e6fc578346acd7c0b81 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 11:40:04 -0500 Subject: [PATCH 61/83] Add colorization option to default options parser should be picked up by most cli's --- tools/options.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/options.py b/tools/options.py index 36789f505a..dc44f5f958 100644 --- a/tools/options.py +++ b/tools/options.py @@ -37,6 +37,10 @@ def get_default_options_parser(add_clean=True, add_options=True): metavar="TOOLCHAIN", type=argparse_many(argparse_force_uppercase_type(toolchainlist, "toolchain"))) + parser.add_argument("--color", + help="print Warnings, and Errors in color", + action="store_true", default=False) + if add_clean: parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the build directory") From 3aacdb44210ca5af86bc9258eaecc1bbbda4ea7f Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 13:20:39 -0500 Subject: [PATCH 62/83] Implement colorization in it's own file --- tools/colorize.py | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tools/colorize.py diff --git a/tools/colorize.py b/tools/colorize.py new file mode 100644 index 0000000000..c8d5aec7fd --- /dev/null +++ b/tools/colorize.py @@ -0,0 +1,75 @@ +""" +mbed SDK +Copyright (c) 2016 ARM Limited + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +""" This python file is responsible for generating colorized notifiers. +""" + +import sys +import re +from colorama import init +init() + +colors = { + 'none' : "", + 'default' : "\033[.0m", + 'bold' : "\033[.1m", + 'underline' : "\033[.4m", + 'blink' : "\033[.5m", + 'reverse' : "\033[.7m", + 'concealed' : "\033[.8m", + + 'black' : "\033[.30m", + 'red' : "\033[.31m", + 'green' : "\033[.32m", + 'yellow' : "\033[.33m", + 'blue' : "\033[.34m", + 'magenta' : "\033[.35m", + 'cyan' : "\033[.36m", + 'white' : "\033[.37m", + + 'on_black' : "\033[.40m", + 'on_red' : "\033[.41m", + 'on_green' : "\033[.42m", + 'on_yellow' : "\033[.43m", + 'on_blue' : "\033[.44m", + 'on_magenta' : "\033[.45m", + 'on_cyan' : "\033[46m", + 'on_white' : "\033[47m", +} + +# Convert a color string from a string into an ascii escape code that will print +# that color on the terminal. +color_matcher = re.compile(r"(\w+)(\W+on\W+\w+)?") +def colorstring_to_escapecode(color_string): + match = re.match(color_matcher, color_string) + if match: + return colors[match.group(1)] + (colors[match.group(2).strip().replace(" ","_")] if match.group(2) else "") + else: + return corols['default'] + +# Wrap a toolchain notifier in a colorizer. This colorizer will wrap notifications +# in a color if the severity matches a color in the *color_map*. +def print_in_color_notifier (color_map, print_fn): + def wrap(event, silent=False): + fd = sys.stdout + if fd.isatty() and 'severity' in event and event['severity'] in color_map: + fd.write(colorstring_to_escapecode(color_map[event['severity']])) + print_fn(event, silent) + fd.write(colorstring_to_escapecode('default')) + else: + print_fn(event, silent) + return wrap From 21f025e6013afe4f046a7718955f6943e4f922b6 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 13:27:20 -0500 Subject: [PATCH 63/83] Add a setting for colorization map so that it may be overwritten by the user --- tools/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/settings.py b/tools/settings.py index 5103aca060..01e2f96937 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -51,6 +51,10 @@ BUILD_OPTIONS = [] # mbed.org username MBED_ORG_USER = "" +CLI_COLOR_MAP = { + "warning": "yellow", + "error" : "red" +} ############################################################################## # User Settings (file) From 6b8bde9471d696696b53ce438ca9d6b69c2042da Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 14:57:48 -0500 Subject: [PATCH 64/83] Update event dict with toolchain, use toolchain for wrapping --- tools/colorize.py | 5 +++-- tools/toolchains/__init__.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/colorize.py b/tools/colorize.py index c8d5aec7fd..a93353add2 100644 --- a/tools/colorize.py +++ b/tools/colorize.py @@ -66,10 +66,11 @@ def colorstring_to_escapecode(color_string): def print_in_color_notifier (color_map, print_fn): def wrap(event, silent=False): fd = sys.stdout + self = event['toolchain'] if fd.isatty() and 'severity' in event and event['severity'] in color_map: fd.write(colorstring_to_escapecode(color_map[event['severity']])) - print_fn(event, silent) + print_fn(self, event, silent) fd.write(colorstring_to_escapecode('default')) else: - print_fn(event, silent) + print_fn(self, event, silent) return wrap diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index 97c73e0379..456e856660 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -338,7 +338,6 @@ class mbedToolchain: event['severity'] = event['severity'].title() event['file'] = basename(event['file']) event['mcu_name'] = "None" - event['toolchain'] = "None" event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown" event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown" msg = '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event @@ -351,6 +350,7 @@ class mbedToolchain: def notify(self, event): """ Little closure for notify functions """ + event['toolchain'] = self return self.notify_fun(event, self.silent) def goanna_parse_line(self, line): From 12492c17b80a98cb715e9bfcc29e613f6787d856 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 14:39:59 -0500 Subject: [PATCH 65/83] Call colorized notify when --color for build.py, make.py, test.py --- tools/build.py | 16 ++++++++++++++++ tools/make.py | 14 ++++++++++++++ tools/test.py | 15 +++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/tools/build.py b/tools/build.py index 275d89cdf9..90236040c7 100644 --- a/tools/build.py +++ b/tools/build.py @@ -28,6 +28,7 @@ sys.path.insert(0, ROOT) from tools.toolchains import TOOLCHAINS +from tools.toolchains import mbedToolchain from tools.targets import TARGET_NAMES, TARGET_MAP from tools.options import get_default_options_parser from tools.build_api import build_library, build_mbed_libs, build_lib @@ -36,6 +37,7 @@ from tools.build_api import static_analysis_scan, static_analysis_scan_lib, stat from tools.build_api import print_build_results from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT from utils import argparse_filestring_type +from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, CLI_COLOR_MAP if __name__ == '__main__': start = time() @@ -164,6 +166,17 @@ if __name__ == '__main__': # Get toolchains list toolchains = options.tool if options.tool else TOOLCHAINS + if options.color: + # This import happens late to prevent initializing colorization when we don't need it + import colorize + if options.verbose: + notify = mbedToolchain.print_notify_verbose + else: + notify = mbedToolchain.print_notify + notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify) + else: + notify = None + # Get libraries list libraries = [] @@ -224,6 +237,7 @@ if __name__ == '__main__': lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain, options=options.options, extra_verbose=options.extra_verbose_notify, + notify=notify, verbose=options.verbose, silent=options.silent, jobs=options.jobs, @@ -235,6 +249,7 @@ if __name__ == '__main__': lib_build_res = build_mbed_libs(mcu, toolchain, options=options.options, extra_verbose=options.extra_verbose_notify, + notify=notify, verbose=options.verbose, silent=options.silent, jobs=options.jobs, @@ -245,6 +260,7 @@ if __name__ == '__main__': build_lib(lib_id, mcu, toolchain, options=options.options, extra_verbose=options.extra_verbose_notify, + notify=notify, verbose=options.verbose, silent=options.silent, clean=options.clean, diff --git a/tools/make.py b/tools/make.py index ba86f5170a..477585409a 100644 --- a/tools/make.py +++ b/tools/make.py @@ -46,6 +46,8 @@ from tools.build_api import mcu_toolchain_matrix from utils import argparse_filestring_type from utils import argparse_many from argparse import ArgumentTypeError +from tools.toolchains import mbedToolchain +from tools.settings import CLI_COLOR_MAP if __name__ == '__main__': # Parse Options @@ -212,6 +214,17 @@ if __name__ == '__main__': args_error(parser, "[ERROR] You should specify a TOOLCHAIN") toolchain = options.tool[0] + if options.color: + # This import happens late to prevent initializing colorization when we don't need it + import colorize + if options.verbose: + notify = mbedToolchain.print_notify_verbose + else: + notify = mbedToolchain.print_notify + notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify) + else: + notify = None + # Test for test_no in p: test = Test(test_no) @@ -250,6 +263,7 @@ if __name__ == '__main__': linker_script=options.linker_script, clean=options.clean, verbose=options.verbose, + notify=notify, silent=options.silent, macros=options.macros, jobs=options.jobs, diff --git a/tools/test.py b/tools/test.py index 96ea461aee..c993794cb5 100644 --- a/tools/test.py +++ b/tools/test.py @@ -34,6 +34,8 @@ from tools.targets import TARGET_MAP from tools.utils import mkdir, ToolException, NotSupportedException from tools.test_exporters import ReportExporter, ResultExporterType from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many +from tools.toolchains import mbedToolchain +from tools.settings import CLI_COLOR_MAP if __name__ == '__main__': try: @@ -121,6 +123,17 @@ if __name__ == '__main__': else: tests = all_tests + if options.color: + # This import happens late to prevent initializing colorization when we don't need it + import colorize + if options.verbose: + notify = mbedToolchain.print_notify_verbose + else: + notify = mbedToolchain.print_notify + notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify) + else: + notify = None + if options.list: # Print available tests in order and exit print_tests(tests, options.format) @@ -155,6 +168,7 @@ if __name__ == '__main__': name="mbed-build", macros=options.macros, verbose=options.verbose, + notify=notify, archive=False) library_build_success = True @@ -179,6 +193,7 @@ if __name__ == '__main__': properties=build_properties, macros=options.macros, verbose=options.verbose, + notify=notify, jobs=options.jobs, continue_on_build_fail=options.continue_on_build_fail) From bac254c7a31bf3f0776012044e43d6f938d2e3ed Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 7 Jul 2016 15:19:36 -0500 Subject: [PATCH 66/83] Add documentation of the notify parameter to mbedToolchain --- tools/toolchains/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index 456e856660..2026261906 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -274,6 +274,14 @@ class mbedToolchain: self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]]) # Output notify function + # This function is passed all events, and expected to handle notification of the + # user, emit the events to a log, etc. + # The API for all notify methods passed into the notify parameter is as follows: + # def notify(Event, Silent) + # Where *Event* is a dict representing the toolchain event that was generated + # e.g.: a compile succeeded, or a warning was emitted by the compiler + # or an application was linked + # *Silent* is a boolean if notify: self.notify_fun = notify elif extra_verbose: From e2c88373ee0ef8564384a623f28163c48b58ce5c Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Fri, 8 Jul 2016 11:32:09 -0500 Subject: [PATCH 67/83] Replace color definitions with colorama constants --- tools/colorize.py | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/tools/colorize.py b/tools/colorize.py index a93353add2..b36f212143 100644 --- a/tools/colorize.py +++ b/tools/colorize.py @@ -20,35 +20,30 @@ limitations under the License. import sys import re -from colorama import init +from colorama import init, Fore, Back, Style init() colors = { 'none' : "", - 'default' : "\033[.0m", - 'bold' : "\033[.1m", - 'underline' : "\033[.4m", - 'blink' : "\033[.5m", - 'reverse' : "\033[.7m", - 'concealed' : "\033[.8m", + 'default' : Style.RESET_ALL, - 'black' : "\033[.30m", - 'red' : "\033[.31m", - 'green' : "\033[.32m", - 'yellow' : "\033[.33m", - 'blue' : "\033[.34m", - 'magenta' : "\033[.35m", - 'cyan' : "\033[.36m", - 'white' : "\033[.37m", + 'black' : Fore.BLACK, + 'red' : Fore.RED, + 'green' : Fore.GREEN, + 'yellow' : Fore.YELLOW, + 'blue' : Fore.BLUE, + 'magenta' : Fore.MAGENTA, + 'cyan' : Fore.CYAN, + 'white' : Fore.WHITE, - 'on_black' : "\033[.40m", - 'on_red' : "\033[.41m", - 'on_green' : "\033[.42m", - 'on_yellow' : "\033[.43m", - 'on_blue' : "\033[.44m", - 'on_magenta' : "\033[.45m", - 'on_cyan' : "\033[46m", - 'on_white' : "\033[47m", + 'on_black' : Back.BLACK, + 'on_red' : Back.RED, + 'on_green' : Back.GREEN, + 'on_yellow' : Back.YELLOW, + 'on_blue' : Back.BLUE, + 'on_magenta' : Back.MAGENTA, + 'on_cyan' : Back.CYAN, + 'on_white' : Back.WHITE, } # Convert a color string from a string into an ascii escape code that will print From cebe292c5e03686fe5d7bd2e4dbd98d9434899dc Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Mon, 11 Jul 2016 10:38:50 -0500 Subject: [PATCH 68/83] [Project.py] Make -i and -m optional Resolves #2135 --- tools/project.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/project.py b/tools/project.py index c58858d79d..cabdfdf7b9 100644 --- a/tools/project.py +++ b/tools/project.py @@ -32,14 +32,12 @@ if __name__ == '__main__': parser.add_argument("-m", "--mcu", metavar="MCU", default='LPC1768', - required=True, type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU")), help="generate project for the given MCU (%s)"% ', '.join(targetnames)) parser.add_argument("-i", dest="ide", default='uvision', - required=True, type=argparse_force_lowercase_type(toolchainlist, "toolchain"), help="The target IDE: %s"% str(toolchainlist)) From 126de5b07a02110bfd5dbfc890db84869769c935 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 22 Jun 2016 00:38:41 -0500 Subject: [PATCH 69/83] Added config option for stdio baud rate --- hal/common/retarget.cpp | 3 +++ mbed_lib.json | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index 9fbc27b784..62c243af26 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -98,6 +98,9 @@ static void init_serial() { #if DEVICE_SERIAL if (stdio_uart_inited) return; serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX); +#if MBED_CONF_CORE_STDIO_BAUD_RATE + serial_baud(&stdio_uart, MBED_CONF_CORE_STDIO_BAUD_RATE); +#endif #endif } diff --git a/mbed_lib.json b/mbed_lib.json index 50cd29aa75..6300a4b0f2 100644 --- a/mbed_lib.json +++ b/mbed_lib.json @@ -4,6 +4,11 @@ "stdio-convert-newlines": { "help": "Enable conversion to standard newlines on stdin/stdout", "value": false + }, + + "stdio-baud-rate": { + "help": "Baud rate for stdio", + "value": 9600 } } } From 0343ad26742b9e444bc438a13c4efee5c9f38fe5 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Mon, 11 Jul 2016 20:34:40 -0500 Subject: [PATCH 70/83] KSDK2 - set ADC mux before taking measurement Set the channel mux before taking a reading rather than on initialization. This allows ADC pins on both mux A and B to be used in the same application. --- .../TARGET_Freescale/TARGET_KSDK2_MCUS/api/analogin_api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/analogin_api.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/analogin_api.c index fd589d0b85..12bdd4f6e2 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/analogin_api.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/api/analogin_api.c @@ -54,9 +54,6 @@ void analogin_init(analogin_t *obj, PinName pin) { ADC16_Init(adc_addrs[instance], &adc16_config); ADC16_EnableHardwareTrigger(adc_addrs[instance], false); ADC16_SetHardwareAverage(adc_addrs[instance], kADC16_HardwareAverageCount4); - ADC16_SetChannelMuxMode(adc_addrs[instance], - obj->adc & (1 << ADC_B_CHANNEL_SHIFT) ? kADC16_ChannelMuxB : kADC16_ChannelMuxA); - pinmap_pinout(pin, PinMap_ADC); } @@ -71,6 +68,9 @@ uint16_t analogin_read_u16(analogin_t *obj) { adc16_channel_config.enableDifferentialConversion = false; #endif + ADC16_SetChannelMuxMode(adc_addrs[instance], + obj->adc & (1 << ADC_B_CHANNEL_SHIFT) ? kADC16_ChannelMuxB : kADC16_ChannelMuxA); + /* * When in software trigger mode, each conversion would be launched once calling the "ADC16_ChannelConfigure()" * function, which works like writing a conversion command and executing it. From a4475a0cf874b45e56d2927555ab59c43400abcf Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Tue, 12 Jul 2016 11:31:58 +0300 Subject: [PATCH 71/83] Use correct mask for CTS flow control --- .../TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c index 7856bd87a3..ad419d6ccd 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/serial_api.c @@ -288,24 +288,24 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi switch(type) { case FlowControlRTS: pinmap_pinout(rxflow, PinMap_UART_RTS); - uart_addrs[obj->index]->MODEM &= ~UART_MODEM_TXRTSE_MASK; + uart_addrs[obj->index]->MODEM &= ~UART_MODEM_TXCTSE_MASK; uart_addrs[obj->index]->MODEM |= UART_MODEM_RXRTSE_MASK; break; case FlowControlCTS: pinmap_pinout(txflow, PinMap_UART_CTS); uart_addrs[obj->index]->MODEM &= ~UART_MODEM_RXRTSE_MASK; - uart_addrs[obj->index]->MODEM |= UART_MODEM_TXRTSE_MASK; + uart_addrs[obj->index]->MODEM |= UART_MODEM_TXCTSE_MASK; break; case FlowControlRTSCTS: pinmap_pinout(rxflow, PinMap_UART_RTS); pinmap_pinout(txflow, PinMap_UART_CTS); - uart_addrs[obj->index]->MODEM |= UART_MODEM_TXRTSE_MASK | UART_MODEM_RXRTSE_MASK; + uart_addrs[obj->index]->MODEM |= UART_MODEM_TXCTSE_MASK | UART_MODEM_RXRTSE_MASK; break; case FlowControlNone: - uart_addrs[obj->index]->MODEM &= ~(UART_MODEM_TXRTSE_MASK | UART_MODEM_RXRTSE_MASK); + uart_addrs[obj->index]->MODEM &= ~(UART_MODEM_TXCTSE_MASK | UART_MODEM_RXRTSE_MASK); break; default: From 50dbce9e74018bf41f93dbd65969f4a49e8335f5 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 12 Jul 2016 12:54:44 +0300 Subject: [PATCH 72/83] Fixes to function caching in targets.py Now funnctions are looked up in the cache using a (function name, arguments) key, which makes it possible to cache different invocations of the functions (with different arguments). Also applied the @cached attribute to get_target. --- tools/targets.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/targets.py b/tools/targets.py index 73a3c0a840..f6a8b8cb39 100644 --- a/tools/targets.py +++ b/tools/targets.py @@ -48,9 +48,9 @@ class HookError(Exception): caches = {} def cached(func): def wrapper(*args, **kwargs): - if not caches.has_key(func): - caches[func] = func(*args, **kwargs) - return caches[func] + if not caches.has_key((func.__name__, args)): + caches[(func.__name__, args)] = func(*args, **kwargs) + return caches[(func.__name__, args)] return wrapper class Target: @@ -58,9 +58,6 @@ class Target: # need to be computed differently than regular attributes __cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features'] - # {target_name: target_instance} map for all the targets in the system - __target_map = {} - # List of targets that were added dynamically using "add_py_targets" (see below) __py_targets = set() @@ -200,10 +197,9 @@ class Target: # Return the target instance starting from the target name @staticmethod + @cached def get_target(name): - if not Target.__target_map.has_key(name): - Target.__target_map[name] = Target(name) - return Target.__target_map[name] + return Target(name) def __init__(self, name): self.name = name From 117b21df8fc0079d53f32e9522c0aeeaf1634975 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Tue, 12 Jul 2016 12:58:53 +0300 Subject: [PATCH 73/83] It's now possible to specify the location of targets.json With this change, it becomes possible to use targets.py with any targets.json, not just the default one in ../hal/targets.json. targets.py will still be initialized with the default targets.json, but the code can then call "set_targets_json_location" to specify the new location of targets.json. set_targets_json_location modifies all the data "in place"; that is, it doesn't create a new TARGET_MAP, TARGET_NAMES or alike, but rather modified the existing ones. This is important, because code using this construct: from tools.targets import TARGET_MAP can work unmodified with this change. --- tools/targets.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/targets.py b/tools/targets.py index f6a8b8cb39..4257da6e08 100644 --- a/tools/targets.py +++ b/tools/targets.py @@ -61,11 +61,21 @@ class Target: # List of targets that were added dynamically using "add_py_targets" (see below) __py_targets = set() + # Location of the 'targets.json' file + __targets_json_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json') + # Load the description of JSON target data @staticmethod @cached def get_json_target_data(): - return json_file_to_dict(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json')) + return json_file_to_dict(Target.__targets_json_location) + + # Set the location of the targets.json file + @staticmethod + def set_targets_json_location(location): + Target.__targets_json_location = location + # Invalidate caches, since the location of the JSON file changed + caches.clear() # Get the members of this module using Python's "inspect" module @staticmethod @@ -410,3 +420,15 @@ def get_target_detect_codes(): for detect_code in target.detect_code: result[detect_code] = target.name return result + +# Sets the location of the JSON file that contains the targets +def set_targets_json_location(location): + # First instruct Target about the new location + Target.set_targets_json_location(location) + # Then re-initialize TARGETS, TARGET_MAP and TARGET_NAMES + # The re-initialization does not create new variables, it keeps the old ones instead + # This ensures compatibility with code that does "from tools.targets import TARGET_NAMES" + TARGETS[:] = [Target.get_target(name) for name, value in Target.get_json_target_data().items() if value.get("public", True)] + TARGET_MAP.clear() + TARGET_MAP.update(dict([(t.name, t) for t in TARGETS])) + TARGET_NAMES[:] = TARGET_MAP.keys() From 9704edfca7f579b0f79489ed275c22d878843b01 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Tue, 12 Jul 2016 14:42:21 +0300 Subject: [PATCH 74/83] Fix add_py_targets and tests Previously, add_py_targets assumed that it is not an error to add an existing target if that target was previously added using add_py_targets. This was done to aid testing, but it was weird, error prone and broke with the latest changes to the caching mechanism. With this commit: - it is always an error to add a target that was previously added, which is much more consistent. - tests for the configuration mechanism use the newly added 'set_targets_json_location' function to clear the internal caches in targets.py (and thus all previously added custom targets). As a side effect, this commit also tests the 'set_targets_json_location' function itself. --- tools/targets.py | 32 ++++++--------------------- tools/test/config_test/config_test.py | 3 +++ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/tools/targets.py b/tools/targets.py index 4257da6e08..3d4a3b380c 100644 --- a/tools/targets.py +++ b/tools/targets.py @@ -58,9 +58,6 @@ class Target: # need to be computed differently than regular attributes __cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features'] - # List of targets that were added dynamically using "add_py_targets" (see below) - __py_targets = set() - # Location of the 'targets.json' file __targets_json_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'hal', 'targets.json') @@ -175,35 +172,20 @@ class Target: return v # Add one or more new target(s) represented as a Python dictionary in 'new_targets' - # It it an error to add a target with a name that exists in "targets.json" - # However, it is OK to add a target that was previously added via "add_py_targets" - # (this makes testing easier without changing the regular semantics) + # It is an error to add a target with a name that already exists. @staticmethod def add_py_targets(new_targets): crt_data = Target.get_json_target_data() - # First add all elemnts to the internal dictionary for tk, tv in new_targets.items(): - if crt_data.has_key(tk) and (not tk in Target.__py_targets): + if crt_data.has_key(tk): raise Exception("Attempt to add target '%s' that already exists" % tk) + # Add target data to the internal target dictionary crt_data[tk] = tv - Target.__py_targets.add(tk) - # Then create the new instances and update global variables if needed - for tk, tv in new_targets.items(): - # Is the target already created? - old_target = Target.__target_map.get(tk, None) - # Instantiate this target. If it is public, update the data in - # in TARGETS, TARGET_MAP, TARGET_NAMES + # Create the new target and add it to the relevant data structures new_target = Target(tk) - if tv.get("public", True): - if old_target: # remove the old target from TARGETS and TARGET_NAMES - TARGETS.remove(old_target) - TARGET_NAMES.remove(tk) - # Add the new target - TARGETS.append(new_target) - TARGET_MAP[tk] = new_target - TARGET_NAMES.append(tk) - # Update the target cache - Target.__target_map[tk] = new_target + TARGETS.append(new_target) + TARGET_MAP[tk] = new_target + TARGET_NAMES.append(tk) # Return the target instance starting from the target name @staticmethod diff --git a/tools/test/config_test/config_test.py b/tools/test/config_test/config_test.py index 59c2b50c98..d9f692e5bf 100644 --- a/tools/test/config_test/config_test.py +++ b/tools/test/config_test/config_test.py @@ -16,6 +16,7 @@ limitations under the License. """ from tools.build_api import get_config +from tools.targets import set_targets_json_location, Target from tools.config import ConfigException, Config import os, sys @@ -43,6 +44,8 @@ def test_tree(full_name, name): sys.stdout.flush() err_msg = None try: + # Use 'set_targets_json_location' to remove the previous custom targets from the target list + set_targets_json_location(Target._Target__targets_json_location) cfg, macros, features = get_config(full_name, target, "GCC_ARM") macros = Config.config_macros_to_macros(macros) except ConfigException as e: From 33dd3fe8ad0795147d978589aefec7bd57ced974 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Tue, 12 Jul 2016 17:14:59 +0300 Subject: [PATCH 75/83] More verrbose errors for JSON parsing This commit adds information about the location of problematic JSON files when reporting a JSON parsing error. Before this commit: ``` [ERROR] Expecting property name: line 7 column 9 (char 188) ``` After this commit: ``` Error parsing 'core/mbed_lib.json': [ERROR] Expecting property name: line 7 column 9 (char 188) ``` --- tools/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index 5c64c41e65..8c33e36d4e 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -196,8 +196,12 @@ def dict_to_ascii(input): # Read a JSON file and return its Python representation, transforming all the strings from Unicode # to ASCII. The order of keys in the JSON file is preserved. def json_file_to_dict(fname): - with open(fname, "rt") as f: - return dict_to_ascii(json.load(f, object_pairs_hook=OrderedDict)) + try: + with open(fname, "rt") as f: + return dict_to_ascii(json.load(f, object_pairs_hook=OrderedDict)) + except (ValueError, IOError): + sys.stderr.write("Error parsing '%s':\n" % fname) + raise # Wowza, double closure def argparse_type(casedness, prefer_hyphen=False) : From bba13ddad2bf1e587a38688b1e93d09e48aa1c98 Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Wed, 13 Jul 2016 11:25:01 +0100 Subject: [PATCH 76/83] Replace in memap CSV report fields Changes: * This change impacts #2047 * In code summary columns were shortened and names changed a bit, see [here](https://github.com/mbedmicro/mbed/pull/2047/files?w=1#diff-f9cb941bde5647a5763e18fc220efc51R410) * There is a need to allign memap CSV report fields (summary columns) with what is in code now. This discrapency may create problems when generating reports in the future. All columns should have the same name. * memap CSV sumamry fields names changes: 'total_static_ram' -> 'static_ram' 'allocated_heap' -> 'heap' 'allocated_stack' -> 'stack' See example of discrepancy: 'total_static_ram' vs 'static_ram' 'allocated_heap' vs 'heap' 'allocated_stack' vs 'stack' What is in code and presented with prettytable: +----------------------------------------+--------+-----------+------------+-------+-------+-----------+-------------+ | name | target | toolchain | static_ram | stack | heap | total_ram | total_flash | +----------------------------------------+--------+-----------+------------+-------+-------+-----------+-------------+ | tests-mbed_drivers-c_strings | K64F | GCC_ARM | 11468 | 32768 | 65540 | 109776 | 74182 | | tests-mbed_drivers-callback | K64F | GCC_ARM | 11980 | 32768 | 65540 | 110288 | 88406 | | tests-mbedmicro-rtos-mbed-threads | K64F | GCC_ARM | 11468 | 32768 | 65540 | 109776 | 75918 | | tests-mbedmicro-rtos-mbed-timer | K64F | GCC_ARM | 10788 | 32768 | 65540 | 109096 | 68534 | +----------------------------------------+--------+-----------+------------+-------+-------+-----------+-------------+ vs CSV: ``` total_static_ram,allocated_heap,allocated_stack,total_ram,total_flash 10788,65540,32768,109096,67486 ``` vs memstats_map.JSON: ```json [ { "module": "Fill", "size": { ".data": 4, ".bss": 2257, ".text": 173 } }, { "summary": { "total_flash": 67486, "allocated_stack": 32768, "total_static_ram": 10788, "total_ram": 109096, "allocated_heap": 65540 } } ] ``` --- tools/memap.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/memap.py b/tools/memap.py index 94d378024f..0186d24c4d 100644 --- a/tools/memap.py +++ b/tools/memap.py @@ -436,16 +436,16 @@ class MemapParser(object): csv_module_section += [i+k] csv_sizes += [self.modules[i][k]] - csv_module_section += ['total_static_ram'] + csv_module_section += ['static_ram'] csv_sizes += [subtotal['.data']+subtotal['.bss']] - csv_module_section += ['allocated_heap'] + csv_module_section += ['heap'] if subtotal['.heap'] == 0: csv_sizes += ['unknown'] else: csv_sizes += [subtotal['.heap']] - csv_module_section += ['allocated_stack'] + csv_module_section += ['stack'] if subtotal['.stack'] == 0: csv_sizes += ['unknown'] else: From a68eadd7cc07efabdd6f6cf9b9c64e6fc88ce90a Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 13 Jul 2016 18:08:39 +0300 Subject: [PATCH 77/83] Document the .mbedignore file --- docs/ignoring_files_from_build.md | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/ignoring_files_from_build.md diff --git a/docs/ignoring_files_from_build.md b/docs/ignoring_files_from_build.md new file mode 100644 index 0000000000..478a2a6bf1 --- /dev/null +++ b/docs/ignoring_files_from_build.md @@ -0,0 +1,49 @@ +# Ignoring files from mbed build + +The `.mbedignore` file allows you to ignore files and directories from being processed by `mbed build` command. + +## Usage +You can place the `.mbedignore` file in any directory where `mbed build` command is going to search for source files. + +The most convenient place is the root directory of the library or application. However, this is not a requirement. + +Avoid defining rules that would cross the library boundaries as those would lead to side effects or build problems that are hard to find. + +## Syntax + +Each line in the `.mbedignore` file is a file pattern used for matching files. Each matched file or directory is ignored from build. + +The following wildcards are accepted: + +|Pattern | Meaning| +|--------|--------| +| `*` | Matches everything. | +| `?` | Matches any single character. | +| `[seq]` | Matches any character in seq. | +| `[!seq]` | Matches any character not in seq. | + +File is parsed with Python's [fnmatch](https://docs.python.org/2/library/fnmatch.html) functionality so the syntax follows basic shell patterns with the following exceptions: + +1. Each line is internally prefixed with the path of the `.mbedignore` file. +2. Line cannot start with `.` or `/` (because of rule 1) + +Globbing functionality is not used, so you cannot recursively match specific file pattern. You need to define rule per directory in that case. + +Relative paths can be used, so you can match files deeper in the build tree. However, avoid crossing library boundaries. + +### Example +A file located in `source/obsolete/.mbedignore` with following content: + +``` +*.c +*.h +second_level/*.c +``` + +After applying the rule 1, actual patterns used internally for matching the source files are: + +``` +source/obsolete/*.c +source/obsolete/*.h +source/obsolete/second_level/*.c +``` From 24fcb4700bbd9330cf76df57c7f062f8b020a643 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 14 Jul 2016 13:14:37 -0500 Subject: [PATCH 78/83] [tools-build.py]Enforce supported toolchains by skipping unsupported combinations --- tools/build.py | 92 ++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/tools/build.py b/tools/build.py index 90236040c7..2c5a6b98ce 100644 --- a/tools/build.py +++ b/tools/build.py @@ -231,52 +231,54 @@ if __name__ == '__main__': for toolchain in toolchains: for target in targets: tt_id = "%s::%s" % (toolchain, target) - try: - mcu = TARGET_MAP[target] - if options.source_dir: - lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain, - options=options.options, - extra_verbose=options.extra_verbose_notify, - notify=notify, - verbose=options.verbose, - silent=options.silent, - jobs=options.jobs, - clean=options.clean, - archive=(not options.no_archive), - macros=options.macros, - name=options.artifact_name) - else: - lib_build_res = build_mbed_libs(mcu, toolchain, - options=options.options, - extra_verbose=options.extra_verbose_notify, - notify=notify, - verbose=options.verbose, - silent=options.silent, - jobs=options.jobs, - clean=options.clean, - macros=options.macros) + if toolchain not in TARGET_MAP[target].supported_toolchains: + # Log this later + print "%s skipped: toolchain not supported" % tt_id + skipped.append(tt_id) + else: + try: + mcu = TARGET_MAP[target] + if options.source_dir: + lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain, + options=options.options, + extra_verbose=options.extra_verbose_notify, + verbose=options.verbose, + silent=options.silent, + jobs=options.jobs, + clean=options.clean, + archive=(not options.no_archive), + macros=options.macros, + name=options.artifact_name) + else: + lib_build_res = build_mbed_libs(mcu, toolchain, + options=options.options, + extra_verbose=options.extra_verbose_notify, + verbose=options.verbose, + silent=options.silent, + jobs=options.jobs, + clean=options.clean, + macros=options.macros) - for lib_id in libraries: - build_lib(lib_id, mcu, toolchain, - options=options.options, - extra_verbose=options.extra_verbose_notify, - notify=notify, - verbose=options.verbose, - silent=options.silent, - clean=options.clean, - macros=options.macros, - jobs=options.jobs) - if lib_build_res: - successes.append(tt_id) - else: - skipped.append(tt_id) - except Exception, e: - if options.verbose: - import traceback - traceback.print_exc(file=sys.stdout) - sys.exit(1) - failures.append(tt_id) - print e + for lib_id in libraries: + build_lib(lib_id, mcu, toolchain, + options=options.options, + extra_verbose=options.extra_verbose_notify, + verbose=options.verbose, + silent=options.silent, + clean=options.clean, + macros=options.macros, + jobs=options.jobs) + if lib_build_res: + successes.append(tt_id) + else: + skipped.append(tt_id) + except Exception, e: + if options.verbose: + import traceback + traceback.print_exc(file=sys.stdout) + sys.exit(1) + failures.append(tt_id) + print e # Write summary of the builds print From 6aa2bbb801de4f528a652552d2959328ce195f40 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 14 Jul 2016 13:54:23 -0500 Subject: [PATCH 79/83] [tools/build_api] Retrun truthy value on success from build_* before: ``` $ python tools/build.py -m NRF51_DK --source . -t GCC_ARM,ARM --build build --silent [SNIP] Completed in: (3.39)s Build skipped: * GCC_ARM::NRF51_DK * ARM::NRF51_DK ``` after: ``` $ python tools/build.py -m NRF51_DK --source . -t GCC_ARM,ARM --build build --silent [SNIP] Completed in: (3.43)s Build successes: * GCC_ARM::NRF51_DK * ARM::NRF51_DK ``` --- tools/build_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/build_api.py b/tools/build_api.py index f9700e86ee..041b6b90b6 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -396,6 +396,7 @@ def build_library(src_paths, build_path, target, toolchain_name, cur_result["result"] = "OK" add_result_to_report(report, cur_result) + return True except Exception, e: if report != None: @@ -540,6 +541,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean cur_result["result"] = "OK" add_result_to_report(report, cur_result) + return True except Exception, e: if report != None: From f95265f38d994c9038141bf738675dc23b22145d Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Fri, 15 Jul 2016 13:37:50 +0100 Subject: [PATCH 80/83] Exporters - progen TARGETS lazy evaluated To speed up project.py, use @property for TARGETS. When exporters are used, it would ask progen for all targets support (number of tools x number of targets), this takes a lot of time, thus lazily evaluated, and TARGETS are for backaward compatibility, not currently used by project.py but by other scripts to check if a target is supported. Profiling: ``` python tools\project.py -m K64F -i uvision -n MBED_10 -b Before the change: 1 0.000 0.000 0.010 0.010 definitions.py:113(get_tool_definition) 824 0.004 0.000 2.990 0.004 definitions.py:124(is_supported) 1 0.000 0.000 0.000 0.000 definitions.py:145(get_debugger) 1 0.002 0.002 0.044 0.044 definitions.py:15() 384 0.002 0.000 2.986 0.008 definitions.py:26(_load_record) 1 0.000 0.000 0.000 0.000 definitions.py:32(ProGenMcus) 992 0.055 0.000 1.959 0.002 definitions.py:34(__init__) 1376 0.002 0.000 0.003 0.000 definitions.py:40(get_mcus) 384 0.001 0.000 1.070 0.003 definitions.py:43(get_mcu_record) 1 0.000 0.000 0.000 0.000 definitions.py:50(ProGenTargets) 992 0.000 0.000 0.000 0.000 definitions.py:52(__init__) 1196 0.002 0.000 0.004 0.000 definitions.py:55(get_targets) 204 0.001 0.000 1.922 0.009 definitions.py:58(get_mcu_record) 1 0.000 0.000 0.000 0.000 definitions.py:67(get_debugger) 1 0.000 0.000 0.000 0.000 definitions.py:74(ProGenDef) 992 0.008 0.000 1.973 0.002 definitions.py:83(__init__) Days : 0 Hours : 0 Minutes : 0 Seconds : 4 Milliseconds : 723 Ticks : 47237302 TotalDays : 5.46728032407407E-05 TotalHours : 0.00131214727777778 TotalMinutes : 0.0787288366666667 TotalSeconds : 4.7237302 TotalMilliseconds : 4723.7302 After the change: 1 0.000 0.000 0.010 0.010 definitions.py:113(get_tool_definition) 2 0.000 0.000 0.025 0.012 definitions.py:124(is_supported) 1 0.000 0.000 0.000 0.000 definitions.py:145(get_debugger) 1 0.002 0.002 0.042 0.042 definitions.py:15() 3 0.000 0.000 0.035 0.012 definitions.py:26(_load_record) 1 0.000 0.000 0.000 0.000 definitions.py:32(ProGenMcus) 2 0.000 0.000 0.005 0.002 definitions.py:34(__init__) 5 0.000 0.000 0.000 0.000 definitions.py:40(get_mcus) 3 0.000 0.000 0.000 0.000 definitions.py:43(get_mcu_record) 1 0.000 0.000 0.000 0.000 definitions.py:50(ProGenTargets) 2 0.000 0.000 0.000 0.000 definitions.py:52(__init__) 5 0.000 0.000 0.000 0.000 definitions.py:55(get_targets) 3 0.000 0.000 0.035 0.012 definitions.py:58(get_mcu_record) 1 0.000 0.000 0.000 0.000 definitions.py:67(get_debugger) 1 0.000 0.000 0.000 0.000 definitions.py:74(ProGenDef) 2 0.000 0.000 0.005 0.003 definitions.py:83(__init__) Days : 0 Hours : 0 Minutes : 0 Seconds : 1 Milliseconds : 178 Ticks : 11780618 TotalDays : 1.3634974537037E-05 TotalHours : 0.000327239388888889 TotalMinutes : 0.0196343633333333 TotalSeconds : 1.1780618 TotalMilliseconds : 1178.0618 ``` --- tools/export/iar.py | 23 +++++++++++++---------- tools/export/uvision4.py | 23 +++++++++++++---------- tools/export/uvision5.py | 25 ++++++++++++++++--------- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/tools/export/iar.py b/tools/export/iar.py index 16a626a9ba..4393867ed7 100644 --- a/tools/export/iar.py +++ b/tools/export/iar.py @@ -35,16 +35,19 @@ class IAREmbeddedWorkbench(Exporter): MBED_CONFIG_HEADER_SUPPORTED = True - # backward compatibility with our scripts - TARGETS = [] - for target in TARGET_NAMES: - try: - if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or - ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])): - TARGETS.append(target) - except AttributeError: - # target is not supported yet - continue + @property + def TARGETS(self): + if not hasattr(self, "_targets_supported"): + self._targets_supported = [] + for target in TARGET_NAMES: + try: + if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or + ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])): + self._targets_supported.append(target) + except AttributeError: + # target is not supported yet + continue + return self._targets_supported def generate(self): """ Generates the project files """ diff --git a/tools/export/uvision4.py b/tools/export/uvision4.py index 17c62f2903..a4f684e832 100644 --- a/tools/export/uvision4.py +++ b/tools/export/uvision4.py @@ -36,16 +36,19 @@ class Uvision4(Exporter): MBED_CONFIG_HEADER_SUPPORTED = True - # backward compatibility with our scripts - TARGETS = [] - for target in TARGET_NAMES: - try: - if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or - ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])): - TARGETS.append(target) - except AttributeError: - # target is not supported yet - continue + @property + def TARGETS(self): + if not hasattr(self, "_targets_supported"): + self._targets_supported = [] + for target in TARGET_NAMES: + try: + if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or + ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])): + self._targets_supported.append(target) + except AttributeError: + # target is not supported yet + continue + return self._targets_supported def get_toolchain(self): return TARGET_MAP[self.target].default_toolchain diff --git a/tools/export/uvision5.py b/tools/export/uvision5.py index 50ebf91906..3be797f0e3 100644 --- a/tools/export/uvision5.py +++ b/tools/export/uvision5.py @@ -37,15 +37,22 @@ class Uvision5(Exporter): MBED_CONFIG_HEADER_SUPPORTED = True # backward compatibility with our scripts - TARGETS = [] - for target in TARGET_NAMES: - try: - if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or - ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])): - TARGETS.append(target) - except AttributeError: - # target is not supported yet - continue + def __init__(self): + self._targets = [] + + @property + def TARGETS(self): + if not hasattr(self, "_targets_supported"): + self._targets_supported = [] + for target in TARGET_NAMES: + try: + if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or + ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])): + self._targets_supported.append(target) + except AttributeError: + # target is not supported yet + continue + return self._targets_supported def get_toolchain(self): return TARGET_MAP[self.target].default_toolchain From 59e2f9621c2f89725e3ad3ce151bbc79baa5937d Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Fri, 15 Jul 2016 11:10:38 -0500 Subject: [PATCH 81/83] Suppress warnings about deprecated __ldrex/strex Suppress warnings about ARMCC warnings about the __ldrex and __strex intrinsics to match CMSIS 5. --- rtos/rtx/TARGET_CORTEX_A/rt_HAL_CA.h | 5 +++++ rtos/rtx/TARGET_CORTEX_A/rt_HAL_CM.h | 5 +++++ rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CA.h b/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CA.h index a1f41223f6..834258f216 100644 --- a/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CA.h +++ b/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CA.h @@ -60,6 +60,11 @@ #undef __USE_EXCLUSIVE_ACCESS #endif +/* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */ +#ifdef __USE_EXCLUSIVE_ACCESS +#pragma diag_suppress 3731 +#endif + #elif defined (__GNUC__) /* GNU Compiler */ #undef __USE_EXCLUSIVE_ACCESS diff --git a/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CM.h b/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CM.h index 2c989928ff..d9e5aa0f92 100644 --- a/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CM.h +++ b/rtos/rtx/TARGET_CORTEX_A/rt_HAL_CM.h @@ -46,6 +46,11 @@ #undef __USE_EXCLUSIVE_ACCESS #endif +/* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */ +#ifdef __USE_EXCLUSIVE_ACCESS +#pragma diag_suppress 3731 +#endif + #elif defined (__GNUC__) /* GNU Compiler */ #undef __USE_EXCLUSIVE_ACCESS diff --git a/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h b/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h index c43a51b6af..29f8c84554 100644 --- a/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h +++ b/rtos/rtx/TARGET_CORTEX_M/rt_HAL_CM.h @@ -47,6 +47,11 @@ #undef __USE_EXCLUSIVE_ACCESS #endif +/* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */ +#ifdef __USE_EXCLUSIVE_ACCESS +#pragma diag_suppress 3731 +#endif + #ifndef __CMSIS_GENERIC #define __DMB() do {\ __schedule_barrier();\ From b969fa5bb12077cee3103324d54e2da4e165883f Mon Sep 17 00:00:00 2001 From: Sarah Marsh Date: Fri, 15 Jul 2016 11:14:21 -0500 Subject: [PATCH 82/83] IDE build tests with progen --- requirements.txt | 2 +- tools/export/__init__.py | 31 ++++-- tools/export/exporters.py | 9 +- tools/export/iar.py | 7 +- tools/export/uvision4.py | 7 +- tools/export/uvision5.py | 7 +- tools/project.py | 66 ++----------- tools/project_api.py | 111 +++++++++++++++++++++ tools/test/export/build_test.py | 169 ++++++++++++++++++++++++++++++++ 9 files changed, 336 insertions(+), 73 deletions(-) create mode 100644 tools/project_api.py create mode 100644 tools/test/export/build_test.py diff --git a/requirements.txt b/requirements.txt index 53efae0aef..fcec27e282 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ PySerial>=2.7 PrettyTable>=0.7.2 Jinja2>=2.7.3 IntelHex>=1.3 -project-generator>=0.9.3,<0.10.0 +project-generator>=0.9.7,<0.10.0 project_generator_definitions>=0.2.26,<0.3.0 junit-xml pyYAML diff --git a/tools/export/__init__.py b/tools/export/__init__.py index e766bd2708..8ae7c69070 100644 --- a/tools/export/__init__.py +++ b/tools/export/__init__.py @@ -21,7 +21,7 @@ import yaml from tools.utils import mkdir from tools.export import uvision4, uvision5, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32, e2studio -from tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException +from tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException, FailedBuildException from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP from project_generator_definitions.definitions import ProGenDef @@ -58,7 +58,8 @@ def online_build_url_resolver(url): def export(project_path, project_name, ide, target, destination='/tmp/', - tempdir=None, clean=True, extra_symbols=None, make_zip=True, sources_relative=False, build_url_resolver=online_build_url_resolver): + tempdir=None, pgen_build = False, clean=True, extra_symbols=None, make_zip=True, sources_relative=False, + build_url_resolver=online_build_url_resolver, progen_build=False): # Convention: we are using capitals for toolchain and target names if target is not None: target = target.upper() @@ -68,8 +69,8 @@ def export(project_path, project_name, ide, target, destination='/tmp/', use_progen = False supported = True - report = {'success': False, 'errormsg':''} - + report = {'success': False, 'errormsg':'', 'skip': False} + if ide is None or ide == "zip": # Simple ZIP exporter try: @@ -83,6 +84,7 @@ def export(project_path, project_name, ide, target, destination='/tmp/', else: if ide not in EXPORTERS: report['errormsg'] = ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN % (target, ide) + report['skip'] = True else: Exporter = EXPORTERS[ide] target = EXPORT_MAP.get(target, target) @@ -91,24 +93,35 @@ def export(project_path, project_name, ide, target, destination='/tmp/', use_progen = True except AttributeError: pass + + if target not in Exporter.TARGETS or Exporter.TOOLCHAIN not in TARGET_MAP[target].supported_toolchains: + supported = False + if use_progen: if not ProGenDef(ide).is_supported(TARGET_MAP[target].progen['target']): supported = False - else: - if target not in Exporter.TARGETS: - supported = False if supported: # target checked, export try: exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols, sources_relative=sources_relative) exporter.scan_and_copy_resources(project_path, tempdir, sources_relative) - exporter.generate() - report['success'] = True + if progen_build: + #try to build with pgen ide builders + try: + exporter.generate(progen_build=True) + report['success'] = True + except FailedBuildException, f: + report['errormsg'] = "Build Failed" + else: + exporter.generate() + report['success'] = True except OldLibrariesException, e: report['errormsg'] = ERROR_MESSAGE_NOT_EXPORT_LIBS + else: report['errormsg'] = ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN % (target, ide) + report['skip'] = True zip_path = None if report['success']: diff --git a/tools/export/exporters.py b/tools/export/exporters.py index deb8926ddd..2273bf0482 100644 --- a/tools/export/exporters.py +++ b/tools/export/exporters.py @@ -21,6 +21,8 @@ from tools.config import Config class OldLibrariesException(Exception): pass +class FailedBuildException(Exception) : pass + class Exporter(object): TEMPLATE_DIR = dirname(__file__) DOT_IN_RELATIVE_PATH = False @@ -107,7 +109,7 @@ class Exporter(object): } return project_data - def progen_gen_file(self, tool_name, project_data): + def progen_gen_file(self, tool_name, project_data, progen_build=False): """ Generate project using ProGen Project API """ settings = ProjectSettings() project = Project(self.program_name, [project_data], settings) @@ -115,6 +117,11 @@ class Exporter(object): # thinks it is not dict but a file, and adds them to workspace. project.project['common']['include_paths'] = self.resources.inc_dirs project.generate(tool_name, copied=not self.sources_relative) + if progen_build: + print("Project exported, building...") + result = project.build(tool_name) + if result == -1: + raise FailedBuildException("Build Failed") def __scan_all(self, path): resources = [] diff --git a/tools/export/iar.py b/tools/export/iar.py index 16a626a9ba..f9f18d4199 100644 --- a/tools/export/iar.py +++ b/tools/export/iar.py @@ -46,7 +46,7 @@ class IAREmbeddedWorkbench(Exporter): # target is not supported yet continue - def generate(self): + def generate(self, progen_build=False): """ Generates the project files """ project_data = self.progen_get_project_data() tool_specific = {} @@ -75,7 +75,10 @@ class IAREmbeddedWorkbench(Exporter): # VLA is enabled via template IccAllowVLA project_data['tool_specific']['iar']['misc']['c_flags'].remove("--vla") project_data['common']['build_dir'] = os.path.join(project_data['common']['build_dir'], 'iar_arm') - self.progen_gen_file('iar_arm', project_data) + if progen_build: + self.progen_gen_file('iar_arm', project_data, True) + else: + self.progen_gen_file('iar_arm', project_data) # Currently not used, we should reuse folder_name to create virtual folders class IarFolder(): diff --git a/tools/export/uvision4.py b/tools/export/uvision4.py index 17c62f2903..94dc3a8ff4 100644 --- a/tools/export/uvision4.py +++ b/tools/export/uvision4.py @@ -50,7 +50,7 @@ class Uvision4(Exporter): def get_toolchain(self): return TARGET_MAP[self.target].default_toolchain - def generate(self): + def generate(self, progen_build=False): """ Generates the project files """ project_data = self.progen_get_project_data() tool_specific = {} @@ -96,4 +96,7 @@ class Uvision4(Exporter): i += 1 project_data['common']['macros'].append('__ASSERT_MSG') project_data['common']['build_dir'] = join(project_data['common']['build_dir'], 'uvision4') - self.progen_gen_file('uvision', project_data) + if progen_build: + self.progen_gen_file('uvision', project_data, True) + else: + self.progen_gen_file('uvision', project_data) diff --git a/tools/export/uvision5.py b/tools/export/uvision5.py index 50ebf91906..4e789712d0 100644 --- a/tools/export/uvision5.py +++ b/tools/export/uvision5.py @@ -50,7 +50,7 @@ class Uvision5(Exporter): def get_toolchain(self): return TARGET_MAP[self.target].default_toolchain - def generate(self): + def generate(self, progen_build=False): """ Generates the project files """ project_data = self.progen_get_project_data() tool_specific = {} @@ -95,4 +95,7 @@ class Uvision5(Exporter): project_data['common']['macros'].pop(i) i += 1 project_data['common']['macros'].append('__ASSERT_MSG') - self.progen_gen_file('uvision5', project_data) + if progen_build: + self.progen_gen_file('uvision5', project_data, True) + else: + self.progen_gen_file('uvision5', project_data) diff --git a/tools/project.py b/tools/project.py index cabdfdf7b9..96f86d2f64 100644 --- a/tools/project.py +++ b/tools/project.py @@ -7,16 +7,14 @@ from shutil import move, rmtree from argparse import ArgumentParser from os import path -from tools.paths import EXPORT_DIR, EXPORT_WORKSPACE, EXPORT_TMP -from tools.paths import MBED_BASE, MBED_LIBRARIES -from tools.export import export, setup_user_prj, EXPORTERS, mcu_ide_matrix -from tools.utils import args_error, mkdir -from tools.tests import TESTS, Test, TEST_MAP +from tools.paths import EXPORT_DIR +from tools.export import export, EXPORTERS, mcu_ide_matrix +from tools.tests import TESTS, TEST_MAP from tools.tests import test_known, test_name_known from tools.targets import TARGET_NAMES -from tools.libraries import LIBRARIES -from utils import argparse_lowercase_type, argparse_uppercase_type, argparse_filestring_type, argparse_many +from utils import argparse_filestring_type, argparse_many from utils import argparse_force_lowercase_type, argparse_force_uppercase_type +from project_api import setup_project, perform_export, print_results, get_lib_symbols @@ -129,8 +127,6 @@ if __name__ == '__main__': # Export results successes = [] failures = [] - zip = True - clean = True # source_dir = use relative paths, otherwise sources are copied sources_relative = True if options.source_dir else False @@ -138,47 +134,13 @@ if __name__ == '__main__': for mcu in options.mcu: # Program Number or name p, src, ide = options.program, options.source_dir, options.ide + project_dir, project_name, project_temp = setup_project(mcu, ide, p, src, options.build) - if src: - # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file - project_dir = options.source_dir - project_name = TESTS[p] if p else "Unnamed_project" - project_temp = path.join(options.source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu)) - mkdir(project_temp) - lib_symbols = [] - if options.macros: - lib_symbols += options.macros - zip = False # don't create zip - clean = False # don't cleanup because we use the actual source tree to generate IDE files - else: - test = Test(p) - - # Some libraries have extra macros (called by exporter symbols) to we need to pass - # them to maintain compilation macros integrity between compiled library and - # header files we might use with it - lib_symbols = [] - if options.macros: - lib_symbols += options.macros - for lib in LIBRARIES: - if lib['build_dir'] in test.dependencies: - lib_macros = lib.get('macros', None) - if lib_macros is not None: - lib_symbols.extend(lib_macros) - - if not options.build: - # Substitute the library builds with the sources - # TODO: Substitute also the other library build paths - if MBED_LIBRARIES in test.dependencies: - test.dependencies.remove(MBED_LIBRARIES) - test.dependencies.append(MBED_BASE) - - # Build the project with the same directory structure of the mbed online IDE - project_name = test.id - project_dir = [join(EXPORT_WORKSPACE, project_name)] - project_temp = EXPORT_TMP - setup_user_prj(project_dir[0], test.source_dir, test.dependencies) + zip = src is [] # create zip when no src_dir provided + clean = src is [] # don't clean when source is provided, use acrual source tree for IDE files # Export to selected toolchain + lib_symbols = get_lib_symbols(options.macros, src, p) tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative) if report['success']: if not zip: @@ -191,12 +153,4 @@ if __name__ == '__main__': failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) # Prints export results - print - if len(successes) > 0: - print "Successful exports:" - for success in successes: - print " * %s"% success - if len(failures) > 0: - print "Failed exports:" - for failure in failures: - print " * %s"% failure + print_results(successes, failures) diff --git a/tools/project_api.py b/tools/project_api.py new file mode 100644 index 0000000000..f0bfb04795 --- /dev/null +++ b/tools/project_api.py @@ -0,0 +1,111 @@ +import sys +from os.path import join, abspath, dirname, exists, basename +ROOT = abspath(join(dirname(__file__), "..")) +sys.path.insert(0, ROOT) + +from tools.paths import EXPORT_WORKSPACE, EXPORT_TMP +from tools.paths import MBED_BASE, MBED_LIBRARIES +from tools.export import export, setup_user_prj +from tools.utils import mkdir +from tools.tests import Test, TEST_MAP, TESTS +from tools.libraries import LIBRARIES + +try: + import tools.private_settings as ps +except: + ps = object() + + +def get_program(n): + p = TEST_MAP[n].n + return p + + +def get_test(p): + return Test(p) + + +def get_test_from_name(n): + if not n in TEST_MAP.keys(): + # Check if there is an alias for this in private_settings.py + if getattr(ps, "test_alias", None) is not None: + alias = ps.test_alias.get(n, "") + if not alias in TEST_MAP.keys(): + return None + else: + n = alias + else: + return None + return get_program(n) + + +def get_lib_symbols(macros, src, program): + # Some libraries have extra macros (called by exporter symbols) to we need to pass + # them to maintain compilation macros integrity between compiled library and + # header files we might use with it + lib_symbols = [] + if macros: + lib_symbols += macros + if src: + return lib_symbols + test = get_test(program) + for lib in LIBRARIES: + if lib['build_dir'] in test.dependencies: + lib_macros = lib.get('macros', None) + if lib_macros is not None: + lib_symbols.extend(lib_macros) + + +def setup_project(mcu, ide, program=None, source_dir=None, build=None): + + # Some libraries have extra macros (called by exporter symbols) to we need to pass + # them to maintain compilation macros integrity between compiled library and + # header files we might use with it + if source_dir: + # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file + project_dir = source_dir + project_name = TESTS[program] if program else "Unnamed_Project" + project_temp = join(source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu)) + mkdir(project_temp) + else: + test = get_test(program) + if not build: + # Substitute the library builds with the sources + # TODO: Substitute also the other library build paths + if MBED_LIBRARIES in test.dependencies: + test.dependencies.remove(MBED_LIBRARIES) + test.dependencies.append(MBED_BASE) + + # Build the project with the same directory structure of the mbed online IDE + project_name = test.id + project_dir = [join(EXPORT_WORKSPACE, project_name)] + project_temp = EXPORT_TMP + setup_user_prj(project_dir[0], test.source_dir, test.dependencies) + + return project_dir, project_name, project_temp + + +def perform_export(dir, name, ide, mcu, temp, clean=False, zip=False, lib_symbols='', + sources_relative=False, progen_build=False): + + tmp_path, report = export(dir, name, ide, mcu, dir[0], temp, clean=clean, + make_zip=zip, extra_symbols=lib_symbols, sources_relative=sources_relative, + progen_build=progen_build) + return tmp_path, report + + +def print_results(successes, failures, skips = []): + print + if len(successes) > 0: + print "Successful: " + for success in successes: + print " * %s" % success + if len(failures) > 0: + print "Failed: " + for failure in failures: + print " * %s" % failure + if len(skips) > 0: + print "Skipped: " + for skip in skips: + print " * %s" % skip + diff --git a/tools/test/export/build_test.py b/tools/test/export/build_test.py new file mode 100644 index 0000000000..ec80fcfd00 --- /dev/null +++ b/tools/test/export/build_test.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python +""" +mbed SDK +Copyright (c) 2011-2013 ARM Limited + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + + +import sys +import argparse +import os +import shutil +from os.path import join, abspath, dirname, exists, basename +r=dirname(__file__) +ROOT = abspath(join(r, "..","..","..")) +sys.path.insert(0, ROOT) + +from tools.export import EXPORTERS +from tools.targets import TARGET_NAMES, TARGET_MAP +from tools.project_api import setup_project, perform_export, print_results, get_test_from_name, get_lib_symbols +from project_generator_definitions.definitions import ProGenDef +from tools.utils import args_error + + +class ProgenBuildTest(): + def __init__(self, desired_ides, targets): + #map of targets and the ides that can build programs for them + self.target_ides = {} + for target in targets: + self.target_ides[target] =[] + for ide in desired_ides: + if target in EXPORTERS[ide].TARGETS: + #target is supported by ide + self.target_ides[target].append(ide) + if len(self.target_ides[target]) == 0: + del self.target_ides[target] + + + @staticmethod + def get_pgen_targets(ides): + #targets supported by pgen and desired ides for tests + targs = [] + for ide in ides: + for target in TARGET_NAMES: + if target not in targs and hasattr(TARGET_MAP[target],'progen') \ + and ProGenDef(ide).is_supported(TARGET_MAP[target].progen['target']): + targs.append(target) + return targs + + @staticmethod + def handle_project_files(project_dir, mcu, test, tool, clean=False): + log = '' + if tool == 'uvision' or tool == 'uvision5': + log = os.path.join(project_dir,"build","build_log.txt") + elif tool == 'iar': + log = os.path.join(project_dir, 'build_log.txt') + try: + with open(log, 'r') as f: + print f.read() + except: + return + + prefix = "_".join([test, mcu, tool]) + log_name = os.path.join(os.path.dirname(project_dir), prefix+"_log.txt") + + #check if a log already exists for this platform+test+ide + if os.path.exists(log_name): + #delete it if so + os.remove(log_name) + os.rename(log, log_name) + + if clean: + shutil.rmtree(project_dir, ignore_errors=True) + return + + def generate_and_build(self, tests, clean=False): + + #build results + successes = [] + failures = [] + skips = [] + for mcu, ides in self.target_ides.items(): + for test in tests: + #resolve name alias + test = get_test_from_name(test) + for ide in ides: + lib_symbols = get_lib_symbols(None, None, test) + project_dir, project_name, project_temp = setup_project(mcu, ide, test) + + dest_dir = os.path.dirname(project_temp) + destination = os.path.join(dest_dir,"_".join([project_name, mcu, ide])) + + tmp_path, report = perform_export(project_dir, project_name, ide, mcu, destination, + lib_symbols=lib_symbols, progen_build = True) + + if report['success']: + successes.append("build for %s::%s\t%s" % (mcu, ide, project_name)) + elif report['skip']: + skips.append("%s::%s\t%s" % (mcu, ide, project_name)) + else: + failures.append("%s::%s\t%s for %s" % (mcu, ide, report['errormsg'], project_name)) + + ProgenBuildTest.handle_project_files(destination, mcu, project_name, ide, clean) + return successes, failures, skips + + +if __name__ == '__main__': + accepted_ides = ["iar", "uvision", "uvision5"] + accepted_targets = sorted(ProgenBuildTest.get_pgen_targets(accepted_ides)) + default_tests = ["MBED_BLINKY"] + + parser = argparse.ArgumentParser(description = "Test progen builders. Leave any flag off to run with all possible options.") + parser.add_argument("-i", "--IDEs", + nargs = '+', + dest="ides", + help="tools you wish to perfrom build tests. (%s)" % ', '.join(accepted_ides), + default = accepted_ides) + + parser.add_argument("-n", + nargs='+', + dest="tests", + help="names of desired test programs", + default = default_tests) + + parser.add_argument("-m", "--mcus", + nargs='+', + dest ="targets", + help="generate project for the given MCUs (%s)" % '\n '.join(accepted_targets), + default = accepted_targets) + + parser.add_argument("-c", "--clean", + dest="clean", + action = "store_true", + help="clean up the exported project files", + default=False) + + options = parser.parse_args() + + tests = options.tests + ides = [ide.lower() for ide in options.ides] + targets = [target.upper() for target in options.targets] + + if any(get_test_from_name(test) is None for test in tests): + args_error(parser, "[ERROR] test name not recognized") + + if any(target not in accepted_targets for target in targets): + args_error(parser, "[ERROR] mcu must be one of the following:\n %s" % '\n '.join(accepted_targets)) + + if any(ide not in accepted_ides for ide in ides): + args_error(parser, "[ERROR] ide must be in %s" % ', '.join(accepted_ides)) + + build_test = ProgenBuildTest(ides, targets) + successes, failures, skips = build_test.generate_and_build(tests, options.clean) + print_results(successes, failures, skips) + sys.exit(len(failures)) + + + From bf2ad16c699996e22e0dca3309360225c3a9ee20 Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Mon, 18 Jul 2016 15:45:18 +0100 Subject: [PATCH 83/83] project - zip and src check if empty fix Regression from #2179. Fixes #2184. --- tools/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/project.py b/tools/project.py index 96f86d2f64..1a8e93eae4 100644 --- a/tools/project.py +++ b/tools/project.py @@ -136,8 +136,8 @@ if __name__ == '__main__': p, src, ide = options.program, options.source_dir, options.ide project_dir, project_name, project_temp = setup_project(mcu, ide, p, src, options.build) - zip = src is [] # create zip when no src_dir provided - clean = src is [] # don't clean when source is provided, use acrual source tree for IDE files + zip = not bool(src) # create zip when no src_dir provided + clean = not bool(src) # don't clean when source is provided, use acrual source tree for IDE files # Export to selected toolchain lib_symbols = get_lib_symbols(options.macros, src, p)