Skip to content

Commit 973ccc4

Browse files
committed
Adding first files, not Zero specific
0 parents  commit 973ccc4

Some content is hidden

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

96 files changed

+15584
-0
lines changed

boards.txt

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
arduino_zero_dbg.name=Arduino Zero (Programming Port)
3+
arduino_zero_dbg.vid.0=0x03eb
4+
arduino_zero_dbg.pid.0=0x2111
5+
arduino_zero_dbg.upload.tool=bossac
6+
arduino_zero_dbg.upload.protocol=sam-ba
7+
arduino_zero_dbg.upload.maximum_size=262144
8+
arduino_zero_dbg.upload.use_1200bps_touch=false
9+
arduino_zero_dbg.upload.wait_for_upload_port=false
10+
arduino_zero_dbg.upload.native_usb=false
11+
arduino_zero_dbg.build.mcu=cortex-m0p
12+
arduino_zero_dbg.build.f_cpu=48000000L
13+
arduino_zero_dbg.build.usb_product="Arduino Zero"
14+
arduino_zero_dbg.build.board=SAM_ZERO
15+
arduino_zero_dbg.build.core=arduino
16+
arduino_zero_dbg.build.extra_flags=-D__SAMD21J18A__ -mthumb {build.usb_flags}
17+
arduino_zero_dbg.build.ldscript=linker_scripts/gcc/flash.ld
18+
arduino_zero_dbg.build.variant=arduino_zero
19+
arduino_zero_dbg.build.variant_system_lib=
20+
arduino_zero_dbg.build.vid=0x03eb
21+
arduino_zero_dbg.build.pid=0x2111
22+
23+
arduino_zero.name=Arduino Zero (Native USB Port)
24+
arduino_zero.vid.0=0x2341
25+
arduino_zero.pid.0=0x004d
26+
arduino_zero.upload.tool=bossac
27+
arduino_zero.upload.protocol=sam-ba
28+
arduino_zero.upload.maximum_size=262144
29+
arduino_zero.upload.use_1200bps_touch=false
30+
arduino_zero.upload.wait_for_upload_port=false
31+
arduino_zero.upload.native_usb=true
32+
arduino_zero.build.mcu=cortex-m0p
33+
arduino_zero.build.f_cpu=48000000L
34+
arduino_zero.build.usb_product="Arduino Zero"
35+
arduino_zero.build.board=SAM_ZERO
36+
arduino_zero.build.core=arduino
37+
arduino_zero.build.extra_flags=-D__SAMD21J18A__ -mthumb {build.usb_flags}
38+
arduino_zero.build.ldscript=linker_scripts/gcc/flash.ld
39+
arduino_zero.build.variant=arduino_zero
40+
arduino_zero.build.variant_system_lib=
41+
arduino_zero.build.vid=0x2341
42+
arduino_zero.build.pid=0x004d
43+
44+
arduino_zero_dbg.name=SAMS21-XPRO (Programming Port)
45+
arduino_zero_dbg.vid.0=0x03eb
46+
arduino_zero_dbg.pid.0=0x2111
47+
arduino_zero_dbg.upload.tool=bossac
48+
arduino_zero_dbg.upload.protocol=sam-ba
49+
arduino_zero_dbg.upload.maximum_size=262144
50+
arduino_zero_dbg.upload.use_1200bps_touch=false
51+
arduino_zero_dbg.upload.wait_for_upload_port=false
52+
arduino_zero_dbg.upload.native_usb=false
53+
arduino_zero_dbg.build.mcu=cortex-m0p
54+
arduino_zero_dbg.build.f_cpu=48000000L
55+
arduino_zero_dbg.build.usb_product="SAMD21-XPRO"
56+
arduino_zero_dbg.build.board=SAM_ZERO
57+
arduino_zero_dbg.build.core=arduino
58+
arduino_zero_dbg.build.extra_flags=-D__SAMD21J18A__ -mthumb {build.usb_flags}
59+
arduino_zero_dbg.build.ldscript=linker_scripts/gcc/flash.ld
60+
arduino_zero_dbg.build.variant=samd21_xpro
61+
arduino_zero_dbg.build.variant_system_lib=
62+
arduino_zero_dbg.build.vid=0x03eb
63+
arduino_zero_dbg.build.pid=0x2111
64+
65+
arduino_zero.name=SAMS21-XPRO (Native USB Port)
66+
arduino_zero.vid.0=0x2341
67+
arduino_zero.pid.0=0x004d
68+
arduino_zero.upload.tool=bossac
69+
arduino_zero.upload.protocol=sam-ba
70+
arduino_zero.upload.maximum_size=262144
71+
arduino_zero.upload.use_1200bps_touch=false
72+
arduino_zero.upload.wait_for_upload_port=false
73+
arduino_zero.upload.native_usb=true
74+
arduino_zero.build.mcu=cortex-m0p
75+
arduino_zero.build.f_cpu=48000000L
76+
arduino_zero.build.usb_product="SAMD21-XPRO"
77+
arduino_zero.build.board=SAM_ZERO
78+
arduino_zero.build.core=arduino
79+
arduino_zero.build.extra_flags=-D__SAMD21J18A__ -mthumb {build.usb_flags}
80+
arduino_zero.build.ldscript=linker_scripts/gcc/flash.ld
81+
arduino_zero.build.variant=samd21_xpro
82+
arduino_zero.build.variant_system_lib=
83+
arduino_zero.build.vid=0x2341
84+
arduino_zero.build.pid=0x004d
85+

