1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-19 13:54:23 +01:00

Merge branch 'ide-1.5.7' into ide-1.5.x

This commit is contained in:
Cristian Maglie 2014-06-27 13:44:18 +02:00
commit 370648a532
35 changed files with 153 additions and 18392 deletions

2
.gitignore vendored
View File

@ -36,3 +36,5 @@ test-bin
build/windows/launch4j-*
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
avr-toolchain-*.zip

View File

@ -61,9 +61,9 @@ import static processing.app.I18n._;
* files and images, etc) that comes from that.
*/
public class Base {
public static final int REVISION = 156;
public static final int REVISION = 157;
/** This might be replaced by main() if there's a lib/version.txt file. */
static String VERSION_NAME = "0156";
static String VERSION_NAME = "0157";
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = false;

View File

@ -1,9 +1,10 @@
package processing.app.helpers;
import java.io.IOException;
import processing.app.Base;
import java.io.IOException;
import java.util.Map;
public class ProcessUtils {
public static Process exec(String[] command) throws IOException {
@ -20,6 +21,10 @@ public class ProcessUtils {
String[] cmdLine = new String[command.length];
for (int i = 0; i < command.length; i++)
cmdLine[i] = command[i].replace("\"", "\\\"");
return Runtime.getRuntime().exec(cmdLine);
ProcessBuilder pb = new ProcessBuilder(cmdLine);
Map<String, String> env = pb.environment();
env.put("CYGWIN", "nodosfilewarning");
return pb.start();
}
}

View File

@ -229,8 +229,11 @@
</copy>
<!-- Unzip AVR tools -->
<!-- <unzip dest="macosx/work/Arduino.app/Contents/Resources/Java/hardware" src="macosx/dist/tools-universal.zip" overwrite="false"/> -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="mac32" />
</antcall>
<!--
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
@ -239,24 +242,25 @@
<arg value="macosx/dist/tools-universal.zip" />
</exec>
<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>
-->
<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/">
<fileset file="macosx/dist/bossac" />
</copy>
<chmod file="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/bossac" perm="+x" />
<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>
<antcall target="assemble">
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
</antcall>
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.4.1-2010q1-188-macos.tar.gz" />
<param name="dist_url" value="http://arduino.googlecode.com/files/gcc-arm-none-eabi-4.4.1-2010q1-188-macos.tar.gz" />
<param name="dist_check_file" value="g++_arm_none_eabi" />
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
</antcall>
<delete includeEmptyDirs="true" quiet="true">
@ -341,9 +345,7 @@
<chmod perm="+x">
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-3/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-4/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/libexec/gcc/avr/4.3.2/" includes="**/cc1*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/libexec/gcc/avr/4.8.1/" includes="*" />
</chmod>
<replace file="macosx/work/Arduino.app/Contents/Info.plist"
@ -470,11 +472,8 @@
<mkdir dir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/adk2install" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/adk2tool" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/avrdude${arch-bits}" tofile="linux/work/hardware/tools/avrdude" />
<copy file="linux/dist/tools/avrdude.conf" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/bossac${arch-bits}" tofile="linux/work/hardware/tools/bossac" />
<chmod perm="755" file="linux/work/hardware/tools/avrdude" />
<chmod perm="755" file="linux/work/hardware/tools/bossac" />
<chmod perm="755" file="linux/work/hardware/tools/adk2tool" />
<chmod perm="755" file="linux/work/hardware/tools/adk2install" />
@ -491,36 +490,29 @@
<target name="linux32-build" depends="linux-build" description="Build linux (32-bit) version">
<!-- Unzip ARM tools -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz" />
<param name="dist_url" value="http://arduino.googlecode.com/files/gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz" />
<param name="dist_check_file" value="g++_arm_none_eabi" />
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
</antcall>
<!-- Unzip AVR tools -->
<exec executable="tar" dir="linux/work/hardware">
<arg value="-xjf"/>
<arg value="../../avr_tools_linux32.tar.bz2"/>
</exec>
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux32" />
</antcall>
</target>
<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
<copy tofile="linux/work/hardware/tools/avrdude" file="linux/dist/tools/avrdude64" overwrite="true" />
<chmod perm="755" file="linux/work/hardware/tools/avrdude" />
<!-- Unzip ARM tools -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz" />
<param name="dist_url" value="http://arduino.googlecode.com/files/gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz" />
<param name="dist_check_file" value="g++_arm_none_eabi" />
<antcall target="unzip-tool">
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
</antcall>
<!-- Unzip AVR tools -->
<exec executable="tar" dir="linux/work/hardware">
<arg value="-xjf"/>
<arg value="../../avr_tools_linux64.tar.bz2"/>
</exec>
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux64" />
</antcall>
</target>
<target name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
@ -531,6 +523,68 @@
<exec executable="./linux/work/arduino" spawn="false"/>
</target>
<target name="unzip-avr-toolchain">
<get src="http://downloads.arduino.cc/avr-toolchain-${file_arch}-gcc-4.8.1.zip" dest="${staging_folder}" usetimestamp="true" ignoreerrors="true" verbose="true" />
<checksum file="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File avr-toolchain-${file_arch}-gcc-4.8.1.zip failed checksum.
Please remove "${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" and download it again.
</fail>
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<arg value="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" />
</exec>
</target>
<!-- Set '${dist_file}_available' property if toolchain dist_file is downloaded -->
<!-- Set '${dist_file}_installed' property if toolchain is installed in working directory -->
<!-- hardware/tools/${dist_check_file} is checked for existence -->
<target name="check-tool">
<available file="${staging_folder}/dist/${dist_file}" property="${dist_file}_available" />
<available file="${staging_folder}/work/hardware/tools/${dist_check_file}" property="${dist_file}_installed" />
</target>
<!-- Retrieve tool -->
<target name="get-tool" depends="check-tool" unless="${dist_file}_available">
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
</target>
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
<target name="unzip-tool" depends="get-tool, check-tool" unless="${dist_file}_installed">
<echo>Testing checksum of "${staging_folder}/dist/${dist_file}"</echo>
<checksum file="${staging_folder}/dist/${dist_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File ${dist_file} failed checksum.
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
</fail>
<!-- Unzip tool to the destination folder -->
<echo>Unzipping into folder ${staging_folder}/dist/${dist_file}</echo>
<exec executable="tar">
<arg value="xfz"/>
<arg value="${staging_folder}/dist/${dist_file}"/>
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
</exec>
</target>
<!-- Set 'arm_disfile_available' property if ARM toolchain dist_file is downloaded -->
<!-- Set 'arm_toolchain_installed' property if ARM toolchain is installed in working directory -->
<target name="check-arm-toolchain">
@ -540,7 +594,7 @@
<!-- Retrieve ARM toolchain -->
<target name="get-arm-toolchain" depends="check-arm-toolchain" unless="arm_distfile_available">
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" />
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
</target>
<target name="unzip-arm-toolchain" depends="get-arm-toolchain, check-arm-toolchain"
@ -684,12 +738,9 @@
</copy>
<!-- Unzip AVR tools -->
<get src="http://downloads.arduino.cc/WinAVR-20081205-arduino-2.zip" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<unzip dest="windows/work/hardware" src="windows/WinAVR-20081205-arduino-2.zip" overwrite="false"/>
<copy todir="windows/work/hardware/tools/avr/avr/include/avr">
<fileset file="windows/eeprom.h" />
</copy>
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="win32" />
</antcall>
<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="windows" usetimestamp="true" skipexisting="true" />
<unzip src="windows/libastylej-2.03.zip" dest="windows" overwrite="true"/>
@ -732,9 +783,9 @@
<!-- Unzip ARM toolchain -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.4.1-2010q1-188-win32.tar.gz" />
<param name="dist_url" value="http://arduino.googlecode.com/files/gcc-arm-none-eabi-4.4.1-2010q1-188-win32.tar.gz" />
<param name="dist_check_file" value="g++_arm_none_eabi" />
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
</antcall>
<delete includeEmptyDirs="true" quiet="true">
@ -770,18 +821,11 @@
prefix="arduino-${version}" />
</zip>
<zip destfile="windows/arduino-${version}-${platform}-expert.zip" level="9">
<zipfileset dir="windows/work"
prefix="arduino-${version}"
excludes="java/**" />
</zip>
<echo>
=======================================================
Arduino for Windows was built. Grab the archive from
windows/arduino-${version}-${platform}.zip
windows/arduino-${version}-${platform}-expert.zip
=======================================================
</echo>
</target>

View File

@ -0,0 +1 @@
60f9edb4dd033109e22ee9e87cb6f45efd15882e

View File

@ -0,0 +1 @@
5b0131ac2ccf20637d16ecc40a0ef2fae48fe73a

View File

@ -1 +0,0 @@
46a93ceec28772ac19c76ffc9b285a1eac4288a3

View File

@ -0,0 +1 @@
20500b304b2b7c08a699cdd25564003aaf78088e

View File

@ -0,0 +1 @@
194309bbe4b442c5047ad2887e252ed49b6c4758

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
c1c15b14ede121884d17c0360e1f1ad15fb5c98f

View File

@ -1,442 +0,0 @@
/* Copyright (c) 2002, 2003, 2004, 2007 Marek Michalkiewicz
Copyright (c) 2005, 2006 Bjoern Haase
Copyright (c) 2008 Atmel Corporation
Copyright (c) 2008 Wouter van Gulik
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
/* $Id: eeprom.h,v 1.21.2.6 2008/08/19 22:10:39 arcanum Exp $ */
#ifndef _AVR_EEPROM_H_
#define _AVR_EEPROM_H_ 1
#include <avr/io.h>
#include <stddef.h> /* size_t */
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __ATTR_PURE__
# ifdef __DOXYGEN__
# define __ATTR_PURE__
# else
# define __ATTR_PURE__ __attribute__((__pure__))
# endif
#endif
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
uint16_t __eerd_word (const uint16_t *, uint8_t (*)(const uint8_t *))
__ATTR_PURE__;
uint32_t __eerd_dword (const uint32_t *, uint8_t (*)(const uint8_t *))
__ATTR_PURE__;
void __eerd_block (void *, const void *, size_t, uint8_t (*)(const uint8_t *));
void __eewr_word (uint16_t *, uint16_t, void (*)(uint8_t *, uint8_t));
void __eewr_dword (uint32_t *, uint32_t, void (*)(uint8_t *, uint8_t));
void __eewr_block (void *, const void *, size_t, void (*)(uint8_t *, uint8_t));
#endif /* (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) ) */
#if !E2END && !defined(__DOXYGEN__)
# ifndef __COMPILING_AVR_LIBC__
# warning "Device does not have EEPROM available."
# endif
/* Omit below for chips without EEPROM. */
#else
/** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
\code #include <avr/eeprom.h> \endcode
This header file declares the interface to some simple library
routines suitable for handling the data EEPROM contained in the
AVR microcontrollers. The implementation uses a simple polled
mode interface. Applications that require interrupt-controlled
EEPROM access to ensure that no time will be wasted in spinloops
will have to deploy their own implementation.
\note All of the read/write functions first make sure the EEPROM
is ready to be accessed. Since this may cause long delays if a
write operation is still pending, time-critical applications
should first poll the EEPROM e. g. using eeprom_is_ready() before
attempting any actual I/O. But this functions are not wait until
SELFPRGEN in SPMCSR becomes zero. Do this manually, if your
softwate contains the Flash burning.
\note As these functions modify IO registers, they are known to be
non-reentrant. If any of these functions are used from both,
standard and interrupt context, the applications must ensure
proper protection (e.g. by disabling interrupts before accessing
them).
\note All write functions force erase_and_write programming mode.
*/
/** \def EEMEM
\ingroup avr_eeprom
Attribute expression causing a variable to be allocated within the
.eeprom section. */
#define EEMEM __attribute__((section(".eeprom")))
/* Register definitions */
/* Check for aliases. */
#if !defined(EEWE) && defined(EEPE)
# define EEWE EEPE
#endif
#if !defined(EEMWE) && defined(EEMPE)
# define EEMWE EEMPE
#endif
#if !defined(EECR) && defined(DEECR)
/* AT86RF401 */
# define EECR DEECR
# define EEAR DEEAR
# define EEARL DEEAR
# define EEDR DEEDR
# define EERE EER
# define EEWE EEL
# define EEMWE EEU
#endif
#if !defined(EECR) || !defined(EEDR) || !defined(EEARL)
# if !defined(__EEPROM_REG_LOCATIONS__) \
&& !defined(EEPROM_REG_LOCATIONS_OVERRIDE)
/* 6-byte string denoting where to find the EEPROM registers in memory
space. Adresses denoted in hex syntax with uppercase letters. Used
by the EEPROM subroutines.
First two letters: EECR address.
Second two letters: EEDR address.
Last two letters: EEAR address.
*/
# error "Unknown EEPROM register(s) location."
# endif
/* If needed, override the locations defined in the IO headers. */
# ifdef EEPROM_REG_LOCATIONS_OVERRIDE
# undef __EEPROM_REG_LOCATIONS__
# define __EEPROM_REG_LOCATIONS__ EEPROM_REG_LOCATIONS_OVERRIDE
# endif
# define CONCAT1(a, b) CONCAT2(a, b)
# define CONCAT2(a, b) a ## b
# define HEXNR CONCAT1(0x, __EEPROM_REG_LOCATIONS__)
# undef EECR
# define EECR _SFR_IO8((HEXNR >> 16) & 0xFF)
# undef EEDR
# define EEDR _SFR_IO8((HEXNR >> 8) & 0xFF)
# undef EEAR
# define EEAR _SFR_IO8(HEXNR & 0xFF)
# undef EEARH
# undef EEARL
# define EEARL EEAR
#endif
/** \def eeprom_is_ready
\ingroup avr_eeprom
\returns 1 if EEPROM is ready for a new read/write operation, 0 if not.
*/
#if defined(__DOXYGEN__)
# define eeprom_is_ready()
#elif defined(DEECR)
# define eeprom_is_ready() bit_is_clear(DEECR, BSY)
#else
# define eeprom_is_ready() bit_is_clear(EECR, EEWE)
#endif
/** \def eeprom_busy_wait
\ingroup avr_eeprom
Loops until the eeprom is no longer busy.
\returns Nothing.
*/
#define eeprom_busy_wait() do {} while (!eeprom_is_ready())
/** \ingroup avr_eeprom
Read one byte from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__ uint8_t eeprom_read_byte (const uint8_t *__p)
{
do {} while (!eeprom_is_ready ());
#if E2END <= 0xFF
EEARL = (uint8_t)(uint16_t)__p;
#else
EEAR = (uint16_t)__p;
#endif
/* Use inline assembly below as some AVRs have problems with accessing
EECR with STS instructions. For example, see errata for ATmega64.
The code below also assumes that EECR and EEDR are in the I/O space.
*/
uint8_t __result;
__asm__ __volatile__
(
"/* START EEPROM READ CRITICAL SECTION */ \n\t"
"sbi %1, %2 \n\t"
"in %0, %3 \n\t"
"/* END EEPROM READ CRITICAL SECTION */ \n\t"
: "=r" (__result)
: "i" (_SFR_IO_ADDR(EECR)),
"i" (EERE),
"i" (_SFR_IO_ADDR(EEDR))
);
return __result;
}
/** \ingroup avr_eeprom
Read one 16-bit word (little endian) from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__ uint16_t eeprom_read_word (const uint16_t *__p)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
return __eerd_word (__p, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint16_t word;
struct
{
uint8_t lo;
uint8_t hi;
} byte;
} x;
x.byte.lo = eeprom_read_byte ((const uint8_t *)__p);
x.byte.hi = eeprom_read_byte ((const uint8_t *)__p + 1);
return x.word;
#endif
}
/** \ingroup avr_eeprom
Read one 32-bit double word (little endian) from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__
uint32_t eeprom_read_dword (const uint32_t *__p)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
return __eerd_dword (__p, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint32_t dword;
struct
{
uint8_t byte0;
uint8_t byte1;
uint8_t byte2;
uint8_t byte3;
} byte;
} x;
x.byte.byte0 = eeprom_read_byte ((const uint8_t *)__p);
x.byte.byte1 = eeprom_read_byte ((const uint8_t *)__p + 1);
x.byte.byte2 = eeprom_read_byte ((const uint8_t *)__p + 2);
x.byte.byte3 = eeprom_read_byte ((const uint8_t *)__p + 3);
return x.dword;
#endif
}
/** \ingroup avr_eeprom
Read a block of \a __n bytes from EEPROM address \a __src to SRAM
\a __dst.
*/
static __inline__ void
eeprom_read_block (void *__dst, const void *__src, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eerd_block (__dst, __src, __n, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
char *_myDstPtr;
char *_mySrcPtr;
_myDstPtr = (char *)__dst;
_mySrcPtr = (char *)__src;
while (__n--)
{
//* Jul 6, 2010 modifed by Mark Sproul to work with the 2560
// *(char *)__dst++ = eeprom_read_byte((const uint8_t *)__src++);
*_myDstPtr = eeprom_read_byte((const uint8_t *)_mySrcPtr);
_myDstPtr++;
_mySrcPtr++;
}
#endif
}
/** \ingroup avr_eeprom
Write a byte \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_byte (uint8_t *__p, uint8_t __value)
{
do {} while (!eeprom_is_ready ());
#if defined(EEPM0) && defined(EEPM1)
EECR = 0; /* Set programming mode: erase and write. */
#elif defined(EEPM0) || defined(EEPM1)
# warning "Unknown EECR register, eeprom_write_byte() has become outdated."
#endif
#if E2END <= 0xFF
EEARL = (unsigned)__p;
#else
EEAR = (unsigned)__p;
#endif
EEDR = __value;
__asm__ __volatile__ (
"/* START EEPROM WRITE CRITICAL SECTION */\n\t"
"in r0, %[__sreg] \n\t"
"cli \n\t"
"sbi %[__eecr], %[__eemwe] \n\t"
"sbi %[__eecr], %[__eewe] \n\t"
"out %[__sreg], r0 \n\t"
"/* END EEPROM WRITE CRITICAL SECTION */"
:
: [__eecr] "i" (_SFR_IO_ADDR(EECR)),
[__sreg] "i" (_SFR_IO_ADDR(SREG)),
[__eemwe] "i" (EEMWE),
[__eewe] "i" (EEWE)
: "r0"
);
}
/** \ingroup avr_eeprom
Write a word \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_word (uint16_t *__p, uint16_t __value)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_word (__p, __value, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint16_t word;
struct
{
uint8_t lo;
uint8_t hi;
} byte;
} x;
x.word = __value;
eeprom_write_byte ((uint8_t *)__p, x.byte.lo);
eeprom_write_byte ((uint8_t *)__p + 1, x.byte.hi);
#endif
}
/** \ingroup avr_eeprom
Write a 32-bit double word \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_dword (uint32_t *__p, uint32_t __value)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_dword (__p, __value, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint32_t dword;
struct
{
uint8_t byte0;
uint8_t byte1;
uint8_t byte2;
uint8_t byte3;
} byte;
} x;
x.dword = __value;
eeprom_write_byte ((uint8_t *)__p, x.byte.byte0);
eeprom_write_byte ((uint8_t *)__p + 1, x.byte.byte1);
eeprom_write_byte ((uint8_t *)__p + 2, x.byte.byte2);
eeprom_write_byte ((uint8_t *)__p + 3, x.byte.byte3);
#endif
}
/** \ingroup avr_eeprom
Write a block of \a __n bytes to EEPROM address \a __dst from \a __src.
\note The argument order is mismatch with common functions like strcpy().
*/
static __inline__ void
eeprom_write_block (const void *__src, void *__dst, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_block (__dst, __src, __n, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
uint8_t *_myDstPtr;
uint8_t *_mySrcPtr;
//* Jul 6, 2010 modifed by Mark Sproul to work with the 2560
_myDstPtr = (uint8_t *)__dst;
_mySrcPtr = (uint8_t *)__src;
while (__n--)
{
// eeprom_write_byte((uint8_t *)__dst++, *(uint8_t *)__src++);
eeprom_write_byte(_myDstPtr++, *_mySrcPtr++);
}
#endif
}
/** \name IAR C compatibility defines */
/*@{*/
/** \def _EEPUT
\ingroup avr_eeprom
Write a byte to EEPROM. Compatibility define for IAR C. */
#define _EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
/** \def _EEGET
\ingroup avr_eeprom
Read a byte from EEPROM. Compatibility define for IAR C. */
#define _EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
/*@}*/
#endif /* E2END || defined(__DOXYGEN__) */
#ifdef __cplusplus
}
#endif
#endif /* !_AVR_EEPROM_H */

View File

@ -1 +0,0 @@
14c554bb9aa9f0d0262a593e7452d33f4babc60d

View File

@ -0,0 +1 @@
b9510ef55d65d191ec3ed973da84d2ee2844fb06

Binary file not shown.

View File

@ -1,7 +1,37 @@
ARDUINO 1.5.7
ARDUINO 1.5.7 BETA
[core]
* [fix] Bridge HttpClient had wrong implementation of running() function
* Upgraded AVR toolchain: gcc 4.8.1, avr-libc 1.8.0
* Upgraded ARM toolchain: gcc 4.8.3-2014q1
* Upgraded avrdude to version 6.0.1
* ARM gcc doesn't require ia32-libs anymore on 64 bits linux systems
* avr: fixed typo in SerialEvent3 handling (Matthijs Kooijman)
* avr: HardwareSerial support for different size of TX and RX buffer sizes (Jan Baeyens)
* avr: HardwareSerial support for buffer sizes bigger than 256 bytes (Jan Baeyens)
* sam: Added configuration (parity, data bits, stop bits) to Serial1/2/3 of Arduino Due (bluesign2k)
* Removed a lot of compiler warnings from Arduino core
* avr: Fix EXTERNAL_NUM_INTERRUPTS for atmega128rfa1 and atmega256rfr2 (Matthijs Kooijman)
* sam: Fix to Wire::endTransmisson() return value (bluesign2k)
* sam: Fix to Wire usage of TWI status register (bluesign2k)
[ide]
* Added support for '-' and '.' in filenames (Georg von Zengen)
* (re)Added 'arduino_debug.exe' in Windows build for debugging purposes
* Magic baudrate is no longer removed (it was a workaround for RXTX)
(for more info see github issues: #1203 and #995)
* Allow overriding platform.txt using platform.local.txt (Matthijs Kooijman)
* Explicitly define compiler.path in avr/platform.txt (Matthijs Kooijman)
* Make the low available memory message a warning (Matt Robinson)
* Proceed with upload even if port can't be found (David Mellis)
[libraries]
* Updated SpaceBrew library
* Fixed HttpClient::running() function
* Fixed HttpClient::ready() function (Manuel Rabade)
* Added HttpClient::noCheckSSL() method
* Improved speed of YunSerialTerminal
* Fixed CRC of shutdown command on YunSerialTerminal example
* Updates/Fix to various examples
ARDUINO 1.5.6-r2 BETA 2014.02.21

View File

@ -0,0 +1 @@
21577a37f6f438a25903a3338c448385c0c87aeb

BIN
build/windows/dist/cyggcc_s-1.dll vendored Normal file

Binary file not shown.

BIN
build/windows/dist/cygiconv-2.dll vendored Executable file → Normal file

Binary file not shown.

BIN
build/windows/dist/cygwin1.dll vendored Executable file → Normal file

Binary file not shown.

BIN
build/windows/dist/cygz.dll vendored Normal file

Binary file not shown.

View File

@ -1 +0,0 @@
f288affa058bfdd44f8b93800fc4cb01b2ebf1e5

View File

@ -0,0 +1 @@
7b309df740cdddb6d4d252fffc8db7a170448814

View File

@ -1,442 +0,0 @@
/* Copyright (c) 2002, 2003, 2004, 2007 Marek Michalkiewicz
Copyright (c) 2005, 2006 Bjoern Haase
Copyright (c) 2008 Atmel Corporation
Copyright (c) 2008 Wouter van Gulik
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
/* $Id: eeprom.h,v 1.21.2.6 2008/08/19 22:10:39 arcanum Exp $ */
#ifndef _AVR_EEPROM_H_
#define _AVR_EEPROM_H_ 1
#include <avr/io.h>
#include <stddef.h> /* size_t */
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __ATTR_PURE__
# ifdef __DOXYGEN__
# define __ATTR_PURE__
# else
# define __ATTR_PURE__ __attribute__((__pure__))
# endif
#endif
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
uint16_t __eerd_word (const uint16_t *, uint8_t (*)(const uint8_t *))
__ATTR_PURE__;
uint32_t __eerd_dword (const uint32_t *, uint8_t (*)(const uint8_t *))
__ATTR_PURE__;
void __eerd_block (void *, const void *, size_t, uint8_t (*)(const uint8_t *));
void __eewr_word (uint16_t *, uint16_t, void (*)(uint8_t *, uint8_t));
void __eewr_dword (uint32_t *, uint32_t, void (*)(uint8_t *, uint8_t));
void __eewr_block (void *, const void *, size_t, void (*)(uint8_t *, uint8_t));
#endif /* (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) ) */
#if !E2END && !defined(__DOXYGEN__)
# ifndef __COMPILING_AVR_LIBC__
# warning "Device does not have EEPROM available."
# endif
/* Omit below for chips without EEPROM. */
#else
/** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
\code #include <avr/eeprom.h> \endcode
This header file declares the interface to some simple library
routines suitable for handling the data EEPROM contained in the
AVR microcontrollers. The implementation uses a simple polled
mode interface. Applications that require interrupt-controlled
EEPROM access to ensure that no time will be wasted in spinloops
will have to deploy their own implementation.
\note All of the read/write functions first make sure the EEPROM
is ready to be accessed. Since this may cause long delays if a
write operation is still pending, time-critical applications
should first poll the EEPROM e. g. using eeprom_is_ready() before
attempting any actual I/O. But this functions are not wait until
SELFPRGEN in SPMCSR becomes zero. Do this manually, if your
softwate contains the Flash burning.
\note As these functions modify IO registers, they are known to be
non-reentrant. If any of these functions are used from both,
standard and interrupt context, the applications must ensure
proper protection (e.g. by disabling interrupts before accessing
them).
\note All write functions force erase_and_write programming mode.
*/
/** \def EEMEM
\ingroup avr_eeprom
Attribute expression causing a variable to be allocated within the
.eeprom section. */
#define EEMEM __attribute__((section(".eeprom")))
/* Register definitions */
/* Check for aliases. */
#if !defined(EEWE) && defined(EEPE)
# define EEWE EEPE
#endif
#if !defined(EEMWE) && defined(EEMPE)
# define EEMWE EEMPE
#endif
#if !defined(EECR) && defined(DEECR)
/* AT86RF401 */
# define EECR DEECR
# define EEAR DEEAR
# define EEARL DEEAR
# define EEDR DEEDR
# define EERE EER
# define EEWE EEL
# define EEMWE EEU
#endif
#if !defined(EECR) || !defined(EEDR) || !defined(EEARL)
# if !defined(__EEPROM_REG_LOCATIONS__) \
&& !defined(EEPROM_REG_LOCATIONS_OVERRIDE)
/* 6-byte string denoting where to find the EEPROM registers in memory
space. Adresses denoted in hex syntax with uppercase letters. Used
by the EEPROM subroutines.
First two letters: EECR address.
Second two letters: EEDR address.
Last two letters: EEAR address.
*/
# error "Unknown EEPROM register(s) location."
# endif
/* If needed, override the locations defined in the IO headers. */
# ifdef EEPROM_REG_LOCATIONS_OVERRIDE
# undef __EEPROM_REG_LOCATIONS__
# define __EEPROM_REG_LOCATIONS__ EEPROM_REG_LOCATIONS_OVERRIDE
# endif
# define CONCAT1(a, b) CONCAT2(a, b)
# define CONCAT2(a, b) a ## b
# define HEXNR CONCAT1(0x, __EEPROM_REG_LOCATIONS__)
# undef EECR
# define EECR _SFR_IO8((HEXNR >> 16) & 0xFF)
# undef EEDR
# define EEDR _SFR_IO8((HEXNR >> 8) & 0xFF)
# undef EEAR
# define EEAR _SFR_IO8(HEXNR & 0xFF)
# undef EEARH
# undef EEARL
# define EEARL EEAR
#endif
/** \def eeprom_is_ready
\ingroup avr_eeprom
\returns 1 if EEPROM is ready for a new read/write operation, 0 if not.
*/
#if defined(__DOXYGEN__)
# define eeprom_is_ready()
#elif defined(DEECR)
# define eeprom_is_ready() bit_is_clear(DEECR, BSY)
#else
# define eeprom_is_ready() bit_is_clear(EECR, EEWE)
#endif
/** \def eeprom_busy_wait
\ingroup avr_eeprom
Loops until the eeprom is no longer busy.
\returns Nothing.
*/
#define eeprom_busy_wait() do {} while (!eeprom_is_ready())
/** \ingroup avr_eeprom
Read one byte from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__ uint8_t eeprom_read_byte (const uint8_t *__p)
{
do {} while (!eeprom_is_ready ());
#if E2END <= 0xFF
EEARL = (uint8_t)(uint16_t)__p;
#else
EEAR = (uint16_t)__p;
#endif
/* Use inline assembly below as some AVRs have problems with accessing
EECR with STS instructions. For example, see errata for ATmega64.
The code below also assumes that EECR and EEDR are in the I/O space.
*/
uint8_t __result;
__asm__ __volatile__
(
"/* START EEPROM READ CRITICAL SECTION */ \n\t"
"sbi %1, %2 \n\t"
"in %0, %3 \n\t"
"/* END EEPROM READ CRITICAL SECTION */ \n\t"
: "=r" (__result)
: "i" (_SFR_IO_ADDR(EECR)),
"i" (EERE),
"i" (_SFR_IO_ADDR(EEDR))
);
return __result;
}
/** \ingroup avr_eeprom
Read one 16-bit word (little endian) from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__ uint16_t eeprom_read_word (const uint16_t *__p)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
return __eerd_word (__p, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint16_t word;
struct
{
uint8_t lo;
uint8_t hi;
} byte;
} x;
x.byte.lo = eeprom_read_byte ((const uint8_t *)__p);
x.byte.hi = eeprom_read_byte ((const uint8_t *)__p + 1);
return x.word;
#endif
}
/** \ingroup avr_eeprom
Read one 32-bit double word (little endian) from EEPROM address \a __p.
*/
__ATTR_PURE__ static __inline__
uint32_t eeprom_read_dword (const uint32_t *__p)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
return __eerd_dword (__p, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint32_t dword;
struct
{
uint8_t byte0;
uint8_t byte1;
uint8_t byte2;
uint8_t byte3;
} byte;
} x;
x.byte.byte0 = eeprom_read_byte ((const uint8_t *)__p);
x.byte.byte1 = eeprom_read_byte ((const uint8_t *)__p + 1);
x.byte.byte2 = eeprom_read_byte ((const uint8_t *)__p + 2);
x.byte.byte3 = eeprom_read_byte ((const uint8_t *)__p + 3);
return x.dword;
#endif
}
/** \ingroup avr_eeprom
Read a block of \a __n bytes from EEPROM address \a __src to SRAM
\a __dst.
*/
static __inline__ void
eeprom_read_block (void *__dst, const void *__src, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eerd_block (__dst, __src, __n, eeprom_read_byte);
#else
/* If ATmega256x device, do not call function. */
char *_myDstPtr;
char *_mySrcPtr;
_myDstPtr = (char *)__dst;
_mySrcPtr = (char *)__src;
while (__n--)
{
//* Jul 6, 2010 modifed by Mark Sproul to work with the 2560
// *(char *)__dst++ = eeprom_read_byte((const uint8_t *)__src++);
*_myDstPtr = eeprom_read_byte((const uint8_t *)_mySrcPtr);
_myDstPtr++;
_mySrcPtr++;
}
#endif
}
/** \ingroup avr_eeprom
Write a byte \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_byte (uint8_t *__p, uint8_t __value)
{
do {} while (!eeprom_is_ready ());
#if defined(EEPM0) && defined(EEPM1)
EECR = 0; /* Set programming mode: erase and write. */
#elif defined(EEPM0) || defined(EEPM1)
# warning "Unknown EECR register, eeprom_write_byte() has become outdated."
#endif
#if E2END <= 0xFF
EEARL = (unsigned)__p;
#else
EEAR = (unsigned)__p;
#endif
EEDR = __value;
__asm__ __volatile__ (
"/* START EEPROM WRITE CRITICAL SECTION */\n\t"
"in r0, %[__sreg] \n\t"
"cli \n\t"
"sbi %[__eecr], %[__eemwe] \n\t"
"sbi %[__eecr], %[__eewe] \n\t"
"out %[__sreg], r0 \n\t"
"/* END EEPROM WRITE CRITICAL SECTION */"
:
: [__eecr] "i" (_SFR_IO_ADDR(EECR)),
[__sreg] "i" (_SFR_IO_ADDR(SREG)),
[__eemwe] "i" (EEMWE),
[__eewe] "i" (EEWE)
: "r0"
);
}
/** \ingroup avr_eeprom
Write a word \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_word (uint16_t *__p, uint16_t __value)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_word (__p, __value, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint16_t word;
struct
{
uint8_t lo;
uint8_t hi;
} byte;
} x;
x.word = __value;
eeprom_write_byte ((uint8_t *)__p, x.byte.lo);
eeprom_write_byte ((uint8_t *)__p + 1, x.byte.hi);
#endif
}
/** \ingroup avr_eeprom
Write a 32-bit double word \a __value to EEPROM address \a __p.
*/
static __inline__ void eeprom_write_dword (uint32_t *__p, uint32_t __value)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_dword (__p, __value, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
union
{
uint32_t dword;
struct
{
uint8_t byte0;
uint8_t byte1;
uint8_t byte2;
uint8_t byte3;
} byte;
} x;
x.dword = __value;
eeprom_write_byte ((uint8_t *)__p, x.byte.byte0);
eeprom_write_byte ((uint8_t *)__p + 1, x.byte.byte1);
eeprom_write_byte ((uint8_t *)__p + 2, x.byte.byte2);
eeprom_write_byte ((uint8_t *)__p + 3, x.byte.byte3);
#endif
}
/** \ingroup avr_eeprom
Write a block of \a __n bytes to EEPROM address \a __dst from \a __src.
\note The argument order is mismatch with common functions like strcpy().
*/
static __inline__ void
eeprom_write_block (const void *__src, void *__dst, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
__eewr_block (__dst, __src, __n, eeprom_write_byte);
#else
/* If ATmega256x device, do not call function. */
uint8_t *_myDstPtr;
uint8_t *_mySrcPtr;
//* Jul 6, 2010 modifed by Mark Sproul to work with the 2560
_myDstPtr = (uint8_t *)__dst;
_mySrcPtr = (uint8_t *)__src;
while (__n--)
{
// eeprom_write_byte((uint8_t *)__dst++, *(uint8_t *)__src++);
eeprom_write_byte(_myDstPtr++, *_mySrcPtr++);
}
#endif
}
/** \name IAR C compatibility defines */
/*@{*/
/** \def _EEPUT
\ingroup avr_eeprom
Write a byte to EEPROM. Compatibility define for IAR C. */
#define _EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
/** \def _EEGET
\ingroup avr_eeprom
Read a byte from EEPROM. Compatibility define for IAR C. */
#define _EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
/*@}*/
#endif /* E2END || defined(__DOXYGEN__) */
#ifdef __cplusplus
}
#endif
#endif /* !_AVR_EEPROM_H */

