Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,38 @@ Nucleo_8L152R8.menu.upload_method.stm8Flasher=stm8Flasher
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher

################################################################################
# STM8L151Gx
XMOTO_8L151G4.name=XMOTO_8L151G4

XMOTO_8L151G4.build.core=arduino
XMOTO_8L151G4.build.board=XMOTO_8L151G4
XMOTO_8L151G4.build.extra_flags=-d{build.product_line} {build.xSerial}

# XMOTO_8L151G4 board
# Support: Serial1 (USART1 on PA2, PA3)
XMOTO_8L151G4=XMOTO_8L151G4
XMOTO_8L151G4.device=STM8L15xG4
XMOTO_8L151G4.node=NODE_8L151
XMOTO_8L151G4.upload.maximum_size=32768
XMOTO_8L151G4.upload.maximum_data_size=2048
XMOTO_8L151G4.build.mcu=8-bit
XMOTO_8L151G4.build.board=XMOTO_8L151G4
XMOTO_8L151G4.build.series=STM8Lxx
XMOTO_8L151G4.build.splibraryPrefix=_StdPeriph_Driver
XMOTO_8L151G4.build.product_line=STM8L15X_HD
XMOTO_8L151G4.build.variant=XMOTO_8L151G4
XMOTO_8L151G4.build.f_cpu=16000000

XMOTO_8L151G4.menu.upload_method.MassStorage=Mass Storage
XMOTO_8L151G4.menu.upload_method.MassStorage.upload.protocol=
XMOTO_8L151G4.menu.upload_method.MassStorage.upload.tool=massStorageCopy

XMOTO_8L151G4.menu.upload_method.stm8Flasher=stm8Flasher
XMOTO_8L151G4.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
XMOTO_8L151G4.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher


################################################################################
# Serialx activation
Nucleo_8S208RB.menu.xserial.generic=Enabled with generic Serial
Expand Down
158 changes: 158 additions & 0 deletions variants/XMOTO_8L151G4/PeripheralPins.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/*
*******************************************************************************
* Copyright (c) 2018, 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.
*******************************************************************************
* Automatically generated from STM8L152R8Tx.xml
*/
#include "Arduino.h"
#include "PeripheralPins.h"

/* =====
* Note: Commented lines are alternative possibilities which are not used per default.
* If you change them, you will have to know what you do
* =====
*/

//*** ADC ***

#if !defined(NO_HWADC)
const PinMap PinMap_ADC[] = {
{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 2, 0)}, // ADC1_IN2
{PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 1, 0)}, // ADC1_IN1
{PB_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 16, 0)}, // ADC1_IN16
{PB_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 15, 0)}, // ADC1_IN15
{PB_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 14, 0)}, // ADC1_IN14
{PB_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 13, 0)}, // ADC1_IN13
{PB_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 12, 0)}, // ADC1_IN12
{PB_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 11, 0)}, // ADC1_IN11
{PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 6, 0)}, // ADC1_IN6
{PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 5, 0)}, // ADC1_IN5
{PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 4, 0)}, // ADC1_IN4
{PC_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 3, 0)}, // ADC1_IN3
{PD_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 22, 0)}, // ADC1_IN22
{PD_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 21, 0)}, // ADC1_IN21
{PD_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 19, 0)}, // ADC1_IN19
{NC, NP, 0}
};
#endif

//*** DAC ***

#if !defined(NO_HWDAC)
const PinMap PinMap_DAC[] = {
{PB_4, DAC, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_Mode_In_FL_No_IT, 0, 1, 0)}, // DAC_OUT
{NC, NP, 0}
};
#endif

//*** I2C ***

#if !defined(NO_HWI2C)
const PinMap PinMap_I2C_SDA[] = {
{PC_0, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_Mode_In_FL_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

#if !defined(NO_HWI2C)
const PinMap PinMap_I2C_SCL[] = {
{PC_1, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_Mode_In_FL_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

//*** PWM ***

#if !defined(NO_HWTIM)
const PinMap PinMap_PWM[] = {
{PB_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 1, 0)}, // TIM2_CH1
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 1, 0)}, // TIM3_CH1
{PB_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 2, 0)}, // TIM2_CH2
{PD_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 2, 0)}, // TIM3_CH2
{PD_2, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 1, 0)}, // TIM1_CH1
{PD_4, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 2, 0)}, // TIM1_CH2
{PD_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 3, 0)}, // TIM1_CH3
{PB_3, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_NONE, 1, 1)}, // TIM1_CH1N
{NC, NP, 0}
};
#endif

//*** SERIAL ***

#if !defined(NO_HWSERIAL)
const PinMap PinMap_UART_TX[] = {
{PA_2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_Out_PP_Low_Fast, AFIO_USART1_PORTA_ENABLE)},
{NC, NP, 0}
};
#endif