cores/arduino/Arduino.h

+195
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
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 <string.h>
26+
#include <math.h>
27+
28+
// some libraries and sketches depend on this
29+
// AVR stuff, assuming Arduino.h or WProgram.h
30+
// automatically includes it...
31+
#include <avr/pgmspace.h>
32+
#include <avr/interrupt.h>
33+
34+
#include "binary.h"
35+
#include "itoa.h"
36+
37+
#ifdef __cplusplus
38+
extern "C"{
39+
#endif // __cplusplus
40+
41+
// Includes Atmel CMSIS
42+
#include <chip.h>
43+
44+
#include "wiring_constants.h"
45+
46+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
47+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
48+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
49+
50+
void yield(void);
51+
52+
/* sketch */
53+
extern void setup( void ) ;
54+
extern void loop( void ) ;
55+
56+
//#define NOT_A_PIN 0 // defined in pio.h/EPioType
57+
#define NOT_A_PORT 0
58+
59+
#define NOT_AN_INTERRUPT -1
60+
61+
typedef enum _EExt_Interrupts
62+
{
63+
EXTERNAL_INT_0=0,
64+
EXTERNAL_INT_1=1,
65+
EXTERNAL_INT_2=2,
66+
EXTERNAL_INT_3=3,
67+
EXTERNAL_INT_4=4,
68+
EXTERNAL_INT_5=5,
69+
EXTERNAL_INT_6=6,
70+
EXTERNAL_INT_7=7,
71+
EXTERNAL_NUM_INTERRUPTS
72+
} EExt_Interrupts ;
73+
74+
typedef void (*voidFuncPtr)( void ) ;
75+
76+
/* Define attribute */
77+
#if defined ( __CC_ARM ) /* Keil uVision 4 */
78+
#define WEAK (__attribute__ ((weak)))
79+
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
80+
#define WEAK __weak
81+
#elif defined ( __GNUC__ ) /* GCC CS */
82+
#define WEAK __attribute__ ((weak))
83+
#endif
84+
85+
/* Definitions and types for pins */
86+
typedef enum _EAnalogChannel
87+
{
88+
NO_ADC=-1,
89+
ADC0=0,
90+
ADC1,
91+
ADC2,
92+
ADC3,
93+
ADC4,
94+
ADC5
95+
} EAnalogChannel ;
96+
97+
#define ADC_CHANNEL_NUMBER_NONE 0xffffffff
98+
99+
// Definitions for PWM channels
100+
typedef enum _EPWMChannel
101+
{
102+
NOT_ON_PWM=-1,
103+
PWM_CH0=0, // todo
104+
PWM_CH1,
105+
PWM_CH2,
106+
PWM_CH3,
107+
PWM_CH4,
108+
PWM_CH5,
109+
PWM_CH6,
110+
PWM_CH7
111+
} EPWMChannel ;
112+
113+
// Definitions for TC channels
114+
typedef enum _ETCChannel
115+
{
116+
NOT_ON_TIMER=-1,
117+
TC0_CHA0=0, // todo
118+
TC0_CHB0,
119+
TC0_CHA1,
120+
TC0_CHB1,
121+
TC0_CHA2,
122+
TC0_CHB2,
123+
TC1_CHA3,
124+
TC1_CHB3,
125+
TC1_CHA4,
126+
TC1_CHB4,
127+
TC1_CHA5,
128+
TC1_CHB5,
129+
TC2_CHA6,
130+
TC2_CHB6,
131+
TC2_CHA7,
132+
TC2_CHB7,
133+
TC2_CHA8,
134+
TC2_CHB8
135+
} ETCChannel ;
136+
137+
/**
138+
* Pin Attributes to be OR-ed
139+
*/
140+
#define PIN_ATTR_COMBO (1UL<<0)
141+
#define PIN_ATTR_ANALOG (1UL<<1)
142+
#define PIN_ATTR_DIGITAL (1UL<<2)
143+
#define PIN_ATTR_PWM (1UL<<3)
144+
#define PIN_ATTR_TIMER (1UL<<4)
145+
146+
/* Types used for the tables below */
147+
typedef struct _PinDescription
148+
{
149+
Pio* pPort ;
150+
uint32_t ulPin ;
151+
uint32_t ulPeripheralId ;
152+
EPioType ulPinType ;
153+
uint32_t ulPinConfiguration ;
154+
uint32_t ulPinAttribute ;
155+
EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
156+
EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
157+
EPWMChannel ulPWMChannel ;
158+
ETCChannel ulTCChannel ;
159+
} PinDescription ;
160+
161+
/* Pins table to be instanciated into variant.cpp */
162+
extern const PinDescription g_APinDescription[] ;
163+
164+
#ifdef __cplusplus
165+
} // extern "C"
166+
167+
#include "WCharacter.h"
168+
#include "WString.h"
169+
#include "Tone.h"
170+
#include "WMath.h"
171+
#include "HardwareSerial.h"
172+
#include "wiring_pulse.h"
173+
174+
#endif // __cplusplus
175+
176+
// Include board variant
177+
#include "variant.h"
178+
179+
#include "wiring.h"
180+
#include "wiring_digital.h"
181+
#include "wiring_analog.h"
182+
#include "wiring_shift.h"
183+
#include "WInterrupts.h"
184+
185+
// USB Device
186+
#define USB_VID 0x2341 // arduino LLC vid
187+
#define USB_PID_LEONARDO 0x0034
188+
#define USB_PID_MICRO 0x0035
189+
#define USB_PID_DUE 0x003E
190+
#define USB_PID_DUE 0x004D
191+
#include "USB/USBDesc.h"
192+
#include "USB/USBCore.h"
193+
#include "USB/USBAPI.h"
194+
195+
#endif // Arduino_h

