1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

[sam] fixing last stupid commit

This commit is contained in:
Thibaut VIARD
2011-09-06 21:05:41 +02:00
parent 8f01f92e87
commit a5d2349761
550 changed files with 16866 additions and 17198 deletions

View File

@ -79,32 +79,12 @@ typedef unsigned int word;
typedef uint8_t boolean ; typedef uint8_t boolean ;
typedef uint8_t byte ; typedef uint8_t byte ;
#include "wiring.h"
#include "wiring_digital.h"
#include "wiring_analog.h"
#include "wiring_shift.h"
// wiring_digital.c /* sketch */
extern void pinMode( uint32_t dwPin, uint32_t dwMode ) ;
extern void digitalWrite( uint32_t dwPin, uint32_t dwVal ) ;
extern int digitalRead( uint32_t dwPin ) ;
// wiring_analog.c
extern int analogRead( uint8_t ) ;
extern void analogReference( uint8_t mode ) ;
extern void analogWrite( uint8_t, int ) ;
// wiring.c
extern void init( void ) ;
extern uint32_t millis( void ) ;
extern uint32_t micros( void ) ;
extern void delay( uint32_t dwMs ) ;
extern void delayMicroseconds( uint32_t dwUs ) ;
// wiring_shift.c
extern void shiftOut( uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val ) ;
extern uint8_t shiftIn( uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder ) ;
extern void attachInterrupt( uint8_t, void (*)(void), int mode ) ;
extern void detachInterrupt( uint8_t ) ;
// sketch
extern void setup( void ) ; extern void setup( void ) ;
extern void loop( void ) ; extern void loop( void ) ;
@ -127,31 +107,24 @@ extern void loop( void ) ;
#define NOT_ON_TIMER 0 #define NOT_ON_TIMER 0
#define TIMER0 1 #define TIMER0 1
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif // __cplusplus #endif // __cplusplus
#ifdef __cplusplus #ifdef __cplusplus
# include "WCharacter.h" #include "WCharacter.h"
# include "WString.h" #include "WString.h"
# include "HardwareSerial.h" #include "HardwareSerial.h"
uint16_t makeWord( uint16_t w ) ; uint16_t makeWord( uint16_t w ) ;
uint16_t makeWord( byte h, byte l ) ; uint16_t makeWord( byte h, byte l ) ;
#define word(...) makeWord(__VA_ARGS__) #define word(...) makeWord(__VA_ARGS__)
extern uint32_t pulseIn( uint32_t pin, uint32_t state, uint32_t timeout = 1000000L ) ; #include "Tone.h"
#include "WMath.h"
extern void tone( uint32_t dwPin, uint32_t dwFrequency, uint32_t dwDuration = 0 ) ;
extern void noTone( uint32_t dwPin ) ;
// WMath prototypes
extern long random( long ) ;
extern long random( long, long ) ;
extern void randomSeed( uint32_t dwSeed ) ;
extern long map( long, long, long, long, long ) ;
#endif // __cplusplus #endif // __cplusplus
@ -194,4 +167,4 @@ typedef struct _PinDescription
#include "pins_arduino.h" #include "pins_arduino.h"
#endif // Arduino_h #endif // Arduino_h

View File

@ -32,7 +32,9 @@ class HardwareSerial : public Stream
virtual void flush( void ) =0 ; virtual void flush( void ) =0 ;
virtual void write( const uint8_t c ) =0 ; virtual void write( const uint8_t c ) =0 ;
using Print::write ; // pull in write(str) and write(buf, size) from Print virtual void write( const char *str ) ;
virtual void write( const uint8_t *buffer, size_t size ) ;
// using Print::write ; // pull in write(str) and write(buf, size) from Print
} ; } ;
// Complementary API // Complementary API

View File

@ -39,7 +39,7 @@ class Print
virtual void write(uint8_t) = 0; virtual void write(uint8_t) = 0;
virtual void write(const char *str); virtual void write(const char *str);
virtual void write(const uint8_t *buffer, size_t size); virtual void write(const uint8_t *buffer, size_t size);
void print(const String &); void print(const String &);
void print(const char[]); void print(const char[]);
void print(char); void print(char);

View File

@ -26,7 +26,9 @@ class UARTClass : public HardwareSerial
void IrqHandler( void ) ; void IrqHandler( void ) ;
using Print::write ; // pull in write(str) and write(buf, size) from Print virtual void write( const char *str ) ;
virtual void write( const uint8_t *buffer, size_t size ) ;
// using Print::write ; // pull in write(str) and write(buf, size) from Print
}; };
#endif // _UART_ #endif // _UART_

View File

@ -26,7 +26,9 @@ class USARTClass : public HardwareSerial
void IrqHandler( void ) ; void IrqHandler( void ) ;
using Print::write ; // pull in write(str) and write(buf, size) from Print void write( const char *str ) ;
void write( const uint8_t *buffer, size_t size ) ;
// using Print::write ; // pull in write(str) and write(buf, size) from Print
}; };
#endif // _USART_ #endif // _USART_

View File

@ -1,17 +1,17 @@
/* /*
WCharacter.h - Character utility functions for Wiring & Arduino WCharacter.h - Character utility functions for Wiring & Arduino
Copyright (c) 2010 Hernando Barragan. All right reserved. Copyright (c) 2010 Hernando Barragan. All right reserved.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@ -22,7 +22,12 @@
#include <ctype.h> #include <ctype.h>
#ifdef __cplusplus
extern "C" {
#endif
// WCharacter.h prototypes // WCharacter.h prototypes
#if defined ( __GNUC__ )
inline boolean isAlphaNumeric(int c) __attribute__((always_inline)); inline boolean isAlphaNumeric(int c) __attribute__((always_inline));
inline boolean isAlpha(int c) __attribute__((always_inline)); inline boolean isAlpha(int c) __attribute__((always_inline));
inline boolean isAscii(int c) __attribute__((always_inline)); inline boolean isAscii(int c) __attribute__((always_inline));
@ -39,17 +44,18 @@ inline boolean isHexadecimalDigit(int c) __attribute__((always_inline));
inline int toAscii(int c) __attribute__((always_inline)); inline int toAscii(int c) __attribute__((always_inline));
inline int toLowerCase(int c) __attribute__((always_inline)); inline int toLowerCase(int c) __attribute__((always_inline));
inline int toUpperCase(int c)__attribute__((always_inline)); inline int toUpperCase(int c)__attribute__((always_inline));
#elif defined ( __ICCARM__ )
#endif
// Checks for an alphanumeric character.
// Checks for an alphanumeric character.
// It is equivalent to (isalpha(c) || isdigit(c)). // It is equivalent to (isalpha(c) || isdigit(c)).
inline boolean isAlphaNumeric(int c) inline boolean isAlphaNumeric(int c)
{ {
return ( isalnum(c) == 0 ? false : true); return ( isalnum(c) == 0 ? false : true);
} }
// Checks for an alphabetic character. // Checks for an alphabetic character.
// It is equivalent to (isupper(c) || islower(c)). // It is equivalent to (isupper(c) || islower(c)).
inline boolean isAlpha(int c) inline boolean isAlpha(int c)
{ {
@ -57,11 +63,12 @@ inline boolean isAlpha(int c)
} }
// Checks whether c is a 7-bit unsigned char value // Checks whether c is a 7-bit unsigned char value
// that fits into the ASCII character set. // that fits into the ASCII character set.
inline boolean isAscii(int c) inline boolean isAscii(int c)
{ {
return ( isascii (c) == 0 ? false : true); /* return ( isascii(c) == 0 ? false : true); */
return ( (c & ~0x7f) != 0 ? false : true);
} }
@ -107,7 +114,7 @@ inline boolean isPrintable(int c)
} }
// Checks for any printable character which is not a space // Checks for any printable character which is not a space
// or an alphanumeric character. // or an alphanumeric character.
inline boolean isPunct(int c) inline boolean isPunct(int c)
{ {
@ -115,8 +122,8 @@ inline boolean isPunct(int c)
} }
// Checks for white-space characters. For the avr-libc library, // Checks for white-space characters. For the avr-libc library,
// these are: space, formfeed ('\f'), newline ('\n'), carriage // these are: space, formfeed ('\f'), newline ('\n'), carriage
// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). // return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').
inline boolean isSpace(int c) inline boolean isSpace(int c)
{ {
@ -131,7 +138,7 @@ inline boolean isUpperCase(int c)
} }
// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 // Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7
// 8 9 a b c d e f A B C D E F. // 8 9 a b c d e f A B C D E F.
inline boolean isHexadecimalDigit(int c) inline boolean isHexadecimalDigit(int c)
{ {
@ -139,17 +146,18 @@ inline boolean isHexadecimalDigit(int c)
} }
// Converts c to a 7-bit unsigned char value that fits into the // Converts c to a 7-bit unsigned char value that fits into the
// ASCII character set, by clearing the high-order bits. // ASCII character set, by clearing the high-order bits.
inline int toAscii(int c) inline int toAscii(int c)
{ {
return toascii (c); /* return toascii (c); */
return (c & 0x7f);
} }
// Warning: // Warning:
// Many people will be unhappy if you use this function. // Many people will be unhappy if you use this function.
// This function will convert accented letters into random // This function will convert accented letters into random
// characters. // characters.
// Converts the letter c to lower case, if possible. // Converts the letter c to lower case, if possible.
@ -165,4 +173,8 @@ inline int toUpperCase(int c)
return toupper (c); return toupper (c);
} }
#endif #ifdef __cplusplus
}
#endif
#endif

View File

@ -3,19 +3,4 @@
#include "wiring_private.h" #include "wiring_private.h"
volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
{
intFunc[interruptNum] = userFunc;
}
}
void detachInterrupt( uint8_t interruptNum )
{
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
{
intFunc[interruptNum] = 0;
}
}

View File

@ -4,7 +4,7 @@
Part of the Wiring project - http://wiring.org.co Part of the Wiring project - http://wiring.org.co
Copyright (c) 2004-06 Hernando Barragan Copyright (c) 2004-06 Hernando Barragan
Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -19,7 +19,7 @@
Public License along with this library; if not, write to the Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA Boston, MA 02111-1307 USA
$Id$ $Id$
*/ */
@ -64,11 +64,11 @@ long map(long x, long in_min, long in_max, long out_min, long out_max)
} }
uint32_t makeWord( uint32_t w ) uint32_t makeWord( uint32_t w )
{ {
return w ; return w ;
} }
uint32_t makeWord( uint8_t h, uint8_t l ) uint32_t makeWord( uint8_t h, uint8_t l )
{ {
return (h << 8) | l ; return (h << 8) | l ;
} }

View File