View File

@ -1,267 +0,0 @@
/* Copyright (c) 2002, 2004, 2010 Joerg Wunsch
Copyright (c) 2010 Gerben van den Broeke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* $Id: malloc.c 2149 2010-06-09 20:45:37Z joerg_wunsch $ */
#include <stdlib.h>
#include "sectionname.h"
#include "stdlib_private.h"
#include <avr/io.h>
/*
* Exported interface:
*
* When extending the data segment, the allocator will not try to go
* beyond the current stack limit, decreased by __malloc_margin bytes.
* Thus, all possible stack frames of interrupt routines that could
* interrupt the current function, plus all further nested function
* calls must not require more stack space, or they'll risk to collide
* with the data segment.
*/
/* May be changed by the user only before the first malloc() call. */
size_t __malloc_margin = 128;
char *__malloc_heap_start = &__heap_start;
char *__malloc_heap_end = &__heap_end;
char *__brkval;
struct __freelist *__flp;
ATTRIBUTE_CLIB_SECTION
void *
malloc(size_t len)
{
struct __freelist *fp1, *fp2, *sfp1, *sfp2;
char *cp;
size_t s, avail;
/*
* Our minimum chunk size is the size of a pointer (plus the
* size of the "sz" field, but we don't need to account for
* this), otherwise we could not possibly fit a freelist entry
* into the chunk later.
*/
if (len < sizeof(struct __freelist) - sizeof(size_t))
len = sizeof(struct __freelist) - sizeof(size_t);
/*
* First, walk the free list and try finding a chunk that
* would match exactly. If we found one, we are done. While
* walking, note down the smallest chunk we found that would
* still fit the request -- we need it for step 2.
*
*/
for (s = 0, fp1 = __flp, fp2 = 0;
fp1;
fp2 = fp1, fp1 = fp1->nx) {
if (fp1->sz < len)
continue;
if (fp1->sz == len) {
/*
* Found it. Disconnect the chunk from the
* freelist, and return it.
*/
if (fp2)
fp2->nx = fp1->nx;
else
__flp = fp1->nx;
return &(fp1->nx);
}
else {
if (s == 0 || fp1->sz < s) {
/* this is the smallest chunk found so far */
s = fp1->sz;
sfp1 = fp1;
sfp2 = fp2;
}
}
}
/*
* Step 2: If we found a chunk on the freelist that would fit
* (but was too large), look it up again and use it, since it
* is our closest match now. Since the freelist entry needs
* to be split into two entries then, watch out that the
* difference between the requested size and the size of the
* chunk found is large enough for another freelist entry; if
* not, just enlarge the request size to what we have found,
* and use the entire chunk.
*/
if (s) {
if (s - len < sizeof(struct __freelist)) {
/* Disconnect it from freelist and return it. */
if (sfp2)
sfp2->nx = sfp1->nx;
else
__flp = sfp1->nx;
return &(sfp1->nx);
}
/*
* Split them up. Note that we leave the first part
* as the new (smaller) freelist entry, and return the
* upper portion to the caller. This saves us the
* work to fix up the freelist chain; we just need to
* fixup the size of the current entry, and note down
* the size of the new chunk before returning it to
* the caller.
*/
cp = (char *)sfp1;
s -= len;
cp += s;
sfp2 = (struct __freelist *)cp;
sfp2->sz = len;
sfp1->sz = s - sizeof(size_t);
return &(sfp2->nx);
}
/*
* Step 3: If the request could not be satisfied from a
* freelist entry, just prepare a new chunk. This means we
* need to obtain more memory first. The largest address just
* not allocated so far is remembered in the brkval variable.
* Under Unix, the "break value" was the end of the data
* segment as dynamically requested from the operating system.
* Since we don't have an operating system, just make sure
* that we don't collide with the stack.
*/
if (__brkval == 0)
__brkval = __malloc_heap_start;
cp = __malloc_heap_end;
if (cp == 0)
cp = STACK_POINTER() - __malloc_margin;
if (cp <= __brkval)
/*
* Memory exhausted.
*/
return 0;
avail = cp - __brkval;
/*
* Both tests below are needed to catch the case len >= 0xfffe.
*/
if (avail >= len && avail >= len + sizeof(size_t)) {
fp1 = (struct __freelist *)__brkval;
__brkval += len + sizeof(size_t);
fp1->sz = len;
return &(fp1->nx);
}
/*
* Step 4: There's no help, just fail. :-/
*/
return 0;
}
ATTRIBUTE_CLIB_SECTION
void
free(void *p)
{
struct __freelist *fp1, *fp2, *fpnew;
char *cp1, *cp2, *cpnew;
/* ISO C says free(NULL) must be a no-op */
if (p == 0)
return;
cpnew = p;
cpnew -= sizeof(size_t);
fpnew = (struct __freelist *)cpnew;
fpnew->nx = 0;
/*
* Trivial case first: if there's no freelist yet, our entry
* will be the only one on it. If this is the last entry, we
* can reduce __brkval instead.
*/
if (__flp == 0) {
if ((char *)p + fpnew->sz == __brkval)
__brkval = cpnew;
else
__flp = fpnew;
return;
}
/*
* Now, find the position where our new entry belongs onto the
* freelist. Try to aggregate the chunk with adjacent chunks
* if possible.
*/
for (fp1 = __flp, fp2 = 0;
fp1;
fp2 = fp1, fp1 = fp1->nx) {
if (fp1 < fpnew)
continue;
cp1 = (char *)fp1;
fpnew->nx = fp1;
if ((char *)&(fpnew->nx) + fpnew->sz == cp1) {
/* upper chunk adjacent, assimilate it */
fpnew->sz += fp1->sz + sizeof(size_t);
fpnew->nx = fp1->nx;
}
if (fp2 == 0) {
/* new head of freelist */
__flp = fpnew;
return;
}
break;
}
/*
* Note that we get here either if we hit the "break" above,
* or if we fell off the end of the loop. The latter means
* we've got a new topmost chunk. Either way, try aggregating
* with the lower chunk if possible.
*/
fp2->nx = fpnew;
cp2 = (char *)&(fp2->nx);
if (cp2 + fp2->sz == cpnew) {
/* lower junk adjacent, merge */
fp2->sz += fpnew->sz + sizeof(size_t);
fp2->nx = fpnew->nx;
}
/*
* If there's a new topmost chunk, lower __brkval instead.
*/
for (fp1 = __flp, fp2 = 0;
fp1->nx != 0;
fp2 = fp1, fp1 = fp1->nx)
/* advance to entry just before end of list */;
cp2 = (char *)&(fp1->nx);
if (cp2 + fp1->sz == __brkval) {
if (fp2 == NULL)
/* Freelist is empty now. */
__flp = NULL;
else
fp2->nx = NULL;
__brkval = cp2 - sizeof(size_t);
}
}

