diff --git a/.gitignore b/.gitignore index 6edc62fd..05b9c0c5 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ include/libopencmsis/lpc13xx/ include/libopencmsis/lpc17xx/ include/libopencmsis/lpc43xx/ include/libopencmsis/msp432/ +include/libopencmsis/pac55xx/ include/libopencmsis/sam/ include/libopencmsis/stm32/ include/libopencmsis/swm050/ diff --git a/Makefile b/Makefile index 29421a67..98f3d18d 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ TARGETS ?= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7 \ sam/3a sam/3n sam/3s sam/3u sam/3x sam/4l \ sam/d \ vf6xx \ - swm050 + swm050 \ + pac55xx # Be silent per default, but 'make V=1' will show all compiler calls. ifneq ($(V),1) diff --git a/README.md b/README.md index 33c952db..9b77b5d4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Currently (at least partly) supported microcontrollers: - TI (Tiva) LM4F series (continuing as TM4F, pin and peripheral compatible) - EFM32 Gecko series (only core support) - Freescale Vybrid VF6xx + - Qorvo (formerly ActiveSemi) PAC55XX The library is written completely from scratch based on the vendor datasheets, programming manuals, and application notes. The code is meant to be used diff --git a/doc/Makefile b/doc/Makefile index b35e2f2c..7695ebdc 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -15,7 +15,9 @@ TARGETS ?= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7 \ lpc13xx lpc17xx lpc43xx \ sam/3a sam/3n sam/3s sam/3u sam/3x \ vf6xx \ - swm050 + swm050 \ + pac55xx + TARGETS_DIRS = $(subst /,,$(TARGETS)) diff --git a/doc/pac55xx/doxy.custom b/doc/pac55xx/doxy.custom new file mode 100644 index 00000000..4789a761 --- /dev/null +++ b/doc/pac55xx/doxy.custom @@ -0,0 +1 @@ +PREDEFINED += __ARM_ARCH_7EM__ diff --git a/include/libopencm3/dispatch/nvic.h b/include/libopencm3/dispatch/nvic.h index b7e2810b..f2f65180 100644 --- a/include/libopencm3/dispatch/nvic.h +++ b/include/libopencm3/dispatch/nvic.h @@ -78,6 +78,9 @@ #elif defined(SWM050) # include +#elif defined(PAC55XX) +# include + #else # warning"no interrupts defined for chipset; NVIC_IRQ_COUNT = 0" diff --git a/include/libopencm3/pac55xx/irq.json b/include/libopencm3/pac55xx/irq.json new file mode 100644 index 00000000..a141d80a --- /dev/null +++ b/include/libopencm3/pac55xx/irq.json @@ -0,0 +1,38 @@ +{ + "irqs": [ + "memctl", + "wdt", + "rtc", + "adc0", + "adc1", + "adc2", + "adc3", + "timera", + "timerb", + "timerc", + "timerd", + "timera_qep", + "timerb_qep", + "timerc_qep", + "timerd_qep", + "gpioa", + "gpiob", + "gpioc", + "gpiod", + "gpioe", + "gpiof", + "gpiog", + "i2c", + "usarta", + "usartb", + "usartc", + "usartd", + "can", + "gptimera", + "gptimerb", + "scc" + ], + "partname_humanreadable": "PAC55XX Series", + "partname_doxygen": "PAC55XX", + "includeguard": "LIBOPENCM3_PAC55XX_H_" +} diff --git a/ld/devices.data b/ld/devices.data index 4b72d7d7..9db709e2 100644 --- a/ld/devices.data +++ b/ld/devices.data @@ -467,6 +467,15 @@ vf610 vf6xx RAM=256K RAM1=256K RAM_OFF=0x1f000000 RAM1_OFF=0x3f040000 swm050* END ROM=8K RAM=1K ROM_OFF=0x00000000 RAM_OFF=0x20000000 CPU=cortex-m0 FPU=soft +################################################################################ +# Qorvo PAC55xx Cortex-M4 based chips + +pac5523 pac55xx ROM=128K RAM=32K +pac5524 pac55xx ROM=128K RAM=32K +pac5527 pac55xx ROM=128K RAM=32K +pac5532 pac55xx ROM=128K RAM=32K +pac5556 pac55xx ROM=128K RAM=32K + ################################################################################ ################################################################################ ################################################################################ @@ -564,3 +573,8 @@ rm46l END ROM_OFF=0x00000000 RAM_OFF=0x08000000 RAM1_OFF=0x08400000 # VF6xx families vf6xx END CPU=cortex-m4 FPU=hard-fpv4-sp-d16 + +################################################################################ +# PAC55xx families + +pac55xx END ROM_OFF=0x00000000 RAM_OFF=0x20000000 CPU=cortex-m4 FPU=hard-fpv4-sp-d16 diff --git a/lib/dispatch/vector_chipset.c b/lib/dispatch/vector_chipset.c index 0ea09eac..552ec219 100644 --- a/lib/dispatch/vector_chipset.c +++ b/lib/dispatch/vector_chipset.c @@ -16,6 +16,8 @@ # include "../efm32/wg/vector_chipset.c" #elif defined(EZR32WG) # include "../efm32/ezr32wg/vector_chipset.c" +#elif defined(PAC55XX) +# include "../pac55xx/vector_chipset.c" #else static void pre_main(void) {} diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c index 0d4dd519..cf545b84 100644 --- a/lib/dispatch/vector_nvic.c +++ b/lib/dispatch/vector_nvic.c @@ -64,6 +64,10 @@ #elif defined(VF6XX) # include "../vf6xx/vector_nvic.c" +#elif defined(PAC55XX) +# include "../pac55xx/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/pac55xx/Makefile b/lib/pac55xx/Makefile new file mode 100644 index 00000000..8255c82d --- /dev/null +++ b/lib/pac55xx/Makefile @@ -0,0 +1,41 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2019 Brian Viele +## +## 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 . +## +## The PAC55xx by Qorvo (formerly ActiveSemi) is a Cortex-M4F based device +## which is specialized for motor control and PSC applications. + +LIBNAME = libopencm3_pac55xx +SRCLIBDIR ?= .. +FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16 +CC = $(PREFIX)gcc +AR = $(PREFIX)ar +TGT_CFLAGS = -Os \ + -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 -DPAC55XX +TGT_CFLAGS += $(DEBUG_FLAGS) +TGT_CFLAGS += $(STANDARD_FLAGS) +ARFLAGS = rcs + +VPATH += ../cm3 + + +include ../Makefile.include diff --git a/lib/pac55xx/vector_chipset.c b/lib/pac55xx/vector_chipset.c new file mode 100644 index 00000000..96293f1a --- /dev/null +++ b/lib/pac55xx/vector_chipset.c @@ -0,0 +1,25 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2019 Brian Viele + * + * 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 . + */ + +/* Standard Cortex-M4F initialization of FPU. */ +static void pre_main(void) +{ + /* Enable FPU */ + SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11); +}