@ -1,171 +0,0 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, 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 disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "Arduino.h"
/*----------------------------------------------------------------------------
* Exported variables
*----------------------------------------------------------------------------*/
/* Stack Configuration */
#define STACK_SIZE 0x900 /** Stack size (in DWords) */
__attribute__ ((aligned(8),section(".stack")))
uint32_t pdwStack[STACK_SIZE] ;
/* Initialize segments */
extern uint32_t _sfixed;
extern uint32_t _efixed;
extern uint32_t _etext;
extern uint32_t _srelocate;
extern uint32_t _erelocate;
extern uint32_t _szero;
extern uint32_t _ezero;
/*----------------------------------------------------------------------------
* Prototypes
*----------------------------------------------------------------------------*/
/** \cond DOXYGEN_SHOULD_SKIP_THIS */
extern int main( void ) ;
/** \endcond */
void Reset_Handler( void ) ;
extern void __libc_init_array( void ) ;
/*------------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
void* vector_table[] __attribute__ ((section(".vectors"))) = {
/* Configure Initial Stack Pointer, using linker-generated symbols */
(IntFunc)(&pdwStack[STACK_SIZE-1]),
Reset_Handler,
NMI_Handler,
HardFault_Handler,
MemManage_Handler,
BusFault_Handler,
UsageFault_Handler,
0, 0, 0, 0, /* Reserved */
SVC_Handler,
DebugMon_Handler,
0, /* Reserved */
PendSV_Handler,
SysTick_Handler,
/* Configurable interrupts */
SUPC_IrqHandler, /* 0 Supply Controller */
RSTC_IrqHandler, /* 1 Reset Controller */
RTC_IrqHandler, /* 2 Real Time Clock */
RTT_IrqHandler, /* 3 Real Time Timer */
WDT_IrqHandler, /* 4 Watchdog Timer */
PMC_IrqHandler, /* 5 PMC */
EEFC_IrqHandler, /* 6 EEFC */
Dummy_Handler, /* 7 Reserved */
UART0_IrqHandler, /* 8 UART0 */
UART1_IrqHandler, /* 9 UART1 */
SMC_IrqHandler, /* 10 SMC */
PIOA_IrqHandler, /* 11 Parallel IO Controller A */
PIOB_IrqHandler, /* 12 Parallel IO Controller B */
PIOC_IrqHandler, /* 13 Parallel IO Controller C */
USART0_IrqHandler, /* 14 USART 0 */
USART1_IrqHandler, /* 15 USART 1 */
Dummy_Handler, /* 16 Reserved */
Dummy_Handler, /* 17 Reserved */
MCI_IrqHandler, /* 18 MCI */
TWI0_IrqHandler, /* 19 TWI 0 */
TWI1_IrqHandler, /* 20 TWI 1 */
SPI_IrqHandler, /* 21 SPI */
SSC_IrqHandler, /* 22 SSC */
TC0_IrqHandler, /* 23 Timer Counter 0 */
TC1_IrqHandler, /* 24 Timer Counter 1 */
TC2_IrqHandler, /* 25 Timer Counter 2 */
TC3_IrqHandler, /* 26 Timer Counter 3 */
TC4_IrqHandler, /* 27 Timer Counter 4 */
TC5_IrqHandler, /* 28 Timer Counter 5 */
ADC_IrqHandler, /* 29 ADC controller */
DAC_IrqHandler, /* 30 DAC controller */
PWM_IrqHandler, /* 31 PWM */
CRCCU_IrqHandler, /* 32 CRC Calculation Unit */
ACC_IrqHandler, /* 33 Analog Comparator */
USBD_IrqHandler, /* 34 USB Device Port */
Dummy_Handler /* 35 not used */
};
/**
* \brief This is the code that gets called on processor reset.
* To initialize the device, and call the main() routine.
*/
void Reset_Handler( void )
{
uint32_t *pSrc, *pDest ;
/* Arduino board Low level Initialization */
init() ;
/* Initialize the relocate segment */
pSrc = &_etext ;
pDest = &_srelocate ;
if ( pSrc != pDest )
{
for ( ; pDest < &_erelocate ; )
{
*pDest++ = *pSrc++ ;
}
}
/* Clear the zero segment */
for ( pDest = &_szero ; pDest < &_ezero ; )
{
*pDest++ = 0;
}
/* Set the vector table base address */
pSrc = (uint32_t *)&_sfixed;
SCB->VTOR = ( (uint32_t)pSrc & SCB_VTOR_TBLOFF_Msk ) ;
if ( ((uint32_t)pSrc >= IRAM_ADDR) && ((uint32_t)pSrc < IRAM_ADDR+IRAM_SIZE) )
{
SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos ;
}
/* Initialize the C library */
__libc_init_array() ;
/* Branch to main function */
main() ;
/* Infinite loop */
while ( 1 ) ;
}

View File

@ -1,148 +0,0 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, 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 disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "Arduino.h"
/*----------------------------------------------------------------------------
* Exported variables
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* Types
*------------------------------------------------------------------------------*/
typedef union { IntFunc __fun; void * __ptr; } IntVector;
/*------------------------------------------------------------------------------
* ProtoTypes
*------------------------------------------------------------------------------*/
extern void __iar_program_start( void ) ;
extern int __low_level_init( void ) ;
/*------------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
#pragma language=extended
#pragma segment="CSTACK"
/* The name "__vector_table" has special meaning for C-SPY: */
/* it is where the SP start value is found, and the NVIC vector */
/* table register (VTOR) is initialized to this address if != 0. */
#pragma section = ".vectors"
#pragma location = ".vectors"
const IntVector __vector_table[] =
{
{ .__ptr = __sfe( "CSTACK" ) },
__iar_program_start,
NMI_Handler,
HardFault_Handler,
MemManage_Handler,
BusFault_Handler,
UsageFault_Handler,
0, 0, 0, 0, /* Reserved */
SVC_Handler,
DebugMon_Handler,
0, /* Reserved */
PendSV_Handler,
SysTick_Handler,
#if defined sam3s4c
/* Configurable interrupts */
SUPC_IrqHandler, /* 0 Supply Controller */
RSTC_IrqHandler, /* 1 Reset Controller */
RTC_IrqHandler, /* 2 Real Time Clock */
RTT_IrqHandler, /* 3 Real Time Timer */
WDT_IrqHandler, /* 4 Watchdog Timer */
PMC_IrqHandler, /* 5 PMC */
EEFC_IrqHandler, /* 6 EEFC */
Dummy_Handler, /* 7 Reserved */
UART0_IrqHandler, /* 8 UART0 */
UART1_IrqHandler, /* 9 UART1 */
SMC_IrqHandler, /* 10 SMC */
PIOA_IrqHandler, /* 11 Parallel IO Controller A */
PIOB_IrqHandler, /* 12 Parallel IO Controller B */
PIOC_IrqHandler, /* 13 Parallel IO Controller C */
USART0_IrqHandler, /* 14 USART 0 */
USART1_IrqHandler, /* 15 USART 1 */
Dummy_Handler, /* 16 Reserved */
Dummy_Handler, /* 17 Reserved */
MCI_IrqHandler, /* 18 MCI */
TWI0_IrqHandler, /* 19 TWI 0 */
TWI1_IrqHandler, /* 20 TWI 1 */
SPI_IrqHandler, /* 21 SPI */
SSC_IrqHandler, /* 22 SSC */
TC0_IrqHandler, /* 23 Timer Counter 0 */
TC1_IrqHandler, /* 24 Timer Counter 1 */
TC2_IrqHandler, /* 25 Timer Counter 2 */
TC3_IrqHandler, /* 26 Timer Counter 3 */
TC4_IrqHandler, /* 27 Timer Counter 4 */
TC5_IrqHandler, /* 28 Timer Counter 5 */
ADC_IrqHandler, /* 29 ADC controller */
DAC_IrqHandler, /* 30 DAC controller */
PWM_IrqHandler, /* 31 PWM */
CRCCU_IrqHandler, /* 32 CRC Calculation Unit */
ACC_IrqHandler, /* 33 Analog Comparator */
USBD_IrqHandler, /* 34 USB Device Port */
Dummy_Handler /* 35 not used */
#endif /* defined sam3s4c */
#if defined sam3u4e
#endif /* defined sam3u4e */
};
/**------------------------------------------------------------------------------
* This is the code that gets called on processor reset. To initialize the
* device.
*------------------------------------------------------------------------------*/
extern int __low_level_init( void )
{
uint32_t* pSrc = (uint32_t*)__section_begin( ".vectors" ) ;
/* Low level Initialize */
LowLevelInit() ;
SCB->VTOR = ( (uint32_t)pSrc & SCB_VTOR_TBLOFF_Msk ) ;
if ( ((uint32_t)pSrc >= IRAM0_ADDR) && ((uint32_t)pSrc < NFC_RAM_ADDR) )
{
SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos ;
}
return 1 ; /* if return 0, the data sections will not be initialized. */
}

View File

@ -1,7 +1,7 @@
# Makefile for compiling libArduino # Makefile for compiling libArduino
.SUFFIXES: .o .a .c .s .SUFFIXES: .o .a .c .s
CHIP=sam3s4 CHIP=__SAM3S4C__
VARIANT=sam3s_ek VARIANT=sam3s_ek
LIBNAME=libarduino_$(VARIANT) LIBNAME=libarduino_$(VARIANT)
TOOLCHAIN=gcc TOOLCHAIN=gcc
@ -16,7 +16,7 @@ OUTPUT_BIN = ../lib
# Libraries # Libraries
PROJECT_BASE_PATH = .. PROJECT_BASE_PATH = ..
SYSTEM_PATH = ../../../system SYSTEM_PATH = ../../../system
CMSIS_PATH = $(SYSTEM_PATH)/CMSIS/CM3/CoreSupport CMSIS_PATH = $(SYSTEM_PATH)/CMSIS/Include
VARIANT_PATH = ../../../variants/sam3s-ek VARIANT_PATH = ../../../variants/sam3s-ek
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -103,7 +103,7 @@
</option> </option>
<option> <option>
<name>GenLowLevelInterface</name> <name>GenLowLevelInterface</name>
<state>1</state> <state>0</state>
</option> </option>
<option> <option>
<name>GEndianModeBE</name> <name>GEndianModeBE</name>
@ -164,7 +164,7 @@
<debug>1</debug> <debug>1</debug>
<option> <option>
<name>CCDefines</name> <name>CCDefines</name>
<state>__sam3s4c__</state> <state>__SAM3S4C__</state>
</option> </option>
<option> <option>
<name>CCPreprocFile</name> <name>CCPreprocFile</name>
@ -2718,6 +2718,9 @@
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\syscalls.h</name> <name>$PROJ_DIR$\..\syscalls.h</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\syscalls_sam3.c</name> <name>$PROJ_DIR$\..\syscalls_sam3.c</name>
@ -2733,12 +2736,18 @@
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\UART.cpp</name> <name>$PROJ_DIR$\..\UART.cpp</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\UART.h</name> <name>$PROJ_DIR$\..\UART.h</name>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\USART.cpp</name> <name>$PROJ_DIR$\..\USART.cpp</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\USART.h</name> <name>$PROJ_DIR$\..\USART.h</name>
@ -2748,19 +2757,31 @@
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\WInterrupts.c</name> <name>$PROJ_DIR$\..\WInterrupts.c</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file> </file>
<file> <file>
<name>$PROJ_DIR$\..\wiring.c</name> <name>$PROJ_DIR$\..\wiring.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\wiring.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\wiring_analog.c</name> <name>$PROJ_DIR$\..\wiring_analog.c</name>
<excluded> <excluded>
<configuration>Debug</configuration> <configuration>Debug</configuration>
</excluded> </excluded>
</file> </file>
<file>
<name>$PROJ_DIR$\..\wiring_analog.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\wiring_digital.c</name> <name>$PROJ_DIR$\..\wiring_digital.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\wiring_digital.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\wiring_private.h</name> <name>$PROJ_DIR$\..\wiring_private.h</name>
</file> </file>
@ -2770,12 +2791,21 @@
<configuration>Debug</configuration> <configuration>Debug</configuration>
</excluded> </excluded>
</file> </file>
<file>
<name>$PROJ_DIR$\..\wiring_pulse.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\wiring_shift.c</name> <name>$PROJ_DIR$\..\wiring_shift.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\wiring_shift.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\WMath.cpp</name> <name>$PROJ_DIR$\..\WMath.cpp</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\WMath.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\WString.cpp</name> <name>$PROJ_DIR$\..\WString.cpp</name>
</file> </file>

View File

@ -25,19 +25,19 @@ extern void itoa( int n, char s[] )
{ {
n = -n; /* make n positive */ n = -n; /* make n positive */
} }
i = 0; i = 0;
do do
{ /* generate digits in reverse order */ { /* generate digits in reverse order */
s[i++] = n % 10 + '0'; /* get next digit */ s[i++] = n % 10 + '0'; /* get next digit */
} while ((n /= 10) > 0) ; /* delete it */ } while ((n /= 10) > 0) ; /* delete it */
if (sign < 0 ) if (sign < 0 )
{ {
s[i++] = '-'; s[i++] = '-';
} }
s[i] = '\0'; s[i] = '\0';
reverse( s ) ; reverse( s ) ;
} }

View File

