Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit 413cdae

Browse files
ridhaosWi6labsVVESTM
authored andcommitted
Update cores folder
Update cores files to work with STM8 architecture and compile with cosmic. Signed-off-by: Ridha Noomane <ridha.noomane@wi6labs.com> Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent d3e77c1 commit 413cdae

54 files changed

Lines changed: 1708 additions & 1471 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1-
# Arduino_Core_STM8
2-
STM8 core support for Arduino
1+
# Arduino core support for STM8 based boards
2+
[![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM8.svg)](https://github.com/stm32duino/Arduino_Core_STM8/releases/latest)
3+
4+
* [Introduction](https://github.com/stm32duino/Arduino_Core_STM8#Introduction)<br>
5+
* [Getting Started](https://github.com/stm32duino/Arduino_Core_STM8#getting-started)<br>
6+
* [Boards available](https://github.com/stm32duino/Arduino_Core_STM8#boards-available)<br>
7+
* [Troubleshooting](https://github.com/stm32duino/Arduino_Core_STM8#troubleshooting)<br>
8+
* [Wiki](https://github.com/stm32duino/wiki/wiki/)
9+
10+
## Introduction
11+
12+
This repo adds the support of STM8 architecture in Arduino IDE.<br>
13+
14+
This porting is based on several external components :
15+
* STMicroelectronics Standard Peripheral Libraries (SPL)
16+
* [SPL for STM8L](https://www.st.com/en/embedded-software/stsw-stm8016.html)
17+
* [SPL for STM8S](https://www.st.com/en/embedded-software/stsw-stm8069.html)
18+
* Cosmic compiler, allowing to compile c++ source code on stm8 family (http://www.cosmic-software.com/)
19+
20+
For now, the solution is running on Windows only.
21+
22+
## Getting Started
23+
24+
This repo is available as a package usable with [Arduino Boards Manager](https://www.arduino.cc/en/guide/cores).
25+
26+
Use this link in the "*Additional Boards Managers URLs*" field:
27+
28+
https://github.com/stm32duino/BoardManagerFiles/raw/master/STM8/package_stm8_index.json
29+
30+
For full instructions on using the "**Boards Manager**", see the [Getting Started](https://github.com/stm32duino/wiki/wiki/Getting-Started) page.
31+
32+
For advanced user, you can use the repository: see the [Using git repository](https://github.com/stm32duino/wiki/wiki/Using-git-repository) page.
33+
34+
## Boards available
35+
* STM8L
36+
* [Nucleo STM8L152R8](https://www.st.com/en/evaluation-tools/nucleo-8l152r8.html)
37+
38+
* STM8S
39+
* [Nucleo STM8S208RB](https://www.st.com/en/evaluation-tools/nucleo-8s208rb.html)
40+
41+
42+
## Troubleshooting and known issues
43+
44+
Please note that this is a new core using a new compiler. You may face some issues with libraries compatibility.<br>
45+
We have several known issues :
46+
* Windows 10:
47+
*Board binary may be corrupted when plugged on a Windows 10 machine.
48+
To ensure compatibility with Windows 10, please upgrade STLink with revision 2.32.22 or higher (estimated availability October 1st).*
49+
* Endianness:
50+
*STM8 microcontrollers are natively Big Endian whereas Arduino boards and STM32 microcontrollers are Little Endian.
51+
By default, some libraries don't handle endianess, therefore these won't be directly compatible with STM8 (this is the case of SD library for example).*
52+
53+
If you have any issue, you could [file an issue on Github](https://github.com/stm32duino/Arduino_Core_STM8/issues/new).
54+
55+
If you have a question about compiler, you can also send a mail to Cosmic support : [send a mail to Cosmic support](mailto:support@cosmic.fr)
356

cores/arduino/Arduino.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@
2020
#ifndef Arduino_h
2121
#define Arduino_h
2222

23-
#ifndef GCC_VERSION
24-
#define GCC_VERSION (__GNUC__ * 10000 \
25-
+ __GNUC_MINOR__ * 100 \
26-
+ __GNUC_PATCHLEVEL__)
27-
#endif
28-
#if GCC_VERSION < 60300
29-
#error "GCC version 6.3 or higher is required"
30-
#endif
31-
3223
#include "wiring.h"
3324

3425
/* sketch */
@@ -38,8 +29,8 @@ extern "C"{
3829
#endif // __cplusplus
3930
extern void setup( void ) ;
4031
extern void loop( void ) ;
41-
42-
void yield(void);
32+
extern void initVariant(void);
33+
extern void yield(void);
4334
#ifdef __cplusplus
4435
} // extern "C"
4536
#endif // __cplusplus

cores/arduino/Client.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
#include "Stream.h"
2424
#include "IPAddress.h"
2525

26-
class Client : public Stream {
26+
class Client : public Stream
27+
{
2728

2829
public:
29-
virtual int connect(IPAddress ip, uint16_t port) =0;
30-
virtual int connect(const char *host, uint16_t port) =0;
31-
virtual size_t write(uint8_t) =0;
32-
virtual size_t write(const uint8_t *buf, size_t size) =0;
30+
virtual int connect(IPAddress ip, uint16_t port) = 0;
31+
virtual int connect(const char *host, uint16_t port) = 0;
32+
virtual size_t write(uint8_t) = 0;
33+
virtual size_t write(const uint8_t *buf, size_t size) = 0;
3334
virtual int available() = 0;
3435
virtual int read() = 0;
3536
virtual int read(uint8_t *buf, size_t size) = 0;
@@ -38,8 +39,9 @@ class Client : public Stream {
3839
virtual void stop() = 0;
3940
virtual uint8_t connected() = 0;
4041
virtual operator bool() = 0;
42+
4143
protected:
42-
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
44+
uint8_t *rawIPAddress(IPAddress &addr) { return addr.raw_address(); };
4345
};
4446

4547
#endif

0 commit comments

Comments
 (0)