View File

@ -1,150 +0,0 @@
/* Copyright (c) 2004, 2010 Joerg Wunsch
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* $Id: realloc.c 2127 2010-06-07 14:49:37Z joerg_wunsch $ */
#include <stdlib.h>
#include <string.h>
#include "sectionname.h"
#include "stdlib_private.h"
#include <avr/io.h>
ATTRIBUTE_CLIB_SECTION
void *
realloc(void *ptr, size_t len)
{
struct __freelist *fp1, *fp2, *fp3, *ofp3;
char *cp, *cp1;
void *memp;
size_t s, incr;
/* Trivial case, required by C standard. */
if (ptr == 0)
return malloc(len);
cp1 = (char *)ptr;
cp1 -= sizeof(size_t);
fp1 = (struct __freelist *)cp1;
cp = (char *)ptr + len; /* new next pointer */
if (cp < cp1)
/* Pointer wrapped across top of RAM, fail. */
return 0;
/*
* See whether we are growing or shrinking. When shrinking,
* we split off a chunk for the released portion, and call
* free() on it. Therefore, we can only shrink if the new
* size is at least sizeof(struct __freelist) smaller than the
* previous size.
*/
if (len <= fp1->sz) {
/* The first test catches a possible unsigned int
* rollover condition. */
if (fp1->sz <= sizeof(struct __freelist) ||
len > fp1->sz - sizeof(struct __freelist))
return ptr;
fp2 = (struct __freelist *)cp;
fp2->sz = fp1->sz - len - sizeof(size_t);
fp1->sz = len;
free(&(fp2->nx));
return ptr;
}
/*
* If we get here, we are growing. First, see whether there
* is space in the free list on top of our current chunk.
*/
incr = len - fp1->sz;
cp = (char *)ptr + fp1->sz;
fp2 = (struct __freelist *)cp;
for (s = 0, ofp3 = 0, fp3 = __flp;
fp3;
ofp3 = fp3, fp3 = fp3->nx) {
if (fp3 == fp2 && fp3->sz + sizeof(size_t) >= incr) {
/* found something that fits */
if (fp3->sz + sizeof(size_t) - incr > sizeof(struct __freelist)) {
/* split off a new freelist entry */
cp = (char *)ptr + len;
fp2 = (struct __freelist *)cp;
fp2->nx = fp3->nx;
fp2->sz = fp3->sz - incr;
fp1->sz = len;
} else {
/* it just fits, so use it entirely */
fp1->sz += fp3->sz + sizeof(size_t);
fp2 = fp3->nx;
}
if (ofp3)
ofp3->nx = fp2;
else
__flp = fp2;
return ptr;
}
/*
* Find the largest chunk on the freelist while
* walking it.
*/
if (fp3->sz > s)
s = fp3->sz;
}
/*
* If we are the topmost chunk in memory, and there was no
* large enough chunk on the freelist that could be re-used
* (by a call to malloc() below), quickly extend the
* allocation area if possible, without need to copy the old
* data.
*/
if (__brkval == (char *)ptr + fp1->sz && len > s) {
cp1 = __malloc_heap_end;
cp = (char *)ptr + len;
if (cp1 == 0)
cp1 = STACK_POINTER() - __malloc_margin;
if (cp < cp1) {
__brkval = cp;
fp1->sz = len;
return ptr;
}
/* If that failed, we are out of luck. */
return 0;
}
/*
* Call malloc() for a new chunk, then copy over the data, and
* release the old region.
*/
if ((memp = malloc(len)) == 0)
return 0;
memcpy(memp, ptr, fp1->sz);
free(ptr);
return memp;
}

