Merge branch 'platforms-arm' of https://github.com/arduino/ARM into platforms-arm

This commit is contained in:
Thibaut VIARD 2012-04-29 00:51:47 +02:00
commit dc95506b06
9 changed files with 97 additions and 49 deletions

View File

@ -175,8 +175,8 @@ typedef struct _PinDescription
EPioType ulPinType ;
uint32_t ulPinConfiguration ;
uint32_t ulPinAttribute ;
EAnalogChannel ulAnalogChannel ; /* Describe which Analog pin is linked to a MCU pin */
EAnalogChannel ulADCChannelNumber ; /* We use the same enum than for ADC pins to describe the ADC channel in use on this pin */
EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
EPWMChannel ulPWMChannel ;
ETCChannel ulTCChannel ;
} PinDescription ;

View File

@ -19,6 +19,15 @@
#define ARDUINO_MAIN
#include "Arduino.h"
/*
* Cortex-M3 Systick IT handler
*/
extern void SysTick_Handler( void )
{
// Increment tick count each ms
TimeTick_Increment() ;
}
/*
* \brief Main entry point of Arduino application
*/

View File

@ -85,7 +85,7 @@ void loop( void )
// Serial1.write( "test1\n" ) ; // send a string
// Serial1.write( "test2" ) ; // send another string
Serial1.print("Analog ins: ");
Serial1.print("Analog pins: ");
for (int i=A0; i<=MAX_ANALOG; i++) {
int a = analogRead(i);
Serial1.print(a, DEC);

View File

@ -55,13 +55,13 @@ void delayMicroseconds( uint32_t dwUs )
}
/*
* Cortex-M3 Systick IT handler
* Cortex-M3 Systick IT handler: MOVED TO MAIN DUE TO WEAK SYMBOL ISSUE NOT RESOLVED
*/
extern void SysTick_Handler( void )
/*extern void SysTick_Handler( void )
{
// Increment tick count each ms
TimeTick_Increment() ;
}
}*/
#if defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
extern signed int putchar( signed int c ) ;

View File

@ -1,33 +1,37 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash.
# Connect to J-Link and debug application in flash on SAM3X.
#
# define 'reset' command
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3U4E
monitor flash device = AT91SAM3X8E
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1200 = 0xA5000004
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initializing PC and stack pointer
# Initialize PC and stack pointer
mon reg sp=(0x80000)
set *0x80004 = *0x80004 & 0xFFFFFFFE
#set *0x80004 = *0x80004 & 0xFFFFFFFE
mon reg pc=(0x80004)
info reg
break main
# end of 'reset' command
# End of 'reset' command
end

View File

@ -1,23 +1,37 @@
#*************************************************
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3U
# Connect to J-Link and debug application in sram on SAM3X.
#
# Note:
# First,users should do Step1 and Step2 according to your project,
# then do Step3.
# Step1: Connect to the J-Link gdb server
#target remote localhost:2331
#mon reset
# Define 'reset' command
define reset
# Step2: Load file(eg. getting-started project)
#load bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
#symbol-file bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
# Connect to the J-Link gdb server
target remote localhost:2331
# Step3: Initializing PC and stack pointer
# Perpheral reset RSTC_CR
set *0x400e1200 = 0xA5000004
# Modify pc value to even before writing pc register
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3X8E
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
break main
# End of 'reset' command
end

View File

@ -1,33 +1,37 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash.
# Connect to J-Link and debug application in flash on SAM3X.
#
# define 'reset' command
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3U4E
monitor flash device = AT91SAM3X8H
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1200 = 0xA5000004
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initializing PC and stack pointer
# Initialize PC and stack pointer
mon reg sp=(0x80000)
set *0x80004 = *0x80004 & 0xFFFFFFFE
#set *0x80004 = *0x80004 & 0xFFFFFFFE
mon reg pc=(0x80004)
info reg
break main
# end of 'reset' command
# End of 'reset' command
end

View File

@ -1,29 +1,37 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash.
# Connect to J-Link and debug application in sram on SAM3X.
#
# define 'reset' command
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3X8H
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1200 = 0xA5000004
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initializing PC and stack pointer
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
break main
# end of 'reset' command
# End of 'reset' command
end

View File

@ -70,7 +70,7 @@ extern const PinDescription g_APinDescription[]=
// 10 - Analog pins
// ----------------------
{ PIOA, PIO_PA3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NO_PWM, NO_TC }, // AD0
{ PIOA, PIO_PA3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC1, NO_PWM, NO_TC }, // AD0
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NO_PWM, NO_TC } // END
} ;
@ -109,9 +109,6 @@ void USART0_Handler( void )
extern "C" {
#endif
// Should be made in a better way...
extern void analogOutputInit(void);
/**
*
*/
@ -148,6 +145,18 @@ extern void init( void )
g_APinDescription[PIN_LED_RED].ulPinConfiguration ) ;
PIO_Clear( g_APinDescription[PIN_LED_RED].pPort, g_APinDescription[PIN_LED_RED].ulPin ) ;
// Initialize 10bit Analog Controller
pmc_enable_periph_clk( ID_ADC ) ;
adc_init( ADC, SystemCoreClock, ADC_FREQ_MAX, ADC_STARTUP_FAST ) ;
adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);
adc_configure_trigger(ADC, ADC_TRIG_SW, 0); // Disable hardware trigger.
adc_disable_interrupt( ADC, 0xFFFFFFFF ) ; // Disable all ADC interrupts.
adc_disable_all_channel( ADC ) ;
// Initialize analogOutput module
analogOutputInit();
}
#ifdef __cplusplus
}