@ -1,385 +0,0 @@
WInterrupts.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
00000003 r SCK
00000000 r SS
00000000 T attachInterrupt
00000000 T detachInterrupt
00000000 b intFunc
board_cstartup_gnu_sam3.o:
U ACC_IrqHandler
U ADC_IrqHandler
00000004 r APinDescription
U BusFault_Handler
U CRCCU_IrqHandler
U DAC_IrqHandler
U DebugMon_Handler
U Dummy_Handler
U EEFC_IrqHandler
U HardFault_Handler
U MCI_IrqHandler
00000002 r MISO
00000001 r MOSI
U MemManage_Handler
U NMI_Handler
U PIOA_IrqHandler
U PIOB_IrqHandler
U PIOC_IrqHandler
U PMC_IrqHandler
U PWM_IrqHandler
U PendSV_Handler
U RSTC_IrqHandler
U RTC_IrqHandler
U RTT_IrqHandler
00000000 T Reset_Handler
00000003 r SCK
U SMC_IrqHandler
U SPI_IrqHandler
00000000 r SS
U SSC_IrqHandler
U SUPC_IrqHandler
U SVC_Handler
U SysTick_Handler
U TC0_IrqHandler
U TC1_IrqHandler
U TC2_IrqHandler
U TC3_IrqHandler
U TC4_IrqHandler
U TC5_IrqHandler
U TWI0_IrqHandler
U TWI1_IrqHandler
U UART0_IrqHandler
U UART1_IrqHandler
U USART0_IrqHandler
U USART1_IrqHandler
U USBD_IrqHandler
U UsageFault_Handler
U WDT_IrqHandler
U __libc_init_array
U _erelocate
U _etext
U _ezero
U _sfixed
U _srelocate
U _szero
U init
U main
00000000 D pdwStack
00000000 D vector_table
itoa.o:
00000000 T itoa
00000000 t reverse
U strlen
syscalls_sam3.o:
00000000 T _close
U _end
00000000 T _exit
00000000 T _fstat
00000000 T _getpid
00000000 T _isatty
00000000 T _kill
00000000 T _lseek
00000000 T _read
00000000 T _sbrk
00000000 T _write
00000000 b heap.6819
U iprintf
00000000 T link
wiring.o:
00000004 r APinDescription
U GetTickCount
00000000 t LowLevelInit_sam3s_ek
00000002 r MISO
00000001 r MOSI
00000000 t NVIC_SetPriority
U PIO_Configure
00000003 r SCK
00000000 r SS
00000000 t SysTick_Config
00000000 T SysTick_Handler
U TimeTick_Increment
U WDT_Disable
00000000 T Wait
00000000 T delayMicroseconds
00000000 T init
00000000 T micros
00000000 T millis
00000008 b timer0_fract
00000004 B timer0_millis
00000000 B timer0_overflow_count
wiring_digital.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
U PIO_Configure
U PIO_Get
U PIO_SetOutput
00000003 r SCK
00000000 r SS
00000000 T digitalRead
00000000 T digitalWrite
00000000 T pinMode
wiring_shift.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
00000003 r SCK
00000000 r SS
U digitalRead
U digitalWrite
00000000 T shiftIn
00000000 T shiftOut
HardwareSerial.o:
00000000 T _Z10store_charhP12_ring_buffer
Print.o:
00000030 r _ZL15APinDescription
0000002b r _ZL2SS
0000002e r _ZL3SCK
0000002d r _ZL4MISO
0000002c r _ZL4MOSI
00000000 T _ZN5Print10printFloatEdh
00000000 T _ZN5Print11printNumberEmh
00000000 T _ZN5Print5printEPKc
00000000 T _ZN5Print5printERK6String
00000000 T _ZN5Print5printEc
00000000 T _ZN5Print5printEdi
00000000 T _ZN5Print5printEhi
00000000 T _ZN5Print5printEii
00000000 T _ZN5Print5printEji
00000000 T _ZN5Print5printEli
00000000 T _ZN5Print5printEmi
00000000 T _ZN5Print5writeEPKc
00000000 T _ZN5Print5writeEPKhj
00000000 T _ZN5Print7printlnEPKc
00000000 T _ZN5Print7printlnERK6String
00000000 T _ZN5Print7printlnEc
00000000 T _ZN5Print7printlnEdi
00000000 T _ZN5Print7printlnEhi
00000000 T _ZN5Print7printlnEii
00000000 T _ZN5Print7printlnEji
00000000 T _ZN5Print7printlnEli
00000000 T _ZN5Print7printlnEmi
00000000 T _ZN5Print7printlnEv
00000000 W _ZNK6String6lengthEv
U _ZNK6StringixEj
0000001c R _ZTI5Print
00000024 R _ZTS5Print
00000008 R _ZTV5Print
U _ZTVN10__cxxabiv117__class_type_infoE
U __aeabi_d2iz
U __aeabi_d2uiz
U __aeabi_dadd
U __aeabi_dcmplt
U __aeabi_ddiv
U __aeabi_dmul
U __aeabi_dsub
U __aeabi_i2d
U __aeabi_ui2d
U __aeabi_unwind_cpp_pr1
U __cxa_pure_virtual
UART.o:
U PMC_DisablePeripheral
U PMC_EnablePeripheral
U _Z10store_charhP12_ring_buffer
00000048 r _ZL15APinDescription
00000043 r _ZL2SS
00000046 r _ZL3SCK
00000045 r _ZL4MISO
00000044 r _ZL4MOSI
00000000 W _ZN14HardwareSerialC1Ev
00000000 W _ZN14HardwareSerialC2Ev
00000000 n _ZN14HardwareSerialC5Ev
U _ZN5Print5writeEPKc
U _ZN5Print5writeEPKhj
00000000 W _ZN5PrintC1Ev
00000000 W _ZN5PrintC2Ev
00000000 n _ZN5PrintC5Ev
00000000 W _ZN6StreamC1Ev
00000000 W _ZN6StreamC2Ev
00000000 n _ZN6StreamC5Ev
00000000 T _ZN9UARTClass10IrqHandlerEv
00000000 T _ZN9UARTClass3endEv
00000000 T _ZN9UARTClass4peekEv
00000000 T _ZN9UARTClass4readEv
00000000 T _ZN9UARTClass5beginEm
00000000 T _ZN9UARTClass5flushEv
00000000 T _ZN9UARTClass5writeEh
00000000 T _ZN9UARTClass9availableEv
00000000 T _ZN9UARTClassC1EP4Uart4IRQnmP12_ring_bufferS4_
00000000 T _ZN9UARTClassC2EP4Uart4IRQnmP12_ring_bufferS4_
00000000 V _ZTI14HardwareSerial
U _ZTI5Print
00000000 V _ZTI6Stream
0000002c R _ZTI9UARTClass
00000000 V _ZTS14HardwareSerial
00000000 V _ZTS6Stream
00000038 R _ZTS9UARTClass
00000000 V _ZTV14HardwareSerial
U _ZTV5Print
00000000 V _ZTV6Stream
00000000 R _ZTV9UARTClass
U _ZTVN10__cxxabiv120__si_class_type_infoE
U __aeabi_unwind_cpp_pr1
U __cxa_pure_virtual
USART.o:
U PMC_DisablePeripheral
U PMC_EnablePeripheral
U _Z10store_charhP12_ring_buffer
0000004c r _ZL15APinDescription
00000045 r _ZL2SS
00000048 r _ZL3SCK
00000047 r _ZL4MISO
00000046 r _ZL4MOSI
00000000 T _ZN10USARTClass10IrqHandlerEv
00000000 T _ZN10USARTClass3endEv
00000000 T _ZN10USARTClass4peekEv
00000000 T _ZN10USARTClass4readEv
00000000 T _ZN10USARTClass5beginEm
00000000 T _ZN10USARTClass5flushEv
00000000 T _ZN10USARTClass5writeEh
00000000 T _ZN10USARTClass9availableEv
00000000 T _ZN10USARTClassC1EP5Usart4IRQnmP12_ring_bufferS4_
00000000 T _ZN10USARTClassC2EP5Usart4IRQnmP12_ring_bufferS4_
00000000 W _ZN14HardwareSerialC1Ev
00000000 W _ZN14HardwareSerialC2Ev
00000000 n _ZN14HardwareSerialC5Ev
U _ZN5Print5writeEPKc
U _ZN5Print5writeEPKhj
00000000 W _ZN5PrintC1Ev
00000000 W _ZN5PrintC2Ev
00000000 n _ZN5PrintC5Ev
00000000 W _ZN6StreamC1Ev
00000000 W _ZN6StreamC2Ev
00000000 n _ZN6StreamC5Ev
0000002c R _ZTI10USARTClass
00000000 V _ZTI14HardwareSerial
U _ZTI5Print
00000000 V _ZTI6Stream
00000038 R _ZTS10USARTClass
00000000 V _ZTS14HardwareSerial
00000000 V _ZTS6Stream
00000000 R _ZTV10USARTClass
00000000 V _ZTV14HardwareSerial
U _ZTV5Print
00000000 V _ZTV6Stream
U _ZTVN10__cxxabiv120__si_class_type_infoE
U __aeabi_unwind_cpp_pr1
U __cxa_pure_virtual
WString.o:
00000000 T _ZN6String10invalidateEv
00000000 T _ZN6String11toLowerCaseEv
00000000 T _ZN6String11toUpperCaseEv
00000000 T _ZN6String12changeBufferEj
00000000 T _ZN6String4copyEPKcj
00000000 W _ZN6String4initEv
00000000 T _ZN6String4trimEv
00000000 T _ZN6String6concatEPKc
00000000 T _ZN6String6concatEPKcj
00000000 T _ZN6String6concatERKS_
00000000 T _ZN6String6concatEc
00000000 T _ZN6String6concatEh
00000000 T _ZN6String6concatEi
00000000 T _ZN6String6concatEj
00000000 T _ZN6String6concatEl
00000000 T _ZN6String6concatEm
00000000 T _ZN6String7replaceERKS_S1_
00000000 T _ZN6String7replaceEcc
00000000 T _ZN6String7reserveEj
00000000 T _ZN6String9setCharAtEjc
00000000 T _ZN6StringC1EPKc
00000000 T _ZN6StringC1ERKS_
00000000 T _ZN6StringC1Ec
00000000 T _ZN6StringC1Ehh
00000000 T _ZN6StringC1Eih
00000000 T _ZN6StringC1Ejh
00000000 T _ZN6StringC1Elh
00000000 T _ZN6StringC1Emh
00000000 T _ZN6StringC2EPKc
00000000 T _ZN6StringC2ERKS_
00000000 T _ZN6StringC2Ec
00000000 T _ZN6StringC2Ehh
00000000 T _ZN6StringC2Eih
00000000 T _ZN6StringC2Ejh
00000000 T _ZN6StringC2Elh
00000000 T _ZN6StringC2Emh
00000000 T _ZN6StringD1Ev
00000000 T _ZN6StringD2Ev
00000000 T _ZN6StringaSEPKc
00000000 T _ZN6StringaSERKS_
00000000 T _ZN6StringixEj
00000000 T _ZNK6String10startsWithERKS_
00000000 T _ZNK6String10startsWithERKS_j
00000000 T _ZNK6String11lastIndexOfERKS_
00000000 T _ZNK6String11lastIndexOfERKS_i
00000000 T _ZNK6String11lastIndexOfEc
00000000 T _ZNK6String11lastIndexOfEci
00000000 T _ZNK6String16equalsIgnoreCaseERKS_
00000000 T _ZNK6String5toIntEv
00000000 T _ZNK6String6charAtEj
00000000 T _ZNK6String6equalsEPKc
00000000 T _ZNK6String6equalsERKS_
00000000 T _ZNK6String7indexOfERKS_
00000000 T _ZNK6String7indexOfERKS_j
00000000 T _ZNK6String7indexOfEc
00000000 T _ZNK6String7indexOfEcj
00000000 T _ZNK6String8endsWithERKS_
00000000 T _ZNK6String8getBytesEPhjj
00000000 T _ZNK6String9compareToERKS_
00000000 T _ZNK6String9substringEj
00000000 T _ZNK6String9substringEjj
00000000 T _ZNK6StringgeERKS_
00000000 T _ZNK6StringgtERKS_
00000000 T _ZNK6StringixEj
00000000 T _ZNK6StringleERKS_
00000000 T _ZNK6StringltERKS_
00000000 b _ZZN6StringixEjE19dummy_writable_char
00000000 T _ZplRK15StringSumHelperPKc
00000000 T _ZplRK15StringSumHelperRK6String
00000000 T _ZplRK15StringSumHelperc
00000000 T _ZplRK15StringSumHelperh
00000000 T _ZplRK15StringSumHelperi
00000000 T _ZplRK15StringSumHelperj
00000000 T _ZplRK15StringSumHelperl
00000000 T _ZplRK15StringSumHelperm
U __aeabi_unwind_cpp_pr1
U atol
U free
U isspace
U memcpy
U memmove
U realloc
U strchr
U strcmp
U strcpy
U strlen
U strncmp
U strncpy
U strrchr
U strstr
U tolower
U toupper
main.o:
00000004 r _ZL15APinDescription
00000000 r _ZL2SS
00000003 r _ZL3SCK
00000002 r _ZL4MISO
00000001 r _ZL4MOSI
U __aeabi_unwind_cpp_pr0
U init
U loop
00000000 T main
U setup

View File

