diff --git a/Makefile b/Makefile index 0edf3f70..b66196c0 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ SRCLIBDIR:= $(subst $(space),\$(space),$(realpath lib)) TARGETS:= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/l1 lpc13xx lpc17xx \ lpc43xx/m4 lpc43xx/m0 lm3s lm4f \ efm32/efm32tg efm32/efm32g efm32/efm32lg efm32/efm32gg \ - sam/3a sam/3n sam/3s sam/3u sam/3x + sam/3a sam/3n sam/3s sam/3u sam/3x \ + vf6xx # Be silent per default, but 'make V=1' will show all compiler calls. ifneq ($(V),1) diff --git a/include/libopencm3/dispatch/nvic.h b/include/libopencm3/dispatch/nvic.h index a1f1751e..a4de8806 100644 --- a/include/libopencm3/dispatch/nvic.h +++ b/include/libopencm3/dispatch/nvic.h @@ -44,6 +44,9 @@ /* Yes, we use the same interrupt table for both LM3S and LM4F */ # include +#elif defined(VF6XX) +# include + #else # warning"no interrupts defined for chipset; NVIC_IRQ_COUNT = 0" diff --git a/include/libopencm3/vf6xx/irq.json b/include/libopencm3/vf6xx/irq.json new file mode 100644 index 00000000..d8d15573 --- /dev/null +++ b/include/libopencm3/vf6xx/irq.json @@ -0,0 +1,119 @@ +{ + "irqs": [ + "cpu2cpu_int0", + "cpu2cpu_int1", + "cpu2cpu_int2", + "cpu2cpu_int3", + "directed0_sema4", + "directed1_mcm", + "directed2", + "directed3", + "dma0", + "dma0_error", + "dma1", + "dma1_error", + "reserved0", + "reserved1", + "mscm_ecc0", + "mscm_ecc1", + "csu_alarm", + "reserved2", + "mscm_actzs", + "reserved3", + "wdog_a5", + "wdog_m4", + "wdog_snvs", + "cp1_boot_fail", + "qspi0", + "qspi1", + "ddrmc", + "sdhc0", + "sdhc1", + "reserved4", + "dcu0", + "dcu1", + "viu", + "reserved5", + "reserved6", + "rle", + "seg_lcd", + "reserved7", + "reserved8", + "pit", + "lptimer0", + "reserved9", + "flextimer0", + "flextimer1", + "flextimer2", + "flextimer3", + "reserved10", + "reserved11", + "reserved12", + "reserved13", + "usbphy0", + "usbphy1", + "reserved14", + "adc0", + "adc1", + "dac0", + "dac1", + "reserved15", + "flexcan0", + "flexcan1", + "reserved16", + "uart0", + "uart1", + "uart2", + "uart3", + "uart4", + "uart5", + "spi0", + "spi1", + "spi2", + "spi3", + "i2c0", + "i2c1", + "i2c2", + "i2c3", + "usbc0", + "usbc1", + "reserved17", + "enet0", + "enet1", + "enet0_1588", + "enet1_1588", + "enet_switch", + "nfc", + "sai0", + "sai1", + "sai2", + "sai3", + "esai_bififo", + "spdif", + "asrc", + "vreg", + "wkpu0", + "reserved18", + "ccm_fxosc", + "ccm", + "src", + "pdb", + "ewm", + "reserved19", + "reserved20", + "reserved21", + "reserved22", + "reserved23", + "reserved24", + "reserved25", + "reserved26", + "gpio0", + "gpio1", + "gpio2", + "gpio3", + "gpio4" + ], + "partname_humanreadable": "VF6xx series", + "partname_doxygen": "VF6XX", + "includeguard": "LIBOPENCM3_VF6XX_NVIC_H" +} diff --git a/lib/dispatch/vector_chipset.c b/lib/dispatch/vector_chipset.c index c491c2fd..6036e164 100644 --- a/lib/dispatch/vector_chipset.c +++ b/lib/dispatch/vector_chipset.c @@ -4,6 +4,8 @@ # include "../stm32/f4/vector_chipset.c" #elif defined(LPC43XX_M4) # include "../lpc43xx/m4/vector_chipset.c" +#elif defined(VF6XX) +# include "../vf6xx/vector_chipset.c" #else diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c index f5f47084..17f072b8 100644 --- a/lib/dispatch/vector_nvic.c +++ b/lib/dispatch/vector_nvic.c @@ -40,6 +40,9 @@ #elif defined(SAM3X) # include "../sam/3x/vector_nvic.c" +#elif defined(VF6XX) +# include "../vf6xx/vector_nvic.c" + #elif defined(LM3S) || defined(LM4F) /* Yes, we use the same interrupt table for both LM3S and LM4F */ # include "../lm3s/vector_nvic.c" diff --git a/lib/vf6xx/Makefile b/lib/vf6xx/Makefile new file mode 100644 index 00000000..e10758f6 --- /dev/null +++ b/lib/vf6xx/Makefile @@ -0,0 +1,40 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2009 Uwe Hermann +## Copyright (C) 2014 Stefan Agner +## +## 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 . +## + +LIBNAME = libopencm3_vf6xx +SRCLIBDIR ?= .. + +FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16 +PREFIX ?= arm-none-eabi + +CC = $(PREFIX)-gcc +AR = $(PREFIX)-ar +CFLAGS = -Os -g \ + -Wall -Wextra -Wimplicit-function-declaration \ + -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ + -Wundef -Wshadow \ + -I../../include -fno-common \ + -mcpu=cortex-m4 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ + -ffunction-sections -fdata-sections -MD -DVF6XX +ARFLAGS = rcs + +VPATH += ../cm3 + +include ../Makefile.include diff --git a/lib/vf6xx/libopencm3_vf6xx.ld b/lib/vf6xx/libopencm3_vf6xx.ld new file mode 100644 index 00000000..eb8201de --- /dev/null +++ b/lib/vf6xx/libopencm3_vf6xx.ld @@ -0,0 +1,109 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * Copyright (C) 2014 Stefan Agner + * + * 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 . + */ + +/* Generic linker script for VF6xx 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 */ + . = ALIGN(0x400); + *(.text.reset_handler) /* Force reset handler at start */ + *(.text*) /* Program code */ + . = ALIGN(4); + *(.rodata*) /* Read-only data */ + . = ALIGN(4); + } >pc_ram + + /* 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 = .; + } >pc_ram + .init_array : { + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + } >pc_ram + .fini_array : { + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + } >pc_ram + + /* + * Another section used by C++ stuff, appears when using newlib with + * 64bit (long long) printf support + */ + .ARM.extab : { + *(.ARM.extab*) + } >pc_ram + .ARM.exidx : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >pc_ram + + . = ALIGN(4); + _etext = .; + + .data : { + _data = .; + *(.data*) /* Read-write initialized data */ + . = ALIGN(4); + _edata = .; + } >ps_ram AT >pc_ram + _data_loadaddr = LOADADDR(.data); + + .bss : { + *(.bss*) /* Read-write zero initialized data */ + *(COMMON) + . = ALIGN(4); + _ebss = .; + } >ps_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(ps_ram) + LENGTH(ps_ram)); + diff --git a/lib/vf6xx/vector_chipset.c b/lib/vf6xx/vector_chipset.c new file mode 100644 index 00000000..c5e395c1 --- /dev/null +++ b/lib/vf6xx/vector_chipset.c @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2014 Stefan Agner + * + * 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 . + */ + +#include + +static inline void pre_main(void) +{ + /* + * For Vybrid we need to set the stack pointer manually + * since the boot ROM has its own stack + */ + asm ( \ + "ldr sp,=_stack;" \ + ); +}