Split sam3x/sam3n support.
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
4535a4c9b6
commit
ce3e3dc39b
@@ -24,7 +24,9 @@
|
||||
# include "../lpc43xx/vector_nvic.c"
|
||||
|
||||
#elif defined(SAM3X)
|
||||
# include "../sam3x/vector_nvic.c"
|
||||
# include "../sam/3x/vector_nvic.c"
|
||||
#elif defined(SAM3N)
|
||||
# include "../sam/3n/vector_nvic.c"
|
||||
|
||||
#elif defined(LM3S) || defined(LM4F)
|
||||
/* Yes, we use the same interrupt table for both LM3S and LM4F */
|
||||
|
||||
36
lib/sam/3n/Makefile
Normal file
36
lib/sam/3n/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
##
|
||||
## This file is part of the libopencm3 project.
|
||||
##
|
||||
## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
|
||||
##
|
||||
## This library is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU Lesser General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public License
|
||||
## along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
LIBNAME = libopencm3_sam3n
|
||||
|
||||
PREFIX ?= arm-none-eabi
|
||||
#PREFIX ?= arm-elf
|
||||
CC = $(PREFIX)-gcc
|
||||
AR = $(PREFIX)-ar
|
||||
CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
|
||||
-mcpu=cortex-m3 -mthumb -Wstrict-prototypes \
|
||||
-ffunction-sections -fdata-sections -MD -DSAM3N
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = gpio.o pmc.o usart.o
|
||||
|
||||
VPATH += ../../cm3:../common
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -23,14 +23,14 @@ PREFIX ?= arm-none-eabi
|
||||
#PREFIX ?= arm-elf
|
||||
CC = $(PREFIX)-gcc
|
||||
AR = $(PREFIX)-ar
|
||||
CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \
|
||||
CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
|
||||
-mcpu=cortex-m3 -mthumb -Wstrict-prototypes \
|
||||
-ffunction-sections -fdata-sections -MD -DSAM3X
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = gpio.o pmc.o usart.o
|
||||
|
||||
VPATH += ../usb:../cm3
|
||||
VPATH += ../../usb:../../cm3:../common
|
||||
|
||||
include ../Makefile.include
|
||||
include ../../Makefile.include
|
||||
|
||||
106
lib/sam/3x/libopencm3_sam3x.ld
Normal file
106
lib/sam/3x/libopencm3_sam3x.ld
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Generic linker script for STM32 targets using libopencm3. */
|
||||
|
||||
/* Memory regions must be defined in the ld script which includes this one. */
|
||||
|
||||
/* Enforce emmition of the vector table. */
|
||||
EXTERN (vector_table)
|
||||
|
||||
/* Define the entry point of the output file. */
|
||||
ENTRY(reset_handler)
|
||||
|
||||
/* Define sections. */
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
*(.vectors) /* Vector table */
|
||||
*(.text*) /* Program code */
|
||||
. = ALIGN(4);
|
||||
*(.rodata*) /* Read-only data */
|
||||
. = ALIGN(4);
|
||||
} >rom
|
||||
|
||||
/* C++ Static constructors/destructors, also used for __attribute__
|
||||
* ((constructor)) and the likes */
|
||||
.preinit_array : {
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
} >rom
|
||||
.init_array : {
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
} >rom
|
||||
.fini_array : {
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} >rom
|
||||
|
||||
/*
|
||||
* Another section used by C++ stuff, appears when using newlib with
|
||||
* 64bit (long long) printf support
|
||||
*/
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >rom
|
||||
.ARM.exidx : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >rom
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data*) /* Read-write initialized data */
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} >ram AT >rom
|
||||
_data_loadaddr = LOADADDR(.data);
|
||||
|
||||
.bss : {
|
||||
*(.bss*) /* Read-write zero initialized data */
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} >ram
|
||||
|
||||
/*
|
||||
* The .eh_frame section appears to be used for C++ exception handling.
|
||||
* You may need to fix this if you're using C++.
|
||||
*/
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
|
||||
. = ALIGN(4);
|
||||
end = .;
|
||||
}
|
||||
|
||||
PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/sam3x/gpio.h>
|
||||
#include <libopencm3/sam/gpio.h>
|
||||
|
||||
void gpio_init(u32 port, u32 pins, enum gpio_flags flags)
|
||||
{
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/sam3x/pmc.h>
|
||||
#include <libopencm3/sam3x/eefc.h>
|
||||
#include <libopencm3/sam/pmc.h>
|
||||
#include <libopencm3/sam/eefc.h>
|
||||
|
||||
/** Default peripheral clock frequency after reset. */
|
||||
u32 pmc_mck_frequency = 4000000;
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/sam3x/usart.h>
|
||||
#include <libopencm3/sam3x/pmc.h>
|
||||
#include <libopencm3/sam/usart.h>
|
||||
#include <libopencm3/sam/pmc.h>
|
||||
|
||||
void usart_set_baudrate(u32 usart, u32 baud)
|
||||
{
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2012 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/sam3x/pio.h>
|
||||
|
||||
void pio_toggle(u32 gpioport, u32 gpios)
|
||||
{
|
||||
u32 odsr = PIO_ODSR(gpioport);
|
||||
PIO_CODR(gpioport) = odsr & gpios;
|
||||
PIO_SODR(gpioport) = ~odsr & gpios;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user