1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

[sam] UART/USART write(char) working and cmsis update

This commit is contained in:
Thibaut VIARD
2011-09-16 23:07:44 +02:00
parent d1d60447e9
commit 04432caacd
52 changed files with 602 additions and 364 deletions

View File

@ -10,9 +10,6 @@
*/
#include "include/sam3.h"
/** Define MAX number of Interrupts: (IRQn_Type+1) + 8 for CM3 core */
#define EXTERNAL_NUM_INTERRUPTS (UDP_IRQn+1+8)
/* Define attribute */
#if defined ( __GNUC__ ) /* GCC CS3 */
#define WEAK __attribute__ ((weak))

View File

@ -4,7 +4,7 @@
*
* \par Purpose
*
* This file provides basic support for Cortex-M processor based
* This file provides basic support for Cortex-M processor based
* microcontrollers.
*
* \author Atmel Corporation: http://www.atmel.com \n
@ -26,7 +26,7 @@ extern "C" {
/* @endcond */
/* Function prototype for exception table items (interrupt handler). */
typedef void( *IntFunc )( void ) ;
typedef void (*IntFunc) (void);
/* Default empty handler */
extern void Dummy_Handler( void ) ;

View File

@ -1,31 +1,16 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, Atmel Corporation
/*! \file *********************************************************************
*
* All rights reserved.
* \brief Startup file for SAM3N.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* This file defines common SAM series.
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Compiler: ARMGCC
* - Supported devices: All SAM3N devices can be used.
* - AppNote:
*
* 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.
* ----------------------------------------------------------------------------
*/
******************************************************************************/
/* $asf_license$ */
/*----------------------------------------------------------------------------
* Headers
@ -61,9 +46,9 @@ extern int main(void);
void ResetException( void ) ;
extern void __libc_init_array( void ) ;
/*------------------------------------------------------------------------------
/*----------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
__attribute__((section(".vectors")))
IntFunc exception_table[] = {

View File

@ -10,7 +10,7 @@
*
******************************************************************************/
// $asf_license$
/* $asf_license$ */
/*------------------------------------------------------------------------------
* Headers
@ -42,7 +42,6 @@ extern int __low_level_init( void ) ;
#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. */
@ -65,7 +64,7 @@ const intvec_elem __vector_table[] =
0, /* Reserved */
PendSV_Handler,
SysTick_Handler,
/* Configurable interrupts */
SUPC_IrqHandler, /* 0 Supply Controller */
RSTC_IrqHandler, /* 1 Reset Controller */
@ -80,7 +79,7 @@ const intvec_elem __vector_table[] =
Dummy_Handler, /* 10 Reserved */
PIOA_IrqHandler, /* 11 Parallel IO Controller A */
PIOB_IrqHandler, /* 12 Parallel IO Controller B */
PIOC_IrqHandler, /* 13 Parallel IO Controller C */
PIOC_IrqHandler, /* 13 Parallel IO Controller C */
USART0_IrqHandler, /* 14 USART 0 */
USART1_IrqHandler, /* 15 USART 1 */
Dummy_Handler, /* 16 Reserved */
@ -88,14 +87,14 @@ const intvec_elem __vector_table[] =
Dummy_Handler, /* 18 Reserved */
TWI0_IrqHandler, /* 19 TWI 0 */
TWI1_IrqHandler, /* 20 TWI 1 */
SPI_IrqHandler, /* 21 SPI */
SPI_IrqHandler, /* 21 SPI */
Dummy_Handler, /* 22 Reserved */
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 */
TC5_IrqHandler, /* 28 Timer Counter 5 */
ADC_IrqHandler, /* 29 ADC controller */
DACC_IrqHandler, /* 30 DAC controller */
PWM_IrqHandler, /* 31 PWM */
@ -111,7 +110,7 @@ extern int __low_level_init( void )
uint32_t* pSrc = __section_begin( ".intvec" ) ;
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 ;

View File

@ -29,10 +29,10 @@ extern "C" {
/* Clock settings (48MHz) */
#define BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8))
#define BOARD_PLLR (CKGR_PLLR_STUCKTO1 \
| CKGR_PLLR_MUL(0x7) \
| CKGR_PLLR_MUL(0x3) \
| CKGR_PLLR_PLLCOUNT(0x3f) \
| CKGR_PLLR_DIV(0x1))
#define BOARD_MCKR (PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLL_CLK)
#define BOARD_MCKR (PMC_MCKR_PRES_CLK | PMC_MCKR_CSS_PLL_CLK)
/* Clock Definitions */
#define XTAL32 ( 32768UL) /* 32k crystal frequency */
@ -43,7 +43,7 @@ extern "C" {
#define MCK_HZ (48000000UL) /* Processor frequency */
/* FIXME: should be generated by sock */
uint32_t SystemCoreClock = 4000000;
uint32_t SystemCoreClock = EFRC_OSC;
/**
* \brief Setup the microcontroller system.

View File

@ -5,7 +5,7 @@
*
* \par Purpose
*
* This file provides basic support for Cortex-M processor based
* This file provides basic support for Cortex-M processor based
* microcontrollers.
*
* \author Atmel Corporation: http://www.atmel.com \n
@ -28,19 +28,19 @@ extern "C" {
#include <stdint.h>
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/**
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
extern void SystemInit(void);
/**
* @brief Updates the SystemCoreClock with current core Clock
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
extern void SystemCoreClockUpdate(void);
/* @cond 0 */
/**INDENT-OFF**/

View File

@ -1,31 +1,16 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, Atmel Corporation
/*! \file *********************************************************************
*
* All rights reserved.
* \brief Startup file for SAM3S.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* This file defines common SAM series.
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Compiler: ARMGCC
* - Supported devices: All SAM3S devices can be used.
* - AppNote:
*
* 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.
* ----------------------------------------------------------------------------
*/
******************************************************************************/
/* $asf_license$ */
/*----------------------------------------------------------------------------
* Headers
@ -39,10 +24,10 @@
* Exported variables
*----------------------------------------------------------------------------*/
/* Stack Configuration */
/* Stack Configuration */
#define STACK_SIZE 0x900 /** Stack size (in DWords) */
__attribute__ ((aligned(8),section(".stack")))
uint32_t pdwStack[STACK_SIZE] ;
uint32_t pdwStack[STACK_SIZE] ;
/* Initialize segments */
extern uint32_t _sfixed;
@ -158,7 +143,7 @@ void Reset_Handler( void )
/* 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 ;

View File

@ -20,7 +20,7 @@
#include "sam3.h"
/*----------------------------------------------------------------------------
* Definitions
* Exported variables
*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------

View File

@ -26,11 +26,11 @@ extern "C" {
/* @endcond */
/* Clock Settings (64MHz) */
#define BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8))
#define BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8U))
#define BOARD_PLLAR (CKGR_PLLAR_STUCKTO1 \
| CKGR_PLLAR_MULA(0xf) \
| CKGR_PLLAR_PLLACOUNT(0x3f) \
| CKGR_PLLAR_DIVA(0x3))
| CKGR_PLLAR_MULA(0xfU) \
| CKGR_PLLAR_PLLACOUNT(0x3fU) \
| CKGR_PLLAR_DIVA(0x3U))
#define BOARD_MCKR (PMC_MCKR_PRES_CLK | PMC_MCKR_CSS_PLLA_CLK)
/* Clock Definitions */