cores/arduino/Client.h

+45
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
1- Prerequesites
2+
3+
ARM GCC toolchain from https://launchpad.net/gcc-arm-embedded/+download
4+
5+
*Windows only*
6+
7+
GNU Make from http://gnuwin32.sourceforge.net/packages/make.htm
8+
Binaries http://gnuwin32.sourceforge.net/downlinks/make-bin-zip.php
9+
Dependencies http://gnuwin32.sourceforge.net/downlinks/make-dep-zip.php
10+
11+
*MacOS*
12+
13+
*Linux*
14+
15+
16+
2- Path to GCC ARM toolchain and Make
17+
18+
Set into environment variables the ARM_GCC_TOOLCHAIN variable:
19+
ex:
20+
ARM_GCC_TOOLCHAIN=C:\GNU Tools ARM Embedded_4.8 2013q4\bin
21+
22+
Add to PATH the path were Make has been installed
23+
24+
3- Compile libarduino (Arduino API)
25+
26+
Go to hardware/arduino/samd/cores/arduino/build_gcc
27+
28+
run the command: 'make'
29+
30+
This will compile the libarduino library and deliver to main Arduino folder the files:
31+
32+
hardware/arduino/samd/cores/arduino/libarduino_arduino_zero_gcc_dbg.a
33+
hardware/arduino/samd/cores/arduino/libarduino_arduino_zero_gcc_dbg.a.txt (result of nm)
34+
35+
4- Compile libvariant (variant specific library, use Arduino API and libsam)
36+
37+
Go to hardware/sam/variants/arduino_zero/build_gcc
38+
39+
run the command: 'make'
40+
41+
This will compile the libvariant library and deliver to main Arduino folder the files:
42+
43+
hardware/arduino/samd/cores/arduino/libvariant_arduino_zero_gcc_dbg.a
44+
hardware/arduino/samd/cores/arduino/libvariant_arduino_zero_gcc_dbg.a.txt (result of nm)
45+
46+
5- Compile test application
47+
48+
Go to hardware/arduino/samd/cores/arduino/validation/build_gcc
49+
50+
run the command: 'make'
51+
52+
This will compile the test application and deliver the binary into:
53+
54+
hardware/arduino/samd/cores/arduino/validation/debug_arduino_zero/test_gcc_dbg.elf
55+
hardware/arduino/samd/cores/arduino/validation/debug_arduino_zero/test_gcc_dbg.bin
56+
hardware/arduino/samd/cores/arduino/validation/debug_arduino_zero/test_gcc_dbg.map (mapping matching linker script)
57+
hardware/arduino/samd/cores/arduino/validation/debug_arduino_zero/test_gcc_dbg.elf.txt (result of nm)
58+
59+
60+

0 commit comments

Comments
 (0)