Skip to content

Commit 09a6c2e

Browse files
author
David Hunt
committed
ATLEDGE-62 Create Initial Release of Arduino Corelibs
Allows Arduino IDE to build Blink Sketch Includes pinMode(), digitalWrite() and delay() Allows download via JTAG Signed-off-by: David Hunt <[email protected]>
1 parent a5ca45c commit 09a6c2e

Some content is hidden

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

73 files changed

+10327
-91
lines changed

boards.txt

+24-21
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
# See: http://code.google.com/p/arduino/wiki/Platforms
2-
3-
menu.cpu=Processor
41

5-
##############################################################
62

7-
izmir_ec.name=Intel® AtlasEdge
8-
izmir_ec.upload.tool=shakespere
9-
izmir_ec.upload.protocol=shakespere
10-
izmir_ec.upload.maximum_size=10000000
11-
izmir_ec.upload.use_1200bps_touch=false
12-
izmir_ec.upload.wait_for_upload_port=false
13-
izmir_ec.upload.native_usb=false
14-
15-
izmir_ec.build.mcu=arc32
16-
izmir_ec.build.f_cpu=-m32
17-
#izmir_ec.build.main=arduino\main.cpp
18-
izmir_ec.build.core=arduino
19-
izmir_ec.build.variant=atlas_fab_c
20-
#izmir_ec.build.variant_system_lib=libx86_izmir_gcc_rel.a
21-
izmir_ec.build.toolchain_path=x86_64-pokysdk-linux-eglibc/usr/bin/i586-poky-linux
22-
izmir_ec.build.sysroot_path=i586-poky-linux-eglibc
23-
izmir_ec.build.toolchain_prefix=i586-poky-linux-
3+
intel_edu_x.name=Intel® EDU
4+
intel_edu_x.vid.0=0x2341
5+
intel_edu_x.pid.0=0x003e
6+
intel_edu_x.vid.1=0x2A03
7+
intel_edu_x.pid.1=0x003e
8+
intel_edu_x.vid.0x2A03.warning=Uncertified
9+
intel_edu_x.upload.tool=eduload
10+
intel_edu_x.upload.protocol=script
11+
intel_edu_x.upload.maximum_size=196608
12+
intel_edu_x.upload.use_1200bps_touch=falase
13+
intel_edu_x.upload.wait_for_upload_port=false
14+
intel_edu_x.upload.native_usb=false
15+
intel_edu_x.upload.params.quiet=-q
16+
intel_edu_x.upload.params.verbose=-q
17+
intel_edu_x.build.usb_product="Arduino Due"
18+
intel_edu_x.build.mcu=ARCv2EM
19+
intel_edu_x.build.board=ARC32_TOOLS
20+
intel_edu_x.build.core=arduino
21+
intel_edu_x.build.ldscript=linker_scripts/flash.ld
22+
intel_edu_x.build.variant=intel_edu_x
23+
intel_edu_x.build.variant_system_lib=arc32drv_edu
24+
intel_edu_x.build.vid=0x2341
25+
intel_edu_x.build.pid=0x003e
2426

27+
# See: http://code.google.com/p/arduino/wiki/Platforms
2528

2629

cores/arduino/Arduino.h

+88-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,92 @@
1919