@ -1,391 +0,0 @@
WInterrupts.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
00000003 r SCK
00000000 r SS
00000000 T attachInterrupt
00000000 T detachInterrupt
00000000 b intFunc
board_cstartup_gnu_sam3.o:
U ACC_IrqHandler
U ADC_IrqHandler
00000004 r APinDescription
U BusFault_Handler
U CRCCU_IrqHandler
U DAC_IrqHandler
U DebugMon_Handler
U Dummy_Handler
U EEFC_IrqHandler
U HardFault_Handler
U MCI_IrqHandler
00000002 r MISO
00000001 r MOSI
U MemManage_Handler
U NMI_Handler
U PIOA_IrqHandler
U PIOB_IrqHandler
U PIOC_IrqHandler
U PMC_IrqHandler
U PWM_IrqHandler
U PendSV_Handler
U RSTC_IrqHandler
U RTC_IrqHandler
U RTT_IrqHandler
00000000 T Reset_Handler
00000003 r SCK
U SMC_IrqHandler
U SPI_IrqHandler
00000000 r SS
U SSC_IrqHandler
U SUPC_IrqHandler
U SVC_Handler
U SysTick_Handler
U TC0_IrqHandler
U TC1_IrqHandler
U TC2_IrqHandler
U TC3_IrqHandler
U TC4_IrqHandler
U TC5_IrqHandler
U TWI0_IrqHandler
U TWI1_IrqHandler
U UART0_IrqHandler
U UART1_IrqHandler
U USART0_IrqHandler
U USART1_IrqHandler
U USBD_IrqHandler
U UsageFault_Handler
U WDT_IrqHandler
U __libc_init_array
U _erelocate
U _etext
U _ezero
U _sfixed
U _srelocate
U _szero
U init
U main
00000000 D pdwStack
00000000 D vector_table
itoa.o:
00000000 T itoa
00000000 t reverse
U strlen
syscalls_sam3.o:
00000000 T _close
U _end
00000000 T _exit
00000000 T _fstat
00000000 T _getpid
00000000 T _isatty
00000000 T _kill
00000000 T _lseek
00000000 T _read
00000000 T _sbrk
00000000 T _write
00000000 b heap.6819
U iprintf
00000000 T link
wiring.o:
00000004 r APinDescription
U GetTickCount
00000000 t LowLevelInit_sam3s_ek
00000002 r MISO
00000001 r MOSI
00000000 t NVIC_SetPriority
U PIO_Configure
00000003 r SCK
00000000 r SS
00000000 t SysTick_Config
00000000 T SysTick_Handler
U TimeTick_Increment
U WDT_Disable
U Wait
00000000 T delay
00000000 T delayMicroseconds
00000000 T init
00000000 T micros
00000000 T millis
wiring_digital.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
U PIO_Configure
U PIO_Get
U PIO_SetOutput
00000003 r SCK
00000000 r SS
00000000 T digitalRead
00000000 T digitalWrite
00000000 T pinMode
wiring_shift.o:
00000004 r APinDescription
00000002 r MISO
00000001 r MOSI
00000003 r SCK
00000000 r SS
U digitalRead
U digitalWrite
00000000 T shiftIn
00000000 T shiftOut
HardwareSerial.o:
00000000 T _Z10store_charhP12_ring_buffer
Print.o:
00000020 r _ZL15APinDescription
0000001c r _ZL2SS
0000001f r _ZL3SCK
0000001e r _ZL4MISO
0000001d r _ZL4MOSI
00000000 T _ZN5Print10printFloatEdh
00000000 T _ZN5Print11printNumberEmh
00000000 T _ZN5Print5printEPKc
00000000 T _ZN5Print5printERK6String
00000000 T _ZN5Print5printEc
00000000 T _ZN5Print5printEdi
00000000 T _ZN5Print5printEhi
00000000 T _ZN5Print5printEii
00000000 T _ZN5Print5printEji
00000000 T _ZN5Print5printEli
00000000 T _ZN5Print5printEmi
00000000 T _ZN5Print5writeEPKc
00000000 T _ZN5Print5writeEPKhj
00000000 T _ZN5Print7printlnEPKc
00000000 T _ZN5Print7printlnERK6String
00000000 T _ZN5Print7printlnEc
00000000 T _ZN5Print7printlnEdi
00000000 T _ZN5Print7printlnEhi
00000000 T _ZN5Print7printlnEii
00000000 T _ZN5Print7printlnEji
00000000 T _ZN5Print7printlnEli
00000000 T _ZN5Print7printlnEmi
00000000 T _ZN5Print7printlnEv
00000000 W _ZNK6String6lengthEv
U _ZNK6StringixEj
00000008 R _ZTV5Print
U __aeabi_d2iz
U __aeabi_d2uiz
U __aeabi_dadd
U __aeabi_dcmplt
U __aeabi_ddiv
U __aeabi_dmul
U __aeabi_dsub
U __aeabi_i2d
U __aeabi_ui2d
U __cxa_pure_virtual
UART.o:
U PMC_DisablePeripheral
U PMC_EnablePeripheral
U _Z10store_charhP12_ring_buffer
00000030 r _ZL15APinDescription
0000002c r _ZL2SS
0000002f r _ZL3SCK
0000002e r _ZL4MISO
0000002d r _ZL4MOSI
00000000 W _ZN14HardwareSerialC1Ev
00000000 W _ZN14HardwareSerialC2Ev
00000000 n _ZN14HardwareSerialC5Ev
U _ZN5Print5writeEPKc
U _ZN5Print5writeEPKhj
00000000 W _ZN5PrintC1Ev
00000000 W _ZN5PrintC2Ev
00000000 n _ZN5PrintC5Ev
00000000 W _ZN6StreamC1Ev
00000000 W _ZN6StreamC2Ev
00000000 n _ZN6StreamC5Ev
00000000 T _ZN9UARTClass10IrqHandlerEv
00000000 T _ZN9UARTClass3endEv
00000000 T _ZN9UARTClass4peekEv
00000000 T _ZN9UARTClass4readEv
00000000 T _ZN9UARTClass5beginEm
00000000 T _ZN9UARTClass5flushEv
00000000 T _ZN9UARTClass5writeEh
00000000 T _ZN9UARTClass9availableEv
00000000 T _ZN9UARTClassC1EP4Uart4IRQnmP12_ring_bufferS4_
00000000 T _ZN9UARTClassC2EP4Uart4IRQnmP12_ring_bufferS4_
00000000 V _ZTV14HardwareSerial
U _ZTV5Print
00000000 V _ZTV6Stream
00000000 R _ZTV9UARTClass
U __cxa_pure_virtual
USART.o:
U PMC_DisablePeripheral
U PMC_EnablePeripheral
U _Z10store_charhP12_ring_buffer
00000030 r _ZL15APinDescription
0000002c r _ZL2SS
0000002f r _ZL3SCK
0000002e r _ZL4MISO
0000002d r _ZL4MOSI
00000000 T _ZN10USARTClass10IrqHandlerEv
00000000 T _ZN10USARTClass3endEv
00000000 T _ZN10USARTClass4peekEv
00000000 T _ZN10USARTClass4readEv
00000000 T _ZN10USARTClass5beginEm
00000000 T _ZN10USARTClass5flushEv
00000000 T _ZN10USARTClass5writeEh
00000000 T _ZN10USARTClass9availableEv
00000000 T _ZN10USARTClassC1EP5Usart4IRQnmP12_ring_bufferS4_
00000000 T _ZN10USARTClassC2EP5Usart4IRQnmP12_ring_bufferS4_
00000000 W _ZN14HardwareSerialC1Ev
00000000 W _ZN14HardwareSerialC2Ev
00000000 n _ZN14HardwareSerialC5Ev
U _ZN5Print5writeEPKc
U _ZN5Print5writeEPKhj
00000000 W _ZN5PrintC1Ev
00000000 W _ZN5PrintC2Ev
00000000 n _ZN5PrintC5Ev
00000000 W _ZN6StreamC1Ev
00000000 W _ZN6StreamC2Ev
00000000 n _ZN6StreamC5Ev
00000000 R _ZTV10USARTClass
00000000 V _ZTV14HardwareSerial
U _ZTV5Print
00000000 V _ZTV6Stream
U __cxa_pure_virtual
WMath.o:
00000000 T _Z10randomSeedm
00000000 T _Z3maplllll
00000000 T _Z6randoml
00000000 T _Z6randomll
00000000 T _Z8makeWordhh
00000000 T _Z8makeWordm
U rand
U srand
WString.o:
00000000 T _ZN6String10invalidateEv
00000000 T _ZN6String11toLowerCaseEv
00000000 T _ZN6String11toUpperCaseEv
00000000 T _ZN6String12changeBufferEj
00000000 T _ZN6String4copyEPKcj
00000000 W _ZN6String4initEv
00000000 T _ZN6String4trimEv
00000000 T _ZN6String6concatEPKc
00000000 T _ZN6String6concatEPKcj
00000000 T _ZN6String6concatERKS_
00000000 T _ZN6String6concatEc
00000000 T _ZN6String6concatEh
00000000 T _ZN6String6concatEi
00000000 T _ZN6String6concatEj
00000000 T _ZN6String6concatEl
00000000 T _ZN6String6concatEm
00000000 T _ZN6String7replaceERKS_S1_
00000000 T _ZN6String7replaceEcc
00000000 T _ZN6String7reserveEj
00000000 T _ZN6String9setCharAtEjc
00000000 T _ZN6StringC1EPKc
00000000 T _ZN6StringC1ERKS_
00000000 T _ZN6StringC1Ec
00000000 T _ZN6StringC1Ehh
00000000 T _ZN6StringC1Eih
00000000 T _ZN6StringC1Ejh
00000000 T _ZN6StringC1Elh
00000000 T _ZN6StringC1Emh
00000000 T _ZN6StringC2EPKc
00000000 T _ZN6StringC2ERKS_
00000000 T _ZN6StringC2Ec
00000000 T _ZN6StringC2Ehh
00000000 T _ZN6StringC2Eih
00000000 T _ZN6StringC2Ejh
00000000 T _ZN6StringC2Elh
00000000 T _ZN6StringC2Emh
00000000 T _ZN6StringD1Ev
00000000 T _ZN6StringD2Ev
00000000 T _ZN6StringaSEPKc
00000000 T _ZN6StringaSERKS_
00000000 T _ZN6StringixEj
00000000 T _ZNK6String10startsWithERKS_
00000000 T _ZNK6String10startsWithERKS_j
00000000 T _ZNK6String11lastIndexOfERKS_
00000000 T _ZNK6String11lastIndexOfERKS_i
00000000 T _ZNK6String11lastIndexOfEc
00000000 T _ZNK6String11lastIndexOfEci
00000000 T _ZNK6String16equalsIgnoreCaseERKS_
00000000 T _ZNK6String5toIntEv
00000000 T _ZNK6String6charAtEj
00000000 T _ZNK6String6equalsEPKc
00000000 T _ZNK6String6equalsERKS_
00000000 T _ZNK6String7indexOfERKS_
00000000 T _ZNK6String7indexOfERKS_j
00000000 T _ZNK6String7indexOfEc
00000000 T _ZNK6String7indexOfEcj
00000000 T _ZNK6String8endsWithERKS_
00000000 T _ZNK6String8getBytesEPhjj
00000000 T _ZNK6String9compareToERKS_
00000000 T _ZNK6String9substringEj
00000000 T _ZNK6String9substringEjj
00000000 T _ZNK6StringgeERKS_
00000000 T _ZNK6StringgtERKS_
00000000 T _ZNK6StringixEj
00000000 T _ZNK6StringleERKS_
00000000 T _ZNK6StringltERKS_
00000000 b _ZZN6StringixEjE19dummy_writable_char
00000000 T _ZplRK15StringSumHelperPKc
00000000 T _ZplRK15StringSumHelperRK6String
00000000 T _ZplRK15StringSumHelperc
00000000 T _ZplRK15StringSumHelperh
00000000 T _ZplRK15StringSumHelperi
00000000 T _ZplRK15StringSumHelperj
00000000 T _ZplRK15StringSumHelperl
00000000 T _ZplRK15StringSumHelperm
U atol
U free
U isspace
U memcpy
U memmove
U realloc
U strchr
U strcmp
U strcpy
U strlen
U strncmp
U strncpy
U strrchr
U strstr
U tolower
U toupper
cxxabi-compat.o:
00000000 T __cxa_pure_virtual
main.o:
00000004 r _ZL15APinDescription
00000000 r _ZL2SS
00000003 r _ZL3SCK
00000002 r _ZL4MISO
00000001 r _ZL4MOSI
U init
U loop
00000000 T main
U setup
variant.o:
00000120 B Serial1
00000138 B Serial2
00000000 t _GLOBAL__I_rx_buffer1
00000000 T _Z16UART0_IrqHandlerv
00000000 T _Z16UART1_IrqHandlerv
00000000 t _Z41__static_initialization_and_destruction_0ii
00000004 r _ZL15APinDescription
00000000 r _ZL2SS
00000003 r _ZL3SCK
00000002 r _ZL4MISO
00000001 r _ZL4MOSI
U _ZN9UARTClass10IrqHandlerEv
U _ZN9UARTClassC1EP4Uart4IRQnmP12_ring_bufferS4_
00000000 B rx_buffer1
00000090 B rx_buffer2
00000048 B tx_buffer1
000000d8 B tx_buffer2

View File

@ -1,15 +1,19 @@
#define ARDUINO_MAIN #define ARDUINO_MAIN
#include "Arduino.h" #include "Arduino.h"
int main(void) /*
* \brief Main entry point of Arduino application
*/
int main( void )
{ {
init(); init() ;
setup(); setup() ;
for (;;) for ( ; ; )
loop(); {
loop() ;
return 0; }
// return 0 ;
} }

