diff options
Diffstat (limited to 'libopencm3/lib/lpc17xx')
| -rw-r--r-- | libopencm3/lib/lpc17xx/Makefile | 40 | ||||
| -rw-r--r-- | libopencm3/lib/lpc17xx/gpio.c | 48 | ||||
| -rw-r--r-- | libopencm3/lib/lpc17xx/libopencm3_lpc17xx.ld | 106 | 
3 files changed, 194 insertions, 0 deletions
diff --git a/libopencm3/lib/lpc17xx/Makefile b/libopencm3/lib/lpc17xx/Makefile new file mode 100644 index 0000000..4b49df4 --- /dev/null +++ b/libopencm3/lib/lpc17xx/Makefile @@ -0,0 +1,40 @@ +## +## 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_lpc17xx +SRCLIBDIR	?= .. + +PREFIX		?= arm-none-eabi + +CC		= $(PREFIX)-gcc +AR		= $(PREFIX)-ar +CFLAGS		= -O0 -g \ +		  -Wall -Wextra -Wimplicit-function-declaration \ +		  -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ +		  -Wundef -Wshadow \ +		  -I../../include -fno-common \ +		  -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ +		  -ffunction-sections -fdata-sections -MD -DLPC17XX +# ARFLAGS	= rcsv +ARFLAGS		= rcs +OBJS		= gpio.o + +VPATH += ../cm3 + +include ../Makefile.include diff --git a/libopencm3/lib/lpc17xx/gpio.c b/libopencm3/lib/lpc17xx/gpio.c new file mode 100644 index 0000000..4831af7 --- /dev/null +++ b/libopencm3/lib/lpc17xx/gpio.c @@ -0,0 +1,48 @@ +/** @defgroup gpio_file GPIO + +@ingroup LPC17xx + +@brief <b>libopencm3 LPC17xx General Purpose I/O</b> + +@version 1.0.0 + +@author @htmlonly © @endhtmlonly 2009 Uwe Hermann <uwe@hermann-uwe.de> + +LGPL License Terms @ref lgpl_license +*/ + +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2010 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/>. + */ + +/**@{*/ + +#include <libopencm3/lpc17xx/gpio.h> + +void gpio_set(uint32_t gpioport, uint32_t gpios) +{ +	GPIO_SET(gpioport) = gpios; +} + +void gpio_clear(uint32_t gpioport, uint32_t gpios) +{ +	GPIO_CLR(gpioport) = gpios; +} + +/**@}*/ + diff --git a/libopencm3/lib/lpc17xx/libopencm3_lpc17xx.ld b/libopencm3/lib/lpc17xx/libopencm3_lpc17xx.ld new file mode 100644 index 0000000..bd0005c --- /dev/null +++ b/libopencm3/lib/lpc17xx/libopencm3_lpc17xx.ld @@ -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 LPC13XX 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)); +  | 