2020
#ifndef Arduino_h
2121
#define Arduino_h
22-
void setup(void);
23-
void loop(void);
24-
/*int main(void);*/
22+
23+
#include <stdint.h>
24+
#include <stdlib.h>
25+
#include <string.h>
26+
#include <math.h>
27+
28+
#include "binary.h"
29+
#include "itoa.h"
30+
31+
#ifdef __cplusplus
32+
extern "C"{
33+
#endif // __cplusplus
34+
35+
#include "wiring_constants.h"
36+
37+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
38+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
39+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
40+
41+
void yield(void);
42+
43+
/* sketch */
44+
extern void setup( void ) ;
45+
extern void loop( void ) ;
46+
47+
typedef void (*voidFuncPtr)( void ) ;
48+
49+
/* Define attribute */
50+
#define WEAK __attribute__ ((weak))
51+
52+
#define INVALID 0xFFFFFFFF
53+
54+
/* Types used for the tables below */
55+
/* TODO - consider using smaller types to optimise storage space */
56+
typedef struct _PinDescription
57+
{
58+
uint32_t ulGPIOId; // GPIO port pin
59+
uint32_t ulGPIOPort; // GPIO port ID
60+
uint32_t ulGPIOType; // LMT or SS
61+
uint32_t ulGPIOBase; // GPIO register base address
62+
uint32_t ulSocPin; // SoC pin number
63+
uint32_t ulPinMode; // Current SoC pin mux mode
64+
uint32_t ulPwmChan; // PWM channel
65+
uint32_t ulPwmScale; // PWM frequency scaler
66+
} PinDescription;
67+
68+
#ifdef OUT
69+
/* Types used for the tables below */
70+
typedef struct _PinDescription
71+
{
72+
// TODO Pio* pPort ;
73+
uint32_t ulPin ;
74+
uint32_t ulPeripheralId ;
75+
// TODO EPioType ulPinType ;
76+
uint32_t ulPinConfiguration ;
77+
uint32_t ulPinAttribute ;
78+
EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
79+
EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
80+
EPWMChannel ulPWMChannel ;
81+
ETCChannel ulTCChannel ;
82+
} PinDescription ;
2583
#endif
84+
85+
86+
/* Pins table to be instanciated into variant.cpp */
87+
extern PinDescription g_APinDescription[] ;
88+
89+
#ifdef __cplusplus
90+
} // extern "C"
91+
92+
#include "WCharacter.h"
93+
#include "WString.h"
94+
#include "Tone.h"
95+
#include "WMath.h"
96+
#include "HardwareSerial.h"
97+
#include "wiring_pulse.h"
98+
99+
#endif // __cplusplus
100+
101+
// Include board variant
102+
#include "variant.h"
103+
104+
#include "wiring.h"
105+
#include "wiring_digital.h"
106+
#include "wiring_analog.h"
107+
#include "wiring_shift.h"
108+
#include "WInterrupts.h"
109+
110+
#endif // Arduino_h

cores/arduino/HardwareSerial.h

+42
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/Print.h

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
Print.h - Base class that provides print() and println()
3+
Copyright (c) 2008 David A. Mellis. 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 Print_h
21+
#define Print_h
22+
23+
#include <inttypes.h>
24+
#include <stdio.h> // for size_t
25+
26+
#include "WString.h"
27+
#include "Printable.h"
28+
29+
#define DEC 10
30+
#define HEX 16
31+
#define OCT 8
32+
#define BIN 2
33+
34+
class Print
35+
{
36+
private:
37+
int write_error;
38+
size_t printNumber(unsigned long, uint8_t);
39+
size_t printFloat(double, uint8_t);
40+
protected:
41+
void setWriteError(int err = 1) { write_error = err; }
42+
public:
43+
Print() : write_error(0) {}
44+
45+
int getWriteError() { return write_error; }
46+
void clearWriteError() { setWriteError(0); }
47+
48+
virtual size_t write(uint8_t) = 0;
49+
size_t write(const char *str) {
50+
if (str == NULL) return 0;
51+
return write((const uint8_t *)str, strlen(str));
52+
}
53+
virtual size_t write(const uint8_t *buffer, size_t size);
54+
size_t write(const char *buffer, size_t size) {
55+
return write((const uint8_t *)buffer, size);
56+
}
57+
58+
size_t print(const __FlashStringHelper *);
59+
size_t print(const String &);
60+
size_t print(const char[]);
61+
size_t print(char);
62+
size_t print(unsigned char, int = DEC);
63+
size_t print(int, int = DEC);
64+
size_t print(unsigned int, int = DEC);
65+
size_t print(long, int = DEC);
66+
size_t print(unsigned long, int = DEC);
67+
size_t print(double, int = 2);
68+
size_t print(const Printable&);
69+
70+
size_t println(const __FlashStringHelper *);
71+
size_t println(const String &s);
72+
size_t println(const char[]);
73+
size_t println(char);
74+
size_t println(unsigned char, int = DEC);
75+
size_t println(int, int = DEC);
76+
size_t println(unsigned int, int = DEC);
77+
size_t println(long, int = DEC);
78+
size_t println(unsigned long, int = DEC);
79+
size_t println(double, int = 2);
80+
size_t println(const Printable&);
81+
size_t println(void);
82+
};
83+
84+
#endif

cores/arduino/Printable.h

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Printable.h - Interface class that allows printing of complex types
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 Printable_h
21+
#define Printable_h
22+
23+
#include <stdlib.h>
24+
25+
class Print;
26+
27+
/** The Printable class provides a way for new classes to allow themselves to be printed.
28+
By deriving from Printable and implementing the printTo method, it will then be possible
29+
for users to print out instances of this class by passing them into the usual
30+
Print::print and Print::println methods.
31+
*/
32+
33+
class Printable
34+
{
35+
public:
36+
virtual size_t printTo(Print& p) const = 0;
37+
};
38+
39+
#endif
40+

0 commit comments

Comments
 (0)