diff --git a/Makefile b/Makefile index 75b157c5..85b56fbb 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ TARGETS := stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7 TARGETS += stm32/l0 stm32/l1 stm32/l4 TARGETS += lpc13xx lpc17xx lpc43xx/m4 lpc43xx/m0 TARGETS += lm3s lm4f -TARGETS += efm32/tg efm32/g efm32/lg efm32/gg +TARGETS += efm32/tg efm32/g efm32/lg efm32/gg efm32/hg TARGETS += sam/3a sam/3n sam/3s sam/3u sam/3x TARGETS += sam/d TARGETS += vf6xx diff --git a/doc/Makefile b/doc/Makefile index 721f34bc..483af768 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -5,7 +5,7 @@ ARCHS := stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 ARCHS += stm32l0 stm32l1 stm32l4 -ARCHS += efm32g efm32gg efm32lg efm32tg +ARCHS += efm32g efm32gg efm32hg efm32lg efm32tg ARCHS += lm3s lm4f ARCHS += lpc13xx lpc17xx lpc43xx ARCHS += sam3a sam3n sam3s sam3u sam3x @@ -35,6 +35,7 @@ rebuildsources: ../scripts/gendoxylist ../lib/stm32/l4 stm32l4 ../scripts/gendoxylist ../lib/efm32/g efm32g ../scripts/gendoxylist ../lib/efm32/gg efm32gg + ../scripts/gendoxylist ../lib/efm32/hg efm32hg ../scripts/gendoxylist ../lib/efm32/lg efm32lg ../scripts/gendoxylist ../lib/efm32/tg efm32tg ../scripts/gendoxylist ../lib/lm3s lm3s diff --git a/include/libopencm3/dispatch/nvic.h b/include/libopencm3/dispatch/nvic.h index 1c705f83..b664c1b1 100644 --- a/include/libopencm3/dispatch/nvic.h +++ b/include/libopencm3/dispatch/nvic.h @@ -29,6 +29,8 @@ # include #elif defined(EFM32GG) # include +#elif defined(EFM32HG) +# include #elif defined(LPC13XX) # include diff --git a/include/libopencm3/efm32/hg/doc-efm32hg.h b/include/libopencm3/efm32/hg/doc-efm32hg.h new file mode 100644 index 00000000..c7f13c3b --- /dev/null +++ b/include/libopencm3/efm32/hg/doc-efm32hg.h @@ -0,0 +1,32 @@ +/** @mainpage libopencm3 EFM32 Happy Gecko + +@version 1.0.0 + +@date 28 January 2018 + +API documentation for Energy Micro EFM32 Happy Gecko Cortex M0+ series. + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup EFM32LG EFM32 HappyGecko +Libraries for Energy Micro EFM32 Happy Gecko series. + +@version 1.0.0 + +@date 28 January 2018 + +LGPL License Terms @ref lgpl_license +*/ + +/** @defgroup EFM32HG_defines EFM32 Happy Gecko Defines + +@brief Defined Constants and Types for the Energy Micro EFM32 Happy Gecko +series + +@version 1.0.0 + +@date 28 January 2018 + +LGPL License Terms @ref lgpl_license +*/ diff --git a/include/libopencm3/efm32/hg/irq.json b/include/libopencm3/efm32/hg/irq.json new file mode 100644 index 00000000..fd89046a --- /dev/null +++ b/include/libopencm3/efm32/hg/irq.json @@ -0,0 +1,29 @@ +{ + "_source": "The names and sequence are taken from EFM32HG-RM.pdf table 4.1.", + "irqs": [ + "dma", + "gpio_even", + "timer0", + "acmp0", + "adc0", + "i2c0", + "gpio_odd", + "timer1", + "usart1_rx", + "usart1_tx", + "leuart0", + "pcnt0", + "rtc", + "cmu", + "vcmp", + "msc", + "aes", + "usart0_rx", + "usart0_tx", + "usb", + "timer2" + ], + "partname_humanreadable": "EFM32 Happy Gecko series", + "partname_doxygen": "EFM32HG", + "includeguard": "LIBOPENCM3_EFM32HG_NVIC_H" +} diff --git a/ld/devices.data b/ld/devices.data index 38bd3134..0be3f386 100644 --- a/ld/devices.data +++ b/ld/devices.data @@ -287,6 +287,9 @@ efm32zg???f8 efm32zg ROM=8K RAM=2K efm32zg???f16 efm32zg ROM=16K RAM=4K efm32zg???f32 efm32zg ROM=32K RAM=4K +# Happy Gecko +efm32hg???f64 efm32hg ROM=64K RAM=8K + # Tiny Gecko efm32tg108f4 efm32tg ROM=4K RAM=1K efm32tg110f4 efm32tg ROM=4K RAM=2K @@ -448,6 +451,7 @@ lpc43xx END CPU=cortex-m4 FPU=hard-fpv4-sp-d16 # the efm32 Gecko families efm32zg END ROM_OFF=0x00000000 RAM_OFF=0x20000000 RAM1_OFF=0x10000000 CPU=cortex-m0plus FPU=soft +efm32hg END ROM_OFF=0x00000000 RAM_OFF=0x20000000 RAM1_OFF=0x10000000 CPU=cortex-m0plus FPU=soft efm32tg END ROM_OFF=0x00000000 RAM_OFF=0x20000000 RAM1_OFF=0x10000000 CPU=cortex-m3 FPU=soft efm32g END ROM_OFF=0x00000000 RAM_OFF=0x20000000 RAM1_OFF=0x10000000 CPU=cortex-m3 FPU=soft efm32lg END ROM_OFF=0x00000000 RAM_OFF=0x20000000 RAM1_OFF=0x10000000 CPU=cortex-m3 FPU=soft diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c index 167ad872..22d5a82f 100644 --- a/lib/dispatch/vector_nvic.c +++ b/lib/dispatch/vector_nvic.c @@ -25,6 +25,8 @@ # include "../efm32/lg/vector_nvic.c" #elif defined(EFM32GG) # include "../efm32/gg/vector_nvic.c" +#elif defined(EFM32HG) +# include "../efm32/hg/vector_nvic.c" #elif defined(LPC13XX) # include "../lpc13xx/vector_nvic.c" diff --git a/lib/efm32/hg/Makefile b/lib/efm32/hg/Makefile new file mode 100644 index 00000000..155ad20a --- /dev/null +++ b/lib/efm32/hg/Makefile @@ -0,0 +1,47 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2009 Uwe Hermann +## Copyright (C) 2012 chrysn +## Copyright (C) 2015 Kuldeep Singh Dhaka +## Copyright (C) 2018 Seb Holzapfel +## +## 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_efm32hg +SRCLIBDIR ?= ../.. +FAMILY = EFM32HG + +PREFIX ?= arm-none-eabi +#PREFIX ?= arm-elf +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-m0plus $(FP_FLAGS) -mthumb -Wstrict-prototypes \ + -ffunction-sections -fdata-sections -MD -D$(FAMILY) +TGT_CFLAGS += $(DEBUG_FLAGS) +TGT_CFLAGS += $(STANDARD_FLAGS) + +ARFLAGS = rcs + +OBJS = + +VPATH += ../../usb:../:../../cm3: + +include ../../Makefile.include diff --git a/lib/efm32/hg/libopencm3_efm32hg.ld b/lib/efm32/hg/libopencm3_efm32hg.ld new file mode 100644 index 00000000..ed9b616f --- /dev/null +++ b/lib/efm32/hg/libopencm3_efm32hg.ld @@ -0,0 +1,105 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * + * 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 EFM32 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));