View File

@ -46,7 +46,7 @@
* Exported functions * Exported functions
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern caddr_t _sbrk( int incr ) ; extern caddr_t _sbrk( int incr ) ;

View File

@ -43,8 +43,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/types.h> #if defined ( __GNUC__ ) /* GCC CS3 */
#include <sys/stat.h> #include <sys/types.h>
#include <sys/stat.h>
#endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* Exported variables * Exported variables
@ -112,8 +114,8 @@ extern int _read(int file, char *ptr, int len)
extern int _write( int file, char *ptr, int len ) extern int _write( int file, char *ptr, int len )
{ {
int iIndex ; int iIndex ;
// for ( ; *ptr != 0 ; ptr++ ) // for ( ; *ptr != 0 ; ptr++ )
for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ ) for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ )
{ {
@ -132,7 +134,7 @@ extern void _exit( int status )
extern void _kill( int pid, int sig ) extern void _kill( int pid, int sig )
{ {
return ; return ;
} }
extern int _getpid ( void ) extern int _getpid ( void )

View File

@ -19,4 +19,8 @@ clean:
@echo --- Cleaning test @echo --- Cleaning test
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test.mk $@ @$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test.mk $@
.PHONY: debug
debug:
@echo --- Debugging test
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test.mk $@

View File

@ -8,7 +8,7 @@ AR = $(CROSS_COMPILE)ar
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++ CXX = $(CROSS_COMPILE)g++
AS = $(CROSS_COMPILE)as AS = $(CROSS_COMPILE)as
#LD = $(CROSS_COMPILE)ld GDB = $(CROSS_COMPILE)gdb
SIZE = $(CROSS_COMPILE)size SIZE = $(CROSS_COMPILE)size
NM = $(CROSS_COMPILE)nm NM = $(CROSS_COMPILE)nm
OBJCOPY = $(CROSS_COMPILE)objcopy OBJCOPY = $(CROSS_COMPILE)objcopy

View File

@ -15,14 +15,31 @@ OUTPUT_PATH = .
# Libraries # Libraries
PROJECT_BASE_PATH = . PROJECT_BASE_PATH = .
SYSTEM_PATH = ../../../system SYSTEM_PATH = ../../../system
CMSIS_PATH = $(SYSTEM_PATH)/CMSIS/CM3/CoreSupport CMSIS_BASE_PATH = $(SYSTEM_PATH)/CMSIS/Include
VARIANT_PATH = ../../../variants/sam3s-ek VARIANT_PATH = ../../../variants/sam3s-ek
ifeq ($(CHIP), __SAM3S4C__)
CHIP_NAME=sam3s4c
CHIP_SERIE=sam3s
else ifeq ($(CHIP), __SAM3U4E__)
CHIP_NAME=sam3u4e
CHIP_SERIE=sam3u
else ifeq ($(CHIP), __SAM3N4C__)
CHIP_NAME=sam3n4c
CHIP_SERIE=sam3n
else ifeq ($(CHIP), __SAM3X8H__)
CHIP_NAME=sam3x8h
CHIP_SERIE=sam3xa
else
endif
CMSIS_CHIP_PATH=$(PROJECT_BASE_PATH)/../cmsis/$(CHIP_SERIE)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Files # Files
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_BASE_PATH)
vpath %.cpp $(PROJECT_BASE_PATH) vpath %.cpp $(PROJECT_BASE_PATH)
VPATH+=$(PROJECT_BASE_PATH) VPATH+=$(PROJECT_BASE_PATH)
@ -31,7 +48,7 @@ INCLUDES = -I$(PROJECT_BASE_PATH)/..
INCLUDES += -I$(VARIANT_PATH) INCLUDES += -I$(VARIANT_PATH)
INCLUDES += -I$(SYSTEM_PATH) INCLUDES += -I$(SYSTEM_PATH)
INCLUDES += -I$(SYSTEM_PATH)/libsam INCLUDES += -I$(SYSTEM_PATH)/libsam
INCLUDES += -I$(CMSIS_PATH) INCLUDES += -I$(CMSIS_BASE_PATH)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ifdef DEBUG ifdef DEBUG
@ -90,7 +107,7 @@ $(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
@$(CXX) -c $(CPPFLAGS) $< -o $@ @$(CXX) -c $(CPPFLAGS) $< -o $@
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) $(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
$(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS) $(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
$(NM) $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt $(NM) $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
$(OBJCOPY) -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin $(OBJCOPY) -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf $(SIZE) $^ $(OUTPUT_PATH)/$@.elf
@ -104,3 +121,6 @@ clean:
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt 1>NUL 2>&1 -@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt 1>NUL 2>&1
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin 1>NUL 2>&1 -@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin 1>NUL 2>&1
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map 1>NUL 2>&1 -@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map 1>NUL 2>&1
debug: test
$(GDB) -x "$(VARIANT_PATH)/debug_scripts/gcc/flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf

View File

@ -1,281 +0,0 @@
00402190 t .udivsi3_skip_div0_test
00401b58 W ACC_IrqHandler
00401b58 W ADC_IrqHandler
00405434 t APinDescription
00405040 t APinDescription
00401b58 W BusFault_Handler
00401b58 W CRCCU_IrqHandler
00401b58 W DAC_IrqHandler
00401b58 W DebugMon_Handler
00401b58 T Dummy_Handler
00401b58 W EEFC_IrqHandler
00401b58 W HardFault_Handler
00400324 t LowLevelInit_sam3s_ek
00401b58 W MCI_IrqHandler
00405432 t MISO
0040503e t MISO
00405431 t MOSI
0040503d t MOSI
00401b58 W MemManage_Handler
00401b58 W NMI_Handler
00400248 t NVIC_SetPriority
00401b58 W PIOA_IrqHandler
00401b58 W PIOB_IrqHandler
00401b58 W PIOC_IrqHandler
00401d9c T PIO_Configure
00401b60 T PIO_DisableInterrupt
00401b7c T PIO_PullUp
00401cb8 T PIO_SetInput
00401d38 T PIO_SetOutput
00401bac T PIO_SetPeripheral
00401f38 T PMC_DisablePeripheral
00401e94 T PMC_EnablePeripheral
00401b58 W PMC_IrqHandler
00401b58 W PWM_IrqHandler
00401b58 W PendSV_Handler
00401b58 W RSTC_IrqHandler
00401b58 W RTC_IrqHandler
00401b58 W RTT_IrqHandler
00400188 T Reset_Handler
00405433 t SCK
0040503f t SCK
00401b58 W SMC_IrqHandler
00401b58 W SPI_IrqHandler
0040503c t SS
00405430 t SS
00401b58 W SSC_IrqHandler
00401b58 W SUPC_IrqHandler
00401b58 W SVC_Handler
200006a8 B Serial1
200006c0 B Serial2
004002a0 t SysTick_Config
00400314 T SysTick_Handler
00401b58 W TC0_IrqHandler
00401b58 W TC1_IrqHandler
00401b58 W TC2_IrqHandler
00401b58 W TC3_IrqHandler
00401b58 W TC4_IrqHandler
00401b58 W TC5_IrqHandler
00401b58 W TWI0_IrqHandler
00401b58 W TWI1_IrqHandler
00401ff8 T TimeTick_Increment
00401b58 W UART0_IrqHandler
00401b58 W UART1_IrqHandler
00401b58 W USART0_IrqHandler
00401b58 W USART1_IrqHandler
00401b58 W USBD_IrqHandler
00401b58 W UsageFault_Handler
00401fdc T WDT_Disable
00401b58 W WDT_IrqHandler
00402014 T Wait
00400a14 t _GLOBAL__I_rx_buffer1
w _Jv_RegisterClasses
0040099c t _Z41__static_initialization_and_destruction_0ii
00405848 t _ZL15APinDescription
00404c4c t _ZL15APinDescription
00405c68 t _ZL15APinDescription
00405844 t _ZL2SS
00405c64 t _ZL2SS
00404c46 t _ZL2SS
00405c67 t _ZL3SCK
00405847 t _ZL3SCK
00404c49 t _ZL3SCK
00405846 t _ZL4MISO
00405c66 t _ZL4MISO
00404c48 t _ZL4MISO
00405845 t _ZL4MOSI
00404c47 t _ZL4MOSI
00405c65 t _ZL4MOSI
004006e8 W _ZN14HardwareSerialC1Ev
004006e8 W _ZN14HardwareSerialC2Ev
00400604 T _ZN5Print5printEPKc
00400628 T _ZN5Print5printEc
0040057c T _ZN5Print5writeEPKc
004005bc T _ZN5Print5writeEPKhj
00400674 T _ZN5Print7printlnEPKc
0040064c T _ZN5Print7printlnEv
0040069c W _ZN5PrintC1Ev
0040069c W _ZN5PrintC2Ev
004006bc W _ZN6StreamC1Ev
004006bc W _ZN6StreamC2Ev
004007c0 T _ZN9UARTClass3endEv
00400830 T _ZN9UARTClass4peekEv
00400870 T _ZN9UARTClass4readEv
00400764 T _ZN9UARTClass5beginEm
004008c8 T _ZN9UARTClass5flushEv
004008f4 T _ZN9UARTClass5writeEh
00400804 T _ZN9UARTClass9availableEv
00400714 T _ZN9UARTClassC1EP4Uart4IRQnmP12_ring_bufferS4_
00400714 T _ZN9UARTClassC2EP4Uart4IRQnmP12_ring_bufferS4_
00406058 V _ZTV14HardwareSerial
00405830 T _ZTV5Print
00406088 V _ZTV6Stream
00405c38 T _ZTV9UARTClass
00406100 t __FUNCTION__.5774
004060e8 t __FUNCTION__.5778
004060d4 t __FUNCTION__.5800
00402408 W __aeabi_idiv0
00402408 W __aeabi_ldiv0
00402190 T __aeabi_uidiv
004023ec T __aeabi_uidivmod
00404544 T __aeabi_uldivmod
00404334 T __ascii_wctomb
00402454 T __assert
0040240c T __assert_func
00400a2c T __cxa_pure_virtual
004045d0 T __divdi3
004000d0 t __do_global_dtors_aux
00406250 t __do_global_dtors_aux_fini_array_entry
00406254 T __fini_array_end
00406250 T __fini_array_start
004035cc t __fp_lock
004037bc T __fp_lock_all
004035d0 t __fp_unlock
004037d4 T __fp_unlock_all
0040623c t __frame_dummy_init_array_entry
00404570 T __gnu_ldivmod_helper
004045a0 T __gnu_uldivmod_helper
00406244 T __init_array_end
0040623c T __init_array_start
00400a34 T __libc_init_array
00403d6c T __locale_charset
00403d8c T __locale_cjk_lang
00403d78 T __locale_mb_cur_max
00403d84 T __locale_msgcharset
20000000 D __malloc_av_
200006dc B __malloc_current_mallinfo
00401204 T __malloc_lock
20000704 B __malloc_max_sbrked_mem
20000708 B __malloc_max_total_mem
20000408 D __malloc_sbrk_base
200006d8 B __malloc_top_pad
2000040c D __malloc_trim_threshold
00401208 T __malloc_unlock
20000524 D __mb_cur_max
0040623c T __preinit_array_end
0040623c T __preinit_array_start
00404160 T __sclose
004040f8 T __seofread
00406204 T __sf_fake_stderr
004061c4 T __sf_fake_stdin
004061e4 T __sf_fake_stdout
004035e0 T __sfmoreglue
00403724 T __sfp
004037ac T __sfp_lock_acquire
004037b0 T __sfp_lock_release
0040392c T __sfvwrite_r
00404094 T __sigtramp
00404014 T __sigtramp_r
0040361c T __sinit
004037b4 T __sinit_lock_acquire
004037b8 T __sinit_lock_release
00403db0 T __smakebuf_r
00402510 T __sprint_r
004040d4 T __sread
00404138 T __sseek
00404254 T __swbuf
00404168 T __swbuf_r
004040fc T __swrite
004032cc T __swsetup_r
00404930 T __udivdi3
00402190 T __udivsi3
20000580 D __wctomb
00403610 T _cleanup
004035d4 T _cleanup_r
00402084 T _close
004043ac T _close_r
2000070c b _dwTickCount
20000718 B _ebss
00406254 T _efixed
20002b18 A _end
20000584 D _erelocate
0040625c A _etext
0040214c T _exit
20000718 B _ezero
004043d4 T _fclose_r
004033e0 T _fflush_r
00406244 T _fini
00402460 T _fiprintf_r
004037ec T _fputwc_r
00401934 T _free_r
0040209c T _fstat
00404498 T _fstat_r
00403c64 T _fwalk
00403cb8 T _fwalk_reent
0040217c T _getpid
004040d0 T _getpid_r
004060b0 T _global_impure_ptr
20000410 D _impure_ptr
00406230 T _init
00404088 T _init_signal
00403f50 T _init_signal_r
004024e4 T _iprintf_r
004020c0 T _isatty
004044c4 T _isatty_r
00402168 T _kill
004040a4 T _kill_r
00403d90 T _localeconv_r
004020d8 T _lseek
004044ec T _lseek_r
00400a84 T _malloc_r
0040188c T _malloc_trim_r
00403fbc T _raise_r
004020f4 T _read
00404518 T _read_r
0040120c T _realloc_r
00402044 T _sbrk
00401628 T _sbrk_r
20000584 B _sbss
00403d10 T _setlocale_r
00400000 T _sfixed
00403f80 T _signal_r
20000000 D _srelocate
20000584 B _szero
00402594 T _vfiprintf_r
00404264 T _wcrtomb_r
00404350 T _wctomb_r
00402110 T _write
00404380 T _write_r
004033d0 T abort
00406174 t blanks.6556
20000584 b completed.7631
004002f8 T delay
00400500 T digitalWrite
20000714 B errno
00404488 T fclose
004035a4 T fflush
00402480 T fiprintf
004038d4 T fputwc
004000e4 t frame_dummy
20000710 b heap.6819
20000414 d impure_data
004003dc T init
004024ac T iprintf
20000504 d lc_ctype_charset
20000528 d lc_message_charset
20000548 d lconv
00403da8 T localeconv
00400128 T loop
0040097c T main
00401acc T memchr
00401000 T memcpy
00401150 T memmove
00403e9c T memset
20000718 B pdwStack
00400428 T pinMode
00404068 T raise
20000588 B rx_buffer1
20000618 B rx_buffer2
00403d98 T setlocale
00400100 T setup
00000000 a shift
00404078 T signal
00401650 T strcmp
004016d0 t strcmp_unaligned
0040182c T strlen
200005d0 B tx_buffer1
20000660 B tx_buffer2
00400000 T vector_table
004032b0 T vfiprintf
004042c0 T wcrtomb
00406184 t zeroes.6557

File diff suppressed because it is too large Load Diff

View File

@ -33,11 +33,11 @@
</option> </option>
<option> <option>
<name>MacOverride</name> <name>MacOverride</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>MacFile</name> <name>MacFile</name>
<state></state> <state>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\debug_scripts\iar\sam3s_ek_flash.mac</state>
</option> </option>
<option> <option>
<name>MemOverride</name> <name>MemOverride</name>
@ -45,7 +45,7 @@
</option> </option>
<option> <option>
<name>MemFile</name> <name>MemFile</name>
<state></state> <state>$TOOLKIT_DIR$\CONFIG\debugger\Atmel\iosam3s.ddf</state>
</option> </option>
<option> <option>
<name>RunToEnable</name> <name>RunToEnable</name>
@ -85,7 +85,7 @@
</option> </option>
<option> <option>
<name>OCDynDriverList</name> <name>OCDynDriverList</name>
<state>ARMSIM_ID</state> <state>JLINK_ID</state>
</option> </option>
<option> <option>
<name>OCLastSavedByProductVersion</name> <name>OCLastSavedByProductVersion</name>
@ -117,7 +117,7 @@
</option> </option>
<option> <option>
<name>FlashLoadersV3</name> <name>FlashLoadersV3</name>
<state>$TOOLKIT_DIR$\config\flashloader\</state> <state>$TOOLKIT_DIR$\config\flashloader\Atmel\SAM3S4\sam3s4-flash.board</state>
</option> </option>
<option> <option>
<name>OCImagesSuppressCheck1</name> <name>OCImagesSuppressCheck1</name>
@ -366,7 +366,7 @@
</option> </option>
<option> <option>
<name>CCJLinkSpeedRadioV2</name> <name>CCJLinkSpeedRadioV2</name>
<state>0</state> <state>2</state>
</option> </option>
<option> <option>
<name>CCUSBDevice</name> <name>CCUSBDevice</name>
@ -424,7 +424,7 @@
<option> <option>
<name>CCJLinkResetList</name> <name>CCJLinkResetList</name>
<version>5</version> <version>5</version>
<state>5</state> <state>7</state>
</option> </option>
<option> <option>
<name>CCJLinkInterfaceCmdLine</name> <name>CCJLinkInterfaceCmdLine</name>

View File

@ -164,7 +164,7 @@
<debug>1</debug> <debug>1</debug>
<option> <option>
<name>CCDefines</name> <name>CCDefines</name>
<state>__sam3s4c__</state> <state>__SAM3S4C__</state>
</option> </option>
<option> <option>
<name>CCPreprocFile</name> <name>CCPreprocFile</name>
@ -200,7 +200,7 @@
</option> </option>
<option> <option>
<name>CCEnableRemarks</name> <name>CCEnableRemarks</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>CCDiagSuppress</name> <name>CCDiagSuppress</name>
@ -562,7 +562,7 @@
<option> <option>
<name>OOCOutputFormat</name> <name>OOCOutputFormat</name>
<version>2</version> <version>2</version>
<state>0</state> <state>2</state>
</option> </option>
<option> <option>
<name>OCOutputOverride</name> <name>OCOutputOverride</name>
@ -570,7 +570,7 @@
</option> </option>
<option> <option>
<name>OOCOutputFile</name> <name>OOCOutputFile</name>
<state></state> <state>test.bin</state>
</option> </option>
<option> <option>
<name>OOCCommandLineProducer</name> <name>OOCCommandLineProducer</name>
@ -578,7 +578,7 @@
</option> </option>
<option> <option>
<name>OOCObjCopyEnable</name> <name>OOCObjCopyEnable</name>
<state>0</state> <state>1</state>
</option> </option>
</data> </data>
</settings> </settings>
@ -660,35 +660,35 @@
</option> </option>
<option> <option>
<name>IlinkMapFile</name> <name>IlinkMapFile</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogFile</name> <name>IlinkLogFile</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogInitialization</name> <name>IlinkLogInitialization</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogModule</name> <name>IlinkLogModule</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogSection</name> <name>IlinkLogSection</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogVeneer</name> <name>IlinkLogVeneer</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkIcfOverride</name> <name>IlinkIcfOverride</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkIcfFile</name> <name>IlinkIcfFile</name>
<state>$TOOLKIT_DIR$\CONFIG\generic_cortex.icf</state> <state>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\linker_scripts\iar\sam3s_ek_flash.icf</state>
</option> </option>
<option> <option>
<name>IlinkIcfFileSlave</name> <name>IlinkIcfFileSlave</name>
@ -696,7 +696,7 @@
</option> </option>
<option> <option>
<name>IlinkEnableRemarks</name> <name>IlinkEnableRemarks</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkSuppressDiags</name> <name>IlinkSuppressDiags</name>
@ -823,15 +823,15 @@
</option> </option>
<option> <option>
<name>IlinkLogAutoLibSelect</name> <name>IlinkLogAutoLibSelect</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogRedirSymbols</name> <name>IlinkLogRedirSymbols</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogUnusedFragments</name> <name>IlinkLogUnusedFragments</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkCrcReverseByteOrder</name> <name>IlinkCrcReverseByteOrder</name>
@ -1792,6 +1792,30 @@
<data/> <data/>
</settings> </settings>
</configuration> </configuration>
<group>
<name>resources</name>
<group>
<name>arduino_due</name>
</group>
<group>
<name>sam3s_ek</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\linker_scripts\iar\sam3s_ek_flash.icf</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\debug_scripts\iar\sam3s_ek_flash.mac</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\linker_scripts\iar\sam3s_ek_sram.icf</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\variants\sam3s-ek\debug_scripts\iar\sam3s_ek_sram.mac</name>
</file>
</group>
<group>
<name>sam3u_ek</name>
</group>
</group>
<group> <group>
<name>variants</name> <name>variants</name>
<group> <group>

View File

@ -1,22 +1,24 @@
#include "../Arduino.h" #include "../Arduino.h"
void setup( void ) void setup( void )
{ {
// initialize the digital pin as an output. // initialize the digital pin as an output.
// Pin PIN_LED has an LED connected on most Arduino boards: // Pin PIN_LED has an LED connected on most Arduino boards:
pinMode( PIN_LED, OUTPUT ) ; pinMode( PIN_LED, OUTPUT ) ;
pinMode( PIN_LED_RED, OUTPUT ) ;
digitalWrite( PIN_LED_RED, HIGH ) ;
Serial1.begin( 19200 ) ; // Serial1.begin( 19200 ) ;
} }
void loop( void ) void loop( void )
{ {
digitalWrite( PIN_LED, HIGH ) ; // set the LED on //digitalWrite( PIN_LED, HIGH ) ; // set the LED on
delay( 1000 ) ; // wait for a second //delay( 1000 ) ; // wait for a second
digitalWrite( PIN_LED, LOW ) ; // set the LED off //digitalWrite( PIN_LED, LOW ) ; // set the LED off
delay( 1000 ) ; // wait for a second //delay( 1000 ) ; // wait for a second
//
Serial1.println( "test1" ) ; // send an initial string //Serial1.println( "test1" ) ; // send an initial string
delay( 1000 ) ; // wait for a second //delay( 1000 ) ; // wait for a second
Serial1.println( "test2" ) ; // send an initial string //Serial1.println( "test2" ) ; // send an initial string
} }

View File

@ -24,6 +24,10 @@
#include "wiring_private.h" #include "wiring_private.h"
#ifdef __cplusplus
extern "C" {
#endif
uint32_t millis( void ) uint32_t millis( void )
{ {
// todo: ensure no interrupts // todo: ensure no interrupts
@ -37,21 +41,21 @@ uint32_t micros( void )
__disable_irq() ; __disable_irq() ;
dwTicks=SysTick->VAL ; dwTicks=SysTick->VAL ;
__enable_irq() ; __enable_irq() ;
return (GetTickCount()*1000) + ((SysTick->LOAD + 1 - dwTicks)/(VARIANT_MCK/1000000)) ; return (GetTickCount()*1000) + ((SysTick->LOAD + 1 - dwTicks)/(VARIANT_MCK/1000000)) ;
} }
/// \brief Pauses the program for the amount of time (in miliseconds) specified as parameter. /// \brief Pauses the program for the amount of time (in miliseconds) specified as parameter.
/// (There are 1000 milliseconds in a second.) /// (There are 1000 milliseconds in a second.)
/// ///
/// \param dwMs the number of milliseconds to pause (uint32_t) /// \param dwMs the number of milliseconds to pause (uint32_t)
/// ///
void delay( uint32_t dwMs ) void delay( uint32_t dwMs )
{ {
Wait( dwMs ) ; Wait( dwMs ) ;
} }
/// \brief Pauses the program for the amount of time (in microseconds) specified as parameter. /// \brief Pauses the program for the amount of time (in microseconds) specified as parameter.
/// ///
/// \param dwUs the number of microseconds to pause (uint32_t) /// \param dwUs the number of microseconds to pause (uint32_t)
/// ///
@ -74,69 +78,44 @@ extern void SysTick_Handler( void )
TimeTick_Increment() ; TimeTick_Increment() ;
} }
//! Check Variant for PLL/Clock inits extern void init( void )
#if defined sam3s_ek {
#define VARIANT_PLLAR (CKGR_PLLAR_STUCKTO1 | \ SystemInit() ;
CKGR_PLLAR_MULA( 0x0f ) | \
CKGR_PLLAR_PLLACOUNT( 0x1 ) | \
CKGR_PLLAR_DIVA( 0x3 ))
#else
#error "No settings for current VARIANT"
#endif
/* Set Systick to 1ms interval, common to all SAM3 variants */
if ( SysTick_Config( SystemCoreClock / 1000 ) )
{
/* Capture error */
while ( 1 ) ;
}
/* Disable watchdog, common to all SAM variants */
WDT_Disable( WDT ) ;
SysTick_Config( VARIANT_MCK/1000 ) ;
// Initialize Serial port UART0, common to all SAM3 variants
PIO_Configure( APinDescription[PINS_UART].pPort, APinDescription[PINS_UART].dwPinType,
APinDescription[PINS_UART].dwPin, APinDescription[PINS_UART].dwPinAttribute ) ;
// Switch off Power LED
PIO_Clear( APinDescription[PIN_LED_RED].pPort, APinDescription[PIN_LED_RED].dwPin ) ;
//PIO_Configure( APinDescription[PIN_LED_RED].pPort, APinDescription[PIN_LED_RED].dwPinType,
// APinDescription[PIN_LED_RED].dwPin, APinDescription[PIN_LED_RED].dwPinAttribute ) ;
}
/** /**
* \brief Performs the low-level initialization of the chip. * \brief
* This includes EFC and master clock configuration. *
* It also enable a low level on the pin NRST triggers a user reset. * \param c Character to output.
*
* \return The character that was output.
*/ */
static void LowLevelInit_sam3s_ek( void ) extern WEAK signed int putchar( signed int c )
{ {
/* Set 3 FWS for Embedded Flash Access @ 64MHz, we are now at 4MHz on Internal FastRC */ return c ;
EFC->EEFC_FMR = EEFC_FMR_FWS( 3 ) ;
/* Initialize main oscillator */
if ( !(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) )
{
PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCXTST(0x8) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN ;
for ( ; !(PMC->PMC_SR & PMC_SR_MOSCXTS) ; ) ;
}
/* Switch to 3-20MHz Xtal oscillator */
PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCXTST(0x8) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCSEL ;
for ( ; !(PMC->PMC_SR & PMC_SR_MOSCSELS) ; ) ;
PMC->PMC_MCKR = (PMC->PMC_MCKR & ~(uint32_t)PMC_MCKR_CSS_Msk) | PMC_MCKR_CSS_MAIN_CLK ;
for ( ; !(PMC->PMC_SR & PMC_SR_MCKRDY) ; ) ;
/* Initialize PLLA */
PMC->CKGR_PLLAR = VARIANT_PLLAR ;
for ( ; !(PMC->PMC_SR & PMC_SR_LOCKA) ; ) ;
/* Switch to main clock */
PMC->PMC_MCKR = ((PMC_MCKR_PRES_CLK | PMC_MCKR_CSS_PLLA_CLK) & ~PMC_MCKR_CSS_Msk) | PMC_MCKR_CSS_MAIN_CLK ;
for ( ; !(PMC->PMC_SR & PMC_SR_MCKRDY) ; ) ;
PMC->PMC_MCKR = (PMC_MCKR_PRES_CLK | PMC_MCKR_CSS_PLLA_CLK) ;
for ( ; !(PMC->PMC_SR & PMC_SR_MCKRDY) ; ) ;
} }
void init( void ) #ifdef __cplusplus
{ }
// Disable watchdog, common to all SAM variants
WDT_Disable( WDT ) ;
#if defined sam3s_ek
// Set Main clock to 64MHz using external 12MHz
LowLevelInit_sam3s_ek() ;
#else
# error "Board/Variant not defined"
#endif #endif
// Set Systick to 1ms interval, common to all SAM3 variants
SysTick_Config( VARIANT_MCK/1000 ) ;
// Initialize Serial port UART0, common to all SAM3 variants
PIO_Configure( APinDescription[PINS_UART].pPort, APinDescription[PINS_UART].dwPinType,
APinDescription[PINS_UART].dwPin, APinDescription[PINS_UART].dwPinAttribute ) ;
}

