From 76068b4ea6931c047978105a92789d5657e8f9a1 Mon Sep 17 00:00:00 2001 From: Maximilian Gerhardt Date: Thu, 25 Mar 2021 14:15:14 +0100 Subject: [PATCH] Add spl-uart-printf-simple example, refactor old one (#47) This renames the old exapmle to spl-uart-loopback and adds a new, simple UART printf() example which works for all supported STM8 boards. The old "spl-uart" example was a rather complex UART1 to UART3 loopback and buffer check firmware, that also doesn't compile for the boards that do not have a UART1 peripheral. --- .github/workflows/examples.yml | 3 +- appveyor.yml | 3 +- .../.gitignore | 0 .../.travis.yml | 0 .../README.rst | 2 +- .../include/README | 0 .../lib/README | 0 .../platformio.ini | 0 .../src/main.c | 0 .../src/main.h | 0 .../src/readme.txt | 0 .../src/stm8s_conf.h | 0 .../src/stm8s_it.c | 0 .../src/stm8s_it.h | 0 .../test/README | 0 examples/spl-uart-simple-printf/.gitignore | 2 + examples/spl-uart-simple-printf/README.rst | 38 ++ .../spl-uart-simple-printf/include/README | 39 ++ examples/spl-uart-simple-printf/lib/README | 46 ++ .../spl-uart-simple-printf/platformio.ini | 45 ++ examples/spl-uart-simple-printf/src/main.c | 203 +++++++ .../spl-uart-simple-printf/src/stm8s_conf.h | 118 ++++ .../spl-uart-simple-printf/src/stm8s_it.c | 521 ++++++++++++++++++ .../spl-uart-simple-printf/src/stm8s_it.h | 201 +++++++ examples/spl-uart-simple-printf/test/README | 11 + 25 files changed, 1229 insertions(+), 3 deletions(-) rename examples/{spl-uart => spl-uart-loopback}/.gitignore (100%) rename examples/{spl-uart => spl-uart-loopback}/.travis.yml (100%) rename examples/{spl-uart => spl-uart-loopback}/README.rst (96%) rename examples/{spl-uart => spl-uart-loopback}/include/README (100%) rename examples/{spl-uart => spl-uart-loopback}/lib/README (100%) rename examples/{spl-uart => spl-uart-loopback}/platformio.ini (100%) rename examples/{spl-uart => spl-uart-loopback}/src/main.c (100%) rename examples/{spl-uart => spl-uart-loopback}/src/main.h (100%) rename examples/{spl-uart => spl-uart-loopback}/src/readme.txt (100%) rename examples/{spl-uart => spl-uart-loopback}/src/stm8s_conf.h (100%) rename examples/{spl-uart => spl-uart-loopback}/src/stm8s_it.c (100%) rename examples/{spl-uart => spl-uart-loopback}/src/stm8s_it.h (100%) rename examples/{spl-uart => spl-uart-loopback}/test/README (100%) create mode 100644 examples/spl-uart-simple-printf/.gitignore create mode 100644 examples/spl-uart-simple-printf/README.rst create mode 100644 examples/spl-uart-simple-printf/include/README create mode 100644 examples/spl-uart-simple-printf/lib/README create mode 100644 examples/spl-uart-simple-printf/platformio.ini create mode 100644 examples/spl-uart-simple-printf/src/main.c create mode 100644 examples/spl-uart-simple-printf/src/stm8s_conf.h create mode 100644 examples/spl-uart-simple-printf/src/stm8s_it.c create mode 100644 examples/spl-uart-simple-printf/src/stm8s_it.h create mode 100644 examples/spl-uart-simple-printf/test/README diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 6d5913d..1687f97 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -15,7 +15,8 @@ jobs: - "examples/arduino-ping-hc04" - "examples/spl-blink" - "examples/spl-flash" - - "examples/spl-uart" + - "examples/spl-uart-loopback" + - "examples/spl-uart-simple-printf" - "examples/native-blink" runs-on: ${{ matrix.os }} steps: diff --git a/appveyor.yml b/appveyor.yml index 115eb2a..80afe0e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,8 @@ environment: - PLATFORMIO_PROJECT_DIR: "examples/arduino-ping-hc04" - PLATFORMIO_PROJECT_DIR: "examples/spl-blink" - PLATFORMIO_PROJECT_DIR: "examples/spl-flash" - - PLATFORMIO_PROJECT_DIR: "examples/spl-uart" + - PLATFORMIO_PROJECT_DIR: "examples/spl-uart-loopback" + - PLATFORMIO_PROJECT_DIR: "examples/spl-uart-simple-printf" - PLATFORMIO_PROJECT_DIR: "examples/native-blink" install: diff --git a/examples/spl-uart/.gitignore b/examples/spl-uart-loopback/.gitignore similarity index 100% rename from examples/spl-uart/.gitignore rename to examples/spl-uart-loopback/.gitignore diff --git a/examples/spl-uart/.travis.yml b/examples/spl-uart-loopback/.travis.yml similarity index 100% rename from examples/spl-uart/.travis.yml rename to examples/spl-uart-loopback/.travis.yml diff --git a/examples/spl-uart/README.rst b/examples/spl-uart-loopback/README.rst similarity index 96% rename from examples/spl-uart/README.rst rename to examples/spl-uart-loopback/README.rst index 8710e74..0eddada 100644 --- a/examples/spl-uart/README.rst +++ b/examples/spl-uart-loopback/README.rst @@ -20,7 +20,7 @@ How to build PlatformIO based project .. code-block:: bash # Change directory to example - > cd platform-ststm8/examples/spl-uart + > cd platform-ststm8/examples/spl-uart-loopback # Build project > platformio run diff --git a/examples/spl-uart/include/README b/examples/spl-uart-loopback/include/README similarity index 100% rename from examples/spl-uart/include/README rename to examples/spl-uart-loopback/include/README diff --git a/examples/spl-uart/lib/README b/examples/spl-uart-loopback/lib/README similarity index 100% rename from examples/spl-uart/lib/README rename to examples/spl-uart-loopback/lib/README diff --git a/examples/spl-uart/platformio.ini b/examples/spl-uart-loopback/platformio.ini similarity index 100% rename from examples/spl-uart/platformio.ini rename to examples/spl-uart-loopback/platformio.ini diff --git a/examples/spl-uart/src/main.c b/examples/spl-uart-loopback/src/main.c similarity index 100% rename from examples/spl-uart/src/main.c rename to examples/spl-uart-loopback/src/main.c diff --git a/examples/spl-uart/src/main.h b/examples/spl-uart-loopback/src/main.h similarity index 100% rename from examples/spl-uart/src/main.h rename to examples/spl-uart-loopback/src/main.h diff --git a/examples/spl-uart/src/readme.txt b/examples/spl-uart-loopback/src/readme.txt similarity index 100% rename from examples/spl-uart/src/readme.txt rename to examples/spl-uart-loopback/src/readme.txt diff --git a/examples/spl-uart/src/stm8s_conf.h b/examples/spl-uart-loopback/src/stm8s_conf.h similarity index 100% rename from examples/spl-uart/src/stm8s_conf.h rename to examples/spl-uart-loopback/src/stm8s_conf.h diff --git a/examples/spl-uart/src/stm8s_it.c b/examples/spl-uart-loopback/src/stm8s_it.c similarity index 100% rename from examples/spl-uart/src/stm8s_it.c rename to examples/spl-uart-loopback/src/stm8s_it.c diff --git a/examples/spl-uart/src/stm8s_it.h b/examples/spl-uart-loopback/src/stm8s_it.h similarity index 100% rename from examples/spl-uart/src/stm8s_it.h rename to examples/spl-uart-loopback/src/stm8s_it.h diff --git a/examples/spl-uart/test/README b/examples/spl-uart-loopback/test/README similarity index 100% rename from examples/spl-uart/test/README rename to examples/spl-uart-loopback/test/README diff --git a/examples/spl-uart-simple-printf/.gitignore b/examples/spl-uart-simple-printf/.gitignore new file mode 100644 index 0000000..b9f3806 --- /dev/null +++ b/examples/spl-uart-simple-printf/.gitignore @@ -0,0 +1,2 @@ +.pio +.vscode diff --git a/examples/spl-uart-simple-printf/README.rst b/examples/spl-uart-simple-printf/README.rst new file mode 100644 index 0000000..f67ed4d --- /dev/null +++ b/examples/spl-uart-simple-printf/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2018-present PlatformIO + 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. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO Core `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm8/examples/spl-uart-simple-printf + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e stm8sdisco + + # Upload firmware for the specific environment + > platformio run -e stm8sdisco --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/spl-uart-simple-printf/include/README b/examples/spl-uart-simple-printf/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/examples/spl-uart-simple-printf/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/examples/spl-uart-simple-printf/lib/README b/examples/spl-uart-simple-printf/lib/README new file mode 100644 index 0000000..6debab1 --- /dev/null +++ b/examples/spl-uart-simple-printf/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in a an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/examples/spl-uart-simple-printf/platformio.ini b/examples/spl-uart-simple-printf/platformio.ini new file mode 100644 index 0000000..62ceea1 --- /dev/null +++ b/examples/spl-uart-simple-printf/platformio.ini @@ -0,0 +1,45 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:stm8sblue] +platform = ststm8 +board = stm8sblue +framework = spl +upload_protocol = stlinkv2 + +[env:mb208] +platform = ststm8 +board = mb208 +framework = spl + +[env:nucleo_8s207k8] +platform = ststm8 +board = nucleo_8s207k8 +framework = spl + +[env:s8uno] +platform = ststm8 +board = s8uno +framework = spl + +[env:stm8s003f3] +platform = ststm8 +board = stm8s003f3 +framework = spl + +[env:stm8sblack] +platform = ststm8 +board = stm8sblack +framework = spl + +[env:stm8sdisco] +platform = ststm8 +board = stm8sdisco +framework = spl diff --git a/examples/spl-uart-simple-printf/src/main.c b/examples/spl-uart-simple-printf/src/main.c new file mode 100644 index 0000000..93f7489 --- /dev/null +++ b/examples/spl-uart-simple-printf/src/main.c @@ -0,0 +1,203 @@ +/** + ****************************************************************************** + * @file UART1_Printf\main.c + * @brief This file contains the main function for: retarget the C library printf + * /scanf functions to the UART1 example. + * @author MCD Application Team + * @version V2.0.4 + * @date 26-April-2018 + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2014 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 + * + * 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. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm8s.h" +#include "stm8s_it.h" /* SDCC patch: required by SDCC for interrupts */ +#include "stdio.h" +/** + * @addtogroup UART1_Printf + * @{ + */ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +#ifdef _RAISONANCE_ + #define PUTCHAR_PROTOTYPE int putchar (char c) + #define GETCHAR_PROTOTYPE int getchar (void) +#elif defined (_COSMIC_) + #define PUTCHAR_PROTOTYPE char putchar (char c) + #define GETCHAR_PROTOTYPE char getchar (void) +#elif defined (_SDCC_) /* SDCC patch: ensure same types as stdio.h */ + #if SDCC_VERSION >= 30605 // declaration changed in sdcc 3.6.5 (officially with 3.7.0) + #define PUTCHAR_PROTOTYPE int putchar(int c) + #define GETCHAR_PROTOTYPE int getchar(void) + #else + #define PUTCHAR_PROTOTYPE void putchar(char c) + #define GETCHAR_PROTOTYPE char getchar(void) + #endif +#else /* _IAR_ */ + #define PUTCHAR_PROTOTYPE int putchar (int c) + #define GETCHAR_PROTOTYPE int getchar (void) +#endif /* _RAISONANCE_ */ +/* Private macro -------------------------------------------------------------*/ +/* Some chips have UART1, but other chips only have UART2 and not UART1. + * We want this example to work on both types of chips, so we + * macro-define all the correct SPL functions to the default UART of the device. + * + * UART1 devices: STM8S208, STM8S207, STM8S007, STM8S103, STM8S003, STM8S001, STM8S903 + * STM8AF52Ax, STM8AF62Ax + * UART2 devices (which do not have UART1): STM8S105, STM8S005, STM8AF626x + * + * For the TX and RX pins, see chip datasheet. + * For STM8S103 devices, this is e.g. TX=PD5, RX=PD6. +*/ +#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) +#define UART_NAME "UART2" +#define UART_INIT UART2_Init +#define UART_DEINIT UART2_DeInit +#define UART_SENDDATA8 UART2_SendData8 +#define UART_RECEIVEDATA8 UART2_ReceiveData8 +#define UART_GETFLAGSTATUS UART2_GetFlagStatus +#define UART_FLAG_RXNE UART2_FLAG_RXNE +#define UART_FLAG_TXE UART2_FLAG_TXE +#define UART_WORDLENGTH_8D UART2_WORDLENGTH_8D +#define UART_STOPBITS_1 UART2_STOPBITS_1 +#define UART_PARITY_NO UART2_PARITY_NO +#define UART_SYNCMODE_CLOCK_DISABLE UART2_SYNCMODE_CLOCK_DISABLE +#define UART_MODE_TXRX_ENABLE UART2_MODE_TXRX_ENABLE +#else +/* other boards have normal UART 1*/ +#define UART_NAME "UART1" +#define UART_INIT UART1_Init +#define UART_DEINIT UART1_DeInit +#define UART_SENDDATA8 UART1_SendData8 +#define UART_RECEIVEDATA8 UART1_ReceiveData8 +#define UART_GETFLAGSTATUS UART1_GetFlagStatus +#define UART_FLAG_RXNE UART1_FLAG_RXNE +#define UART_FLAG_TXE UART1_FLAG_TXE +#define UART_WORDLENGTH_8D UART1_WORDLENGTH_8D +#define UART_STOPBITS_1 UART1_STOPBITS_1 +#define UART_PARITY_NO UART1_PARITY_NO +#define UART_SYNCMODE_CLOCK_DISABLE UART1_SYNCMODE_CLOCK_DISABLE +#define UART_MODE_TXRX_ENABLE UART1_MODE_TXRX_ENABLE +#endif + +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/** + * @brief Main program. + * @param None + * @retval None + */ +void main(void) +{ + /*High speed internal clock prescaler: 1*/ + CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); + + UART_DEINIT(); + /* Configure either UART1 or UART2 per board definitions above */ + /* UART configured as follow: + - BaudRate = 115200 baud + - Word Length = 8 Bits + - One Stop Bit + - No parity + - Receive and transmit enabled + - UART1 Clock disabled + */ + UART_INIT((uint32_t)115200, UART_WORDLENGTH_8D, UART_STOPBITS_1, UART_PARITY_NO, + UART_SYNCMODE_CLOCK_DISABLE, UART_MODE_TXRX_ENABLE); + + /* Output a message on Hyperterminal using printf function */ + printf("\n" UART_NAME " Example :retarget the C library printf()/getchar() functions to the UART\n"); + + while (1) + { + printf("Hello, world!\n"); + + // simple wait ~1000ms @ 16MHz + for (uint32_t i=0; i<1600000L; i++) + __asm__("nop"); + + /* you may also use blocking getchar() to get input */ + //char ans = getchar(); + //printf("%c", ans); + } +} + +/** + * @brief Retargets the C library printf function to the UART. + * @param c Character to send + * @retval char Character sent + */ +PUTCHAR_PROTOTYPE +{ + /* Write a character to the UART1 */ + UART_SENDDATA8(c); + /* Loop until the end of transmission */ + while (UART_GETFLAGSTATUS(UART_FLAG_TXE) == RESET); + + return (c); +} + +/** + * @brief Retargets the C library scanf function to the USART. + * @param None + * @retval char Character to Read + */ +GETCHAR_PROTOTYPE +{ +#ifdef _COSMIC_ + char c = 0; +#else + int c = 0; +#endif + /* Loop until the Read data register flag is SET */ + while (UART_GETFLAGSTATUS(UART_FLAG_TXE) == RESET); + c = UART_RECEIVEDATA8(); + return (c); +} + +#ifdef USE_FULL_ASSERT + +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t* file, uint32_t line) +{ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + (void) file; + (void) line; + /* Infinite loop */ + while (1) + { + } +} +#endif + +/** + * @} + */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/examples/spl-uart-simple-printf/src/stm8s_conf.h b/examples/spl-uart-simple-printf/src/stm8s_conf.h new file mode 100644 index 0000000..0b7fc2d --- /dev/null +++ b/examples/spl-uart-simple-printf/src/stm8s_conf.h @@ -0,0 +1,118 @@ +/** + ****************************************************************************** + * @file stm8s_conf.h + * @author MCD Application Team + * @version V2.0.4 + * @date 26-April-2018 + * @brief This file is used to configure the Library. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2014 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 + * + * 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. + * + ****************************************************************************** + */ + +/* SDCC patch: include "STM8AF622x" defined in "STM8S_StdPeriph_Tempate" */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM8S_CONF_H +#define __STM8S_CONF_H + +/* Includes ------------------------------------------------------------------*/ +#include "stm8s.h" + +/* Uncomment the line below to enable peripheral header file inclusion */ +#if defined(STM8S105) || defined(STM8S005) || defined(STM8S103) || defined(STM8S003) ||\ + defined(STM8S001) || defined(STM8S903) || defined (STM8AF626x) || defined (STM8AF622x) +//#include "stm8s_adc1.h" +#endif /* (STM8S105) ||(STM8S103) || (STM8S001) || (STM8S903) || (STM8AF626x) */ +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined (STM8AF52Ax) ||\ + defined (STM8AF62Ax) +// #include "stm8s_adc2.h" +#endif /* (STM8S208) || (STM8S207) || (STM8AF62Ax) || (STM8AF52Ax) */ +//#include "stm8s_awu.h" +//#include "stm8s_beep.h" +#if defined (STM8S208) || defined (STM8AF52Ax) +// #include "stm8s_can.h" +#endif /* (STM8S208) || (STM8AF52Ax) */ +#include "stm8s_clk.h" +//#include "stm8s_exti.h" +//#include "stm8s_flash.h" +//#include "stm8s_gpio.h" +//#include "stm8s_i2c.h" +//#include "stm8s_itc.h" +//#include "stm8s_iwdg.h" +//#include "stm8s_rst.h" +//#include "stm8s_spi.h" +//#include "stm8s_tim1.h" +#if !defined(STM8S903) && !defined(STM8AF622x) /* SDCC patch: see https://github.com/tenbaht/sduino/tree/master/STM8S_StdPeriph_Driver */ +// #include "stm8s_tim2.h" +#endif /* (STM8S903) || (STM8AF622x) */ +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) ||\ + defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) +// #include "stm8s_tim3.h" +#endif /* (STM8S208) || (STM8S207) || (STM8S007) || (STM8S105) */ +#if !defined(STM8S903) && !defined(STM8AF622x) /* SDCC patch: see https://github.com/tenbaht/sduino/tree/master/STM8S_StdPeriph_Driver */ +// #include "stm8s_tim4.h" +#endif /* (STM8S903) || (STM8AF622x) */ +#if defined(STM8S903) || defined(STM8AF622x) /* SDCC patch: see https://github.com/tenbaht/sduino/tree/master/STM8S_StdPeriph_Driver */ +// #include "stm8s_tim5.h" +// #include "stm8s_tim6.h" +#endif /* (STM8S903) || (STM8AF622x) */ +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) ||\ + defined(STM8S003) || defined(STM8S001) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax) +#include "stm8s_uart1.h" +#endif /* (STM8S208) || (STM8S207) || (STM8S103) || (STM8S001) || (STM8S903) || (STM8AF52Ax) || (STM8AF62Ax) */ +#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) +#include "stm8s_uart2.h" +#endif /* (STM8S105) || (STM8AF626x) */ +#if defined(STM8S208) ||defined(STM8S207) || defined(STM8S007) || defined (STM8AF52Ax) ||\ + defined (STM8AF62Ax) +// #include "stm8s_uart3.h" +#endif /* (STM8S208) || (STM8S207) || (STM8AF52Ax) || (STM8AF62Ax) */ +#if defined(STM8AF622x) /* SDCC patch: see https://github.com/tenbaht/sduino/tree/master/STM8S_StdPeriph_Driver */ +// #include "stm8s_uart4.h" +#endif /* (STM8AF622x) */ +//#include "stm8s_wwdg.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Uncomment the line below to expanse the "assert_param" macro in the + Standard Peripheral Library drivers code */ +#define USE_FULL_ASSERT (1) + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT + +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval : None + */ +#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t* file, uint32_t line); +#else +#define assert_param(expr) ((void)0) +#endif /* USE_FULL_ASSERT */ + +#endif /* __STM8S_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/examples/spl-uart-simple-printf/src/stm8s_it.c b/examples/spl-uart-simple-printf/src/stm8s_it.c new file mode 100644 index 0000000..2108130 --- /dev/null +++ b/examples/spl-uart-simple-printf/src/stm8s_it.c @@ -0,0 +1,521 @@ +/** + ****************************************************************************** + * @file stm8s_it.c + * @author MCD Application Team + * @version V2.0.4 + * @date 26-April-2018 + * @brief Main Interrupt Service Routines. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2014 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 + * + * 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. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm8s_it.h" + +/** @addtogroup UART1_Printf + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Public functions ----------------------------------------------------------*/ + + +#ifdef _COSMIC_ +/** + * @brief Dummy interrupt routine + * @param None + * @retval None + */ +@far @interrupt void NonHandledInterrupt(void) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief TRAP interrupt routine + * @param None + * @retval None + */ +@far @interrupt void TRAP_IRQHandler(void) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#else /*_RAISONANCE_*/ + +/** + * @brief TRAP interrupt routine + * @param None + * @retval None + */ +INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*_COSMIC_*/ + +/** + * @brief Top Level Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(TLI_IRQHandler, 0) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Auto Wake Up Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(AWU_IRQHandler, 1) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Clock Controller Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(CLK_IRQHandler, 2) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief External Interrupt PORTA Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief External Interrupt PORTB Interrupt routine + * @param None + * @retval None + */ +INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief External Interrupt PORTC Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief External Interrupt PORTD Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief External Interrupt PORTE Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#ifdef STM8S903 +/** + * @brief External Interrupt PORTF Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S903*/ + +#ifdef STM8S208 +/** + * @brief CAN RX Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief CAN TX Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S208 || STM8AF52Ax */ + +/** + * @brief SPI Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(SPI_IRQHandler, 10) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Timer1 Update/Overflow/Trigger/Break Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Timer1 Capture/Compare Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +#ifdef STM8S903 +/** + * @brief Timer5 Update/Overflow/Break/Trigger Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +/** + * @brief Timer5 Capture/Compare Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +#else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8S001 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */ +/** + * @brief Timer2 Update/Overflow/Break Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Timer2 Capture/Compare Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S903*/ + +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \ + defined(STM8S005) || defined(STM8AF62Ax) || defined(STM8AF52Ax) || defined(STM8AF626x) +/** + * @brief Timer3 Update/Overflow/Break Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief Timer3 Capture/Compare Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */ + +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \ + defined(STM8S003) || defined(STM8S001) || defined(STM8AF62Ax) || defined(STM8AF52Ax) || defined(STM8S903) +/** + * @brief UART1 TX Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief UART1 RX Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S105 || STM8S001 */ + +/** + * @brief I2C Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(I2C_IRQHandler, 19) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) +/** + * @brief UART2 TX interrupt routine. + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief UART2 RX interrupt routine. + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /* STM8S105*/ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) +/** + * @brief UART3 TX interrupt routine. + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @brief UART3 RX interrupt routine. + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) +/** + * @brief ADC2 interrupt routine. + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(ADC2_IRQHandler, 22) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#else /*STM8S105, STM8S103 or STM8S903 or STM8AF626x */ +/** + * @brief ADC1 interrupt routine. + * @param None + * @retval None + */ + INTERRUPT_HANDLER(ADC1_IRQHandler, 22) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */ + +#ifdef STM8S903 +/** + * @brief Timer6 Update/Overflow/Trigger Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8S001 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */ +/** + * @brief Timer4 Update/Overflow Interrupt routine + * @param None + * @retval + * None + */ + INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif /*STM8S903*/ + +/** + * @brief Eeprom EEC Interrupt routine + * @param None + * @retval + * None + */ +INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} + +/** + * @} + */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ \ No newline at end of file diff --git a/examples/spl-uart-simple-printf/src/stm8s_it.h b/examples/spl-uart-simple-printf/src/stm8s_it.h new file mode 100644 index 0000000..46aac46 --- /dev/null +++ b/examples/spl-uart-simple-printf/src/stm8s_it.h @@ -0,0 +1,201 @@ +/** + ****************************************************************************** + * @file stm8s_it.h + * @author MCD Application Team + * @version V2.0.4 + * @date 26-April-2018 + * @brief This file contains the headers of the interrupt handlers + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2014 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 + * + * 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM8S_IT_H +#define __STM8S_IT_H + +/* Includes ------------------------------------------------------------------*/ +#include "stm8s.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +#ifdef _COSMIC_ + void _stext(void); /* RESET startup routine */ + INTERRUPT void NonHandledInterrupt(void); +#endif /* _COSMIC_ */ + +// SDCC patch: requires separate handling for SDCC (see below) +#if !defined(_RAISONANCE_) && !defined(_SDCC_) + INTERRUPT void TRAP_IRQHandler(void); /* TRAP */ + INTERRUPT void TLI_IRQHandler(void); /* TLI */ + INTERRUPT void AWU_IRQHandler(void); /* AWU */ + INTERRUPT void CLK_IRQHandler(void); /* CLOCK */ + INTERRUPT void EXTI_PORTA_IRQHandler(void); /* EXTI PORTA */ + INTERRUPT void EXTI_PORTB_IRQHandler(void); /* EXTI PORTB */ + INTERRUPT void EXTI_PORTC_IRQHandler(void); /* EXTI PORTC */ + INTERRUPT void EXTI_PORTD_IRQHandler(void); /* EXTI PORTD */ + INTERRUPT void EXTI_PORTE_IRQHandler(void); /* EXTI PORTE */ + +#if defined(STM8S903) || defined(STM8AF622x) // SDCC patch: add STM8AF622x + INTERRUPT void EXTI_PORTF_IRQHandler(void); /* EXTI PORTF */ +#endif /* (STM8S903) || (STM8AF622x) */ + +#if defined (STM8S208) || defined (STM8AF52Ax) + INTERRUPT void CAN_RX_IRQHandler(void); /* CAN RX */ + INTERRUPT void CAN_TX_IRQHandler(void); /* CAN TX/ER/SC */ +#endif /* (STM8S208) || (STM8AF52Ax) */ + + INTERRUPT void SPI_IRQHandler(void); /* SPI */ + INTERRUPT void TIM1_CAP_COM_IRQHandler(void); /* TIM1 CAP/COM */ + INTERRUPT void TIM1_UPD_OVF_TRG_BRK_IRQHandler(void); /* TIM1 UPD/OVF/TRG/BRK */ + +#if defined(STM8S903) || defined(STM8AF622x) // SDCC patch: add STM8AF622x + INTERRUPT void TIM5_UPD_OVF_BRK_TRG_IRQHandler(void); /* TIM5 UPD/OVF/BRK/TRG */ + INTERRUPT void TIM5_CAP_COM_IRQHandler(void); /* TIM5 CAP/COM */ +#else /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8S103) || (STM8S001) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8A626x) */ + INTERRUPT void TIM2_UPD_OVF_BRK_IRQHandler(void); /* TIM2 UPD/OVF/BRK */ + INTERRUPT void TIM2_CAP_COM_IRQHandler(void); /* TIM2 CAP/COM */ +#endif /* (STM8S903) || (STM8AF622x) */ + +#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \ + defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) + INTERRUPT void TIM3_UPD_OVF_BRK_IRQHandler(void); /* TIM3 UPD/OVF/BRK */ + INTERRUPT void TIM3_CAP_COM_IRQHandler(void); /* TIM3 CAP/COM */ +#endif /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8A626x) */ + +#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \ + defined(STM8S003) || defined(STM8S001) || defined(STM8AF52Ax) || defined(STM8AF62Ax) || defined(STM8S903) + INTERRUPT void UART1_TX_IRQHandler(void); /* UART1 TX */ + INTERRUPT void UART1_RX_IRQHandler(void); /* UART1 RX */ +#endif /* (STM8S208) || (STM8S207) || (STM8S007) || (STM8S103) || (STM8S003) || (STM8S001) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8S903) */ + +#if defined (STM8AF622x) // SDCC patch: add STM8AF622x + INTERRUPT void UART4_TX_IRQHandler(void); /* UART4 TX */ + INTERRUPT void UART4_RX_IRQHandler(void); /* UART4 RX */ +#endif /* (STM8AF622x) */ + + INTERRUPT void I2C_IRQHandler(void); /* I2C */ + +#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) + INTERRUPT void UART2_RX_IRQHandler(void); /* UART2 RX */ + INTERRUPT void UART2_TX_IRQHandler(void); /* UART2 TX */ +#endif /* (STM8S105) || (STM8S005) || (STM8AF626x) */ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) + INTERRUPT void UART3_RX_IRQHandler(void); /* UART3 RX */ + INTERRUPT void UART3_TX_IRQHandler(void); /* UART3 TX */ +#endif /* (STM8S207) || (STM8S007) || (STM8S208) || (STM8AF52Ax) || (STM8AF62Ax) */ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) + INTERRUPT void ADC2_IRQHandler(void); /* ADC2 */ +#else /* (STM8S105) || (STM8S103) || (STM8S903) || (STM8AF622x) */ + INTERRUPT void ADC1_IRQHandler(void); /* ADC1 */ +#endif /* (STM8S207) || (STM8S007) || (STM8S208) || (STM8AF52Ax) || (STM8AF62Ax) */ + +#if defined(STM8S903) || defined(STM8AF622x) // SDCC patch: add STM8AF622x + INTERRUPT void TIM6_UPD_OVF_TRG_IRQHandler(void); /* TIM6 UPD/OVF/TRG */ +#else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */ + INTERRUPT void TIM4_UPD_OVF_IRQHandler(void); /* TIM4 UPD/OVF */ +#endif /* (STM8S903) || (STM8AF622x) */ + INTERRUPT void EEPROM_EEC_IRQHandler(void); /* EEPROM ECC CORRECTION */ + + +// SDCC patch: __interrupt keyword required after function name --> requires new block +#elif defined (_SDCC_) + + INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler); /* TRAP */ + INTERRUPT_HANDLER(TLI_IRQHandler, 0); /* TLI */ + INTERRUPT_HANDLER(AWU_IRQHandler, 1); /* AWU */ + INTERRUPT_HANDLER(CLK_IRQHandler, 2); /* CLOCK */ + INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3); /* EXTI PORTA */ + INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4); /* EXTI PORTB */ + INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5); /* EXTI PORTC */ + INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6); /* EXTI PORTD */ + INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7); /* EXTI PORTE */ + +#if defined(STM8S903) || defined(STM8AF622x) + INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8); /* EXTI PORTF */ +#endif /* (STM8S903) || (STM8AF622x) */ + +#if defined (STM8S208) || defined (STM8AF52Ax) + INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8); /* CAN RX */ + INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9); /* CAN TX/ER/SC */ +#endif /* (STM8S208) || (STM8AF52Ax) */ + + INTERRUPT_HANDLER(SPI_IRQHandler, 10); /* SPI */ + INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11); /* TIM1 UPD/OVF/TRG/BRK */ + INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12); /* TIM1 CAP/COM */ + +#if defined(STM8S903) || defined(STM8AF622x) + INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13); /* TIM5 UPD/OVF/BRK/TRG */ + INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14); /* TIM5 CAP/COM */ +#else /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8S103) || (STM8S001) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8A626x) */ + INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13); /* TIM2 UPD/OVF/BRK */ + INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14); /* TIM2 CAP/COM */ +#endif /* (STM8S903) || (STM8AF622x) */ + +#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \ + defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) + INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15); /* TIM3 UPD/OVF/BRK */ + INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16); /* TIM3 CAP/COM */ +#endif /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8A626x) */ + +#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \ + defined(STM8S003) || defined(STM8S001) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8S903) + INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17); /* UART1 TX */ + INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18); /* UART1 RX */ +#endif /* (STM8S208) || (STM8S207) || (STM8S903) || (STM8S103) || (STM8S001) || (STM8AF52Ax) || (STM8AF62Ax) */ + +#if defined (STM8AF622x) + INTERRUPT_HANDLER(UART4_TX_IRQHandler, 17); /* UART4 TX */ + INTERRUPT_HANDLER(UART4_RX_IRQHandler, 18); /* UART4 RX */ +#endif /* (STM8AF622x) */ + + INTERRUPT_HANDLER(I2C_IRQHandler, 19); /* I2C */ + +#if defined(STM8S105) || defined(STM8S005) || defined (STM8AF626x) + INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20); /* UART2 TX */ + INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21); /* UART2 RX */ +#endif /* (STM8S105) || (STM8AF626x) */ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) + INTERRUPT_HANDLER(UART3_RX_IRQHandler, 20); /* UART3 RX */ + INTERRUPT_HANDLER(UART3_TX_IRQHandler, 21); /* UART3 TX */ +#endif /* (STM8S207) || (STM8S208) || (STM8AF62Ax) || (STM8AF52Ax) */ + +#if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax) + INTERRUPT_HANDLER(ADC2_IRQHandler, 22); /* ADC2 */ +#else /* (STM8S105) || (STM8S103) || (STM8S903) || (STM8AF622x) */ + INTERRUPT_HANDLER(ADC1_IRQHandler, 22); /* ADC1 */ +#endif /* (STM8S207) || (STM8S208) || (STM8AF62Ax) || (STM8AF52Ax) */ + +#if defined(STM8S903) || defined(STM8AF622x) + INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23); /* TIM6 UPD/OVF/TRG */ +#else /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8S103) || (STM8AF62Ax) || (STM8AF52Ax) || (STM8AF626x) */ + INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23); /* TIM4 UPD/OVF */ +#endif /* (STM8S903) || (STM8AF622x) */ + INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24); /* EEPROM ECC CORRECTION */ + +#endif /* !(_RAISONANCE_) && !(_SDCC_) */ + +#endif /* __STM8S_IT_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/examples/spl-uart-simple-printf/test/README b/examples/spl-uart-simple-printf/test/README new file mode 100644 index 0000000..b94d089 --- /dev/null +++ b/examples/spl-uart-simple-printf/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Unit Testing and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/page/plus/unit-testing.html