View File

@ -28,19 +28,19 @@ extern "C" {
#include <stdint.h>
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/**
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
extern void SystemInit(void);
/**
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
extern void SystemCoreClockUpdate(void);
/* @cond 0 */
/**INDENT-OFF**/

View File

@ -1,31 +1,16 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, Atmel Corporation
/*! \file *********************************************************************
*
* All rights reserved.
* \brief Startup file for SAM3S8/SAM3SD.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* This file defines common SAM series.
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Compiler: ARMGCC
* - Supported devices: All SAM3S8/SAM3SD devices can be used.
* - AppNote:
*
* 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.
* ----------------------------------------------------------------------------
*/
******************************************************************************/
/* $asf_license$ */
/*----------------------------------------------------------------------------
* Headers
@ -39,10 +24,10 @@
* Exported variables
*----------------------------------------------------------------------------*/
/* Stack Configuration */
/* Stack Configuration */
#define STACK_SIZE 0x900 /** Stack size (in DWords) */
__attribute__ ((aligned(8),section(".stack")))
uint32_t pdwStack[STACK_SIZE] ;
uint32_t pdwStack[STACK_SIZE] ;
/* Initialize segments */
extern uint32_t _sfixed;
@ -64,9 +49,9 @@ extern int main( void ) ;
void ResetException( void ) ;
extern void __libc_init_array( void ) ;
/*------------------------------------------------------------------------------
/*----------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
__attribute__((section(".vectors")))
IntFunc exception_table[] = {
@ -159,7 +144,7 @@ void ResetException( void )
/* 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 ;

View File

@ -1,27 +1,27 @@
/*! \file *********************************************************************
*
* \brief Startup file for SAM3S.
* \brief Startup file for SAM3S8/SAM3SD.
*
* This file defines common SAM series.
*
* - Compiler: IAR EWARM
* - Supported devices: All SAM3S devices can be used.
* - Supported devices: All SAM3S8/SAM3SD devices can be used.
* - AppNote:
*
******************************************************************************/
// $asf_license$
/* $asf_license$ */
/*------------------------------------------------------------------------------
* Headers
*------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "exceptions.h"
#include "sam3s8.h"
#include "system_sam3sd8.h"
/*----------------------------------------------------------------------------
* Definitions
* Exported variables
*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
@ -114,7 +114,7 @@ extern int __low_level_init( void )
uint32_t* pSrc = __section_begin( ".intvec" ) ;
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 ;

View File

@ -134,7 +134,7 @@ extern void SystemCoreClockUpdate( void )
break;
}
}
if (PMC->PMC_MCKR & PMC_MCKR_CSS_Msk == PMC_MCKR_CSS_PLLA_CLK) {
if ((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_PLLA_CLK) {
SystemCoreClock *= ((((PMC->CKGR_PLLAR) >> CKGR_PLLAR_MULA_Pos) & 0x7FF) + 1);
SystemCoreClock /= ((((PMC->CKGR_PLLAR) >> CKGR_PLLAR_DIVA_Pos) & 0x0FF));
}

View File

@ -5,7 +5,7 @@
*
* \par Purpose
*
* This file provides basic support for Cortex-M processor based
* This file provides basic support for Cortex-M processor based
* microcontrollers.
*
* \author Atmel Corporation: http://www.atmel.com \n
@ -28,19 +28,19 @@ extern "C" {
#include <stdint.h>
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/**
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
extern void SystemInit(void);
/**
* @brief Updates the SystemCoreClock with current core Clock
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
extern void SystemCoreClockUpdate(void);
/* @cond 0 */
/**INDENT-OFF**/

View File

@ -4,13 +4,13 @@
*
* This file defines common SAM series.
*
* - Compiler: Codesoucery
* - Compiler: ARMGCC
* - Supported devices: All SAM3U devices can be used.
* - AppNote:
*
******************************************************************************/
// $asf_license$
/* $asf_license$ */
/*----------------------------------------------------------------------------
* Headers

View File

@ -10,23 +10,23 @@
*
******************************************************************************/
// $asf_license$
/* $asf_license$ */
/*------------------------------------------------------------------------------
* Headers
*------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "exceptions.h"
#include "board.h"
#include "system_sam3u.h"
/*----------------------------------------------------------------------------
* Definitions
* Exported variables
*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* Types
*------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Types
*----------------------------------------------------------------------------*/
typedef void( *intfunc )( void );
typedef union { intfunc __fun; void * __ptr; } intvec_elem;
@ -36,9 +36,9 @@ typedef union { intfunc __fun; void * __ptr; } intvec_elem;
extern void __iar_program_start( void ) ;
extern int __low_level_init( void ) ;
/*------------------------------------------------------------------------------
/*----------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
#pragma language=extended
#pragma segment="CSTACK"

View File

@ -5,7 +5,7 @@
*
* \par Purpose
*
* This file provides basic support for Cortex-M processor based
* This file provides basic support for Cortex-M processor based
* microcontrollers.
*
* \author Atmel Corporation: http://www.atmel.com \n
@ -28,19 +28,19 @@ extern "C" {
#include <stdint.h>
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/**
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
extern void SystemInit(void);
/**
* @brief Updates the SystemCoreClock with current core Clock
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
extern void SystemCoreClockUpdate(void);
/* @cond 0 */
/**INDENT-OFF**/

View File

@ -1,38 +1,16 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2010, Atmel Corporation
/*! \file *********************************************************************
*
* All rights reserved.
* \brief Startup file for SAM3X.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* This file defines common SAM series.
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Compiler: ARMGCC
* - Supported devices: All SAM3X devices can be used.
* - AppNote:
*
* 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.
* ----------------------------------------------------------------------------
*/
******************************************************************************/
/**
* \file
*
* Implementation of start up code for GNU.
*
*/
/* $asf_license$ */
/*----------------------------------------------------------------------------
* Headers
@ -71,9 +49,9 @@ extern int main( void ) ;
void ResetException( void ) ;
extern void __libc_init_array( void ) ;
/*------------------------------------------------------------------------------
/*----------------------------------------------------------------------------
* Exception Table
*------------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
__attribute__((section(".vectors")))
IntFunc exception_table[] = {
@ -153,7 +131,7 @@ IntFunc exception_table[] = {
void ResetException( void )
{
uint32_t *pSrc, *pDest ;
/* Initialize the relocate segment */
pSrc = &_etext ;
pDest = &_srelocate ;

View File

@ -10,18 +10,18 @@
*
******************************************************************************/
// $asf_license$
/* $asf_license$ */
/*------------------------------------------------------------------------------
* Headers
*------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "exceptions.h"
#include "sam3xa.h"
#include "system_sam3x.h"
/*----------------------------------------------------------------------------
* Definitions
* Exported variables
*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
@ -51,7 +51,7 @@ extern int __low_level_init( void ) ;
const intvec_elem __vector_table[] =
{
{ .__ptr = __sfe( "CSTACK" ) },
__iar_program_start,
Reset_Handler,
NMI_Handler,
HardFault_Handler,

View File

@ -16,7 +16,7 @@
/* $asf_license$ */
#include "system_sam3x.h"
#include "sam3.h"
#include "sam3xa.h"
/* @cond 0 */
/**INDENT-OFF**/
@ -29,10 +29,10 @@ extern "C" {
/* Clock settings (84MHz) */
#define BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8))
#define BOARD_PLLAR (CKGR_PLLAR_STUCKTO1 \
| CKGR_PLLAR_MULA(0xd) \
| CKGR_PLLAR_MULA(0x6) \
| CKGR_PLLAR_PLLACOUNT(0x3f) \
| CKGR_PLLAR_DIVA(0x1))
#define BOARD_MCKR (PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK)
#define BOARD_MCKR (PMC_MCKR_PRES_CLK_1 | PMC_MCKR_CSS_PLLA_CLK)
/* Clock Definitions */
#define XTAL32 ( 32768UL) /* 32k crystal frequency */
@ -135,7 +135,7 @@ extern void SystemCoreClockUpdate( void )
break;
}
}
if (PMC->PMC_MCKR & PMC_MCKR_CSS_Msk == PMC_MCKR_CSS_PLLA_CLK) {
if ((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_PLLA_CLK) {
SystemCoreClock *= ((((PMC->CKGR_PLLAR) >> CKGR_PLLAR_MULA_Pos) & 0x7FF) + 1);
SystemCoreClock /= ((((PMC->CKGR_PLLAR) >> CKGR_PLLAR_DIVA_Pos) & 0x0FF));
}

View File

@ -5,7 +5,7 @@
*
* \par Purpose
*
* This file provides basic support for Cortex-M processor based
* This file provides basic support for Cortex-M processor based
* microcontrollers.
*
* \author Atmel Corporation: http://www.atmel.com \n
@ -28,19 +28,19 @@ extern "C" {
#include <stdint.h>
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
extern uint32_t SystemCoreClock; /* System Clock Frequency (Core Clock) */
/**
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
extern void SystemInit(void);
/**
* @brief Updates the SystemCoreClock with current core Clock
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
extern void SystemCoreClockUpdate(void);
/* @cond 0 */
/**INDENT-OFF**/

View File

@ -1 +1,33 @@
Makefile into build_gcc folder build the SAM peripheral library and put it into ../../../cores/sam Arduino API folder
Makefile into build_gcc folder build the SAM peripheral library and put it into ../../../cores/sam Arduino API folder
/*
%atmel_license%
*/
=
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* 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.
* ----------------------------------------------------------------------------