summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-08-26 19:00:05 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2017-08-26 19:00:05 (GMT)
commit6f93f6b1adefa0f541b6e81d37b7677a4cb34460 (patch)
tree1afcb738ea103a473543f6acc34678e2e74ddedc
parente440001a632bb485ed7077b8f019d8a1c2baeb5b (diff)
fix linking to external libs
-rw-r--r--.gitignore2
-rw-r--r--blink/Makefile2
-rw-r--r--blink/stm8s_conf.h2
-rw-r--r--defines.mk6
-rw-r--r--include.mk16
-rw-r--r--lib/serialio.c48
-rw-r--r--lib/serialio.h30
-rw-r--r--lib/util.c10
-rw-r--r--serial-led/Makefile33
-rw-r--r--serial-led/serial-led.c58
-rw-r--r--serial-led/stm8s_conf.h116
-rw-r--r--serial-led/stm8s_it.h122
-rw-r--r--spl.mk5
13 files changed, 437 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index ba9964c..eed8e6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
-*/*.a
*/*.cdb
*/*.d
*/*.d.*
+*/*.lib
*/*.rel
*/*.rst
*/*.lst
diff --git a/blink/Makefile b/blink/Makefile
index 6ea1e77..e89d98f 100644
--- a/blink/Makefile
+++ b/blink/Makefile
@@ -28,6 +28,6 @@ EXTERNAL_LIBS := spl
SPREADSTM8_PATH := ..
SPL_PATH := $(SPREADSTM8_PATH)/contrib/STM8S_StdPeriph_Lib
-#SPL_COMPONENTS := gpio
+SPL_COMPONENTS := clk
include $(SPREADSTM8_PATH)/include.mk
diff --git a/blink/stm8s_conf.h b/blink/stm8s_conf.h
index fdb0e92..590fe45 100644
--- a/blink/stm8s_conf.h
+++ b/blink/stm8s_conf.h
@@ -90,7 +90,7 @@
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
-#define USE_FULL_ASSERT (1)
+/* #define USE_FULL_ASSERT (1) */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
diff --git a/defines.mk b/defines.mk
index 54692c1..7765add 100644
--- a/defines.mk
+++ b/defines.mk
@@ -22,7 +22,7 @@
ifeq ($(BOARD_TYPE),discovery)
MCU := stm8s105c6
- F_CPU := 16000000
+ F_XTAL := 16000000
SPL_MCU := STM8S105
LED_CNT := 1
LED_GPIO := GPIOD
@@ -46,7 +46,9 @@ CFLAGS += --funsigned-char
# CFLAGS += --opt-code-size
CFLAGS += -I$(LIB_DIR)
CFLAGS += -D__BOARD_$(BOARD_TYPE)__
-CFLAGS += -DF_CPU=$(F_CPU)UL
+ifdef F_XTAL
+ CFLAGS += -DF_XTAL=$(F_XTAL)UL
+endif
ifdef LED_CNT
CFLAGS += -DLED_CNT=$(LED_CNT)
CFLAGS += -DLED_GPIO=$(LED_GPIO)
diff --git a/include.mk b/include.mk
index 551c9ca..05215ba 100644
--- a/include.mk
+++ b/include.mk
@@ -49,6 +49,9 @@ LDFLAGS += -L./
ifdef SPL_PATH
CFLAGS += -D$(SPL_MCU)
+ifdef F_XTAL
+ CFLAGS += -DHSE_VALUE="((uint32_t)$(F_XTAL))"
+endif
CFLAGS += -I./
CFLAGS += -I$(SPL_PATH)/Libraries/STM8S_StdPeriph_Driver/inc
endif
@@ -58,14 +61,14 @@ clean-external: $(EXTERNAL_LIBS:%=clean-%)
export
-build-spl: libspl.a
+build-spl: spl.lib
-libspl.a: Makefile
+spl.lib: Makefile
@echo ""
@echo "****************************************************"
@echo "* building external STM8S StdPeriph lib ($(SPL_PATH))"
@echo ""
- make -f $(SPREADSTM8_PATH)/spl.mk libspl.a
+ make -f $(SPREADSTM8_PATH)/spl.mk spl.lib
make -f $(SPREADSTM8_PATH)/spl.mk clean
@echo ""
@echo "****************************************************"
@@ -76,7 +79,7 @@ clean-spl:
@echo "cleaning external STM8S StdPeriph lib ($(SPL_PATH))"
@echo ""
make -f $(SPREADSTM8_PATH)/spl.mk clean
- rm -f libspl.a
+ rm -f spl.lib
@echo ""
@echo "****************************************************"
@@ -107,10 +110,11 @@ endif
lib-%.rel: $(LIB_DIR)/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
-$(HEXFILE): $(OBJ_LIB) $(OBJ)
- $(CC) $(LDFLAGS) --out-fmt-ihx $(OBJ) $(OBJ_LIB) -o $@
+$(HEXFILE): $(OBJ_LIB) $(EXTERNAL_LIBS:%=%.lib) $(OBJ)
+ $(CC) $(LDFLAGS) --out-fmt-ihx $(OBJ) $(OBJ_LIB) $(EXTERNAL_LIBS:%=-l%) -o $@
@echo ""
+
clean:
rm -f *.cdb
rm -f *.d
diff --git a/lib/serialio.c b/lib/serialio.c
new file mode 100644
index 0000000..899ca3e
--- /dev/null
+++ b/lib/serialio.c
@@ -0,0 +1,48 @@
+/*
+ * spreadspace stm8 utils
+ *
+ *
+ * Copyright (C) 2014-2016 Christian Pointner <equinox@spreadspace.org>
+ *
+ * This file is part of spreadspace stm8 utils.
+ *
+ * spreadspace stm8 utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * spreadspace stm8 utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with spreadspace stm8 utils. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stm8s.h>
+
+#include "serialio.h"
+
+void putchar(char c) {
+ while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET);
+ UART2_SendData8(c);
+}
+
+char getchar(void) {
+ return UART2_ReceiveData8();
+}
+
+void serialio_init(const uint32_t baudrate)
+{
+ UART2_Init(baudrate, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE);
+}
+
+void serialio_task(void)
+{
+}
+
+uint8_t serialio_bytes_received(void)
+{
+ return (UART2_GetFlagStatus(UART2_FLAG_RXNE) == RESET) ? 0 : 1;
+}
diff --git a/lib/serialio.h b/lib/serialio.h
new file mode 100644
index 0000000..9cfaae9
--- /dev/null
+++ b/lib/serialio.h
@@ -0,0 +1,30 @@
+/*
+ * spreadspace stm8 utils
+ *
+ *
+ * Copyright (C) 2014-2016 Christian Pointner <equinox@spreadspace.org>
+ *
+ * This file is part of spreadspace stm8 utils.
+ *
+ * spreadspace stm8 utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * spreadspace stm8 utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with spreadspace stm8 utils. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SPREADSTM8_serialio_h_INCLUDED
+#define SPREADSTM8_serialio_h_INCLUDED
+
+void serialio_init(const uint32_t baudrate);
+void serialio_task(void);
+uint8_t serialio_bytes_received(void);
+
+#endif
diff --git a/lib/util.c b/lib/util.c
index 9cc397c..d397d88 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -26,7 +26,15 @@
void cpu_init(void)
{
- CLK->CKDIVR = 0;
+#ifdef F_XTAL
+ CLK_HSECmd(ENABLE);
+ CLK_HSICmd(DISABLE);
+#else
+ CLK_HSICmd(ENABLE);
+ CLK_HSECmd(DISABLE);
+ CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
+#endif
+ CLK_LSICmd(DISABLE);
}
void swim_disable(void)
diff --git a/serial-led/Makefile b/serial-led/Makefile
new file mode 100644
index 0000000..a039111
--- /dev/null
+++ b/serial-led/Makefile
@@ -0,0 +1,33 @@
+##
+## spreadspace stm8 utils
+##
+##
+## Copyright (C) 2017 Christian Pointner <equinox@spreadspace.org>
+##
+## This file is part of spreadspace stm8 utils.
+##
+## spreadspace stm8 utils is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## any later version.
+##
+## spreadspace stm8 utils is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with spreadspace stm8 utils. If not, see <http://www.gnu.org/licenses/>.
+##
+
+NAME := serial-led
+BOARD_TYPE := discovery
+OBJ := $(NAME).rel
+LIBS := util led serialio
+EXTERNAL_LIBS := spl
+SPREADSTM8_PATH := ..
+
+SPL_PATH := $(SPREADSTM8_PATH)/contrib/STM8S_StdPeriph_Lib
+#SPL_COMPONENTS := clk uart2
+
+include $(SPREADSTM8_PATH)/include.mk
diff --git a/serial-led/serial-led.c b/serial-led/serial-led.c
new file mode 100644
index 0000000..0516de3
--- /dev/null
+++ b/serial-led/serial-led.c
@@ -0,0 +1,58 @@
+/*
+ * spreadspace stm8 utils
+ *
+ *
+ * Copyright (C) 2017 Christian Pointner <equinox@spreadspace.org>
+ *
+ * This file is part of spreadspace stm8 utils.
+ *
+ * spreadspace stm8 utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * spreadspace stm8 utils is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with spreadspace stm8 utils. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stm8s.h>
+#include <stdio.h>
+
+#include "util.h"
+#include "led.h"
+#include "serialio.h"
+
+void handle_cmd(uint8_t cmd)
+{
+ switch(cmd) {
+ case '0': led_off(); break;
+ case '1': led_on(); break;
+ case 't': led_toggle(); break;
+ default: printf("error\r\n"); return;
+ }
+ printf("ok\r\n");
+}
+
+int main(void)
+{
+ cpu_init();
+ swim_disable();
+ led_init();
+ serialio_init(115200);
+
+ led_off();
+ for(;;) {
+ uint8_t BytesReceived = serialio_bytes_received();
+ while(BytesReceived > 0) {
+ char ReceivedByte = getchar();
+ handle_cmd(ReceivedByte);
+ BytesReceived--;
+ }
+ serialio_task();
+ }
+}
diff --git a/serial-led/stm8s_conf.h b/serial-led/stm8s_conf.h
new file mode 100644
index 0000000..590fe45
--- /dev/null
+++ b/serial-led/stm8s_conf.h
@@ -0,0 +1,116 @@
+/**
+ ******************************************************************************
+ * @file stm8s_conf.h
+ * @author MCD Application Team
+ * @version V2.2.0
+ * @date 30-September-2014
+ * @brief This file is used to configure the Library.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * 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_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(STM8S903) || defined (STM8AF626x) || defined (STM8AF622x)
+#include "stm8s_adc1.h"
+#endif /* (STM8S105) ||(STM8S103) || (STM8S903) || (STM8AF626x) || (STM8AF622x) */
+#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)
+ #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) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) */
+#if !defined(STM8S903) || !defined(STM8AF622x)
+ #include "stm8s_tim4.h"
+#endif /* (STM8S903) || (STM8AF622x) */
+#if defined(STM8S903) || defined(STM8AF622x)
+ #include "stm8s_tim5.h"
+ #include "stm8s_tim6.h"
+#endif /* (STM8S903) || (STM8AF622x) */
+#if defined(STM8S208) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S103) ||\
+ defined(STM8S003) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
+ #include "stm8s_uart1.h"
+#endif /* (STM8S208) || (STM8S207) || (STM8S103) || (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)
+ #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/serial-led/stm8s_it.h b/serial-led/stm8s_it.h
new file mode 100644
index 0000000..c5779ec
--- /dev/null
+++ b/serial-led/stm8s_it.h
@@ -0,0 +1,122 @@
+/**
+ ******************************************************************************
+ * @file stm8s_it.h
+ * @author MCD Application Team
+ * @version V2.2.0
+ * @date 30-September-2014
+ * @brief This file contains the headers of the interrupt handlers
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
+ *
+ * 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_ */
+
+#if !defined(_RAISONANCE_) && !defined(_SDCC_) // SDCC patch: interrupt keyword required after function
+ 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)
+ 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)
+ 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) || (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 (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8S903)
+ INTERRUPT void UART1_TX_IRQHandler(void); /* UART1 TX */
+ INTERRUPT void UART1_RX_IRQHandler(void); /* UART1 RX */
+#endif /* (STM8S208) || (STM8S207) || (STM8S903) || (STM8S103) || (STM8AF52Ax) || (STM8AF62Ax) */
+
+#if defined (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) || (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) || (STM8S208) || (STM8AF62Ax) || (STM8AF52Ax) */
+
+#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) || (STM8S208) || (STM8AF62Ax) || (STM8AF52Ax) */
+
+#if defined(STM8S903) || defined(STM8AF622x)
+ INTERRUPT void TIM6_UPD_OVF_TRG_IRQHandler(void); /* TIM6 UPD/OVF/TRG */
+#else /* (STM8S208) || (STM8S207) || (STM8S105) || (STM8S103) || (STM8AF62Ax) || (STM8AF52Ax) || (STM8AF626x) */
+ INTERRUPT void TIM4_UPD_OVF_IRQHandler(void); /* TIM4 UPD/OVF */
+#endif /* (STM8S903) || (STM8AF622x) */
+ INTERRUPT void EEPROM_EEC_IRQHandler(void); /* EEPROM ECC CORRECTION */
+#endif /* _RAISONANCE_ */
+
+#endif /* __STM8S_IT_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/spl.mk b/spl.mk
index fac0407..5fce4ba 100644
--- a/spl.mk
+++ b/spl.mk
@@ -24,6 +24,9 @@ include $(SPREADSTM8_PATH)/defines.mk
SPL_LIB = $(SPL_PATH)/Libraries/STM8S_StdPeriph_Driver
SPL_CFLAGS = -D$(SPL_MCU)
+ifdef F_XTAL
+ CFLAGS += -DHSE_VALUE="((uint32_t)$(F_XTAL))"
+endif
SPL_CFLAGS += -I$(SPL_LIB)/inc
SPL_CFLAGS += -I./
@@ -39,7 +42,7 @@ endif
OBJ = $(SRC:%.c=%.rel)
-libspl.a: $(OBJ)
+spl.lib: $(OBJ)
$(AR) $@ $(OBJ)
%.rel: %.c