Skip to content

Commit 34210cc

Browse files
committed
First generic STM32 core version
No static lib Official CMSIS sources provided thanks a package dependency Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 855fe71 commit 34210cc

File tree

1,014 files changed

+775592
-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.

1,014 files changed

+775592
-0
lines changed

boards.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
3+
menu.upload_method=Upload method
4+
5+
################################################################################
6+
# NUCLEO_F429ZI board
7+
8+
NUCLEO_F429ZI.name=Nucleo F429ZI
9+
10+
NUCLEO_F429ZI.vid.0=0x0483
11+
NUCLEO_F429ZI.pid.0=0x5711
12+
NUCLEO_F429ZI.node=NODE_F429ZI
13+
14+
NUCLEO_F429ZI.upload.tool=nucleoFlasher
15+
NUCLEO_F429ZI.upload.protocol=nucleoFlasher
16+
NUCLEO_F429ZI.upload.maximum_size=2097151
17+
NUCLEO_F429ZI.upload.maximum_data_size=262144
18+
19+
NUCLEO_F429ZI.build.mcu=cortex-m4
20+
NUCLEO_F429ZI.build.f_cpu=16000000L
21+
NUCLEO_F429ZI.build.vid=0x0483
22+
NUCLEO_F429ZI.build.pid=0x5711
23+
NUCLEO_F429ZI.build.usb_product="NUCLEO-F429ZI"
24+
NUCLEO_F429ZI.build.board=NUCLEO_F429ZI
25+
NUCLEO_F429ZI.build.series=STM32F4xx
26+
NUCLEO_F429ZI.build.core=arduino
27+
NUCLEO_F429ZI.build.ldscript=linker_scripts/gcc/STM32F429ZI_FLASH.ld
28+
NUCLEO_F429ZI.build.variant=STM32F429ZI_Nucleo
29+
NUCLEO_F429ZI.build.cmsis_lib_gcc=arm_cortexM4l_math
30+
#To enable USB add '-DUSBCON'
31+
#To enable HID (keyboard and mouse support) add also '-DUSBD_USE_HID_COMPOSITE'
32+
NUCLEO_F429ZI.build.extra_flags=-DSTM32F429xx {build.usb_flags}
33+
34+
NUCLEO_F429ZI.menu.upload_method.MassStorageMethod=Mass Storage
35+
NUCLEO_F429ZI.menu.upload_method.MassStorageMethod.upload.protocol=
36+
NUCLEO_F429ZI.menu.upload_method.MassStorageMethod.upload.tool=nucleoFlasher
37+
38+
NUCLEO_F429ZI.menu.upload_method.STLinkMethod=STLink
39+
NUCLEO_F429ZI.menu.upload_method.STLinkMethod.upload.protocol=STLink
40+
NUCLEO_F429ZI.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
41+
42+
################################################################################
43+
# DISCO_F407VG board
44+
45+
DISCO_F407VG.name=STM32F407G-DISC1
46+
47+
DISCO_F407VG.vid.0=0x0483
48+
DISCO_F407VG.pid.0=0x5712B
49+
DISCO_F407VG.node=DIS_F407VG
50+
51+
DISCO_F407VG.upload.tool=nucleoFlasher
52+
DISCO_F407VG.upload.protocol=nucleoFlasher
53+
DISCO_F407VG.upload.maximum_size=1048576
54+
DISCO_F407VG.upload.maximum_data_size=196608
55+
56+
DISCO_F407VG.build.mcu=cortex-m4
57+
DISCO_F407VG.build.f_cpu=16000000L
58+
DISCO_F407VG.build.vid=0x0483
59+
DISCO_F407VG.build.pid=0x5712B
60+
DISCO_F407VG.build.usb_product="DISCO-F407G"
61+
DISCO_F407VG.build.board=DISCO_F407VG
62+
DISCO_F407VG.build.series=STM32F4xx
63+
DISCO_F407VG.build.core=arduino
64+
DISCO_F407VG.build.ldscript=linker_scripts/gcc/STM32F407VGTx_FLASH.ld
65+
DISCO_F407VG.build.variant=STM32F407VG_Disco
66+
DISCO_F407VG.build.cmsis_lib_gcc=arm_cortexM4l_math
67+
68+
#To enable USB add '-DUSBCON'
69+
#To enable HID (keyboard and mouse support) add also '-DUSBD_USE_HID_COMPOSITE'
70+
DISCO_F407VG.build.extra_flags=-DSTM32F407xx {build.usb_flags}
71+
72+
DISCO_F407VG.menu.upload_method.MassStorageMethod=Mass Storage
73+
DISCO_F407VG.menu.upload_method.MassStorageMethod.upload.protocol=
74+
DISCO_F407VG.menu.upload_method.MassStorageMethod.upload.tool=nucleoFlasher
75+
76+
DISCO_F407VG.menu.upload_method.STLinkMethod=STLink
77+
DISCO_F407VG.menu.upload_method.STLinkMethod.upload.protocol=STLink
78+
DISCO_F407VG.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
79+
80+
################################################################################