View File

@ -1,49 +0,0 @@
/* Copyright (c) 2009 Atmel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SECTIONNAME_H__
#define __SECTIONNAME_H__
/* Put all avr-libc functions in a common, unique sub-section name under .text. */
#define CLIB_SECTION .text.avr-libc
#define MLIB_SECTION .text.avr-libc.fplib
#define STR(x) _STR(x)
#define _STR(x) #x
#define ATTRIBUTE_CLIB_SECTION __attribute__ ((section (STR(CLIB_SECTION))))
#define ATTRIBUTE_MLIB_SECTION __attribute__ ((section (STR(MLIB_SECTION))))
#define ASSEMBLY_CLIB_SECTION .section CLIB_SECTION, "ax", @progbits
#define ASSEMBLY_MLIB_SECTION .section MLIB_SECTION, "ax", @progbits
#endif

View File

@ -1,58 +0,0 @@
/* Copyright (c) 2004, Joerg Wunsch
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* $Id: stdlib_private.h 1657 2008-03-24 17:11:08Z arcanum $ */
#include <inttypes.h>
#include <stdlib.h>
#include <avr/io.h>
#if !defined(__DOXYGEN__)
struct __freelist {
size_t sz;
struct __freelist *nx;
};
#endif
extern char *__brkval; /* first location not yet allocated */
extern struct __freelist *__flp; /* freelist pointer (head of freelist) */
extern size_t __malloc_margin; /* user-changeable before the first malloc() */
extern char *__malloc_heap_start;
extern char *__malloc_heap_end;
extern char __heap_start;
extern char __heap_end;
/* Needed for definition of AVR_STACK_POINTER_REG. */
#include <avr/io.h>
#define STACK_POINTER() ((char *)AVR_STACK_POINTER_REG)

View File

@ -14,12 +14,14 @@ version=1.5.6
# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags=-Os -Wl,--gc-sections
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD -flto
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags=-w -flto -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -flto
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
@ -77,8 +79,6 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude.cmd.path.linux={runtime.ide.path}/hardware/tools/avrdude
tools.avrdude.config.path.linux={runtime.ide.path}/hardware/tools/avrdude.conf
tools.avrdude.upload.params.verbose=-v -v -v -v
tools.avrdude.upload.params.quiet=-q -q

View File

@ -10,7 +10,7 @@ version=1.5.6
# SAM3 compile variables
# ----------------------
compiler.path={runtime.ide.path}/hardware/tools/g++_arm_none_eabi/bin/
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf
compiler.c.elf.cmd=arm-none-eabi-g++