View File

@ -25,7 +25,11 @@
*/ */
#include "wiring_private.h" #include "wiring_private.h"
#include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
uint8_t analog_reference = DEFAULT; uint8_t analog_reference = DEFAULT;
@ -257,3 +261,7 @@ void analogWrite(uint8_t pin, int val)
} }
} }
} }
#ifdef __cplusplus
}
#endif

View File

@ -25,79 +25,66 @@
*/ */
#include "wiring_private.h" #include "wiring_private.h"
//#include "pins_arduino.h"
/// \brief Configures the specified pin to behave either as an input or an output. See the description of digital pins for details. #ifdef __cplusplus
/// extern "C" {
/// \param dwPin the number of the pin whose mode you wish to set #endif
/// \param dwMode either INPUT or OUTPUT
/// extern void pinMode( uint32_t dwPin, uint32_t dwMode )
void pinMode( uint32_t dwPin, uint32_t dwMode )
{ {
if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN ) if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN )
{ {
return ; return ;
} }
switch ( dwMode ) switch ( dwMode )
{ {
case INPUT: case INPUT:
PIO_Configure( APinDescription[dwPin].pPort, PIO_INPUT, APinDescription[dwPin].dwPin, 0 ) ; /* Enable peripheral for clocking input */
break ; PMC_EnablePeripheral( APinDescription[dwPin].dwPeripheralId ) ;
PIO_Configure( APinDescription[dwPin].pPort, PIO_INPUT, APinDescription[dwPin].dwPin, 0 ) ;
break ;
case OUTPUT: case OUTPUT:
PIO_Configure( APinDescription[dwPin].pPort, PIO_OUTPUT_1, APinDescription[dwPin].dwPin, APinDescription[dwPin].dwPinAttribute ) ; /* if all pins are output, disable PIO Controller clocking, reduce power consomption */
break ; if ( APinDescription[dwPin].pPort->PIO_OSR == 0xffffffff )
{
PMC_DisablePeripheral( APinDescription[dwPin].dwPeripheralId ) ;
}
PIO_Configure( APinDescription[dwPin].pPort, PIO_OUTPUT_1, APinDescription[dwPin].dwPin, APinDescription[dwPin].dwPinAttribute ) ;
break ;
default: default:
break ; break ;
} }
} }
/// \brief Write a HIGH or a LOW value to a digital pin. extern void digitalWrite( uint32_t dwPin, uint32_t dwVal )
///
/// \desc If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the
/// corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
///
/// If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal
/// 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup
/// resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely
/// cause. The remedy is to set the pin to an output with the pinMode() function.
///
/// NOTE: Digital pin PIN_LED is harder to use as a digital input than the other digital pins because it has an LED
/// and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up
/// resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor
/// pull the voltage level down, meaning it always returns LOW. If you must use pin PIN_LED as a digital input, use an
/// external pull down resistor.
///
/// \param dwPin the pin number
/// \param dwVal HIGH or LOW
///
void digitalWrite( uint32_t dwPin, uint32_t dwVal )
{ {
if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN ) if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN )
{ {
return ; return ;
} }
PIO_SetOutput( APinDescription[dwPin].pPort, APinDescription[dwPin].dwPin, dwVal, 0, PIO_PULLUP ) ; PIO_SetOutput( APinDescription[dwPin].pPort, APinDescription[dwPin].dwPin, dwVal, 0, PIO_PULLUP ) ;
} }
/// \brief Reads the value from a specified digital pin, either HIGH or LOW. extern int digitalRead( uint32_t dwPin )
///
/// \param dwPin the number of the digital pin you want to read (int)
///
int digitalRead( uint32_t dwPin )
{ {
if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN ) if ( APinDescription[dwPin].dwPinType == PIO_NOT_A_PIN )
{ {
return LOW ; return LOW ;
} }
if ( PIO_Get( APinDescription[dwPin].pPort, PIO_INPUT, APinDescription[dwPin].dwPin ) == 1 ) if ( PIO_Get( APinDescription[dwPin].pPort, PIO_INPUT, APinDescription[dwPin].dwPin ) == 1 )
{ {
return HIGH ; return HIGH ;
} }
return LOW ; return LOW ;
} }
#ifdef __cplusplus
}
#endif