cores/arduino/Arduino.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. 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 <stdint.h>
24+
#include <stdlib.h>
25+
#include <stdbool.h>
26+
#include <string.h>
27+
#include <math.h>
28+
29+
#include "binary.h"
30+
#include "itoa.h"
31+
32+
#ifdef __cplusplus
33+
extern "C"{
34+
#endif // __cplusplus
35+
36+
// Includes CMSIS
37+
#include <chip.h>
38+
39+
#include "wiring_constants.h"
40+
41+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
42+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
43+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
44+
45+
void yield(void);
46+
47+
/* sketch */
48+
extern void setup( void ) ;
49+
extern void loop( void ) ;
50+
51+
/* Define attribute */
52+
#if defined ( __CC_ARM ) /* Keil uVision 4 */
53+
#define WEAK (__attribute__ ((weak)))
54+
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
55+
#define WEAK __weak
56+
#elif defined ( __GNUC__ ) /* GCC CS */
57+
#define WEAK __attribute__ ((weak))
58+
#endif
59+
60+
#ifdef __cplusplus
61+
} // extern "C"
62+
#endif // __cplusplus
63+
64+
#ifdef __cplusplus
65+
#include "WCharacter.h"
66+
#include "WString.h"
67+
#include "Tone.h"
68+
#include "WMath.h"
69+
#include "HardwareSerial.h"
70+
#include "wiring_pulse.h"
71+
#endif // __cplusplus
72+
73+
74+
// Include board variant
75+
#include "variant.h"
76+
77+
#include "wiring.h"
78+
#include "wiring_digital.h"
79+
#include "wiring_analog.h"
80+
#include "wiring_shift.h"
81+
#include "WInterrupts.h"
82+
83+
#endif // Arduino_h

cores/arduino/Client.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Client.h - Base class that provides Client
3+
Copyright (c) 2011 Adrian McEwen. 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 client_h
21+
#define client_h
22+
#include "Print.h"
23+
#include "Stream.h"
24+
#include "IPAddress.h"
25+
26+
class Client : public Stream {
27+
28+
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;
33+
virtual int available() = 0;
34+
virtual int read() = 0;
35+
virtual int read(uint8_t *buf, size_t size) = 0;
36+
virtual int peek() = 0;
37+
virtual void flush() = 0;
38+
virtual void stop() = 0;
39+
virtual uint8_t connected() = 0;
40+
virtual operator bool() = 0;
41+
protected:
42+
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
43+
};
44+
45+
#endif

cores/arduino/HardwareSerial.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef HardwareSerial_h
20+
#define HardwareSerial_h
21+
22+
#include <inttypes.h>
23+
24+
#include "Stream.h"
25+
26+
class HardwareSerial : public Stream
27+
{
28+
public:
29+
virtual void begin(unsigned long);
30+
virtual void end();
31+
virtual int available(void) = 0;
32+
virtual int peek(void) = 0;
33+
virtual int read(void) = 0;
34+
virtual void flush(void) = 0;
35+
virtual size_t write(uint8_t) = 0;
36+
using Print::write; // pull in write(str) and write(buf, size) from Print
37+
virtual operator bool() = 0;
38+
};
39+
40+
extern void serialEventRun(void) __attribute__((weak));
41+
42+
#endif

cores/arduino/IPAddress.cpp

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
IPAddress.cpp - Base class that provides IPAddress
3+
Copyright (c) 2011 Adrian McEwen. 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+
#include <Arduino.h>
21+
#include <IPAddress.h>
22+
23+
IPAddress::IPAddress()
24+
{
25+
_address.dword = 0;
26+
}
27+
28+
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
29+
{
30+
_address.bytes[0] = first_octet;
31+
_address.bytes[1] = second_octet;
32+
_address.bytes[2] = third_octet;
33+
_address.bytes[3] = fourth_octet;
34+
}
35+
36+
IPAddress::IPAddress(uint32_t address)
37+
{
38+
_address.dword = address;
39+
}
40+
41+
IPAddress::IPAddress(const uint8_t *address)
42+
{
43+
memcpy(_address.bytes, address, sizeof(_address.bytes));
44+
}
45+
46+
bool IPAddress::fromString(const char *address)
47+
{
48+
// TODO: add support for "a", "a.b", "a.b.c" formats
49+
50+
uint16_t acc = 0; // Accumulator
51+
uint8_t dots = 0;
52+
53+
while (*address)
54+
{
55+
char c = *address++;
56+
if (c >= '0' && c <= '9')
57+
{
58+
acc = acc * 10 + (c - '0');
59+
if (acc > 255) {
60+
// Value out of [0..255] range
61+
return false;
62+
}
63+
}
64+
else if (c == '.')
65+
{
66+
if (dots == 3) {
67+
// Too much dots (there must be 3 dots)
68+
return false;
69+
}
70+
_address.bytes[dots++] = acc;
71+
acc = 0;
72+
}
73+
else
74+
{
75+
// Invalid char
76+
return false;
77+
}
78+
}
79+
80+
if (dots != 3) {
81+
// Too few dots (there must be 3 dots)
82+
return false;
83+
}
84+
_address.bytes[3] = acc;
85+
return true;
86+
}
87+
88+
IPAddress& IPAddress::operator=(const uint8_t *address)
89+
{
90+
memcpy(_address.bytes, address, sizeof(_address.bytes));
91+
return *this;
92+
}
93+
94+
IPAddress& IPAddress::operator=(uint32_t address)
95+
{
96+
_address.dword = address;
97+
return *this;
98+
}
99+
100+
bool IPAddress::operator==(const uint8_t* addr) const
101+
{
102+
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
103+
}
104+
105+
size_t IPAddress::printTo(Print& p) const
106+
{
107+
size_t n = 0;
108+
for (int i =0; i < 3; i++)
109+
{
110+
n += p.print(_address.bytes[i], DEC);
111+
n += p.print('.');
112+
}
113+
n += p.print(_address.bytes[3], DEC);
114+
return n;
115+
}
116+

0 commit comments

Comments
 (0)