Skip to content

Commit cb95f2c

Browse files
Initial Commit
0 parents  commit cb95f2c

File tree

345 files changed

+226232
-0
lines changed

Some content is hidden

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

345 files changed

+226232
-0
lines changed

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Arduino Core for STM32WB based boards
2+
3+
## What is it ?
4+
5+
ArduinoCore-stm32wb is targeted at ultra low power scenarios, sensor hubs, with BLE connectivity.
6+
7+
8+
## Supported boards
9+
10+
### Tlera Corp
11+
* [Firefly-STM32WB55CG](https://www.tindie.com/products/TleraCorp/firefly-stm32wb55-development-board)
12+
13+
### STMicroelectronics
14+
* [NUCLEO-WB55RG](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/stm32-nucleo-expansion-boards/p-nucleo-wb55.html)
15+
16+
17+
## Installing
18+
19+
### Board Manager
20+
21+
1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software) (at least version v1.6.13)
22+
2. Start the Arduino IDE
23+
3. Go into Preferences
24+
4. Add ```https://grumpyoldpizza.github.io/ArduinoCore-stm32wb/package_stm32wb_boards_index.json``` as an "Additional Board Manager URL"
25+
5. Open the Boards Manager from the Tools -> Board menu and install "Tlera Corp STM32WB Boards"
26+
6. Select your STM32WB board from the Tools -> Board menu
27+
28+
#### OS Specific Setup
29+
30+
##### Linux
31+
32+
1. Go to ~/.arduino15/packages/grumpyoldpizza/hardware/stm32wb/```<VERSION>```/drivers/linux/
33+
2. sudo cp *.rules /etc/udev/rules.d
34+
3. reboot
35+
36+
##### Windows
37+
38+
###### STM32 BOOTLOADER driver setup for Tlera Corp boards
39+
40+
1. Go to ~/AppData/Local/Arduino15/packages/grumpypoldpizza/hardware/stm32wb/```<VERSION>```/drivers/windows
41+
2. Right-click on ```STM32Bootloader.bat``` and select ```Run as administrator```
42+
43+
###### ST-LINK V2.1 driver setup for NUCLEO boards
44+
45+
1. Plugin NUCLEO board
46+
2. Download and install [ST-Link USB Drivers](http://www.st.com/en/embedded-software/stsw-link009.html)
47+
48+
### From git (for core development)
49+
50+
1. Follow steps from Board Manager section above
51+
2. ```cd <SKETCHBOOK>```, where ```<SKETCHBOOK>``` is your Arduino Sketch folder:
52+
* OS X: ```~/Documents/Arduino```
53+
* Linux: ```~/Arduino```
54+
* Windows: ```~/Documents/Arduino```
55+
3. Create a folder named ```hardware```, if it does not exist, and change directories to it
56+
4. Clone this repo: ```git clone https://github.com/grumpyoldpizza/ArduinoCore-stm32wb.git TleraCorp/stm32wb```
57+
5. Restart the Arduino IDE
58+
59+
## BLE / Wireless stack firmware installation
60+
61+
STM32WB uses encrypted/signed firmware images for the BLE stack. Please flash the ```FWUpdate``` sketch under the ```STM32WB``` examples before using BLE. The update will take up few seconds/minutes. During that time the LED will stay on, while the serial monitor will say disconnected. When done the LED will blink if the update was succesful, or simply be turned off if an error was encountered. The serial monitor should pop up again and report back the newly updated firmware versions. The ```FWInfo``` sketch can be used to verify what version is installed. At this time it should report back 1.10.0 for the BLE stack.
62+
63+
## Recovering from a faulty sketch for Tlera Corp Boards
64+
65+
Sometimes a faulty sketch can render the normal USB Serial based integration into the Arduindo IDE not working. In this case plugin the STM32WB board and toggle the RESET button while holding down the BOOT button and program a known to be working sketch to go ack to a working USB Serial setup.
66+
67+
## Credits
68+
69+
This core is based on the [Arduino SAMD Core](https://github.com/arduino/ArduinoCore-samd)
70+

boards.txt

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
menu.usb=USB Type
2+
menu.storage=Extenal Storage
3+
menu.speed=CPU Speed
4+
5+
##############################################################
6+
7+
# Tlera Firefly
8+
# ---------------------------------------
9+
Firefly-WB55CG.name=Firefly-WB55CG
10+
Firefly-WB55CG.vid.0=0x1209
11+
Firefly-WB55CG.pid.0=0x6671
12+
13+
Firefly-WB55CG.build.f_cpu=64000000L
14+
Firefly-WB55CG.build.board=STM32WB_FIREFLY
15+
Firefly-WB55CG.build.arch=stm32wb
16+
Firefly-WB55CG.build.core=arduino
17+
Firefly-WB55CG.build.mcu=cortex-m4
18+
Firefly-WB55CG.build.architecture=armv7e-m
19+
Firefly-WB55CG.build.fpu=fpv4-sp-d16
20+
Firefly-WB55CG.build.float-abi=hard
21+
Firefly-WB55CG.build.vid=0x1209
22+
Firefly-WB55CG.build.pid=0x6671
23+
Firefly-WB55CG.build.did=0x0100
24+
Firefly-WB55CG.build.usb_manufacturer="Tlera Corporation"
25+
Firefly-WB55CG.build.usb_product="Firefly"
26+
Firefly-WB55CG.build.extra_flags=-DSTM32WB55xx -fsingle-precision-constant "-D__SYSTEM_CORE_CLOCK__={build.f_cpu}" {build.usb_flags} {build.storage_flags}
27+
Firefly-WB55CG.build.ldscript=STM32WB55xx_FLASH.ld
28+
Firefly-WB55CG.build.openocdscript=openocd_scripts/firefly-wb55cg.cfg
29+
Firefly-WB55CG.build.variant=Firefly-WB55CG
30+
Firefly-WB55CG.build.variant_system_libs="-L{runtime.platform.path}/system/STM32WBxx/Lib" "-L{runtime.platform.path}/system/CMSIS/DSP/Lib" -lstm32wb55xx -larm_cortexM4lf_math
31+
Firefly-WB55CG.build.variant_system_include="-I{runtime.platform.path}/system/CMSIS/Include" "-I{runtime.platform.path}/system/CMSIS/DSP/Include" "-I{runtime.platform.path}/system/CMSIS/Device/ST/STM32WBxx/Include" "-I{runtime.platform.path}/system/STM32WBxx/Include"
32+
33+
Firefly-WB55CG.upload.tool=dfu-util
34+
Firefly-WB55CG.upload.protocol=dfu
35+
Firefly-WB55CG.upload.address=0x08000000
36+
Firefly-WB55CG.upload.interface=0
37+
Firefly-WB55CG.upload.vid=0x1209
38+
Firefly-WB55CG.upload.pid=0x6671
39+
Firefly-WB55CG.upload.use_1200bps_touch=false
40+
Firefly-WB55CG.upload.wait_for_upload_port=false
41+
Firefly-WB55CG.upload.native_usb=true
42+
Firefly-WB55CG.upload.maximum_size=786432
43+
Firefly-WB55CG.upload.maximum_data_size=196608
44+
45+
Firefly-WB55CG.menu.usb.cdc=Serial
46+
Firefly-WB55CG.menu.usb.cdc.build.usb_type=1
47+
Firefly-WB55CG.menu.usb.cdc_msc=Serial + Mass Storage
48+
Firefly-WB55CG.menu.usb.cdc_msc.build.usb_type=2
49+
Firefly-WB55CG.menu.usb.none=No USB
50+
Firefly-WB55CG.menu.usb.none.build.usb_type=0
51+
52+
Firefly-WB55CG.menu.storage.none=None
53+
Firefly-WB55CG.menu.storage.none.build.storage_type=0
54+
Firefly-WB55CG.menu.storage.sflash=SFLASH
55+
Firefly-WB55CG.menu.storage.sflash.build.storage_type=1
56+
Firefly-WB55CG.menu.storage.sdspi=SDCARD
57+
Firefly-WB55CG.menu.storage.sdspi.build.storage_type=2
58+
59+
Firefly-WB55CG.menu.speed.64=64 MHz
60+
Firefly-WB55CG.menu.speed.64.build.f_cpu=64000000L
61+
Firefly-WB55CG.menu.speed.32=32 MHz
62+
Firefly-WB55CG.menu.speed.32.build.f_cpu=32000000L
63+
Firefly-WB55CG.menu.speed.16=16 MHz (No USB)
64+
Firefly-WB55CG.menu.speed.16.build.f_cpu=16000000L
65+
Firefly-WB55CG.menu.speed.2=2 MHz (No USB)
66+
Firefly-WB55CG.menu.speed.2.build.f_cpu=2000000L
67+
68+
# ---------------------------------------
69+
# Tlera Katydid
70+
# ---------------------------------------
71+
Katydid-WB55CG.name=Katydid-WB55CG
72+
Katydid-WB55CG.vid.0=0x1209
73+
Katydid-WB55CG.pid.0=0x6672
74+
75+
Katydid-WB55CG.build.f_cpu=64000000L
76+
Katydid-WB55CG.build.board=STM32WB_KATYDID
77+
Katydid-WB55CG.build.arch=stm32wb
78+
Katydid-WB55CG.build.core=arduino
79+
Katydid-WB55CG.build.mcu=cortex-m4
80+
Katydid-WB55CG.build.architecture=armv7e-m
81+
Katydid-WB55CG.build.fpu=fpv4-sp-d16
82+
Katydid-WB55CG.build.float-abi=hard
83+
Katydid-WB55CG.build.vid=0x1209
84+
Katydid-WB55CG.build.pid=0x6672
85+
Katydid-WB55CG.build.did=0x0100
86+
Katydid-WB55CG.build.usb_manufacturer="Tlera Corporation"
87+
Katydid-WB55CG.build.usb_product="Katydid"
88+
Katydid-WB55CG.build.extra_flags=-DSTM32WB55xx -fsingle-precision-constant "-D__SYSTEM_CORE_CLOCK__={build.f_cpu}" {build.usb_flags}
89+
Katydid-WB55CG.build.ldscript=STM32WB55xx_FLASH.ld
90+
Katydid-WB55CG.build.openocdscript=openocd_scripts/firefly-wb55cg.cfg
91+
Katydid-WB55CG.build.variant=Katydid-WB55CG
92+
Katydid-WB55CG.build.variant_system_libs="-L{runtime.platform.path}/system/STM32WBxx/Lib" "-L{runtime.platform.path}/system/CMSIS/DSP/Lib" -lstm32wb55xx -larm_cortexM4lf_math
93+
Katydid-WB55CG.build.variant_system_include="-I{runtime.platform.path}/system/CMSIS/Include" "-I{runtime.platform.path}/system/CMSIS/DSP/Include" "-I{runtime.platform.path}/system/CMSIS/Device/ST/STM32WBxx/Include" "-I{runtime.platform.path}/system/STM32WBxx/Include"
94+
95+
Katydid-WB55CG.upload.tool=dfu-util
96+
Katydid-WB55CG.upload.protocol=dfu
97+
Katydid-WB55CG.upload.address=0x08000000
98+
Katydid-WB55CG.upload.interface=0
99+
Katydid-WB55CG.upload.vid=0x1209
100+
Katydid-WB55CG.upload.pid=0x6672
101+
Katydid-WB55CG.upload.use_1200bps_touch=false
102+
Katydid-WB55CG.upload.wait_for_upload_port=false
103+
Katydid-WB55CG.upload.native_usb=true
104+
Katydid-WB55CG.upload.maximum_size=786432
105+
Katydid-WB55CG.upload.maximum_data_size=196608
106+
107+
Katydid-WB55CG.menu.usb.cdc=Serial
108+
Katydid-WB55CG.menu.usb.cdc.build.usb_type=1
109+
Katydid-WB55CG.menu.usb.cdc_msc=Serial + Mass Storage
110+
Katydid-WB55CG.menu.usb.cdc_msc.build.usb_type=2
111+
Katydid-WB55CG.menu.usb.none=No USB
112+
Katydid-WB55CG.menu.usb.none.build.usb_type=0
113+
114+
Katydid-WB55CG.menu.speed.64=64 MHz
115+
Katydid-WB55CG.menu.speed.64.build.f_cpu=64000000L
116+
Katydid-WB55CG.menu.speed.32=32 MHz
117+
Katydid-WB55CG.menu.speed.32.build.f_cpu=32000000L
118+
Katydid-WB55CG.menu.speed.16=16 MHz (No USB)
119+
Katydid-WB55CG.menu.speed.16.build.f_cpu=16000000L
120+
Katydid-WB55CG.menu.speed.2=2 MHz (No USB)
121+
Katydid-WB55CG.menu.speed.2.build.f_cpu=2000000L
122+
123+
124+
# ST Nucleo
125+
# ---------------------------------------
126+
NUCLEO-WB55RG.name=NUCLEO-WB55RG
127+
NUCLEO-WB55RG.vid.0=0x0483
128+
NUCLEO-WB55RG.pid.0=0x374b
129+
130+
NUCLEO-WB55RG.build.f_cpu=64000000L
131+
NUCLEO-WB55RG.build.board=STM32WB_NUCLEO
132+
NUCLEO-WB55RG.build.arch=stm32wb
133+
NUCLEO-WB55RG.build.core=arduino
134+
NUCLEO-WB55RG.build.mcu=cortex-m4
135+
NUCLEO-WB55RG.build.architecture=armv7e-m
136+
NUCLEO-WB55RG.build.fpu=fpv4-sp-d16
137+
NUCLEO-WB55RG.build.float-abi=hard
138+
NUCLEO-WB55RG.build.extra_flags=-DSTM32WB55xx -fsingle-precision-constant "-D__SYSTEM_CORE_CLOCK__={build.f_cpu}" {build.storage_flags}
139+
NUCLEO-WB55RG.build.ldscript=STM32WB55xx_FLASH.ld
140+
NUCLEO-WB55RG.build.openocdscript=openocd_scripts/nucleo-wb55rg.cfg
141+
NUCLEO-WB55RG.build.variant=NUCLEO-WB55RG
142+
NUCLEO-WB55RG.build.variant_system_libs="-L{runtime.platform.path}/system/STM32WBxx/Lib" "-L{runtime.platform.path}/system/CMSIS/DSP/Lib" -lstm32wb55xx -larm_cortexM4lf_math
143+
NUCLEO-WB55RG.build.variant_system_include="-I{runtime.platform.path}/system/CMSIS/Include" "-I{runtime.platform.path}/system/CMSIS/DSP/Include" "-I{runtime.platform.path}/system/CMSIS/Device/ST/STM32WBxx/Include" "-I{runtime.platform.path}/system/STM32WBxx/Include"
144+
145+
NUCLEO-WB55RG.upload.tool=openocd
146+
NUCLEO-WB55RG.upload.protocol=stlink
147+
NUCLEO-WB55RG.upload.use_1200bps_touch=false
148+
NUCLEO-WB55RG.upload.wait_for_upload_port=false
149+
NUCLEO-WB55RG.upload.native_usb=false
150+
NUCLEO-WB55RG.upload.maximum_size=786432
151+
NUCLEO-WB55RG.upload.maximum_data_size=196608
152+
153+
NUCLEO-WB55RG.menu.storage.none=None
154+
NUCLEO-WB55RG.menu.storage.none.build.storage_type=0
155+
NUCLEO-WB55RG.menu.storage.sflash=SFLASH
156+
NUCLEO-WB55RG.menu.storage.sflash.build.storage_type=1
157+
NUCLEO-WB55RG.menu.storage.sdspi=SDCARD
158+
NUCLEO-WB55RG.menu.storage.sdspi.build.storage_type=2
159+
160+
NUCLEO-WB55RG.menu.speed.64=64 MHz
161+
NUCLEO-WB55RG.menu.speed.64.build.f_cpu=64000000L
162+
NUCLEO-WB55RG.menu.speed.32=32 MHz
163+
NUCLEO-WB55RG.menu.speed.32.build.f_cpu=32000000L
164+
NUCLEO-WB55RG.menu.speed.16=16 MHz (No USB)
165+
NUCLEO-WB55RG.menu.speed.16.build.f_cpu=16000000L
166+
NUCLEO-WB55RG.menu.speed.2=2 MHz (No USB)
167+
NUCLEO-WB55RG.menu.speed.2.build.f_cpu=2000000L

cores/arduino/Arduino.h

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2014 Arduino LLC. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef Arduino_h
21+
#define Arduino_h
22+
23+
#include <stdbool.h>
24+
#include <stdint.h>
25+
#include <stdlib.h>
26+
#include <string.h>
27+
#include <math.h>
28+
29+
typedef bool boolean;
30+
typedef uint8_t byte;
31+
typedef uint16_t word;
32+
33+
// some libraries and sketches depend on this AVR stuff,
34+
// assuming Arduino.h or WProgram.h automatically includes it...
35+
//
36+
#include "avr/pgmspace.h"
37+
#include "avr/interrupt.h"
38+
#include "avr/io.h"
39+
40+
#include "binary.h"
41+
#include "itoa.h"
42+
43+
#ifdef __cplusplus
44+
extern "C"{
45+
#endif // __cplusplus
46+
47+
#define ARM_MATH_CM4
48+
#include "armv7m.h"
49+
#include "stm32wbxx.h"
50+
#undef STM32WB
51+
#undef DAC1
52+
#undef RTC
53+
#undef SPI1
54+
#undef SPI2
55+
#undef SPI3
56+
57+
#include "wiring_constants.h"
58+
59+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
60+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
61+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
62+
63+
void yield( void ) ;
64+
65+
/* system functions */
66+
int main( void );
67+
void init( void );
68+
69+
/* sketch */
70+
void setup( void ) ;
71+
void loop( void ) ;
72+
73+
#include "WVariant.h"
74+
75+
#ifdef __cplusplus
76+
} // extern "C"
77+
#endif
78+
79+
// The following headers are for C++ only compilation
80+
#ifdef __cplusplus
81+
#include "Callback.h"
82+
#include "Tone.h"
83+
#include "HardwareSerial.h"
84+
#include "WCharacter.h"
85+
#include "WMath.h"
86+
#include "WString.h"
87+
#endif
88+
#include "delay.h"
89+
90+
// Include board variant
91+
#include "variant.h"
92+
93+
#include "wiring.h"
94+
#include "wiring_digital.h"
95+
#include "wiring_analog.h"
96+
#include "wiring_shift.h"
97+
#include "wiring_pulse.h"
98+
#include "WInterrupts.h"
99+
100+
// undefine stdlib's abs if encountered
101+
#ifdef abs
102+
#undef abs
103+
#endif // abs
104+
105+
#define min(a,b) ((a)<(b)?(a):(b))
106+
#define max(a,b) ((a)>(b)?(a):(b))
107+
#define abs(x) ((x)>0?(x):-(x))
108+
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
109+
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
110+
#define radians(deg) ((deg)*DEG_TO_RAD)
111+
#define degrees(rad) ((rad)*RAD_TO_DEG)
112+
#define sq(x) ((x)*(x))
113+
114+
#define interrupts() __enable_irq()
115+
#define noInterrupts() __disable_irq()
116+
117+
#define lowByte(w) ((uint8_t) ((w) & 0xff))
118+
#define highByte(w) ((uint8_t) ((w) >> 8))
119+
120+
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
121+
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
122+
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
123+
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
124+
125+
#define bit(b) (1UL << (b))
126+
127+
#endif // Arduino_h

0 commit comments

Comments
 (0)