View File

@ -37,6 +37,16 @@ extern "C"{
typedef void (*voidFuncPtr)( void ) ; typedef void (*voidFuncPtr)( void ) ;
/* Define attribute */
#if defined ( __CC_ARM ) /* Keil <20>Vision 4 */
#define WEAK __attribute__ ((weak))
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
#define WEAK __weak
#elif defined ( __GNUC__ ) /* GCC CS */
#define WEAK __attribute__ ((weak))
#endif
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

View File

@ -28,7 +28,7 @@
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
* to 3 minutes in length, but must be called at least a few dozen microseconds * to 3 minutes in length, but must be called at least a few dozen microseconds
* before the start of the pulse. */ * before the start of the pulse. */
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout )
{ {
// cache the port and bit of the pin in order to speed up the // cache the port and bit of the pin in order to speed up the
// pulse width measuring loop and achieve finer resolution. calling // pulse width measuring loop and achieve finer resolution. calling

View File

@ -1,5 +1,5 @@
/* /*
wiring_shift.c - shiftOut() function wiring_shift.c
Part of Arduino - http://www.arduino.cc/ Part of Arduino - http://www.arduino.cc/
Copyright (c) 2005-2006 David A. Mellis Copyright (c) 2005-2006 David A. Mellis
@ -24,32 +24,54 @@
#include "wiring_private.h" #include "wiring_private.h"
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { #ifdef __cplusplus
uint8_t value = 0; extern "C"{
uint8_t i; #endif
for (i = 0; i < 8; ++i) { extern uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder )
digitalWrite(clockPin, HIGH);
if (bitOrder == LSBFIRST)
value |= digitalRead(dataPin) << i;
else
value |= digitalRead(dataPin) << (7 - i);
digitalWrite(clockPin, LOW);
}
return value;
}
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{ {
uint8_t i; uint8_t value = 0 ;
uint8_t i ;
for (i = 0; i < 8; i++) { for ( i=0 ; i < 8 ; ++i )
if (bitOrder == LSBFIRST) {
digitalWrite(dataPin, !!(val & (1 << i))); digitalWrite( ulClockPin, HIGH ) ;
if ( ulBitOrder == LSBFIRST )
{
value |= digitalRead( ulDataPin ) << i ;
}
else
{
value |= digitalRead( ulDataPin ) << (7 - i) ;
}
digitalWrite( ulClockPin, LOW ) ;
}
return value ;
}
extern void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal )
{
uint8_t i ;
for ( i=0 ; i < 8 ; i++ )
{
if ( ulBitOrder == LSBFIRST )
{
digitalWrite( ulDataPin, !!(ulVal & (1 << i)) ) ;
}
else else
digitalWrite(dataPin, !!(val & (1 << (7 - i)))); {
digitalWrite( ulDataPin, !!(ulVal & (1 << (7 - i))) ) ;
digitalWrite(clockPin, HIGH); }
digitalWrite(clockPin, LOW);
digitalWrite( ulClockPin, HIGH ) ;
digitalWrite( ulClockPin, LOW ) ;
} }
} }
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -6,21 +6,21 @@ SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
# Rules # Rules
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# libchip_sam3s4_gcc_rel.a # libchip_sam3s4c_gcc_rel.a
all: libchip_sam3s4_gcc_dbg.a all: libchip_sam3s4c_gcc_dbg.a
libchip_sam3s4_gcc_dbg.a: libchip_sam3s4c_gcc_dbg.a:
@echo --- Making $@ @echo --- Making $@
@$(MAKE) CHIP=sam3s4 DEBUG=1 $(SUBMAKE_OPTIONS) -f sam3.mk @$(MAKE) CHIP=__SAM3S4C__ DEBUG=1 $(SUBMAKE_OPTIONS) -f sam3.mk
libchip_sam3s4_gcc_rel.a: libchip_sam3s4c_gcc_rel.a:
@echo --- Making $@ @echo --- Making $@
@$(MAKE) CHIP=sam3s4 $(SUBMAKE_OPTIONS) -f sam3.mk @$(MAKE) CHIP=__SAM3S4C__ $(SUBMAKE_OPTIONS) -f sam3.mk
.PHONY: clean .PHONY: clean
clean: clean:
@echo --- Cleaning sam3s4 release and debug @echo --- Cleaning sam3s4c release and debug
@$(MAKE) CHIP=sam3s4 $(SUBMAKE_OPTIONS) -f sam3.mk $@ @$(MAKE) CHIP=__SAM3S4C__ $(SUBMAKE_OPTIONS) -f sam3.mk $@
@$(MAKE) CHIP=sam3s4 DEBUG=1 $(SUBMAKE_OPTIONS) -f sam3.mk $@ @$(MAKE) CHIP=__SAM3S4C__ DEBUG=1 $(SUBMAKE_OPTIONS) -f sam3.mk $@

View File

@ -9,6 +9,9 @@ ifeq ($(CHIP),)
$(error CHIP not defined) $(error CHIP not defined)
endif endif
#CHIP_NAME=$(subst __,,$(CHIP))
#CHIP_NAME=$(subst __,,$(call lc,$(CHIP)))
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Path # Path
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -18,22 +21,43 @@ OUTPUT_BIN = ../lib
# Libraries # Libraries
PROJECT_BASE_PATH = .. PROJECT_BASE_PATH = ..
CMSIS_BASE_PATH = $(PROJECT_BASE_PATH)/../CMSIS/CM3/CoreSupport CMSIS_BASE_PATH = $(PROJECT_BASE_PATH)/../CMSIS/Include
ifeq ($(CHIP), __SAM3S4C__)
CHIP_NAME=sam3s4c
CHIP_SERIE=sam3s
else ifeq ($(CHIP), __SAM3U4E__)
CHIP_NAME=sam3u4e
CHIP_SERIE=sam3u
else ifeq ($(CHIP), __SAM3N4C__)
CHIP_NAME=sam3n4c
CHIP_SERIE=sam3n
else ifeq ($(CHIP), __SAM3X8H__)
CHIP_NAME=sam3x8h
CHIP_SERIE=sam3xa
else
endif
CMSIS_CHIP_PATH=$(PROJECT_BASE_PATH)/../cmsis/$(CHIP_SERIE)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Files # Files
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
vpath %.h $(PROJECT_BASE_PATH)/include vpath %.h $(PROJECT_BASE_PATH)/include $(PROJECT_BASE_PATH)/../cmsis/$(CHIP_SERIE)/include
vpath %.c $(PROJECT_BASE_PATH)/source $(CMSIS_BASE_PATH) vpath %.c $(PROJECT_BASE_PATH)/source $(CMSIS_BASE_PATH) $(CMSIS_CHIP_PATH)/source/templates $(CMSIS_CHIP_PATH)/source/templates
vpath %.s $(PROJECT_BASE_PATH)/source $(CMSIS_BASE_PATH)
VPATH+=$(PROJECT_BASE_PATH)/source VPATH+=$(PROJECT_BASE_PATH)/source
VPATH+=$(CMSIS_BASE_PATH) VPATH+=$(CMSIS_BASE_PATH)
VPATH+=$(CMSIS_CHIP_PATH)/include
VPATH+=$(CMSIS_CHIP_PATH)/source/templates
VPATH+=$(CMSIS_CHIP_PATH)/source/templates/gcc
INCLUDES = -I$(PROJECT_BASE_PATH) INCLUDES = -I$(PROJECT_BASE_PATH)
INCLUDES += -I$(PROJECT_BASE_PATH)/include INCLUDES += -I$(PROJECT_BASE_PATH)/include
INCLUDES += -I$(CMSIS_BASE_PATH) INCLUDES += -I$(CMSIS_BASE_PATH)
INCLUDES += -I$(CMSIS_CHIP_PATH)/include
INCLUDES += -I$(CMSIS_CHIP_PATH)/source/templates
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ifdef DEBUG ifdef DEBUG
@ -51,19 +75,20 @@ include $(TOOLCHAIN).mk
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ifdef DEBUG ifdef DEBUG
OUTPUT_OBJ=debug OUTPUT_OBJ=debug
OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_dbg.a OUTPUT_LIB=$(LIBNAME)_$(CHIP_NAME)_$(TOOLCHAIN)_dbg.a
else else
OUTPUT_OBJ=release OUTPUT_OBJ=release
OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_rel.a OUTPUT_LIB=$(LIBNAME)_$(CHIP_NAME)_$(TOOLCHAIN)_rel.a
endif endif
OUTPUT_PATH=$(OUTPUT_OBJ)_$(CHIP) OUTPUT_PATH=$(OUTPUT_OBJ)_$(CHIP_NAME)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# C source files and objects # C source files and objects
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.c) C_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.c)
C_SRC+=$(wildcard $(CMSIS_BASE_PATH)/*.c) C_SRC+=$(wildcard $(CMSIS_CHIP_PATH)/*.c)
C_SRC+=$(wildcard $(CMSIS_CHIP_PATH)/gcc*.c)
C_OBJ_TEMP=$(patsubst %.c, %.o, $(notdir $(C_SRC))) C_OBJ_TEMP=$(patsubst %.c, %.o, $(notdir $(C_SRC)))

View File

@ -103,7 +103,7 @@
</option> </option>
<option> <option>
<name>GenLowLevelInterface</name> <name>GenLowLevelInterface</name>
<state>1</state> <state>0</state>
</option> </option>
<option> <option>
<name>GEndianModeBE</name> <name>GEndianModeBE</name>
@ -164,7 +164,7 @@
<debug>1</debug> <debug>1</debug>
<option> <option>
<name>CCDefines</name> <name>CCDefines</name>
<state>__sam3s4c__</state> <state>__SAM3S4C__</state>
</option> </option>
<option> <option>
<name>CCPreprocFile</name> <name>CCPreprocFile</name>
@ -295,6 +295,7 @@
<name>CCIncludePath2</name> <name>CCIncludePath2</name>
<state>$PROJ_DIR$\..</state> <state>$PROJ_DIR$\..</state>
<state>$PROJ_DIR$\..\include</state> <state>$PROJ_DIR$\..\include</state>
<state>$PROJ_DIR$\..\source\templates</state>
</option> </option>
<option> <option>
<name>CCStdIncCheck</name> <name>CCStdIncCheck</name>
@ -3822,9 +3823,6 @@
<file> <file>
<name>$PROJ_DIR$\..\cmsis\sam3s\include\sam3s4c.h</name> <name>$PROJ_DIR$\..\cmsis\sam3s\include\sam3s4c.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\cmsis\sam3s\include\system_sam3s.h</name>
</file>
</group> </group>
<group> <group>
<name>source</name> <name>source</name>
@ -3832,12 +3830,6 @@
<name>templates</name> <name>templates</name>
<group> <group>
<name>iar</name> <name>iar</name>
<file>
<name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\iar\exceptions.c</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file>
<file> <file>
<name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\iar\startup_sam3s.c</name> <name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\iar\startup_sam3s.c</name>
</file> </file>
@ -3851,6 +3843,9 @@
<file> <file>
<name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\system_sam3s.c</name> <name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\system_sam3s.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\cmsis\sam3s\source\templates\system_sam3s.h</name>
</file>
</group> </group>
</group> </group>
</group> </group>

View File

@ -10,7 +10,23 @@
<project> <project>
<path>$WS_DIR$\..\..\..\cores\sam\validation\build_iar\test.ewp</path> <path>$WS_DIR$\..\..\..\cores\sam\validation\build_iar\test.ewp</path>
</project> </project>
<batchBuild/> <batchBuild>
<batchDefinition>
<name>all_debug_sam3s</name>
<member>
<project>libsam</project>
<configuration>Debug</configuration>
</member>
<member>
<project>libarduino</project>
<configuration>Debug</configuration>
</member>
<member>
<project>test</project>
<configuration>Debug</configuration>
</member>
</batchDefinition>
</batchBuild>
</workspace> </workspace>

View File

@ -1,17 +1,14 @@
/*
%atmel_license%
*/
#ifndef _LIB_SAM3S_ #ifndef _LIB_SAM3S_
#define _LIB_SAM3S_ #define _LIB_SAM3S_
/* /*
* Peripherals registers definitions * Core and peripherals registers definitions
*/ */
#if defined sam3s4 #include "include/sam3.h"
#elif defined sam3s2
#elif defined sam3s1
#else
#warning Library does not support the specified chip, specifying sam3s4.
#define sam3s4
#endif
#include "include/SAM3S.h"
/** Define MAX number of Interrupts: (IRQn_Type+1) + 8 for CM3 core */ /** Define MAX number of Interrupts: (IRQn_Type+1) + 8 for CM3 core */
#define EXTERNAL_NUM_INTERRUPTS (UDP_IRQn+1+8) #define EXTERNAL_NUM_INTERRUPTS (UDP_IRQn+1+8)
@ -19,43 +16,29 @@
/* Define attribute */ /* Define attribute */
#if defined ( __GNUC__ ) /* GCC CS3 */ #if defined ( __GNUC__ ) /* GCC CS3 */
#define WEAK __attribute__ ((weak)) #define WEAK __attribute__ ((weak))
#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
#define WEAK __weak
#endif #endif
/* Define NO_INIT attribute */ /* Define NO_INIT attribute */
#if defined ( __GNUC__ ) #if defined ( __GNUC__ )
#define NO_INIT #define NO_INIT
#elif defined ( __ICCARM__ )
#define NO_INIT __no_init
#endif #endif
/*
* Core
*/
#include "include/exceptions.h"
/* /*
* Peripherals * Peripherals
*/ */
#include "include/acc.h"
#include "include/adc.h" #include "include/adc.h"
#include "include/async.h"
#include "include/crccu.h"
#include "include/dacc.h"
#include "include/efc.h"
#include "include/flashd.h"
#include "include/pio.h" #include "include/pio.h"
//#include "include/pio_it.h"
#include "include/pio_capture.h"
#include "include/pmc.h" #include "include/pmc.h"
#include "include/pwmc.h" #include "include/pwmc.h"
#include "include/rtc.h" #include "include/rtc.h"
#include "include/rtt.h" #include "include/rtt.h"
#include "include/spi.h" #include "include/spi.h"
#include "include/spi_pdc.h"
#include "include/ssc.h"
#include "include/tc.h" #include "include/tc.h"
#include "include/twi.h" #include "include/twi.h"
#include "include/twid.h"
#include "include/usart.h" #include "include/usart.h"
#include "include/wdt.h" #include "include/wdt.h"

View File

@ -1,75 +1,95 @@
/*
%atmel_license%
*/
/** \file cmsis example */
#include <stdlib.h> #include <stdlib.h>
#include <compiler.h> #include <compiler.h>
#include <board.h> #include <board.h>
#include "conf_board.h" #include "conf_board.h"
volatile uint32_t msTicks = 0; /* counts 1ms timeTicks */ //! counts 1ms timeTicks
volatile uint32_t dw_ms_ticks = 0;
/*---------------------------------------------------------------------------- /**
SysTick_Handler * \brief SysTick_Handler.
*----------------------------------------------------------------------------*/ */
void SysTick_Handler(void) void SysTick_Handler(void)
{ {
msTicks++; /* increment counter necessary in Delay() */ // increment counter necessary in delay()
dw_ms_ticks++;
} }
/*---------------------------------------------------------------------------- /**
delays number of tick Systicks (happens every 1 ms) * \brief delays number of tick Systicks (happens every 1 ms)
*----------------------------------------------------------------------------*/ */
__INLINE static void Delay(uint32_t dlyTicks) __INLINE static void delay_ms(uint32_t dw_dly_ticks)
{ {
uint32_t curTicks; uint32_t dw_cur_ticks;
curTicks = msTicks; dw_cur_ticks = dw_ms_ticks;
while ((msTicks - curTicks) < dlyTicks); while ((dw_ms_ticks - dw_cur_ticks) < dw_dly_ticks);
} }
/*---------------------------------------------------------------------------- /**
configer LED pins * \brief configer LED pins
*----------------------------------------------------------------------------*/ */
__INLINE static void LED_Config(void) __INLINE static void led_config(void)
{ {
LED0_PIO->PIO_PER = LED0_MASK; /* Setup Pin PA19 for LED */ // Setup LED Pin
LED0_PIO->PIO_PER = LED0_MASK;
LED0_PIO->PIO_OER = LED0_MASK; LED0_PIO->PIO_OER = LED0_MASK;
LED0_PIO->PIO_PUDR = LED0_MASK; LED0_PIO->PIO_PUDR = LED0_MASK;
} }
/*---------------------------------------------------------------------------- /**
Switch on LEDs * \brief Switch on LED
*----------------------------------------------------------------------------*/ */
__INLINE static void LED_On(uint32_t led) __INLINE static void led_on(uint32_t dw_led)
{ {
LED0_PIO->PIO_CODR = led; /* Turn On LED */ // Turn On LED
LED0_PIO->PIO_CODR = dw_led;
} }
/**
/*---------------------------------------------------------------------------- * \brief Switch off LED
Switch off LEDs */
*----------------------------------------------------------------------------*/ __INLINE static void led_off(uint32_t dw_led)
__INLINE static void LED_Off(uint32_t led)
{ {
LED0_PIO->PIO_SODR = led; /* Turn Off LED */ // Turn Off LED
LED0_PIO->PIO_SODR = dw_led;
} }
/*---------------------------------------------------------------------------- /**
MAIN function * \brief Application entry point.
*----------------------------------------------------------------------------*/ *
* \return Unused (ANSI-C compatibility).
*/
int main(void) int main(void)
{ {
SystemInit(); SystemInit();
WDT->WDT_MR = WDT_MR_WDDIS; WDT->WDT_MR = WDT_MR_WDDIS;
if (SysTick_Config(SystemCoreClock / 1000)) { /* Setup SysTick Timer for 1 msec interrupts */ // Setup SysTick Timer for 1 msec interrupts
while (1); /* Capture error */ if (SysTick_Config(SystemCoreClock / 1000)) {
} // Capture error
while (1);
LED_Config(); }
led_config();
// Flash the LED
while(1) { while(1) {
LED_On (LED0_MASK); /* Turn on the LED. */ // Turn on the LED.
Delay (1000); /* delay 100 Msec */ led_on (LED0_MASK);
LED_Off (LED0_MASK); /* Turn off the LED. */ // delay 1000 Msec.
Delay (1000); /* delay 100 Msec */ delay_ms (1000);
// Turn off the LED.
led_off(LED0_MASK);
// delay 1000 Msec.
delay_ms (1000);
} }
} }

Some files were not shown because too many files have changed in this diff Show More