#if !defined(NO_HWSERIAL)
const PinMap PinMap_UART_RX[] = {
{PA_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_In_PU_No_IT, AFIO_USART1_PORTA_ENABLE)},
{NC, NP, 0}
};
#endif

//*** SPI ***

#if !defined(NO_HWSPI)
const PinMap PinMap_SPI_MOSI[] = {
{PB_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_In_PU_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

#if !defined(NO_HWSPI)
const PinMap PinMap_SPI_MISO[] = {
{PB_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_In_PU_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

#if !defined(NO_HWSPI)
const PinMap PinMap_SPI_SCLK[] = {
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_In_PU_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

#if !defined(NO_HWSPI)
const PinMap PinMap_SPI_SSEL[] = {
{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_Mode_In_PU_No_IT, AFIO_NONE)},
{NC, NP, 0}
};
#endif

//*** CAN ***

//*** No CAN_RD ***

//*** No CAN_TD ***

//*** QUADSPI ***

//*** No QUADSPI ***
27 changes: 27 additions & 0 deletions variants/XMOTO_8L151G4/lkfscript.lkf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# link command file for STM8S105C6
# Copyright (c) 2017 by COSMIC Software
#
+seg .vector -b0x8000 -m0x8000 -n .vector -cs code -k # interrupt and rest vectors
+seg .const -a .vector -n .const # constants follow vectors
+seg ._construct_ -a .const -n .construct -k # constructor table
+seg .text -a .construct -n .text # code follow constants
+seg .eeprom -b 0x1000 -m 0x800 -cs eeprom # internal eeprom
+seg .bsct -b 0x0 -m 0x100 -n .bsct -cs data # internal ram
+seg .ubsct -a .bsct -n .ubsct
+seg .bit -a .ubsct -n .bit -id
+seg .data -a .bit -m 0xcff -n .data
+seg .bss -a .data -n .bss
crtspi0.sm8
@*
libcppsl0.sm8
libfsl0.sm8
libisl0.sm8
libll.sm8
libm0.sm8
+def __memory=@.bss
+def __endzp=@.ubsct
+def __stack=0xfff
+def __startmem=@.bss
+def __endmem=0xdfe
+def __ctorstart=start(.construct)
+def __ctorend=end(.construct)
91 changes: 91 additions & 0 deletions variants/XMOTO_8L151G4/stm8l15x_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
******************************************************************************
* @file Project/STM8L15x_StdPeriph_Template/stm8l15x_conf.h
* @author MCD Application Team
* @version V1.6.1
* @date 10-August-2018
* @brief Library configuration file.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2018 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 __STM8L15x_CONF_H
#define __STM8L15x_CONF_H

/* Includes ------------------------------------------------------------------*/
#include "stm8l15x.h"

/* Uncomment the line below to enable peripheral header file inclusion */
#include "stm8l15x_adc.h"
#include "stm8l15x_aes.h"
#include "stm8l15x_beep.h"
#include "stm8l15x_clk.h"
#include "stm8l15x_comp.h"
#include "stm8l15x_dac.h"
#include "stm8l15x_dma.h"
#include "stm8l15x_exti.h"
#include "stm8l15x_flash.h"
#include "stm8l15x_gpio.h"
#include "stm8l15x_i2c.h"
#include "stm8l15x_irtim.h"
#include "stm8l15x_itc.h"
#include "stm8l15x_iwdg.h"
#include "stm8l15x_lcd.h"
#include "stm8l15x_pwr.h"
#include "stm8l15x_rst.h"
#include "stm8l15x_rtc.h"
#include "stm8l15x_spi.h"
#include "stm8l15x_syscfg.h"
#include "stm8l15x_tim1.h"
#include "stm8l15x_tim2.h"
#include "stm8l15x_tim3.h"
#include "stm8l15x_tim4.h"
#include "stm8l15x_tim5.h"
#include "stm8l15x_usart.h"
#include "stm8l15x_wfe.h"
#include "stm8l15x_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 /* __STM8L15x_CONF_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
63 changes: 63 additions & 0 deletions variants/XMOTO_8L151G4/stm8l15x_it.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
******************************************************************************
* @file Project/STM8L15x_StdPeriph_Template/stm8l15x_it.c
* @author MCD Application Team
* @version V1.6.1
* @date 30-September-2014
* @brief Main Interrupt Service Routines.
* This file provides template for all peripherals interrupt service routine.
******************************************************************************
* @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.
*
******************************************************************************
*/

/* Includes ------------------------------------------------------------------*/
#include "stm8_it.h"

#ifdef __cplusplus
extern "C" {
#endif


/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Public functions ----------------------------------------------------------*/

#ifdef _COSMIC_
extern void _stext(); /* startup routine */

#pragma section const {vector}

void (* const @vector _vectab[32])() = {
_stext, /* RESET */
I2C1_SPI2_IRQHandler
};
#endif
/**
* @}
*/
#ifdef __cplusplus
}
#endif


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Loading