mirror of
https://github.com/esp8266/Arduino.git
synced 2025-12-01 17:57:53 +03:00
[sam] committing state-of-the-art code: compiling under EWARM 6.21.1 but debug not easy
This commit is contained in:
0
hardware/sam/cores/sam/Tone.h
Normal file
0
hardware/sam/cores/sam/Tone.h
Normal file
9
hardware/sam/cores/sam/WMath.h
Normal file
9
hardware/sam/cores/sam/WMath.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _WIRING_MATH_
|
||||
#define _WIRING_MATH_
|
||||
|
||||
extern long random( long ) ;
|
||||
extern long random( long, long ) ;
|
||||
extern void randomSeed( uint32_t dwSeed ) ;
|
||||
extern long map( long, long, long, long, long ) ;
|
||||
|
||||
#endif /* _WIRING_MATH_ */
|
||||
148
hardware/sam/cores/sam/board_cstartup_iar_sam3.c
Normal file
148
hardware/sam/cores/sam/board_cstartup_iar_sam3.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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. */
|
||||
}
|
||||
2587
hardware/sam/cores/sam/build_iar/libarduino.ewd
Normal file
2587
hardware/sam/cores/sam/build_iar/libarduino.ewd
Normal file
File diff suppressed because it is too large
Load Diff
2787
hardware/sam/cores/sam/build_iar/libarduino.ewp
Normal file
2787
hardware/sam/cores/sam/build_iar/libarduino.ewp
Normal file
File diff suppressed because it is too large
Load Diff
91
hardware/sam/cores/sam/dlib_lowlevel_sam3.c
Normal file
91
hardware/sam/cores/sam/dlib_lowlevel_sam3.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* Implementation of low level library.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined __ICCARM__ /* IAR Ewarm 5.41+ */
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <yfuns.h>
|
||||
#include <uart.h>
|
||||
|
||||
extern __weak size_t __write( int handle, const unsigned char *buf, size_t bufSize )
|
||||
{
|
||||
size_t nChars = 0 ;
|
||||
|
||||
/* Check for the command to flush all handles */
|
||||
if ( handle == -1 )
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
/* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */
|
||||
if ( handle != 1 && handle != 2 )
|
||||
{
|
||||
/* remove warnings */
|
||||
return 0xfffffff ;
|
||||
}
|
||||
|
||||
for ( /* Empty */ ; bufSize > 0 ; --bufSize )
|
||||
{
|
||||
while ( !uart_is_tx_ready(CONSOLE_UART) )
|
||||
;
|
||||
uart_write( CONSOLE_UART, *buf ) ;
|
||||
++buf ;
|
||||
++nChars ;
|
||||
}
|
||||
|
||||
return nChars ;
|
||||
}
|
||||
|
||||
|
||||
extern __weak size_t __read( int handle, unsigned char *buf, size_t bufSize )
|
||||
{
|
||||
size_t nChars = 0 ;
|
||||
|
||||
/* Check for stdin (only necessary if FILE descriptors are enabled) */
|
||||
if ( handle != 0 )
|
||||
{
|
||||
/* remove warnings */
|
||||
return 0xfffffff ;
|
||||
}
|
||||
|
||||
for ( /*Empty*/; bufSize > 0 ; --bufSize )
|
||||
{
|
||||
uint8_t c;
|
||||
while (uart_read( CONSOLE_UART, &c ))
|
||||
;
|
||||
|
||||
if ( c == 0 )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
*buf++ = c ;
|
||||
++nChars ;
|
||||
}
|
||||
|
||||
return nChars ;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Outputs a character on the UART.
|
||||
*
|
||||
* \param c Character to output.
|
||||
*
|
||||
* \return The character that was output.
|
||||
*/
|
||||
extern __weak signed int putchar( signed int c )
|
||||
{
|
||||
while ( !uart_is_tx_ready(CONSOLE_UART) )
|
||||
;
|
||||
uart_write( CONSOLE_UART, c ) ;
|
||||
|
||||
return c ;
|
||||
}
|
||||
#endif // defined __ICCARM__
|
||||
1761
hardware/sam/cores/sam/validation/build_iar/test.ewd
Normal file
1761
hardware/sam/cores/sam/validation/build_iar/test.ewd
Normal file
File diff suppressed because it is too large
Load Diff
1821
hardware/sam/cores/sam/validation/build_iar/test.ewp
Normal file
1821
hardware/sam/cores/sam/validation/build_iar/test.ewp
Normal file
File diff suppressed because it is too large
Load Diff
24
hardware/sam/cores/sam/wiring.h
Normal file
24
hardware/sam/cores/sam/wiring.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _WIRING_
|
||||
#define _WIRING_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
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 ) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WIRING_ */
|
||||
28
hardware/sam/cores/sam/wiring_analog.h
Normal file
28
hardware/sam/cores/sam/wiring_analog.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _WIRING_ANALOG_
|
||||
#define _WIRING_ANALOG_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* \brief
|
||||
*/
|
||||
extern void analogReference( uint8_t mode ) ;
|
||||
|
||||
/*
|
||||
* \brief
|
||||
*/
|
||||
extern void analogWrite( uint8_t, int ) ;
|
||||
|
||||
/*
|
||||
* \brief
|
||||
*/
|
||||
extern int analogRead( uint8_t ) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WIRING_ANALOG_ */
|
||||
49
hardware/sam/cores/sam/wiring_digital.h
Normal file
49
hardware/sam/cores/sam/wiring_digital.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _WIRING_DIGITAL_
|
||||
#define _WIRING_DIGITAL_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* \brief Configures the specified pin to behave either as an input or an output. See the description of digital pins for details.
|
||||
*
|
||||
* \param dwPin the number of the pin whose mode you wish to set
|
||||
* \param dwMode either INPUT or OUTPUT
|
||||
*/
|
||||
extern void pinMode( uint32_t dwPin, uint32_t dwMode ) ;
|
||||
|
||||
/*
|
||||
* \brief Write a HIGH or a LOW value to a digital pin.
|
||||
*
|
||||
* \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
|
||||
*/
|
||||
extern void digitalWrite( uint32_t dwPin, uint32_t dwVal ) ;
|
||||
|
||||
/*
|
||||
* \brief Reads the value from a specified digital pin, either HIGH or LOW.
|
||||
*
|
||||
* \param dwPin the number of the digital pin you want to read (int)
|
||||
*/
|
||||
extern int digitalRead( uint32_t dwPin ) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WIRING_DIGITAL_ */
|
||||
21
hardware/sam/cores/sam/wiring_pulse.h
Normal file
21
hardware/sam/cores/sam/wiring_pulse.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WIRING_PULSE_
|
||||
#define _WIRING_PULSE_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* 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
|
||||
* before the start of the pulse.
|
||||
*/
|
||||
extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000L ) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WIRING_PULSE_ */
|
||||
24
hardware/sam/cores/sam/wiring_shift.h
Normal file
24
hardware/sam/cores/sam/wiring_shift.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _WIRING_SHIFT_
|
||||
#define _WIRING_SHIFT_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* \brief
|
||||
*/
|
||||
extern uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) ;
|
||||
|
||||
|
||||
/*
|
||||
* \brief
|
||||
*/
|
||||
extern void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WIRING_SHIFT_ */
|
||||
Reference in New Issue
Block a user