initial commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
SUBDIRS:=$(dir $(wildcard */Makefile))
|
||||
|
||||
all subdirs:
|
||||
@for i in ${SUBDIRS}; do \
|
||||
$(MAKE) -C $${i} || exit $$? ;\
|
||||
done
|
||||
clean:
|
||||
@for i in ${SUBDIRS}; do \
|
||||
$(MAKE) -C $${i} $@ || exit $$? ;\
|
||||
done
|
||||
|
||||
.PHONY: $(SUBDIRS) all subdirs clean
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for compiling
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
# Include rules specific to this board
|
||||
-include ../../board-defs.mk
|
||||
-include example-defs.mk
|
||||
|
||||
# All makefiles use this to find the top level directory.
|
||||
SWROOT?=../../../..
|
||||
|
||||
# Include rules for building generic examples.
|
||||
include $(SWROOT)/makedefs/example.mk
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Name:
|
||||
=====
|
||||
binary_counter
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
Example that displays the timer count on the LEDs.
|
||||
|
||||
|
||||
This example increments a variable on every timer interrupt. The global
|
||||
variable is used to set the state of the LEDs. The example sleeps otherwise.
|
||||
|
||||
SWO is configured in 1M baud, 8-n-1 mode.
|
||||
|
||||
|
||||
******************************************************************************
|
||||
|
||||
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := binary_counter
|
||||
COMPILERNAME := gcc
|
||||
PROJECT := binary_counter_gcc
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Setup ####
|
||||
|
||||
TOOLCHAIN ?= arm-none-eabi
|
||||
PART = apollo2
|
||||
CPU = cortex-m4
|
||||
FPU = fpv4-sp-d16
|
||||
#FABI = softfp
|
||||
FABI = hard
|
||||
|
||||
LINKER_FILE := ./binary_counter.ld
|
||||
STARTUP_FILE := ./startup_$(COMPILERNAME).c
|
||||
|
||||
#### Required Executables ####
|
||||
CC = $(TOOLCHAIN)-gcc
|
||||
GCC = $(TOOLCHAIN)-gcc
|
||||
CPP = $(TOOLCHAIN)-cpp
|
||||
LD = $(TOOLCHAIN)-ld
|
||||
CP = $(TOOLCHAIN)-objcopy
|
||||
OD = $(TOOLCHAIN)-objdump
|
||||
RD = $(TOOLCHAIN)-readelf
|
||||
AR = $(TOOLCHAIN)-ar
|
||||
SIZE = $(TOOLCHAIN)-size
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
EXECUTABLES = CC LD CP OD AR RD SIZE GCC
|
||||
K := $(foreach exec,$(EXECUTABLES),\
|
||||
$(if $(shell which $($(exec)) 2>/dev/null),,\
|
||||
$(info $(exec) not found on PATH ($($(exec))).)$(exec)))
|
||||
$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
|
||||
|
||||
ifneq ($(strip $(value K)),)
|
||||
all clean:
|
||||
$(info Tools $(TOOLCHAIN)-$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
DEFINES = -DPART_$(PART)
|
||||
DEFINES+= -DAM_PART_APOLLO2
|
||||
DEFINES+= -DAM_PACKAGE_BGA
|
||||
DEFINES+= -Dgcc
|
||||
|
||||
INCLUDES = -I../src
|
||||
INCLUDES+= -I../../../../../utils
|
||||
INCLUDES+= -I../../../../../mcu/apollo2
|
||||
INCLUDES+= -I../../../bsp
|
||||
INCLUDES+= -I../../../../../devices
|
||||
INCLUDES+= -I../../../../..
|
||||
|
||||
VPATH = ../src
|
||||
VPATH+=:../../../../../utils
|
||||
VPATH+=:../../../../../devices
|
||||
|
||||
SRC = binary_counter.c
|
||||
SRC += am_util_delay.c
|
||||
SRC += am_util_faultisr.c
|
||||
SRC += am_util_stdio.c
|
||||
SRC += am_devices_led.c
|
||||
SRC += startup_gcc.c
|
||||
|
||||
CSRC = $(filter %.c,$(SRC))
|
||||
ASRC = $(filter %.s,$(SRC))
|
||||
|
||||
OBJS = $(CSRC:%.c=$(CONFIG)/%.o)
|
||||
OBJS+= $(ASRC:%.s=$(CONFIG)/%.o)
|
||||
|
||||
DEPS = $(CSRC:%.c=$(CONFIG)/%.d)
|
||||
DEPS+= $(ASRC:%.s=$(CONFIG)/%.d)
|
||||
|
||||
LIBS = ../../../bsp/gcc/bin/libam_bsp.a
|
||||
LIBS += ../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a
|
||||
|
||||
CFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
CFLAGS+= -ffunction-sections -fdata-sections -fomit-frame-pointer
|
||||
CFLAGS+= -MMD -MP -std=c99 -Wall -g
|
||||
CFLAGS+= -O0
|
||||
CFLAGS+= $(DEFINES)
|
||||
CFLAGS+= $(INCLUDES)
|
||||
CFLAGS+=
|
||||
|
||||
LFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
LFLAGS+= -nostartfiles -static
|
||||
LFLAGS+= -Wl,--gc-sections,--entry,am_reset_isr,-Map,$(CONFIG)/$(TARGET).map
|
||||
LFLAGS+= -Wl,--start-group -lm -lc -lgcc $(LIBS) -Wl,--end-group
|
||||
LFLAGS+=
|
||||
|
||||
# Additional user specified CFLAGS
|
||||
CFLAGS+=$(EXTRA_CFLAGS)
|
||||
|
||||
CPFLAGS = -Obinary
|
||||
|
||||
ODFLAGS = -S
|
||||
|
||||
#### Rules ####
|
||||
all: directories $(CONFIG)/$(TARGET).bin
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
$(CONFIG)/%.o: %.c $(CONFIG)/%.d
|
||||
@echo " Compiling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/%.o: %.s $(CONFIG)/%.d
|
||||
@echo " Assembling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/$(TARGET).axf: $(OBJS) $(LIBS)
|
||||
@echo " Linking $(COMPILERNAME) $@" ;\
|
||||
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
|
||||
|
||||
$(CONFIG)/$(TARGET).bin: $(CONFIG)/$(TARGET).axf
|
||||
@echo " Copying $(COMPILERNAME) $@..." ;\
|
||||
$(CP) $(CPFLAGS) $< $@ ;\
|
||||
$(OD) $(ODFLAGS) $< > $(CONFIG)/$(TARGET).lst
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..." ;\
|
||||
$(RM) -f $(OBJS) $(DEPS) \
|
||||
$(CONFIG)/$(TARGET).bin $(CONFIG)/$(TARGET).axf \
|
||||
$(CONFIG)/$(TARGET).lst $(CONFIG)/$(TARGET).map
|
||||
|
||||
$(CONFIG)/%.d: ;
|
||||
|
||||
../../../bsp/gcc/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
# Automatically include any generated dependencies
|
||||
-include $(DEPS)
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* binary_counter.ld - Linker script for applications using startup_gnu.c
|
||||
*
|
||||
*****************************************************************************/
|
||||
ENTRY(am_reset_isr)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text)
|
||||
*(.text*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > FLASH
|
||||
|
||||
/* User stack section initialized by startup code. */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack)
|
||||
*(.stack*)
|
||||
. = ALIGN(8);
|
||||
} > SRAM
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
*(.data)
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} > SRAM AT>FLASH
|
||||
|
||||
/* used by startup to initialize data */
|
||||
_init_data = LOADADDR(.data);
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} > SRAM
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_gcc.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of interrupt handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void am_reset_isr(void) __attribute ((naked));
|
||||
extern void am_nmi_isr(void) __attribute ((weak));
|
||||
extern void am_fault_isr(void) __attribute ((weak));
|
||||
extern void am_mpufault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_busfault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_usagefault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_svcall_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_debugmon_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pendsv_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_systick_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_brownout_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_watchdog_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_clkgen_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_vcomp_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_ios_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_acc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_gpio_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ctimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_adc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pdm0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr6_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr7_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_flash_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_default_isr(void) __attribute ((weak));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int main(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".stack")))
|
||||
static uint32_t g_pui32Stack[1024];
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_am_pfnVectors[])(void) =
|
||||
{
|
||||
(void (*)(void))((uint32_t)g_pui32Stack + sizeof(g_pui32Stack)),
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART
|
||||
am_uart1_isr, // 15: UART
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: SYSTEM TIMER
|
||||
am_stimer_cmpr0_isr, // 19: SYSTEM TIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: SYSTEM TIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: SYSTEM TIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: SYSTEM TIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: SYSTEM TIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: SYSTEM TIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: SYSTEM TIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: SYSTEM TIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are constructs created by the linker, indicating where the
|
||||
// the "data" and "bss" segments reside in memory. The initializers for the
|
||||
// "data" segment resides immediately following the "text" segment.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t _etext;
|
||||
extern uint32_t _sdata;
|
||||
extern uint32_t _edata;
|
||||
extern uint32_t _sbss;
|
||||
extern uint32_t _ebss;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined(__GNUC_STDC_INLINE__)
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Set the vector table pointer.
|
||||
//
|
||||
__asm(" ldr r0, =0xE000ED08\n"
|
||||
" ldr r1, =g_am_pfnVectors\n"
|
||||
" str r1, [r0]");
|
||||
|
||||
//
|
||||
// Set the stack pointer.
|
||||
//
|
||||
__asm(" ldr sp, [r1]");
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the FPU.
|
||||
//
|
||||
__asm("ldr r0, =0xE000ED88\n"
|
||||
"ldr r1,[r0]\n"
|
||||
"orr r1,#(0xF << 20)\n"
|
||||
"str r1,[r0]\n"
|
||||
"dsb\n"
|
||||
"isb\n");
|
||||
#endif
|
||||
//
|
||||
// Copy the data segment initializers from flash to SRAM.
|
||||
//
|
||||
__asm(" ldr r0, =_init_data\n"
|
||||
" ldr r1, =_sdata\n"
|
||||
" ldr r2, =_edata\n"
|
||||
"copy_loop:\n"
|
||||
" ldr r3, [r0], #4\n"
|
||||
" str r3, [r1], #4\n"
|
||||
" cmp r1, r2\n"
|
||||
" blt copy_loop\n");
|
||||
//
|
||||
// Zero fill the bss segment.
|
||||
//
|
||||
__asm(" ldr r0, =_sbss\n"
|
||||
" ldr r1, =_ebss\n"
|
||||
" mov r2, #0\n"
|
||||
"zero_loop:\n"
|
||||
" cmp r0, r1\n"
|
||||
" it lt\n"
|
||||
" strlt r2, [r0], #4\n"
|
||||
" blt zero_loop");
|
||||
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
main();
|
||||
|
||||
//
|
||||
// If main returns then execute a break point instruction
|
||||
//
|
||||
__asm(" bkpt ");
|
||||
}
|
||||
#else
|
||||
#error GNU STDC inline not supported.
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := binary_counter
|
||||
COMPILERNAME := iar
|
||||
PROJECT := binary_counter_iar
|
||||
CONFIG := bin
|
||||
AM_SoftwareRoot ?= ../../../..
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p IarBuild.exe)
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
IarBuild.exe binary_counter.ewp -make Debug -log info
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
IarBuild.exe binary_counter.ewp -clean Debug -log all
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/iar/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/iar/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+3232
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+2810
File diff suppressed because it is too large
Load Diff
+2064
File diff suppressed because it is too large
Load Diff
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\binary_counter.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
// binary_counter.icf
|
||||
//
|
||||
// IAR linker Configuration File
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Define a memory section that covers the entire 4 GB addressable space of the
|
||||
// processor. (32-bit can address up to 4GB)
|
||||
//
|
||||
define memory mem with size = 4G;
|
||||
|
||||
//
|
||||
// Define a region for the flash.
|
||||
//
|
||||
define region FLASH = mem:[from 0x00000000 to 0x00100000];
|
||||
|
||||
//
|
||||
// Define a region for the SRAM.
|
||||
//
|
||||
define region SRAM = mem:[from 0x10000000 to 0x10040000];
|
||||
|
||||
//
|
||||
// Define a block for the heap.
|
||||
//
|
||||
define block HEAP with alignment = 0x8, size = 0x00000000 { };
|
||||
|
||||
//
|
||||
// Define a block for the stack.
|
||||
//
|
||||
define block CSTACK with alignment = 0x8, size = 1024 { };
|
||||
|
||||
//
|
||||
// Read/Write values should be initialized by copying from flash.
|
||||
//
|
||||
initialize by copy { readwrite };
|
||||
|
||||
//
|
||||
// Indicate that the noinit values should be left alone.
|
||||
//
|
||||
do not initialize { section .noinit };
|
||||
|
||||
//
|
||||
// Place the interrupt vectors at the start of flash.
|
||||
//
|
||||
place at start of FLASH { readonly section .intvec };
|
||||
|
||||
//
|
||||
// Place the remainder of the read-only items into flash.
|
||||
//
|
||||
place in FLASH { readonly };
|
||||
|
||||
//
|
||||
// Place the stack at the start of SRAM.
|
||||
//
|
||||
place at start of SRAM { block CSTACK, section .noinit };
|
||||
|
||||
//
|
||||
// Place all read/write items into SRAM.
|
||||
//
|
||||
place in SRAM { block HEAP, readwrite };
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_iar.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable the IAR extensions for this source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma language = extended
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Weak function links.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma weak am_mpufault_isr = am_fault_isr
|
||||
#pragma weak am_busfault_isr = am_fault_isr
|
||||
#pragma weak am_usagefault_isr = am_fault_isr
|
||||
#pragma weak am_svcall_isr = am_default_isr
|
||||
#pragma weak am_debugmon_isr = am_default_isr
|
||||
#pragma weak am_pendsv_isr = am_default_isr
|
||||
#pragma weak am_systick_isr = am_default_isr
|
||||
#pragma weak am_brownout_isr = am_default_isr
|
||||
#pragma weak am_watchdog_isr = am_default_isr
|
||||
#pragma weak am_clkgen_isr = am_default_isr
|
||||
#pragma weak am_vcomp_isr = am_default_isr
|
||||
#pragma weak am_ioslave_ios_isr = am_default_isr
|
||||
#pragma weak am_ioslave_acc_isr = am_default_isr
|
||||
#pragma weak am_iomaster0_isr = am_default_isr
|
||||
#pragma weak am_iomaster1_isr = am_default_isr
|
||||
#pragma weak am_iomaster2_isr = am_default_isr
|
||||
#pragma weak am_iomaster3_isr = am_default_isr
|
||||
#pragma weak am_iomaster4_isr = am_default_isr
|
||||
#pragma weak am_iomaster5_isr = am_default_isr
|
||||
#pragma weak am_gpio_isr = am_default_isr
|
||||
#pragma weak am_ctimer_isr = am_default_isr
|
||||
#pragma weak am_uart_isr = am_default_isr
|
||||
#pragma weak am_uart1_isr = am_default_isr
|
||||
#pragma weak am_adc_isr = am_default_isr
|
||||
#pragma weak am_pdm0_isr = am_default_isr
|
||||
#pragma weak am_stimer_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr0_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr1_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr2_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr3_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr4_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr5_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr6_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr7_isr = am_default_isr
|
||||
#pragma weak am_flash_isr = am_default_isr
|
||||
#pragma weak am_software0_isr = am_default_isr
|
||||
#pragma weak am_software1_isr = am_default_isr
|
||||
#pragma weak am_software2_isr = am_default_isr
|
||||
#pragma weak am_software3_isr = am_default_isr
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the default fault handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __stackless void am_reset_isr(void);
|
||||
extern __weak void am_nmi_isr(void);
|
||||
extern __weak void am_fault_isr(void);
|
||||
extern void am_mpufault_isr(void);
|
||||
extern void am_busfault_isr(void);
|
||||
extern void am_usagefault_isr(void);
|
||||
extern void am_svcall_isr(void);
|
||||
extern void am_debugmon_isr(void);
|
||||
extern void am_pendsv_isr(void);
|
||||
extern void am_systick_isr(void);
|
||||
extern void am_brownout_isr(void);
|
||||
extern void am_watchdog_isr(void);
|
||||
extern void am_clkgen_isr(void);
|
||||
extern void am_vcomp_isr(void);
|
||||
extern void am_ioslave_ios_isr(void);
|
||||
extern void am_ioslave_acc_isr(void);
|
||||
extern void am_iomaster0_isr(void);
|
||||
extern void am_iomaster1_isr(void);
|
||||
extern void am_iomaster2_isr(void);
|
||||
extern void am_iomaster3_isr(void);
|
||||
extern void am_iomaster4_isr(void);
|
||||
extern void am_iomaster5_isr(void);
|
||||
extern void am_gpio_isr(void);
|
||||
extern void am_ctimer_isr(void);
|
||||
extern void am_uart_isr(void);
|
||||
extern void am_uart1_isr(void);
|
||||
extern void am_adc_isr(void);
|
||||
extern void am_pdm0_isr(void);
|
||||
extern void am_stimer_isr(void);
|
||||
extern void am_stimer_cmpr0_isr(void);
|
||||
extern void am_stimer_cmpr1_isr(void);
|
||||
extern void am_stimer_cmpr2_isr(void);
|
||||
extern void am_stimer_cmpr3_isr(void);
|
||||
extern void am_stimer_cmpr4_isr(void);
|
||||
extern void am_stimer_cmpr5_isr(void);
|
||||
extern void am_stimer_cmpr6_isr(void);
|
||||
extern void am_stimer_cmpr7_isr(void);
|
||||
extern void am_flash_isr(void);
|
||||
extern void am_software0_isr(void);
|
||||
extern void am_software1_isr(void);
|
||||
extern void am_software2_isr(void);
|
||||
extern void am_software3_isr(void);
|
||||
|
||||
extern void am_default_isr(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application startup code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void __iar_program_start(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t pui32Stack[1024] @ ".noinit";
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// A union that describes the entries of the vector table. The union is needed
|
||||
// since the first entry is the stack pointer and the remainder are function
|
||||
// pointers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef union
|
||||
{
|
||||
void (*pfnHandler)(void);
|
||||
uint32_t ui32Ptr;
|
||||
}
|
||||
uVectorEntry;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__root const uVectorEntry __vector_table[] @ ".intvec" =
|
||||
{
|
||||
{ .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) },
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART0
|
||||
am_uart1_isr, // 15: UART1
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: STIMER
|
||||
am_stimer_cmpr0_isr, // 19: STIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: STIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: STIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: STIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: STIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: STIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: STIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: STIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Note - The template for this function is originally found in IAR's module,
|
||||
// low_level_init.c. As supplied by IAR, it is an empty function.
|
||||
//
|
||||
// This module contains the function `__low_level_init', a function
|
||||
// that is called before the `main' function of the program. Normally
|
||||
// low-level initializations - such as setting the prefered interrupt
|
||||
// level or setting the watchdog - can be performed here.
|
||||
//
|
||||
// Note that this function is called before the data segments are
|
||||
// initialized, this means that this function cannot rely on the
|
||||
// values of global or static variables.
|
||||
//
|
||||
// When this function returns zero, the startup code will inhibit the
|
||||
// initialization of the data segments. The result is faster startup,
|
||||
// the drawback is that neither global nor static data will be
|
||||
// initialized.
|
||||
//
|
||||
// Copyright 1999-2017 IAR Systems AB.
|
||||
//
|
||||
// $Revision: 112610 $
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AM_REGVAL(x) (*((volatile uint32_t *)(x)))
|
||||
#define VTOR_ADDR 0xE000ED08
|
||||
|
||||
__interwork int __low_level_init(void)
|
||||
{
|
||||
|
||||
AM_REGVAL(VTOR_ADDR) = (uint32_t)&__vector_table;
|
||||
|
||||
/*==================================*/
|
||||
/* Choose if segment initialization */
|
||||
/* should be done or not. */
|
||||
/* Return: 0 to omit seg_init */
|
||||
/* 1 to run seg_init */
|
||||
/*==================================*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
__iar_program_start();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Name: Dbg_RAM.ini
|
||||
* Purpose: RAM Debug Initialization File
|
||||
* Note(s):
|
||||
*----------------------------------------------------------------------------
|
||||
* This file is part of the uVision/ARM development tools.
|
||||
* This software may only be used under the terms of a valid, current,
|
||||
* end user licence from KEIL for a compatible version of KEIL software
|
||||
* development tools. Nothing else gives you the right to use this software.
|
||||
*
|
||||
* This software is supplied "AS IS" without warranties of any kind.
|
||||
*
|
||||
* Copyright (c) 2008-2013 Keil - An ARM Company. All rights reserved.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
TraceSetup() Turn on ITM clocks, etc.
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void TraceSetup (void)
|
||||
{
|
||||
// turn on the ITM/TPIU clock
|
||||
_WDWORD(0x40020250, 0x00000201); // TPIU clock enabled at 3MHz
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Setup() configure PC & SP for RAM Debug
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void Setup (void) {
|
||||
SP = _RDWORD(0x00000000+0x0); // Setup Stack Pointer
|
||||
PC = _RDWORD(0x00000000+0x4); // Setup Program Counter
|
||||
_WDWORD(0xE000ED08, 0x00000000+0x0); // Setup Vector Table Offset Register (done in system file)
|
||||
}
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL // load the application
|
||||
|
||||
|
||||
// Executed after reset via uVision's 'Reset'-button
|
||||
FUNC void OnResetExec (void)
|
||||
{
|
||||
//Set_ui32HALflags();
|
||||
//TraceSetup();
|
||||
}
|
||||
|
||||
FUNC void Set_ui32HALflags (void)
|
||||
{
|
||||
TraceSetup();
|
||||
//g_ui32HALflags = 0x00000001;
|
||||
_break_ = 1;
|
||||
}
|
||||
|
||||
Setup(); // Setup for Running
|
||||
BS main, 1, "Set_ui32HALflags()";
|
||||
|
||||
g
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 1
|
||||
Device="AMAPH1KK-KBR"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := binary_counter
|
||||
COMPILERNAME := Keil
|
||||
PROJECT := binary_counter_Keil
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p UV4.exe)
|
||||
RM := $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
UV4.exe -b -t "binary_counter" binary_counter.uvprojx -j0 || [ $$? -eq 1 ]
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
$(RM) -rf $(CONFIG)
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/keil/bin/libam_bsp.lib:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
|
||||
+4179
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; binary_counter.sct
|
||||
;
|
||||
; Scatter file for Keil linker configuration.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
LR_1 0x00000000
|
||||
{
|
||||
FLASH 0x00000000 0x00100000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
SRAM 0x10000000 0x00040000
|
||||
{
|
||||
* (+RW, +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>binary_counter</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>48000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>255</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>0</tLdApp>
|
||||
<tGomain>0</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<nTsel>3</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile>.\Dbg_RAM.ini</tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGUARM</Key>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>ARMRTXEVENTFLAGS</Key>
|
||||
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGTARM</Key>
|
||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>ARMDBGFLAGS</Key>
|
||||
<Name></Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>JL2CM3</Key>
|
||||
<Name>-U483027775 -O2510 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS2 -TDT0 -TDC1F -TIE1 -TIP0 -TB1 -TFE0 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo2.FLM -FS00 -FL0100000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DbgCM</Key>
|
||||
<Name>-U-O206 -O206 -S2 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS2 -TDT0 -TDC1F -TIE1 -TIP8 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo -FS00 -FL080000</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-UV0264NGE -O2510 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS8002 -TDT0 -TDC1F -TIE1 -TIP8 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo2.FLM -FS00 -FL0100000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>1</periodic>
|
||||
<aLwin>1</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>1</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>1</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<Lin2Executable></Lin2Executable>
|
||||
<Lin2ConfigFile></Lin2ConfigFile>
|
||||
<bLin2Auto>0</bLin2Auto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<bAuto2GenD>0</bAuto2GenD>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>src</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../src/binary_counter.c</PathWithFileName>
|
||||
<FilenameWithoutPath>binary_counter.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>utils</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../../../../../utils/am_util_delay.c</PathWithFileName>
|
||||
<FilenameWithoutPath>am_util_delay.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../../../../../utils/am_util_faultisr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>am_util_faultisr.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../../../../../utils/am_util_stdio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>am_util_stdio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>devices</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../../../../../devices/am_devices_led.c</PathWithFileName>
|
||||
<FilenameWithoutPath>am_devices_led.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>keil</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../keil/startup_keil.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_keil.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
||||
|
||||
+449
@@ -0,0 +1,449 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>binary_counter</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pArmCC></pArmCC>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>AMAPH1KK-KBR</Device>
|
||||
<Vendor>Ambiq Micro</Vendor>
|
||||
<PackID>AmbiqMicro.Apollo_DFP.1.0.0</PackID>
|
||||
<PackURL>http://s3.asia.ambiqmicro.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x10000000,0x40000) IROM(0x00000000,0x100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD10000000 -FC4000 -FN1 -FF0Apollo2 -FS00 -FL010000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM))</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile></RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:AMAPH1KK-KBR$SVD\apollo2.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath>1024 BGA$Device\Include\Apollo2.h\</RegisterFilePath>
|
||||
<DBRegisterFilePath>1024 BGA$Device\Include\Apollo2.h\</DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\bin\</OutputDirectory>
|
||||
<OutputName>binary_counter</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>1</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output bin\binary_counter.bin bin\binary_counter.axf</UserProg1Name>
|
||||
<UserProg2Name>fromelf -cedrst --output bin\binary_counter.txt bin\binary_counter.axf</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> -MPU</SimDllArguments>
|
||||
<SimDlgDll>DCM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3></Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M4"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x10000000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x100000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x100000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x10000000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>1</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>2</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>AM_PART_APOLLO2 AM_PACKAGE_BGA keil</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>../src;../../../../../utils;../../../../../mcu/apollo2;../../../bsp;../../../../../devices;../../../../..</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x0</TextAddressRange>
|
||||
<DataAddressRange>0x10000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\binary_counter.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib(am_hal_global.o) --keep=am_hal_global.o(.data) </Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>src</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>binary_counter.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../src/binary_counter.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>utils</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>am_util_delay.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../../../../../utils/am_util_delay.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>am_util_faultisr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../../../../../utils/am_util_faultisr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>am_util_stdio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../../../../../utils/am_util_stdio.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>devices</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>am_devices_led.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../../../../../devices/am_devices_led.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>keil</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>startup_keil.s</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../keil/startup_keil.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>lib</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>libam_hal.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>libam_bsp.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>../../../bsp/keil/bin/libam_bsp.lib</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
</Project>
|
||||
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
;! @file startup_keil.s
|
||||
;!
|
||||
;! @brief Definitions for Apollo2 interrupt handlers, the vector table, and the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;************************************************************************
|
||||
Stack EQU 0x00001000
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;
|
||||
;******************************************************************************
|
||||
Heap EQU 0x00000000
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
StackMem
|
||||
SPACE Stack
|
||||
__initial_sp
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
HeapMem
|
||||
SPACE Heap
|
||||
__heap_limit
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Indicate that the code in this file preserves 8-byte alignment of the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
PRESERVE8
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Place code into the reset code section.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA RESET, CODE, READONLY
|
||||
THUMB
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; The vector table.
|
||||
;
|
||||
;******************************************************************************
|
||||
;
|
||||
; Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
; am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
; Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
;
|
||||
|
||||
EXPORT __Vectors
|
||||
__Vectors
|
||||
DCD StackMem + Stack ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD am_nmi_isr ; NMI Handler
|
||||
DCD am_fault_isr ; Hard Fault Handler
|
||||
DCD am_fault_isr ; The MPU fault handler
|
||||
DCD am_fault_isr ; The bus fault handler
|
||||
DCD am_fault_isr ; The usage fault handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD am_svcall_isr ; SVCall handler
|
||||
DCD am_debugmon_isr ; Debug monitor handler
|
||||
DCD 0 ; Reserved
|
||||
DCD am_pendsv_isr ; The PendSV handler
|
||||
DCD am_systick_isr ; The SysTick handler
|
||||
|
||||
;
|
||||
; Peripheral Interrupts
|
||||
;
|
||||
DCD am_brownout_isr ; 0: Reserved
|
||||
DCD am_watchdog_isr ; 1: Reserved
|
||||
DCD am_clkgen_isr ; 2: CLKGEN
|
||||
DCD am_vcomp_isr ; 3: Voltage Comparator
|
||||
DCD am_ioslave_ios_isr ; 4: I/O Slave general
|
||||
DCD am_ioslave_acc_isr ; 5: I/O Slave access
|
||||
DCD am_iomaster0_isr ; 6: I/O Master 0
|
||||
DCD am_iomaster1_isr ; 7: I/O Master 1
|
||||
DCD am_iomaster2_isr ; 8: I/O Master 2
|
||||
DCD am_iomaster3_isr ; 9: I/O Master 3
|
||||
DCD am_iomaster4_isr ; 10: I/O Master 4
|
||||
DCD am_iomaster5_isr ; 11: I/O Master 5
|
||||
DCD am_gpio_isr ; 12: GPIO
|
||||
DCD am_ctimer_isr ; 13: CTIMER
|
||||
DCD am_uart_isr ; 14: UART0
|
||||
DCD am_uart1_isr ; 15: UART1
|
||||
DCD am_adc_isr ; 16: ADC
|
||||
DCD am_pdm0_isr ; 17: PDM
|
||||
DCD am_stimer_isr ; 18: SYSTEM TIMER
|
||||
DCD am_stimer_cmpr0_isr ; 19: SYSTEM TIMER COMPARE0
|
||||
DCD am_stimer_cmpr1_isr ; 20: SYSTEM TIMER COMPARE1
|
||||
DCD am_stimer_cmpr2_isr ; 21: SYSTEM TIMER COMPARE2
|
||||
DCD am_stimer_cmpr3_isr ; 22: SYSTEM TIMER COMPARE3
|
||||
DCD am_stimer_cmpr4_isr ; 23: SYSTEM TIMER COMPARE4
|
||||
DCD am_stimer_cmpr5_isr ; 24: SYSTEM TIMER COMPARE5
|
||||
DCD am_stimer_cmpr6_isr ; 25: SYSTEM TIMER COMPARE6
|
||||
DCD am_stimer_cmpr7_isr ; 26: SYSTEM TIMER COMPARE7
|
||||
DCD am_flash_isr ; 27: FLASH
|
||||
DCD am_software0_isr ; 28: SOFTWARE0
|
||||
DCD am_software1_isr ; 29: SOFTWARE1
|
||||
DCD am_software2_isr ; 30: SOFTWARE2
|
||||
DCD am_software3_isr ; 31: SOFTWARE3
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; This is the code that gets called when the processor first starts execution
|
||||
; following a reset event.
|
||||
;
|
||||
;******************************************************************************
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
|
||||
;
|
||||
; Enable the FPU.
|
||||
;
|
||||
MOVW R0, #0xED88
|
||||
MOVT R0, #0xE000
|
||||
LDR R1, [R0]
|
||||
ORR R1, #0x00F00000
|
||||
STR R1, [R0]
|
||||
DSB
|
||||
ISB
|
||||
|
||||
;
|
||||
; Branch to main.
|
||||
;
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Weak Exception Handlers.
|
||||
;
|
||||
;******************************************************************************
|
||||
am_nmi_isr PROC
|
||||
EXPORT am_nmi_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_fault_isr\
|
||||
PROC
|
||||
EXPORT am_fault_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_memmanage_isr\
|
||||
PROC
|
||||
EXPORT am_memmanage_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_default_isr\
|
||||
PROC
|
||||
EXPORT am_svcall_isr [WEAK]
|
||||
EXPORT am_debugmon_isr [WEAK]
|
||||
EXPORT am_pendsv_isr [WEAK]
|
||||
EXPORT am_systick_isr [WEAK]
|
||||
EXPORT am_brownout_isr [WEAK]
|
||||
EXPORT am_adc_isr [WEAK]
|
||||
EXPORT am_watchdog_isr [WEAK]
|
||||
EXPORT am_clkgen_isr [WEAK]
|
||||
EXPORT am_vcomp_isr [WEAK]
|
||||
EXPORT am_ioslave_ios_isr [WEAK]
|
||||
EXPORT am_ioslave_acc_isr [WEAK]
|
||||
EXPORT am_iomaster0_isr [WEAK]
|
||||
EXPORT am_iomaster1_isr [WEAK]
|
||||
EXPORT am_iomaster2_isr [WEAK]
|
||||
EXPORT am_iomaster3_isr [WEAK]
|
||||
EXPORT am_iomaster4_isr [WEAK]
|
||||
EXPORT am_iomaster5_isr [WEAK]
|
||||
EXPORT am_gpio_isr [WEAK]
|
||||
EXPORT am_ctimer_isr [WEAK]
|
||||
EXPORT am_uart_isr [WEAK]
|
||||
EXPORT am_uart0_isr [WEAK]
|
||||
EXPORT am_uart1_isr [WEAK]
|
||||
EXPORT am_pdm0_isr [WEAK]
|
||||
EXPORT am_stimer_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr0_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr1_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr2_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr3_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr4_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr5_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr6_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr7_isr [WEAK]
|
||||
EXPORT am_flash_isr [WEAK]
|
||||
EXPORT am_software0_isr [WEAK]
|
||||
EXPORT am_software1_isr [WEAK]
|
||||
EXPORT am_software2_isr [WEAK]
|
||||
EXPORT am_software3_isr [WEAK]
|
||||
|
||||
am_svcall_isr
|
||||
am_debugmon_isr
|
||||
am_pendsv_isr
|
||||
am_systick_isr
|
||||
am_brownout_isr
|
||||
am_adc_isr
|
||||
am_watchdog_isr
|
||||
am_clkgen_isr
|
||||
am_vcomp_isr
|
||||
am_ioslave_ios_isr
|
||||
am_ioslave_acc_isr
|
||||
am_iomaster0_isr
|
||||
am_iomaster1_isr
|
||||
am_iomaster2_isr
|
||||
am_iomaster3_isr
|
||||
am_iomaster4_isr
|
||||
am_iomaster5_isr
|
||||
am_gpio_isr
|
||||
am_ctimer_isr
|
||||
am_uart_isr
|
||||
am_uart0_isr
|
||||
am_uart1_isr
|
||||
am_pdm0_isr
|
||||
am_stimer_isr
|
||||
am_stimer_cmpr0_isr
|
||||
am_stimer_cmpr1_isr
|
||||
am_stimer_cmpr2_isr
|
||||
am_stimer_cmpr3_isr
|
||||
am_stimer_cmpr4_isr
|
||||
am_stimer_cmpr5_isr
|
||||
am_stimer_cmpr6_isr
|
||||
am_stimer_cmpr7_isr
|
||||
am_flash_isr
|
||||
am_software0_isr
|
||||
am_software1_isr
|
||||
am_software2_isr
|
||||
am_software3_isr
|
||||
|
||||
; all device interrupts go here unless the weak label is over
|
||||
; ridden in the linker hard spin so the debugger will know it
|
||||
; was an unhandled interrupt request a come-from-buffer or
|
||||
; instruction trace hardware would sure be nice if you get here
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Initialization of the heap and stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; User Initial Stack & Heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
IF :DEF: __MICROLIB
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
ELSE
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap PROC
|
||||
LDR R0, =HeapMem
|
||||
LDR R1, =(StackMem + Stack)
|
||||
LDR R2, =(HeapMem + Heap)
|
||||
LDR R3, =StackMem
|
||||
BX LR
|
||||
|
||||
ENDP
|
||||
|
||||
ENDIF
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; All Done
|
||||
;
|
||||
;******************************************************************************
|
||||
END
|
||||
|
||||
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file binary_counter.c
|
||||
//!
|
||||
//! @brief Example that displays the timer count on the LEDs.
|
||||
//!
|
||||
//! This example increments a variable on every timer interrupt. The global
|
||||
//! variable is used to set the state of the LEDs. The example sleeps otherwise.
|
||||
//!
|
||||
//! SWO is configured in 1M baud, 8-n-1 mode.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_bsp.h"
|
||||
#include "am_util.h"
|
||||
|
||||
volatile uint32_t g_ui32TimerCount = 0;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Timer configuration.
|
||||
//
|
||||
//*****************************************************************************
|
||||
am_hal_ctimer_config_t g_sTimer0 =
|
||||
{
|
||||
// Don't link timers.
|
||||
0,
|
||||
|
||||
// Set up Timer0A.
|
||||
(AM_HAL_CTIMER_FN_REPEAT |
|
||||
AM_HAL_CTIMER_INT_ENABLE |
|
||||
AM_HAL_CTIMER_LFRC_32HZ),
|
||||
|
||||
// No configuration for Timer0B.
|
||||
0,
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Function to initialize Timer A0 to interrupt every 1/4 second.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
timerA0_init(void)
|
||||
{
|
||||
uint32_t ui32Period;
|
||||
|
||||
//
|
||||
// Enable the LFRC.
|
||||
//
|
||||
am_hal_clkgen_osc_start(AM_HAL_CLKGEN_OSC_LFRC);
|
||||
|
||||
//
|
||||
// Set up timer A0.
|
||||
//
|
||||
am_hal_ctimer_clear(0, AM_HAL_CTIMER_TIMERA);
|
||||
am_hal_ctimer_config(0, &g_sTimer0);
|
||||
|
||||
//
|
||||
// Set up timerA0 to 32Hz from LFRC divided to 1 second period.
|
||||
//
|
||||
ui32Period = 8;
|
||||
am_hal_ctimer_period_set(0, AM_HAL_CTIMER_TIMERA, ui32Period,
|
||||
(ui32Period >> 1));
|
||||
|
||||
//
|
||||
// Clear the timer Interrupt
|
||||
//
|
||||
am_hal_ctimer_int_clear(AM_HAL_CTIMER_INT_TIMERA0);
|
||||
|
||||
} // timerA0_init()
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Timer Interrupt Service Routine (ISR)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_ctimer_isr(void)
|
||||
{
|
||||
//
|
||||
// Clear TimerA0 Interrupt (write to clear).
|
||||
//
|
||||
am_hal_ctimer_int_clear(AM_HAL_CTIMER_INT_TIMERA0);
|
||||
|
||||
//
|
||||
// Increment count and set limit based on the number of LEDs available.
|
||||
//
|
||||
if (++g_ui32TimerCount >= (1 << AM_BSP_NUM_LEDS))
|
||||
{
|
||||
//
|
||||
// Reset the global.
|
||||
//
|
||||
g_ui32TimerCount = 0;
|
||||
}
|
||||
|
||||
} // am_ctimer_isr()
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Main function.
|
||||
//
|
||||
//*****************************************************************************
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
//
|
||||
// Set the clock frequency.
|
||||
//
|
||||
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
|
||||
|
||||
//
|
||||
// Set the default cache configuration
|
||||
//
|
||||
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
|
||||
|
||||
//
|
||||
// Configure the board for low power operation.
|
||||
//
|
||||
am_bsp_low_power_init();
|
||||
|
||||
//
|
||||
// Initialize the printf interface for ITM/SWO output.
|
||||
//
|
||||
am_util_stdio_printf_init((am_util_stdio_print_char_t) am_bsp_itm_string_print);
|
||||
|
||||
//
|
||||
// Initialize the SWO GPIO pin
|
||||
//
|
||||
am_bsp_pin_enable(ITM_SWO);
|
||||
am_devices_led_array_init(am_bsp_psLEDs, AM_BSP_NUM_LEDS);
|
||||
|
||||
//
|
||||
// Enable the ITM.
|
||||
//
|
||||
am_hal_itm_enable();
|
||||
|
||||
//
|
||||
// Enable debug printf messages using ITM on SWO pin
|
||||
//
|
||||
am_bsp_debug_printf_enable();
|
||||
|
||||
//
|
||||
// Clear the terminal and print the banner.
|
||||
//
|
||||
am_util_stdio_terminal_clear();
|
||||
am_util_stdio_printf("Binary Counter Example\n");
|
||||
|
||||
//
|
||||
// TimerA0 init.
|
||||
//
|
||||
timerA0_init();
|
||||
|
||||
//
|
||||
// Enable the timer Interrupt.
|
||||
//
|
||||
am_hal_ctimer_int_enable(AM_HAL_CTIMER_INT_TIMERA0);
|
||||
|
||||
//
|
||||
// Enable the timer interrupt in the NVIC.
|
||||
//
|
||||
am_hal_interrupt_enable(AM_HAL_INTERRUPT_CTIMER);
|
||||
am_hal_interrupt_master_enable();
|
||||
|
||||
//
|
||||
// Start timer A0
|
||||
//
|
||||
am_hal_ctimer_start(0, AM_HAL_CTIMER_TIMERA);
|
||||
|
||||
//
|
||||
// We are done printing. Disable debug printf messages on ITM.
|
||||
//
|
||||
am_bsp_debug_printf_disable();
|
||||
|
||||
//
|
||||
// Loop forever.
|
||||
//
|
||||
while (1)
|
||||
{
|
||||
//
|
||||
// Go to Deep Sleep.
|
||||
//
|
||||
am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP);
|
||||
|
||||
//
|
||||
// Set the LEDs.
|
||||
//
|
||||
am_devices_led_array_out(am_bsp_psLEDs, AM_BSP_NUM_LEDS,
|
||||
g_ui32TimerCount);
|
||||
}
|
||||
} // main()
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for compiling
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
# Include rules specific to this board
|
||||
-include ../../board-defs.mk
|
||||
-include example-defs.mk
|
||||
|
||||
# All makefiles use this to find the top level directory.
|
||||
SWROOT?=../../../..
|
||||
|
||||
# Include rules for building generic examples.
|
||||
include $(SWROOT)/makedefs/example.mk
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
Name:
|
||||
=====
|
||||
freertos_amdtp
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
AMDTP example.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
******************************************************************************
|
||||
|
||||
|
||||
+409
@@ -0,0 +1,409 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtpc
|
||||
COMPILERNAME := gcc
|
||||
PROJECT := ble_freertos_amdtpc_gcc
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Setup ####
|
||||
|
||||
TOOLCHAIN ?= arm-none-eabi
|
||||
PART = apollo2
|
||||
CPU = cortex-m4
|
||||
FPU = fpv4-sp-d16
|
||||
#FABI = softfp
|
||||
FABI = hard
|
||||
|
||||
LINKER_FILE := ./ble_freertos_amdtpc.ld
|
||||
STARTUP_FILE := ./startup_$(COMPILERNAME).c
|
||||
|
||||
#### Required Executables ####
|
||||
CC = $(TOOLCHAIN)-gcc
|
||||
GCC = $(TOOLCHAIN)-gcc
|
||||
CPP = $(TOOLCHAIN)-cpp
|
||||
LD = $(TOOLCHAIN)-ld
|
||||
CP = $(TOOLCHAIN)-objcopy
|
||||
OD = $(TOOLCHAIN)-objdump
|
||||
RD = $(TOOLCHAIN)-readelf
|
||||
AR = $(TOOLCHAIN)-ar
|
||||
SIZE = $(TOOLCHAIN)-size
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
EXECUTABLES = CC LD CP OD AR RD SIZE GCC
|
||||
K := $(foreach exec,$(EXECUTABLES),\
|
||||
$(if $(shell which $($(exec)) 2>/dev/null),,\
|
||||
$(info $(exec) not found on PATH ($($(exec))).)$(exec)))
|
||||
$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
|
||||
|
||||
ifneq ($(strip $(value K)),)
|
||||
all clean:
|
||||
$(info Tools $(TOOLCHAIN)-$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
DEFINES = -DPART_$(PART)
|
||||
DEFINES+= -DSEC_ECC_CFG=SEC_ECC_CFG_UECC
|
||||
DEFINES+= -DAM_DEBUG_PRINTF
|
||||
DEFINES+= -DAM_FREERTOS
|
||||
DEFINES+= -DWSF_TRACE_ENABLED
|
||||
DEFINES+= -DBLE_MENU
|
||||
DEFINES+= -DAM_PACKAGE_BGA
|
||||
DEFINES+= -DAM_PART_APOLLO2
|
||||
DEFINES+= -Dgcc
|
||||
|
||||
INCLUDES = -I../../../../../third_party/exactle/ble-host/include
|
||||
INCLUDES+= -I../../../bsp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/uribeacon
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/include
|
||||
INCLUDES+= -I../../../../../ambiq_ble/apps/amdtpc
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
INCLUDES+= -I../../../../../third_party/uecc
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
INCLUDES+= -I../../../../../third_party/FreeRTOSv10.1.1/Source/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
INCLUDES+= -I../../../../../devices
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
INCLUDES+= -I../../../../../ambiq_ble/menu
|
||||
INCLUDES+= -I../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
INCLUDES+= -I../../../../../mcu/apollo2
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/include
|
||||
INCLUDES+= -I../../../../../ambiq_ble/services
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
INCLUDES+= -I../src
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/include/app
|
||||
INCLUDES+= -I../../../../../utils
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/util
|
||||
INCLUDES+= -I../../../../../ambiq_ble/profiles/amdtpc
|
||||
INCLUDES+= -I../../../../../ambiq_ble/profiles/amdtpcommon
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
INCLUDES+= -I../../../../../ambiq_ble/em9304
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
|
||||
VPATH = ../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
VPATH+=:../src
|
||||
VPATH+=:../../../../../ambiq_ble/apps/amdtpc
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
VPATH+=:../../../../../third_party/uecc
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
VPATH+=:../../../../../utils
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/util
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/hidapp
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/MemMang
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
VPATH+=:../../../../../devices
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/app/common
|
||||
VPATH+=:../../../../../ambiq_ble/profiles/amdtpc
|
||||
VPATH+=:../../../../../ambiq_ble/profiles/amdtpcommon
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
VPATH+=:../../../../../ambiq_ble/menu
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
VPATH+=:../../../../../ambiq_ble/em9304
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/uecc
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
|
||||
SRC = gap_main.c
|
||||
SRC += l2c_coc.c
|
||||
SRC += l2c_main.c
|
||||
SRC += l2c_master.c
|
||||
SRC += l2c_slave.c
|
||||
SRC += bas_main.c
|
||||
SRC += hci_main.c
|
||||
SRC += ble_freertos_amdtpc.c
|
||||
SRC += radio_task.c
|
||||
SRC += rtos.c
|
||||
SRC += amdtp_main.c
|
||||
SRC += cfg_stack.c
|
||||
SRC += smpi_act.c
|
||||
SRC += smpi_sc_act.c
|
||||
SRC += smpi_sc_sm.c
|
||||
SRC += smpi_sm.c
|
||||
SRC += smpr_act.c
|
||||
SRC += smpr_sc_act.c
|
||||
SRC += smpr_sc_sm.c
|
||||
SRC += smpr_sm.c
|
||||
SRC += smp_act.c
|
||||
SRC += smp_db.c
|
||||
SRC += smp_main.c
|
||||
SRC += smp_non.c
|
||||
SRC += smp_sc_act.c
|
||||
SRC += smp_sc_main.c
|
||||
SRC += uECC.c
|
||||
SRC += uECC_ll.c
|
||||
SRC += hid_main.c
|
||||
SRC += bda.c
|
||||
SRC += bstream.c
|
||||
SRC += calc128.c
|
||||
SRC += crc32.c
|
||||
SRC += print.c
|
||||
SRC += terminal.c
|
||||
SRC += wstr.c
|
||||
SRC += hidapp_main.c
|
||||
SRC += hci_drv_em9304.c
|
||||
SRC += app_db.c
|
||||
SRC += app_hw.c
|
||||
SRC += app_ui.c
|
||||
SRC += ui_console.c
|
||||
SRC += ui_lcd.c
|
||||
SRC += ui_main.c
|
||||
SRC += ui_platform.c
|
||||
SRC += ui_timer.c
|
||||
SRC += amdtpc_main.c
|
||||
SRC += amdtp_common.c
|
||||
SRC += attc_disc.c
|
||||
SRC += attc_main.c
|
||||
SRC += attc_proc.c
|
||||
SRC += attc_read.c
|
||||
SRC += attc_sign.c
|
||||
SRC += attc_write.c
|
||||
SRC += atts_ccc.c
|
||||
SRC += atts_csf.c
|
||||
SRC += atts_dyn.c
|
||||
SRC += atts_ind.c
|
||||
SRC += atts_main.c
|
||||
SRC += atts_proc.c
|
||||
SRC += atts_read.c
|
||||
SRC += atts_sign.c
|
||||
SRC += atts_write.c
|
||||
SRC += att_main.c
|
||||
SRC += att_uuid.c
|
||||
SRC += wsf_assert.c
|
||||
SRC += wsf_buf.c
|
||||
SRC += wsf_efs.c
|
||||
SRC += wsf_math.c
|
||||
SRC += wsf_msg.c
|
||||
SRC += wsf_os.c
|
||||
SRC += wsf_queue.c
|
||||
SRC += wsf_timer.c
|
||||
SRC += wsf_trace.c
|
||||
SRC += ble_menu.c
|
||||
SRC += hci_cmd.c
|
||||
SRC += hci_cmd_ae.c
|
||||
SRC += hci_cmd_cte.c
|
||||
SRC += hci_cmd_past.c
|
||||
SRC += hci_cmd_phy.c
|
||||
SRC += hci_core.c
|
||||
SRC += hci_core_ps.c
|
||||
SRC += hci_evt.c
|
||||
SRC += hci_tr.c
|
||||
SRC += hci_vs.c
|
||||
SRC += hci_vs_ae.c
|
||||
SRC += em9304_init.c
|
||||
SRC += em9304_patches.c
|
||||
SRC += port.c
|
||||
SRC += dm_adv.c
|
||||
SRC += dm_adv_ae.c
|
||||
SRC += dm_adv_leg.c
|
||||
SRC += dm_conn.c
|
||||
SRC += dm_conn_cte.c
|
||||
SRC += dm_conn_master.c
|
||||
SRC += dm_conn_master_ae.c
|
||||
SRC += dm_conn_master_leg.c
|
||||
SRC += dm_conn_slave.c
|
||||
SRC += dm_conn_slave_ae.c
|
||||
SRC += dm_conn_slave_leg.c
|
||||
SRC += dm_conn_sm.c
|
||||
SRC += dm_dev.c
|
||||
SRC += dm_dev_priv.c
|
||||
SRC += dm_main.c
|
||||
SRC += dm_past.c
|
||||
SRC += dm_phy.c
|
||||
SRC += dm_priv.c
|
||||
SRC += dm_scan.c
|
||||
SRC += dm_scan_ae.c
|
||||
SRC += dm_scan_leg.c
|
||||
SRC += dm_sec.c
|
||||
SRC += dm_sec_lesc.c
|
||||
SRC += dm_sec_master.c
|
||||
SRC += dm_sec_slave.c
|
||||
SRC += dm_sync_ae.c
|
||||
SRC += sec_aes.c
|
||||
SRC += sec_aes_rev.c
|
||||
SRC += sec_ccm_hci.c
|
||||
SRC += sec_cmac_hci.c
|
||||
SRC += sec_ecc_debug.c
|
||||
SRC += sec_ecc_hci.c
|
||||
SRC += sec_main.c
|
||||
SRC += sec_ecc.c
|
||||
SRC += gatt_main.c
|
||||
SRC += am_devices_button.c
|
||||
SRC += am_devices_em9304.c
|
||||
SRC += am_devices_led.c
|
||||
SRC += event_groups.c
|
||||
SRC += list.c
|
||||
SRC += queue.c
|
||||
SRC += tasks.c
|
||||
SRC += timers.c
|
||||
SRC += svc_batt.c
|
||||
SRC += svc_bps.c
|
||||
SRC += svc_core.c
|
||||
SRC += svc_cps.c
|
||||
SRC += svc_cscs.c
|
||||
SRC += svc_dis.c
|
||||
SRC += svc_gls.c
|
||||
SRC += svc_gyro.c
|
||||
SRC += svc_hid.c
|
||||
SRC += svc_hrs.c
|
||||
SRC += svc_hts.c
|
||||
SRC += svc_ipss.c
|
||||
SRC += svc_plxs.c
|
||||
SRC += svc_px.c
|
||||
SRC += svc_rscs.c
|
||||
SRC += svc_scpss.c
|
||||
SRC += svc_temp.c
|
||||
SRC += svc_uricfg.c
|
||||
SRC += svc_wdxs.c
|
||||
SRC += svc_wp.c
|
||||
SRC += svc_wss.c
|
||||
SRC += am_util_debug.c
|
||||
SRC += am_util_delay.c
|
||||
SRC += am_util_faultisr.c
|
||||
SRC += am_util_stdio.c
|
||||
SRC += app_disc.c
|
||||
SRC += app_main.c
|
||||
SRC += app_master.c
|
||||
SRC += app_master_leg.c
|
||||
SRC += app_server.c
|
||||
SRC += app_slave.c
|
||||
SRC += app_slave_leg.c
|
||||
SRC += app_terminal.c
|
||||
SRC += heap_2.c
|
||||
SRC += startup_gcc.c
|
||||
|
||||
CSRC = $(filter %.c,$(SRC))
|
||||
ASRC = $(filter %.s,$(SRC))
|
||||
|
||||
OBJS = $(CSRC:%.c=$(CONFIG)/%.o)
|
||||
OBJS+= $(ASRC:%.s=$(CONFIG)/%.o)
|
||||
|
||||
DEPS = $(CSRC:%.c=$(CONFIG)/%.d)
|
||||
DEPS+= $(ASRC:%.s=$(CONFIG)/%.d)
|
||||
|
||||
LIBS = ../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a
|
||||
LIBS += ../../../bsp/gcc/bin/libam_bsp.a
|
||||
|
||||
CFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
CFLAGS+= -ffunction-sections -fdata-sections -fomit-frame-pointer
|
||||
CFLAGS+= -MMD -MP -std=c99 -Wall -g
|
||||
CFLAGS+= -O0
|
||||
CFLAGS+= $(DEFINES)
|
||||
CFLAGS+= $(INCLUDES)
|
||||
CFLAGS+=
|
||||
|
||||
LFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
LFLAGS+= -nostartfiles -static
|
||||
LFLAGS+= -Wl,--gc-sections,--entry,am_reset_isr,-Map,$(CONFIG)/$(TARGET).map
|
||||
LFLAGS+= -Wl,--start-group -lm -lc -lgcc $(LIBS) -Wl,--end-group
|
||||
LFLAGS+=
|
||||
|
||||
# Additional user specified CFLAGS
|
||||
CFLAGS+=$(EXTRA_CFLAGS)
|
||||
|
||||
CPFLAGS = -Obinary
|
||||
|
||||
ODFLAGS = -S
|
||||
|
||||
#### Rules ####
|
||||
all: directories $(CONFIG)/$(TARGET).bin
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
$(CONFIG)/%.o: %.c $(CONFIG)/%.d
|
||||
@echo " Compiling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/%.o: %.s $(CONFIG)/%.d
|
||||
@echo " Assembling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/$(TARGET).axf: $(OBJS) $(LIBS)
|
||||
@echo " Linking $(COMPILERNAME) $@" ;\
|
||||
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
|
||||
|
||||
$(CONFIG)/$(TARGET).bin: $(CONFIG)/$(TARGET).axf
|
||||
@echo " Copying $(COMPILERNAME) $@..." ;\
|
||||
$(CP) $(CPFLAGS) $< $@ ;\
|
||||
$(OD) $(ODFLAGS) $< > $(CONFIG)/$(TARGET).lst
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..." ;\
|
||||
$(RM) -f $(OBJS) $(DEPS) \
|
||||
$(CONFIG)/$(TARGET).bin $(CONFIG)/$(TARGET).axf \
|
||||
$(CONFIG)/$(TARGET).lst $(CONFIG)/$(TARGET).map
|
||||
|
||||
$(CONFIG)/%.d: ;
|
||||
|
||||
../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/gcc/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
# Automatically include any generated dependencies
|
||||
-include $(DEPS)
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* ble_freertos_amdtpc.ld - Linker script for applications using startup_gnu.c
|
||||
*
|
||||
*****************************************************************************/
|
||||
ENTRY(am_reset_isr)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text)
|
||||
*(.text*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > FLASH
|
||||
|
||||
/* User stack section initialized by startup code. */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack)
|
||||
*(.stack*)
|
||||
. = ALIGN(8);
|
||||
} > SRAM
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
*(.data)
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} > SRAM AT>FLASH
|
||||
|
||||
/* used by startup to initialize data */
|
||||
_init_data = LOADADDR(.data);
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} > SRAM
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_gcc.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of interrupt handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void am_reset_isr(void) __attribute ((naked));
|
||||
extern void am_nmi_isr(void) __attribute ((weak));
|
||||
extern void am_fault_isr(void) __attribute ((weak));
|
||||
extern void am_mpufault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_busfault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_usagefault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_svcall_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_debugmon_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pendsv_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_systick_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_brownout_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_watchdog_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_clkgen_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_vcomp_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_ios_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_acc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_gpio_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ctimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_adc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pdm0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr6_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr7_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_flash_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_default_isr(void) __attribute ((weak));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int main(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".stack")))
|
||||
static uint32_t g_pui32Stack[0xac0];
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_am_pfnVectors[])(void) =
|
||||
{
|
||||
(void (*)(void))((uint32_t)g_pui32Stack + sizeof(g_pui32Stack)),
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART
|
||||
am_uart1_isr, // 15: UART
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: SYSTEM TIMER
|
||||
am_stimer_cmpr0_isr, // 19: SYSTEM TIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: SYSTEM TIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: SYSTEM TIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: SYSTEM TIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: SYSTEM TIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: SYSTEM TIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: SYSTEM TIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: SYSTEM TIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are constructs created by the linker, indicating where the
|
||||
// the "data" and "bss" segments reside in memory. The initializers for the
|
||||
// "data" segment resides immediately following the "text" segment.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t _etext;
|
||||
extern uint32_t _sdata;
|
||||
extern uint32_t _edata;
|
||||
extern uint32_t _sbss;
|
||||
extern uint32_t _ebss;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined(__GNUC_STDC_INLINE__)
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Set the vector table pointer.
|
||||
//
|
||||
__asm(" ldr r0, =0xE000ED08\n"
|
||||
" ldr r1, =g_am_pfnVectors\n"
|
||||
" str r1, [r0]");
|
||||
|
||||
//
|
||||
// Set the stack pointer.
|
||||
//
|
||||
__asm(" ldr sp, [r1]");
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the FPU.
|
||||
//
|
||||
__asm("ldr r0, =0xE000ED88\n"
|
||||
"ldr r1,[r0]\n"
|
||||
"orr r1,#(0xF << 20)\n"
|
||||
"str r1,[r0]\n"
|
||||
"dsb\n"
|
||||
"isb\n");
|
||||
#endif
|
||||
//
|
||||
// Copy the data segment initializers from flash to SRAM.
|
||||
//
|
||||
__asm(" ldr r0, =_init_data\n"
|
||||
" ldr r1, =_sdata\n"
|
||||
" ldr r2, =_edata\n"
|
||||
"copy_loop:\n"
|
||||
" ldr r3, [r0], #4\n"
|
||||
" str r3, [r1], #4\n"
|
||||
" cmp r1, r2\n"
|
||||
" blt copy_loop\n");
|
||||
//
|
||||
// Zero fill the bss segment.
|
||||
//
|
||||
__asm(" ldr r0, =_sbss\n"
|
||||
" ldr r1, =_ebss\n"
|
||||
" mov r2, #0\n"
|
||||
"zero_loop:\n"
|
||||
" cmp r0, r1\n"
|
||||
" it lt\n"
|
||||
" strlt r2, [r0], #4\n"
|
||||
" blt zero_loop");
|
||||
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
main();
|
||||
|
||||
//
|
||||
// If main returns then execute a break point instruction
|
||||
//
|
||||
__asm(" bkpt ");
|
||||
}
|
||||
#else
|
||||
#error GNU STDC inline not supported.
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtpc
|
||||
COMPILERNAME := iar
|
||||
PROJECT := ble_freertos_amdtpc_iar
|
||||
CONFIG := bin
|
||||
AM_SoftwareRoot ?= ../../../..
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p IarBuild.exe)
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
IarBuild.exe ble_freertos_amdtpc.ewp -make Debug -log info
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
IarBuild.exe ble_freertos_amdtpc.ewp -clean Debug -log all
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/iar/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/iar/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+64691
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+2810
File diff suppressed because it is too large
Load Diff
+2662
File diff suppressed because it is too large
Load Diff
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\ble_freertos_amdtpc.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ble_freertos_amdtpc.icf
|
||||
//
|
||||
// IAR linker Configuration File
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Define a memory section that covers the entire 4 GB addressable space of the
|
||||
// processor. (32-bit can address up to 4GB)
|
||||
//
|
||||
define memory mem with size = 4G;
|
||||
|
||||
//
|
||||
// Define a region for the flash.
|
||||
//
|
||||
define region FLASH = mem:[from 0x00000000 to 0x00100000];
|
||||
|
||||
//
|
||||
// Define a region for the SRAM.
|
||||
//
|
||||
define region SRAM = mem:[from 0x10000000 to 0x10040000];
|
||||
|
||||
//
|
||||
// Define a block for the heap.
|
||||
//
|
||||
define block HEAP with alignment = 0x8, size = 0x00000000 { };
|
||||
|
||||
//
|
||||
// Define a block for the stack.
|
||||
//
|
||||
define block CSTACK with alignment = 0x8, size = 0xac0 { };
|
||||
|
||||
//
|
||||
// Read/Write values should be initialized by copying from flash.
|
||||
//
|
||||
initialize by copy { readwrite };
|
||||
|
||||
//
|
||||
// Indicate that the noinit values should be left alone.
|
||||
//
|
||||
do not initialize { section .noinit };
|
||||
|
||||
//
|
||||
// Place the interrupt vectors at the start of flash.
|
||||
//
|
||||
place at start of FLASH { readonly section .intvec };
|
||||
|
||||
//
|
||||
// Place the remainder of the read-only items into flash.
|
||||
//
|
||||
place in FLASH { readonly };
|
||||
|
||||
//
|
||||
// Place the stack at the start of SRAM.
|
||||
//
|
||||
place at start of SRAM { block CSTACK, section .noinit };
|
||||
|
||||
//
|
||||
// Place all read/write items into SRAM.
|
||||
//
|
||||
place in SRAM { block HEAP, readwrite };
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_iar.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable the IAR extensions for this source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma language = extended
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Weak function links.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma weak am_mpufault_isr = am_fault_isr
|
||||
#pragma weak am_busfault_isr = am_fault_isr
|
||||
#pragma weak am_usagefault_isr = am_fault_isr
|
||||
#pragma weak am_svcall_isr = am_default_isr
|
||||
#pragma weak am_debugmon_isr = am_default_isr
|
||||
#pragma weak am_pendsv_isr = am_default_isr
|
||||
#pragma weak am_systick_isr = am_default_isr
|
||||
#pragma weak am_brownout_isr = am_default_isr
|
||||
#pragma weak am_watchdog_isr = am_default_isr
|
||||
#pragma weak am_clkgen_isr = am_default_isr
|
||||
#pragma weak am_vcomp_isr = am_default_isr
|
||||
#pragma weak am_ioslave_ios_isr = am_default_isr
|
||||
#pragma weak am_ioslave_acc_isr = am_default_isr
|
||||
#pragma weak am_iomaster0_isr = am_default_isr
|
||||
#pragma weak am_iomaster1_isr = am_default_isr
|
||||
#pragma weak am_iomaster2_isr = am_default_isr
|
||||
#pragma weak am_iomaster3_isr = am_default_isr
|
||||
#pragma weak am_iomaster4_isr = am_default_isr
|
||||
#pragma weak am_iomaster5_isr = am_default_isr
|
||||
#pragma weak am_gpio_isr = am_default_isr
|
||||
#pragma weak am_ctimer_isr = am_default_isr
|
||||
#pragma weak am_uart_isr = am_default_isr
|
||||
#pragma weak am_uart1_isr = am_default_isr
|
||||
#pragma weak am_adc_isr = am_default_isr
|
||||
#pragma weak am_pdm0_isr = am_default_isr
|
||||
#pragma weak am_stimer_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr0_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr1_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr2_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr3_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr4_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr5_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr6_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr7_isr = am_default_isr
|
||||
#pragma weak am_flash_isr = am_default_isr
|
||||
#pragma weak am_software0_isr = am_default_isr
|
||||
#pragma weak am_software1_isr = am_default_isr
|
||||
#pragma weak am_software2_isr = am_default_isr
|
||||
#pragma weak am_software3_isr = am_default_isr
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the default fault handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __stackless void am_reset_isr(void);
|
||||
extern __weak void am_nmi_isr(void);
|
||||
extern __weak void am_fault_isr(void);
|
||||
extern void am_mpufault_isr(void);
|
||||
extern void am_busfault_isr(void);
|
||||
extern void am_usagefault_isr(void);
|
||||
extern void am_svcall_isr(void);
|
||||
extern void am_debugmon_isr(void);
|
||||
extern void am_pendsv_isr(void);
|
||||
extern void am_systick_isr(void);
|
||||
extern void am_brownout_isr(void);
|
||||
extern void am_watchdog_isr(void);
|
||||
extern void am_clkgen_isr(void);
|
||||
extern void am_vcomp_isr(void);
|
||||
extern void am_ioslave_ios_isr(void);
|
||||
extern void am_ioslave_acc_isr(void);
|
||||
extern void am_iomaster0_isr(void);
|
||||
extern void am_iomaster1_isr(void);
|
||||
extern void am_iomaster2_isr(void);
|
||||
extern void am_iomaster3_isr(void);
|
||||
extern void am_iomaster4_isr(void);
|
||||
extern void am_iomaster5_isr(void);
|
||||
extern void am_gpio_isr(void);
|
||||
extern void am_ctimer_isr(void);
|
||||
extern void am_uart_isr(void);
|
||||
extern void am_uart1_isr(void);
|
||||
extern void am_adc_isr(void);
|
||||
extern void am_pdm0_isr(void);
|
||||
extern void am_stimer_isr(void);
|
||||
extern void am_stimer_cmpr0_isr(void);
|
||||
extern void am_stimer_cmpr1_isr(void);
|
||||
extern void am_stimer_cmpr2_isr(void);
|
||||
extern void am_stimer_cmpr3_isr(void);
|
||||
extern void am_stimer_cmpr4_isr(void);
|
||||
extern void am_stimer_cmpr5_isr(void);
|
||||
extern void am_stimer_cmpr6_isr(void);
|
||||
extern void am_stimer_cmpr7_isr(void);
|
||||
extern void am_flash_isr(void);
|
||||
extern void am_software0_isr(void);
|
||||
extern void am_software1_isr(void);
|
||||
extern void am_software2_isr(void);
|
||||
extern void am_software3_isr(void);
|
||||
|
||||
extern void am_default_isr(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application startup code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void __iar_program_start(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t pui32Stack[0xac0] @ ".noinit";
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// A union that describes the entries of the vector table. The union is needed
|
||||
// since the first entry is the stack pointer and the remainder are function
|
||||
// pointers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef union
|
||||
{
|
||||
void (*pfnHandler)(void);
|
||||
uint32_t ui32Ptr;
|
||||
}
|
||||
uVectorEntry;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__root const uVectorEntry __vector_table[] @ ".intvec" =
|
||||
{
|
||||
{ .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) },
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART0
|
||||
am_uart1_isr, // 15: UART1
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: STIMER
|
||||
am_stimer_cmpr0_isr, // 19: STIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: STIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: STIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: STIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: STIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: STIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: STIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: STIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Note - The template for this function is originally found in IAR's module,
|
||||
// low_level_init.c. As supplied by IAR, it is an empty function.
|
||||
//
|
||||
// This module contains the function `__low_level_init', a function
|
||||
// that is called before the `main' function of the program. Normally
|
||||
// low-level initializations - such as setting the prefered interrupt
|
||||
// level or setting the watchdog - can be performed here.
|
||||
//
|
||||
// Note that this function is called before the data segments are
|
||||
// initialized, this means that this function cannot rely on the
|
||||
// values of global or static variables.
|
||||
//
|
||||
// When this function returns zero, the startup code will inhibit the
|
||||
// initialization of the data segments. The result is faster startup,
|
||||
// the drawback is that neither global nor static data will be
|
||||
// initialized.
|
||||
//
|
||||
// Copyright 1999-2017 IAR Systems AB.
|
||||
//
|
||||
// $Revision: 112610 $
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AM_REGVAL(x) (*((volatile uint32_t *)(x)))
|
||||
#define VTOR_ADDR 0xE000ED08
|
||||
|
||||
__interwork int __low_level_init(void)
|
||||
{
|
||||
|
||||
AM_REGVAL(VTOR_ADDR) = (uint32_t)&__vector_table;
|
||||
|
||||
/*==================================*/
|
||||
/* Choose if segment initialization */
|
||||
/* should be done or not. */
|
||||
/* Return: 0 to omit seg_init */
|
||||
/* 1 to run seg_init */
|
||||
/*==================================*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
__iar_program_start();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Name: Dbg_RAM.ini
|
||||
* Purpose: RAM Debug Initialization File
|
||||
* Note(s):
|
||||
*----------------------------------------------------------------------------
|
||||
* This file is part of the uVision/ARM development tools.
|
||||
* This software may only be used under the terms of a valid, current,
|
||||
* end user licence from KEIL for a compatible version of KEIL software
|
||||
* development tools. Nothing else gives you the right to use this software.
|
||||
*
|
||||
* This software is supplied "AS IS" without warranties of any kind.
|
||||
*
|
||||
* Copyright (c) 2008-2013 Keil - An ARM Company. All rights reserved.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
TraceSetup() Turn on ITM clocks, etc.
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void TraceSetup (void)
|
||||
{
|
||||
// turn on the ITM/TPIU clock
|
||||
_WDWORD(0x40020250, 0x00000201); // TPIU clock enabled at 3MHz
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Setup() configure PC & SP for RAM Debug
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void Setup (void) {
|
||||
SP = _RDWORD(0x00000000+0x0); // Setup Stack Pointer
|
||||
PC = _RDWORD(0x00000000+0x4); // Setup Program Counter
|
||||
_WDWORD(0xE000ED08, 0x00000000+0x0); // Setup Vector Table Offset Register (done in system file)
|
||||
}
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL // load the application
|
||||
|
||||
|
||||
// Executed after reset via uVision's 'Reset'-button
|
||||
FUNC void OnResetExec (void)
|
||||
{
|
||||
//Set_ui32HALflags();
|
||||
//TraceSetup();
|
||||
}
|
||||
|
||||
FUNC void Set_ui32HALflags (void)
|
||||
{
|
||||
TraceSetup();
|
||||
//g_ui32HALflags = 0x00000001;
|
||||
_break_ = 1;
|
||||
}
|
||||
|
||||
Setup(); // Setup for Running
|
||||
BS main, 1, "Set_ui32HALflags()";
|
||||
|
||||
g
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 1
|
||||
Device="AMAPH1KK-KBR"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtpc
|
||||
COMPILERNAME := Keil
|
||||
PROJECT := ble_freertos_amdtpc_Keil
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p UV4.exe)
|
||||
RM := $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
UV4.exe -b -t "ble_freertos_amdtpc" ble_freertos_amdtpc.uvprojx -j0 || [ $$? -eq 1 ]
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
$(RM) -rf $(CONFIG)
|
||||
|
||||
|
||||
../../../bsp/keil/bin/libam_bsp.lib:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
|
||||
+50878
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; ble_freertos_amdtpc.sct
|
||||
;
|
||||
; Scatter file for Keil linker configuration.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
LR_1 0x00000000
|
||||
{
|
||||
FLASH 0x00000000 0x00100000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
SRAM 0x10000000 0x00040000
|
||||
{
|
||||
* (+RW, +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
+3131
File diff suppressed because it is too large
Load Diff
+1399
File diff suppressed because it is too large
Load Diff
+351
@@ -0,0 +1,351 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
;! @file startup_keil.s
|
||||
;!
|
||||
;! @brief Definitions for Apollo2 interrupt handlers, the vector table, and the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;************************************************************************
|
||||
Stack EQU 0x00002B00
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;
|
||||
;******************************************************************************
|
||||
Heap EQU 0x00000000
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
StackMem
|
||||
SPACE Stack
|
||||
__initial_sp
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
HeapMem
|
||||
SPACE Heap
|
||||
__heap_limit
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Indicate that the code in this file preserves 8-byte alignment of the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
PRESERVE8
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Place code into the reset code section.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA RESET, CODE, READONLY
|
||||
THUMB
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; The vector table.
|
||||
;
|
||||
;******************************************************************************
|
||||
;
|
||||
; Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
; am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
; Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
;
|
||||
|
||||
EXPORT __Vectors
|
||||
__Vectors
|
||||
DCD StackMem + Stack ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD am_nmi_isr ; NMI Handler
|
||||
DCD am_fault_isr ; Hard Fault Handler
|
||||
DCD am_fault_isr ; The MPU fault handler
|
||||
DCD am_fault_isr ; The bus fault handler
|
||||
DCD am_fault_isr ; The usage fault handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD am_svcall_isr ; SVCall handler
|
||||
DCD am_debugmon_isr ; Debug monitor handler
|
||||
DCD 0 ; Reserved
|
||||
DCD am_pendsv_isr ; The PendSV handler
|
||||
DCD am_systick_isr ; The SysTick handler
|
||||
|
||||
;
|
||||
; Peripheral Interrupts
|
||||
;
|
||||
DCD am_brownout_isr ; 0: Reserved
|
||||
DCD am_watchdog_isr ; 1: Reserved
|
||||
DCD am_clkgen_isr ; 2: CLKGEN
|
||||
DCD am_vcomp_isr ; 3: Voltage Comparator
|
||||
DCD am_ioslave_ios_isr ; 4: I/O Slave general
|
||||
DCD am_ioslave_acc_isr ; 5: I/O Slave access
|
||||
DCD am_iomaster0_isr ; 6: I/O Master 0
|
||||
DCD am_iomaster1_isr ; 7: I/O Master 1
|
||||
DCD am_iomaster2_isr ; 8: I/O Master 2
|
||||
DCD am_iomaster3_isr ; 9: I/O Master 3
|
||||
DCD am_iomaster4_isr ; 10: I/O Master 4
|
||||
DCD am_iomaster5_isr ; 11: I/O Master 5
|
||||
DCD am_gpio_isr ; 12: GPIO
|
||||
DCD am_ctimer_isr ; 13: CTIMER
|
||||
DCD am_uart_isr ; 14: UART0
|
||||
DCD am_uart1_isr ; 15: UART1
|
||||
DCD am_adc_isr ; 16: ADC
|
||||
DCD am_pdm0_isr ; 17: PDM
|
||||
DCD am_stimer_isr ; 18: SYSTEM TIMER
|
||||
DCD am_stimer_cmpr0_isr ; 19: SYSTEM TIMER COMPARE0
|
||||
DCD am_stimer_cmpr1_isr ; 20: SYSTEM TIMER COMPARE1
|
||||
DCD am_stimer_cmpr2_isr ; 21: SYSTEM TIMER COMPARE2
|
||||
DCD am_stimer_cmpr3_isr ; 22: SYSTEM TIMER COMPARE3
|
||||
DCD am_stimer_cmpr4_isr ; 23: SYSTEM TIMER COMPARE4
|
||||
DCD am_stimer_cmpr5_isr ; 24: SYSTEM TIMER COMPARE5
|
||||
DCD am_stimer_cmpr6_isr ; 25: SYSTEM TIMER COMPARE6
|
||||
DCD am_stimer_cmpr7_isr ; 26: SYSTEM TIMER COMPARE7
|
||||
DCD am_flash_isr ; 27: FLASH
|
||||
DCD am_software0_isr ; 28: SOFTWARE0
|
||||
DCD am_software1_isr ; 29: SOFTWARE1
|
||||
DCD am_software2_isr ; 30: SOFTWARE2
|
||||
DCD am_software3_isr ; 31: SOFTWARE3
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; This is the code that gets called when the processor first starts execution
|
||||
; following a reset event.
|
||||
;
|
||||
;******************************************************************************
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
|
||||
;
|
||||
; Enable the FPU.
|
||||
;
|
||||
MOVW R0, #0xED88
|
||||
MOVT R0, #0xE000
|
||||
LDR R1, [R0]
|
||||
ORR R1, #0x00F00000
|
||||
STR R1, [R0]
|
||||
DSB
|
||||
ISB
|
||||
|
||||
;
|
||||
; Branch to main.
|
||||
;
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Weak Exception Handlers.
|
||||
;
|
||||
;******************************************************************************
|
||||
am_nmi_isr PROC
|
||||
EXPORT am_nmi_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_fault_isr\
|
||||
PROC
|
||||
EXPORT am_fault_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_memmanage_isr\
|
||||
PROC
|
||||
EXPORT am_memmanage_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_default_isr\
|
||||
PROC
|
||||
EXPORT am_svcall_isr [WEAK]
|
||||
EXPORT am_debugmon_isr [WEAK]
|
||||
EXPORT am_pendsv_isr [WEAK]
|
||||
EXPORT am_systick_isr [WEAK]
|
||||
EXPORT am_brownout_isr [WEAK]
|
||||
EXPORT am_adc_isr [WEAK]
|
||||
EXPORT am_watchdog_isr [WEAK]
|
||||
EXPORT am_clkgen_isr [WEAK]
|
||||
EXPORT am_vcomp_isr [WEAK]
|
||||
EXPORT am_ioslave_ios_isr [WEAK]
|
||||
EXPORT am_ioslave_acc_isr [WEAK]
|
||||
EXPORT am_iomaster0_isr [WEAK]
|
||||
EXPORT am_iomaster1_isr [WEAK]
|
||||
EXPORT am_iomaster2_isr [WEAK]
|
||||
EXPORT am_iomaster3_isr [WEAK]
|
||||
EXPORT am_iomaster4_isr [WEAK]
|
||||
EXPORT am_iomaster5_isr [WEAK]
|
||||
EXPORT am_gpio_isr [WEAK]
|
||||
EXPORT am_ctimer_isr [WEAK]
|
||||
EXPORT am_uart_isr [WEAK]
|
||||
EXPORT am_uart0_isr [WEAK]
|
||||
EXPORT am_uart1_isr [WEAK]
|
||||
EXPORT am_pdm0_isr [WEAK]
|
||||
EXPORT am_stimer_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr0_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr1_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr2_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr3_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr4_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr5_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr6_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr7_isr [WEAK]
|
||||
EXPORT am_flash_isr [WEAK]
|
||||
EXPORT am_software0_isr [WEAK]
|
||||
EXPORT am_software1_isr [WEAK]
|
||||
EXPORT am_software2_isr [WEAK]
|
||||
EXPORT am_software3_isr [WEAK]
|
||||
|
||||
am_svcall_isr
|
||||
am_debugmon_isr
|
||||
am_pendsv_isr
|
||||
am_systick_isr
|
||||
am_brownout_isr
|
||||
am_adc_isr
|
||||
am_watchdog_isr
|
||||
am_clkgen_isr
|
||||
am_vcomp_isr
|
||||
am_ioslave_ios_isr
|
||||
am_ioslave_acc_isr
|
||||
am_iomaster0_isr
|
||||
am_iomaster1_isr
|
||||
am_iomaster2_isr
|
||||
am_iomaster3_isr
|
||||
am_iomaster4_isr
|
||||
am_iomaster5_isr
|
||||
am_gpio_isr
|
||||
am_ctimer_isr
|
||||
am_uart_isr
|
||||
am_uart0_isr
|
||||
am_uart1_isr
|
||||
am_pdm0_isr
|
||||
am_stimer_isr
|
||||
am_stimer_cmpr0_isr
|
||||
am_stimer_cmpr1_isr
|
||||
am_stimer_cmpr2_isr
|
||||
am_stimer_cmpr3_isr
|
||||
am_stimer_cmpr4_isr
|
||||
am_stimer_cmpr5_isr
|
||||
am_stimer_cmpr6_isr
|
||||
am_stimer_cmpr7_isr
|
||||
am_flash_isr
|
||||
am_software0_isr
|
||||
am_software1_isr
|
||||
am_software2_isr
|
||||
am_software3_isr
|
||||
|
||||
; all device interrupts go here unless the weak label is over
|
||||
; ridden in the linker hard spin so the debugger will know it
|
||||
; was an unhandled interrupt request a come-from-buffer or
|
||||
; instruction trace hardware would sure be nice if you get here
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Initialization of the heap and stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; User Initial Stack & Heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
IF :DEF: __MICROLIB
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
ELSE
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap PROC
|
||||
LDR R0, =HeapMem
|
||||
LDR R1, =(StackMem + Stack)
|
||||
LDR R2, =(HeapMem + Heap)
|
||||
LDR R3, =StackMem
|
||||
BX LR
|
||||
|
||||
ENDP
|
||||
|
||||
ENDIF
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; All Done
|
||||
;
|
||||
;******************************************************************************
|
||||
END
|
||||
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file FreeRTOSConfig.h
|
||||
//!
|
||||
//! @brief Configuration options for FreeRTOS
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
|
||||
#ifdef AM_PART_APOLLO
|
||||
#define configCPU_CLOCK_HZ 24000000UL
|
||||
#else
|
||||
#define configCPU_CLOCK_HZ 48000000UL
|
||||
#endif
|
||||
#define configTICK_RATE_HZ 1000
|
||||
#define configMAX_PRIORITIES 4
|
||||
#define configMINIMAL_STACK_SIZE (256)
|
||||
#define configTOTAL_HEAP_SIZE (16 * 1024)
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
#define configUSE_MUTEXES 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 3
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Interrupt nesting behaviour configuration. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY (0x7 << 5)
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (0x4 << 5)
|
||||
|
||||
/* Define to trap errors during development. */
|
||||
#define configASSERT(x) if (( x ) == 0) while(1);
|
||||
|
||||
/* FreeRTOS MPU specific definitions. */
|
||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 0
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
#define vPortSVCHandler am_svcall_isr
|
||||
#define xPortPendSVHandler am_pendsv_isr
|
||||
#define xPortSysTickHandler am_systick_isr
|
||||
|
||||
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 // Enable non-SysTick based Tick
|
||||
#define configUSE_TICKLESS_IDLE 2 // Ambiq specific implementation for Tickless
|
||||
|
||||
#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
|
||||
extern uint32_t am_freertos_sleep(uint32_t);
|
||||
extern void am_freertos_wakeup(uint32_t);
|
||||
|
||||
#define configPRE_SLEEP_PROCESSING( time ) \
|
||||
do { \
|
||||
(time) = am_freertos_sleep(time); \
|
||||
} while (0);
|
||||
|
||||
#define configPOST_SLEEP_PROCESSING(time) am_freertos_wakeup(time)
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
#ifndef AM_PART_APOLLO
|
||||
#define AM_FREERTOS_USE_STIMER_FOR_TICK
|
||||
#endif
|
||||
|
||||
#ifdef AM_FREERTOS_USE_STIMER_FOR_TICK
|
||||
#define configSTIMER_CLOCK_HZ 32768
|
||||
#else // Use CTimer
|
||||
#define configCTIMER_CLOCK_HZ 32768
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FREERTOS_CONFIG_H
|
||||
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file freertos_amdtp.c
|
||||
//!
|
||||
//! @brief AMDTP example.
|
||||
//!
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This application has a large number of common include files. For
|
||||
// convenience, we'll collect them all together in a single header and include
|
||||
// that everywhere.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "ble_freertos_amdtpc.h"
|
||||
#include "ble_menu.h"
|
||||
#include "rtos.h"
|
||||
|
||||
#ifdef BLE_MENU
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART configuration settings.
|
||||
//
|
||||
//*****************************************************************************
|
||||
am_hal_uart_config_t g_sUartConfig =
|
||||
{
|
||||
.ui32BaudRate = 115200,
|
||||
.ui32DataBits = AM_HAL_UART_DATA_BITS_8,
|
||||
.bTwoStopBits = false,
|
||||
.ui32Parity = AM_HAL_UART_PARITY_NONE,
|
||||
.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE,
|
||||
};
|
||||
|
||||
void
|
||||
setup_serial(int32_t i32Module)
|
||||
{
|
||||
//
|
||||
// Make sure the UART RX and TX pins are enabled.
|
||||
//
|
||||
am_bsp_pin_enable(COM_UART_TX);
|
||||
am_bsp_pin_enable(COM_UART_RX);
|
||||
|
||||
//
|
||||
// Power on the selected UART
|
||||
//
|
||||
am_hal_uart_pwrctrl_enable(i32Module);
|
||||
|
||||
//
|
||||
// Start the UART interface, apply the desired configuration settings, and
|
||||
// enable the FIFOs.
|
||||
//
|
||||
am_hal_uart_clock_enable(i32Module);
|
||||
|
||||
//
|
||||
// Disable the UART before configuring it.
|
||||
//
|
||||
am_hal_uart_disable(i32Module);
|
||||
|
||||
//
|
||||
// Configure the UART.
|
||||
//
|
||||
am_hal_uart_config(i32Module, &g_sUartConfig);
|
||||
|
||||
//
|
||||
// Enable the UART FIFO.
|
||||
//
|
||||
am_hal_uart_fifo_config(i32Module,
|
||||
AM_HAL_UART_TX_FIFO_3_4 | AM_HAL_UART_RX_FIFO_3_4);
|
||||
|
||||
//
|
||||
// Enable the UART.
|
||||
//
|
||||
am_hal_uart_enable(i32Module);
|
||||
|
||||
#if defined(AM_PART_APOLLO)
|
||||
am_hal_interrupt_priority_set(AM_HAL_INTERRUPT_UART, configMAX_SYSCALL_INTERRUPT_PRIORITY);
|
||||
#else
|
||||
am_hal_interrupt_priority_set(AM_HAL_INTERRUPT_UART0, configMAX_SYSCALL_INTERRUPT_PRIORITY);
|
||||
#endif
|
||||
am_hal_uart_int_clear(i32Module, AM_HAL_UART_INT_RX | AM_HAL_UART_INT_RX_TMOUT);
|
||||
am_hal_uart_int_enable(i32Module, AM_HAL_UART_INT_RX | AM_HAL_UART_INT_RX_TMOUT);
|
||||
|
||||
am_hal_interrupt_enable(AM_HAL_INTERRUPT_UART);
|
||||
}
|
||||
|
||||
// buffer for printf
|
||||
static char g_prfbuf[AM_PRINTF_BUFSIZE];
|
||||
|
||||
uint32_t
|
||||
am_menu_printf(const char *pcFmt, ...)
|
||||
{
|
||||
uint32_t ui32NumChars;
|
||||
|
||||
//
|
||||
// Convert to the desired string.
|
||||
//
|
||||
va_list pArgs;
|
||||
va_start(pArgs, pcFmt);
|
||||
ui32NumChars = am_util_stdio_vsprintf(g_prfbuf, pcFmt, pArgs);
|
||||
va_end(pArgs);
|
||||
|
||||
//
|
||||
// This is where we print the buffer to the configured interface.
|
||||
//
|
||||
am_hal_uart_string_transmit_polled(AM_BSP_UART_PRINT_INST, g_prfbuf);
|
||||
|
||||
//
|
||||
// return the number of characters printed.
|
||||
//
|
||||
return ui32NumChars;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t
|
||||
am_menu_printf(const char *pcFmt, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable printing to the console.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
enable_print_interface(void)
|
||||
{
|
||||
//
|
||||
// Initialize a debug printing interface.
|
||||
//
|
||||
am_hal_itm_enable();
|
||||
am_bsp_debug_printf_enable();
|
||||
am_util_debug_printf_init(am_hal_itm_print);
|
||||
am_util_stdio_terminal_clear();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Main Function
|
||||
//
|
||||
//*****************************************************************************
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
//
|
||||
// Set the clock frequency
|
||||
//
|
||||
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
|
||||
|
||||
//
|
||||
// Set the default cache configuration
|
||||
//
|
||||
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
|
||||
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the floating point module, and configure the core for lazy
|
||||
// stacking.
|
||||
//
|
||||
am_hal_sysctrl_fpu_enable();
|
||||
am_hal_sysctrl_fpu_stacking_enable(true);
|
||||
#else
|
||||
am_hal_sysctrl_fpu_disable();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Configure the board for low power.
|
||||
//
|
||||
am_bsp_low_power_init();
|
||||
|
||||
// Turn off unused Flash & SRAM
|
||||
|
||||
#ifdef AM_PART_APOLLO
|
||||
//
|
||||
// SRAM bank power setting.
|
||||
// Need to match up with actual SRAM usage for the program
|
||||
// Current usage is between 32K and 40K - so disabling upper 3 banks
|
||||
//
|
||||
am_hal_mcuctrl_sram_power_set(AM_HAL_MCUCTRL_SRAM_POWER_DOWN_5 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_6 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_7,
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_5 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_6 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_7);
|
||||
|
||||
#if 0 // Not turning off the Flash as it may be needed to download the image
|
||||
//
|
||||
// Flash bank power set.
|
||||
//
|
||||
am_hal_mcuctrl_flash_power_set(AM_HAL_MCUCTRL_FLASH_POWER_DOWN_1);
|
||||
#endif
|
||||
#endif // AM_PART_APOLLO
|
||||
#ifdef AM_PART_APOLLO2
|
||||
#if 0 // Not turning off the Flash as it may be needed to download the image
|
||||
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_FLASH512K);
|
||||
#endif
|
||||
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM256K);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable printing to the console.
|
||||
//
|
||||
#ifdef AM_DEBUG_PRINTF
|
||||
enable_print_interface();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Initialize plotting interface.
|
||||
//
|
||||
am_util_debug_printf("FreeRTOS AMDTP Example\n");
|
||||
|
||||
#ifdef BLE_MENU
|
||||
setup_serial(0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Run the application.
|
||||
//
|
||||
run_tasks();
|
||||
|
||||
//
|
||||
// We shouldn't ever get here.
|
||||
//
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file freertos_amdtp.h
|
||||
//!
|
||||
//! @brief Global includes for the freertos_amdtpc app.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef FREERTOS_AMDTP_H
|
||||
#define FREERTOS_AMDTP_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Required built-ins.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Standard AmbiqSuite includes.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_bsp.h"
|
||||
#include "am_util.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// FreeRTOS include files.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "portmacro.h"
|
||||
#include "portable.h"
|
||||
#include "semphr.h"
|
||||
#include "event_groups.h"
|
||||
//#include "rtos.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Task include files.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "radio_task.h"
|
||||
|
||||
#endif // FREERTOS_AMDTP_H
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file hci_apollo_config.h
|
||||
//!
|
||||
//! @brief This file describes the physical aspects of the HCI conection.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
#include "am_bsp.h"
|
||||
|
||||
#ifndef HCI_APOLLO_CONFIG_H
|
||||
#define HCI_APOLLO_CONFIG_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Pin numbers and configuration.
|
||||
//
|
||||
// NOTE: RTS, CTS, and RESET are implemented as GPIOs, so no "CFG" field is
|
||||
// needed.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//#define HCI_APOLLO_POWER_PIN AM_BSP_GPIO_EM9304_POWER
|
||||
//#define HCI_APOLLO_POWER_CFG AM_BSP_GPIO_CFG_EM9304_POWER
|
||||
|
||||
#define HCI_APOLLO_RESET_PIN AM_BSP_GPIO_EM9304_RESET
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Other options.
|
||||
//
|
||||
// These options are provided in case your board setup is a little more
|
||||
// unusual. Most boards shouldn't need these features. If in doubt, leave all
|
||||
// of these features disabled.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define HCI_APOLLO_CFG_OVERRIDE_ISR 0 // Override the exactle UART ISR
|
||||
|
||||
#endif // HCI_APOLLO_CONFIG_H
|
||||
+399
@@ -0,0 +1,399 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file radio_task.c
|
||||
//!
|
||||
//! @brief Task to handle radio operation.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Global includes for this project.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "ble_freertos_amdtpc.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// WSF standard includes.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "wsf_types.h"
|
||||
#include "wsf_trace.h"
|
||||
#include "wsf_buf.h"
|
||||
#include "wsf_timer.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Includes for operating the ExactLE stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "hci_handler.h"
|
||||
#include "dm_handler.h"
|
||||
#include "l2c_handler.h"
|
||||
#include "att_handler.h"
|
||||
#include "smp_handler.h"
|
||||
#include "l2c_api.h"
|
||||
#include "att_api.h"
|
||||
#include "smp_api.h"
|
||||
#include "app_api.h"
|
||||
#include "hci_core.h"
|
||||
#include "hci_drv.h"
|
||||
#include "hci_drv_apollo.h"
|
||||
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_util.h"
|
||||
#include "am_bsp.h"
|
||||
|
||||
#include "hci_apollo_config.h"
|
||||
#include "wsf_msg.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Includes for the AMDTP profile.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "amdtp_api.h"
|
||||
#include "amdtpc_api.h"
|
||||
#include "app_ui.h"
|
||||
|
||||
#ifdef BLE_MENU
|
||||
#include "ble_menu.h"
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Radio task handle.
|
||||
//
|
||||
//*****************************************************************************
|
||||
TaskHandle_t radio_task_handle;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
void exactle_stack_init(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// WSF buffer pools.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WSF_BUF_POOLS 4
|
||||
|
||||
// Important note: the size of g_pui32BufMem should includes both overhead of internal
|
||||
// buffer management structure, wsfBufPool_t (up to 16 bytes for each pool), and pool
|
||||
// description (e.g. g_psPoolDescriptors below).
|
||||
|
||||
// Memory for the buffer pool
|
||||
// extra AMOTA_PACKET_SIZE bytes for OTA handling
|
||||
static uint32_t g_pui32BufMem[
|
||||
(WSF_BUF_POOLS*16
|
||||
+ 16*8 + 32*4 + 64*6 + 280*8) / sizeof(uint32_t)];
|
||||
|
||||
// Default pool descriptor.
|
||||
static wsfBufPoolDesc_t g_psPoolDescriptors[WSF_BUF_POOLS] =
|
||||
{
|
||||
{ 16, 8 },
|
||||
{ 32, 4 },
|
||||
{ 64, 6 },
|
||||
{ 280, 8 }
|
||||
};
|
||||
|
||||
wsfHandlerId_t g_bleDataReadyHandlerId;
|
||||
/*! Event types for ble rx data handler */
|
||||
#define BLE_DATA_READY_EVENT 0x01 /*! Trigger Rx data path */
|
||||
|
||||
#ifdef BLE_MENU
|
||||
wsfHandlerId_t g_uartDataReadyHandlerId;
|
||||
void uart_data_ready_handler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
|
||||
{
|
||||
BleMenuRx();
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Tracking variable for the scheduler timer.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void radio_timer_handler(void);
|
||||
|
||||
void ble_data_ready_handler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
|
||||
{
|
||||
if (FALSE == HciDataReadyISR())
|
||||
{
|
||||
// trigger event again to handle pending data from BLE controller
|
||||
WsfSetEvent(g_bleDataReadyHandlerId, BLE_DATA_READY_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Initialization for the ExactLE stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
exactle_stack_init(void)
|
||||
{
|
||||
wsfHandlerId_t handlerId;
|
||||
uint16_t wsfBufMemLen;
|
||||
//
|
||||
// Set up timers for the WSF scheduler.
|
||||
//
|
||||
WsfOsInit();
|
||||
WsfTimerInit();
|
||||
|
||||
//
|
||||
// Initialize a buffer pool for WSF dynamic memory needs.
|
||||
//
|
||||
wsfBufMemLen = WsfBufInit(sizeof(g_pui32BufMem), (uint8_t *)g_pui32BufMem, WSF_BUF_POOLS,
|
||||
g_psPoolDescriptors);
|
||||
|
||||
if (wsfBufMemLen > sizeof(g_pui32BufMem))
|
||||
{
|
||||
am_util_debug_printf("Memory pool is too small by %d\r\n",
|
||||
wsfBufMemLen - sizeof(g_pui32BufMem));
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the WSF security service.
|
||||
//
|
||||
SecInit();
|
||||
SecAesInit();
|
||||
SecCmacInit();
|
||||
SecEccInit();
|
||||
|
||||
//
|
||||
// Set up callback functions for the various layers of the ExactLE stack.
|
||||
//
|
||||
handlerId = WsfOsSetNextHandler(HciHandler);
|
||||
HciHandlerInit(handlerId);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(DmHandler);
|
||||
DmDevVsInit(0);
|
||||
DmAdvInit();
|
||||
DmScanInit();
|
||||
DmConnInit();
|
||||
DmConnMasterInit();
|
||||
DmSecInit();
|
||||
DmSecLescInit();
|
||||
DmPrivInit();
|
||||
DmHandlerInit(handlerId);
|
||||
|
||||
L2cInit();
|
||||
L2cMasterInit();
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AttHandler);
|
||||
AttHandlerInit(handlerId);
|
||||
AttsInit();
|
||||
AttsIndInit();
|
||||
AttcInit();
|
||||
|
||||
handlerId = WsfOsSetNextHandler(SmpHandler);
|
||||
SmpHandlerInit(handlerId);
|
||||
SmpiInit();
|
||||
SmpiScInit();
|
||||
HciSetMaxRxAclLen(251);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AppHandler);
|
||||
AppHandlerInit(handlerId);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AmdtpcHandler);
|
||||
AmdtpcHandlerInit(handlerId);
|
||||
|
||||
g_bleDataReadyHandlerId = WsfOsSetNextHandler(ble_data_ready_handler);
|
||||
|
||||
#ifdef BLE_MENU
|
||||
g_uartDataReadyHandlerId = WsfOsSetNextHandler(uart_data_ready_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the CTS pin
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
radio_cts_handler(void)
|
||||
{
|
||||
// Signal radio task to run
|
||||
|
||||
WsfTaskSetReady(0, 0);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the GPIO pins.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_gpio_isr(void)
|
||||
{
|
||||
uint64_t ui64Status;
|
||||
|
||||
//
|
||||
// Read and clear the GPIO interrupt status.
|
||||
//
|
||||
ui64Status = am_hal_gpio_int_status_get(false);
|
||||
am_hal_gpio_int_clear(ui64Status);
|
||||
|
||||
//
|
||||
// Check to see if this was a wakeup event from the BLE radio.
|
||||
//
|
||||
if ( ui64Status & AM_HAL_GPIO_BIT(AM_BSP_GPIO_EM9304_INT) )
|
||||
{
|
||||
WsfSetEvent(g_bleDataReadyHandlerId, BLE_DATA_READY_EVENT);
|
||||
}
|
||||
|
||||
//
|
||||
// Call the individual pin interrupt handlers for any pin that triggered an
|
||||
// interrupt.
|
||||
//
|
||||
am_hal_gpio_int_service(ui64Status);
|
||||
}
|
||||
|
||||
#ifdef BLE_MENU
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART interrupt handler.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_uart_isr(void)
|
||||
{
|
||||
uint32_t ui32Status;
|
||||
char rxData;
|
||||
|
||||
//
|
||||
// Check to see what caused this interrupt, then clear the bit from the
|
||||
// interrupt register.
|
||||
//
|
||||
ui32Status = am_hal_uart_int_status_get(0, false);
|
||||
am_hal_uart_int_clear(0, ui32Status);
|
||||
|
||||
//
|
||||
// Service the uart FIFO.
|
||||
//
|
||||
am_hal_uart_char_receive_polled(0, &rxData);
|
||||
|
||||
if ((rxData == '\n') || (rxData == '\r'))
|
||||
{
|
||||
wsfMsgHdr_t *pMsg;
|
||||
if ( (pMsg = WsfMsgAlloc(0)) != NULL )
|
||||
{
|
||||
WsfMsgSend(g_uartDataReadyHandlerId, pMsg);
|
||||
}
|
||||
// Send an event to the main radio task
|
||||
//
|
||||
radio_cts_handler();
|
||||
}
|
||||
else
|
||||
{
|
||||
menuRxData[menuRxDataLen++] = rxData;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Perform initial setup for the radio task.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
RadioTaskSetup(void)
|
||||
{
|
||||
am_util_debug_printf("RadioTask: setup\r\n");
|
||||
//
|
||||
// Boot the radio.
|
||||
//
|
||||
HciDrvRadioBoot(0);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Short Description.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
RadioTask(void *pvParameters)
|
||||
{
|
||||
am_hal_interrupt_priority_set(AM_HAL_INTERRUPT_GPIO, configMAX_SYSCALL_INTERRUPT_PRIORITY);
|
||||
//
|
||||
// Register an interrupt handler for BLE event
|
||||
//
|
||||
am_hal_gpio_int_register(AM_BSP_GPIO_EM9304_INT, radio_cts_handler);
|
||||
|
||||
#if WSF_TRACE_ENABLED == TRUE
|
||||
//
|
||||
// Enable ITM
|
||||
//
|
||||
am_util_debug_printf("Starting wicentric trace:\n\n");
|
||||
#endif
|
||||
|
||||
//
|
||||
// Initialize the main ExactLE stack.
|
||||
//
|
||||
exactle_stack_init();
|
||||
|
||||
//
|
||||
// Enable BLE data ready interrupt
|
||||
//
|
||||
am_hal_interrupt_enable(AM_HAL_INTERRUPT_GPIO);
|
||||
|
||||
//
|
||||
// Start the "Amdtp" profile.
|
||||
//
|
||||
AmdtpcStart();
|
||||
|
||||
while (1)
|
||||
{
|
||||
//
|
||||
// Calculate the elapsed time from our free-running timer, and update
|
||||
// the software timers in the WSF scheduler.
|
||||
//
|
||||
wsfOsDispatcher();
|
||||
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file radio_task.h
|
||||
//!
|
||||
//! @brief Functions and variables related to the radio task.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef RADIO_TASK_H
|
||||
#define RADIO_TASK_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Radio task handle.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern TaskHandle_t radio_task_handle;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// External function definitions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void RadioTaskSetup(void);
|
||||
extern void RadioTask(void *pvParameters);
|
||||
|
||||
#endif // RADIO_TASK_H
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file rtos.c
|
||||
//!
|
||||
//! @brief Essential functions to make the RTOS run correctly.
|
||||
//!
|
||||
//! These functions are required by the RTOS for ticking, sleeping, and basic
|
||||
//! error checking.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_bsp.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "portmacro.h"
|
||||
#include "portable.h"
|
||||
#include "ble_freertos_amdtpc.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Task handle for the initial setup task.
|
||||
//
|
||||
//*****************************************************************************
|
||||
TaskHandle_t xSetupTask;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the CTIMER module.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_ctimer_isr(void)
|
||||
{
|
||||
uint32_t ui32Status;
|
||||
|
||||
//
|
||||
// Check the timer interrupt status.
|
||||
//
|
||||
ui32Status = am_hal_ctimer_int_status_get(false);
|
||||
am_hal_ctimer_int_clear(ui32Status);
|
||||
|
||||
//
|
||||
// Run handlers for the various possible timer events.
|
||||
//
|
||||
am_hal_ctimer_int_service(ui32Status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Sleep function called from FreeRTOS IDLE task.
|
||||
// Do necessary application specific Power down operations here
|
||||
// Return 0 if this function also incorporates the WFI, else return value same
|
||||
// as idleTime
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t am_freertos_sleep(uint32_t idleTime)
|
||||
{
|
||||
am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Recovery function called from FreeRTOS IDLE task, after waking up from Sleep
|
||||
// Do necessary 'wakeup' operations here, e.g. to power up/enable peripherals etc.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void am_freertos_wakeup(uint32_t idleTime)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// FreeRTOS debugging functions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
vApplicationMallocFailedHook(void)
|
||||
{
|
||||
//
|
||||
// Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
// free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
// internally by FreeRTOS API functions that create tasks, queues, software
|
||||
// timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
// configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
|
||||
//
|
||||
while (1);
|
||||
}
|
||||
|
||||
void
|
||||
vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName)
|
||||
{
|
||||
(void) pcTaskName;
|
||||
(void) pxTask;
|
||||
|
||||
//
|
||||
// Run time stack overflow checking is performed if
|
||||
// configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
// function is called if a stack overflow is detected.
|
||||
//
|
||||
while (1)
|
||||
{
|
||||
__asm("BKPT #0\n") ; // Break into the debugger
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// High priority task to run immediately after the scheduler starts.
|
||||
//
|
||||
// This task is used for any global initialization that must occur after the
|
||||
// scheduler starts, but before any functional tasks are running. This can be
|
||||
// useful for enabling events, semaphores, and other global, RTOS-specific
|
||||
// features.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
setup_task(void *pvParameters)
|
||||
{
|
||||
//
|
||||
// Print a debug message.
|
||||
//
|
||||
am_util_debug_printf("Running setup tasks...\r\n");
|
||||
|
||||
//
|
||||
// Run setup functions.
|
||||
//
|
||||
RadioTaskSetup();
|
||||
|
||||
//
|
||||
// Create the functional tasks
|
||||
//
|
||||
xTaskCreate(RadioTask, "RadioTask", 512, 0, 3, &radio_task_handle);
|
||||
//
|
||||
// The setup operations are complete, so suspend the setup task now.
|
||||
//
|
||||
vTaskSuspend(NULL);
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Initializes all tasks
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
run_tasks(void)
|
||||
{
|
||||
//
|
||||
// Set some interrupt priorities before we create tasks or start the scheduler.
|
||||
//
|
||||
// Note: Timer priority is handled by the FreeRTOS kernel, so we won't
|
||||
// touch it here.
|
||||
//
|
||||
|
||||
//
|
||||
// Create essential tasks.
|
||||
//
|
||||
xTaskCreate(setup_task, "Setup", 512, 0, 3, &xSetupTask);
|
||||
|
||||
|
||||
//
|
||||
// Start the scheduler.
|
||||
//
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file rtos.h
|
||||
//!
|
||||
//! @brief Essential functions to make the RTOS run
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef RTOS_H
|
||||
#define RTOS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
// External variable definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// External function definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
void run_tasks(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RTOS_H
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for compiling
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
# Include rules specific to this board
|
||||
-include ../../board-defs.mk
|
||||
-include example-defs.mk
|
||||
|
||||
# All makefiles use this to find the top level directory.
|
||||
SWROOT?=../../../..
|
||||
|
||||
# Include rules for building generic examples.
|
||||
include $(SWROOT)/makedefs/example.mk
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
Name:
|
||||
=====
|
||||
freertos_amdtp
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
AMDTP example.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
******************************************************************************
|
||||
|
||||
|
||||
+409
@@ -0,0 +1,409 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtps
|
||||
COMPILERNAME := gcc
|
||||
PROJECT := ble_freertos_amdtps_gcc
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Setup ####
|
||||
|
||||
TOOLCHAIN ?= arm-none-eabi
|
||||
PART = apollo2
|
||||
CPU = cortex-m4
|
||||
FPU = fpv4-sp-d16
|
||||
#FABI = softfp
|
||||
FABI = hard
|
||||
|
||||
LINKER_FILE := ./ble_freertos_amdtps.ld
|
||||
STARTUP_FILE := ./startup_$(COMPILERNAME).c
|
||||
|
||||
#### Required Executables ####
|
||||
CC = $(TOOLCHAIN)-gcc
|
||||
GCC = $(TOOLCHAIN)-gcc
|
||||
CPP = $(TOOLCHAIN)-cpp
|
||||
LD = $(TOOLCHAIN)-ld
|
||||
CP = $(TOOLCHAIN)-objcopy
|
||||
OD = $(TOOLCHAIN)-objdump
|
||||
RD = $(TOOLCHAIN)-readelf
|
||||
AR = $(TOOLCHAIN)-ar
|
||||
SIZE = $(TOOLCHAIN)-size
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
EXECUTABLES = CC LD CP OD AR RD SIZE GCC
|
||||
K := $(foreach exec,$(EXECUTABLES),\
|
||||
$(if $(shell which $($(exec)) 2>/dev/null),,\
|
||||
$(info $(exec) not found on PATH ($($(exec))).)$(exec)))
|
||||
$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
|
||||
|
||||
ifneq ($(strip $(value K)),)
|
||||
all clean:
|
||||
$(info Tools $(TOOLCHAIN)-$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
DEFINES = -DPART_$(PART)
|
||||
DEFINES+= -DAM_FREERTOS
|
||||
DEFINES+= -DAM_DEBUG_PRINTF
|
||||
DEFINES+= -DAM_PART_APOLLO2
|
||||
DEFINES+= -DAM_PACKAGE_BGA
|
||||
DEFINES+= -DSEC_ECC_CFG=SEC_ECC_CFG_UECC
|
||||
DEFINES+= -DWSF_TRACE_ENABLED
|
||||
DEFINES+= -Dgcc
|
||||
|
||||
INCLUDES = -I../../../../../third_party/FreeRTOSv10.1.1/Source/include
|
||||
INCLUDES+= -I../../../../../devices
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
INCLUDES+= -I../../../../../third_party/uecc
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/util
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
INCLUDES+= -I../../../../../ambiq_ble/profiles/amdtpcommon
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/uribeacon
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
INCLUDES+= -I../../../../../ambiq_ble/apps/amdtps
|
||||
INCLUDES+= -I../../../../../mcu/apollo2
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/include
|
||||
INCLUDES+= -I../../../../../ambiq_ble/profiles/amdtps
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/include/app
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
INCLUDES+= -I../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
INCLUDES+= -I../../../../../utils
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
INCLUDES+= -I../../../../../ambiq_ble/em9304
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
INCLUDES+= -I../../../bsp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
INCLUDES+= -I../../../../../ambiq_ble/services
|
||||
INCLUDES+= -I../src
|
||||
|
||||
VPATH = ../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
VPATH+=:../../../../../devices
|
||||
VPATH+=:../../../../../ambiq_ble/profiles/amdtps
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
VPATH+=:../../../../../third_party/uecc
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/util
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/MemMang
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
VPATH+=:../../../../../utils
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
VPATH+=:../../../../../ambiq_ble/em9304
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/app/common
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/hidapp
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source
|
||||
VPATH+=:../../../../../ambiq_ble/profiles/amdtpcommon
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/uecc
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
VPATH+=:../../../../../ambiq_ble/apps/amdtps
|
||||
VPATH+=:../../../../../ambiq_ble/services
|
||||
VPATH+=:../src
|
||||
|
||||
SRC = attc_disc.c
|
||||
SRC += attc_main.c
|
||||
SRC += attc_proc.c
|
||||
SRC += attc_read.c
|
||||
SRC += attc_sign.c
|
||||
SRC += attc_write.c
|
||||
SRC += atts_ccc.c
|
||||
SRC += atts_csf.c
|
||||
SRC += atts_dyn.c
|
||||
SRC += atts_ind.c
|
||||
SRC += atts_main.c
|
||||
SRC += atts_proc.c
|
||||
SRC += atts_read.c
|
||||
SRC += atts_sign.c
|
||||
SRC += atts_write.c
|
||||
SRC += att_main.c
|
||||
SRC += att_uuid.c
|
||||
SRC += amdtps_main.c
|
||||
SRC += dm_adv.c
|
||||
SRC += dm_adv_ae.c
|
||||
SRC += dm_adv_leg.c
|
||||
SRC += dm_conn.c
|
||||
SRC += dm_conn_cte.c
|
||||
SRC += dm_conn_master.c
|
||||
SRC += dm_conn_master_ae.c
|
||||
SRC += dm_conn_master_leg.c
|
||||
SRC += dm_conn_slave.c
|
||||
SRC += dm_conn_slave_ae.c
|
||||
SRC += dm_conn_slave_leg.c
|
||||
SRC += dm_conn_sm.c
|
||||
SRC += dm_dev.c
|
||||
SRC += dm_dev_priv.c
|
||||
SRC += dm_main.c
|
||||
SRC += dm_past.c
|
||||
SRC += dm_phy.c
|
||||
SRC += dm_priv.c
|
||||
SRC += dm_scan.c
|
||||
SRC += dm_scan_ae.c
|
||||
SRC += dm_scan_leg.c
|
||||
SRC += dm_sec.c
|
||||
SRC += dm_sec_lesc.c
|
||||
SRC += dm_sec_master.c
|
||||
SRC += dm_sec_slave.c
|
||||
SRC += dm_sync_ae.c
|
||||
SRC += uECC.c
|
||||
SRC += uECC_ll.c
|
||||
SRC += bda.c
|
||||
SRC += bstream.c
|
||||
SRC += calc128.c
|
||||
SRC += crc32.c
|
||||
SRC += print.c
|
||||
SRC += terminal.c
|
||||
SRC += wstr.c
|
||||
SRC += bas_main.c
|
||||
SRC += hci_drv_em9304.c
|
||||
SRC += port.c
|
||||
SRC += sec_aes.c
|
||||
SRC += sec_aes_rev.c
|
||||
SRC += sec_ccm_hci.c
|
||||
SRC += sec_cmac_hci.c
|
||||
SRC += sec_ecc_debug.c
|
||||
SRC += sec_ecc_hci.c
|
||||
SRC += sec_main.c
|
||||
SRC += l2c_coc.c
|
||||
SRC += l2c_main.c
|
||||
SRC += l2c_master.c
|
||||
SRC += l2c_slave.c
|
||||
SRC += em9304_init.c
|
||||
SRC += em9304_patches.c
|
||||
SRC += app_db.c
|
||||
SRC += app_hw.c
|
||||
SRC += app_ui.c
|
||||
SRC += ui_console.c
|
||||
SRC += ui_lcd.c
|
||||
SRC += ui_main.c
|
||||
SRC += ui_platform.c
|
||||
SRC += ui_timer.c
|
||||
SRC += hidapp_main.c
|
||||
SRC += gatt_main.c
|
||||
SRC += hid_main.c
|
||||
SRC += amdtp_common.c
|
||||
SRC += smpi_act.c
|
||||
SRC += smpi_sc_act.c
|
||||
SRC += smpi_sc_sm.c
|
||||
SRC += smpi_sm.c
|
||||
SRC += smpr_act.c
|
||||
SRC += smpr_sc_act.c
|
||||
SRC += smpr_sc_sm.c
|
||||
SRC += smpr_sm.c
|
||||
SRC += smp_act.c
|
||||
SRC += smp_db.c
|
||||
SRC += smp_main.c
|
||||
SRC += smp_non.c
|
||||
SRC += smp_sc_act.c
|
||||
SRC += smp_sc_main.c
|
||||
SRC += hci_cmd.c
|
||||
SRC += hci_cmd_ae.c
|
||||
SRC += hci_cmd_cte.c
|
||||
SRC += hci_cmd_past.c
|
||||
SRC += hci_cmd_phy.c
|
||||
SRC += hci_core.c
|
||||
SRC += hci_core_ps.c
|
||||
SRC += hci_evt.c
|
||||
SRC += hci_tr.c
|
||||
SRC += hci_vs.c
|
||||
SRC += hci_vs_ae.c
|
||||
SRC += gap_main.c
|
||||
SRC += sec_ecc.c
|
||||
SRC += wsf_assert.c
|
||||
SRC += wsf_buf.c
|
||||
SRC += wsf_efs.c
|
||||
SRC += wsf_math.c
|
||||
SRC += wsf_msg.c
|
||||
SRC += wsf_os.c
|
||||
SRC += wsf_queue.c
|
||||
SRC += wsf_timer.c
|
||||
SRC += wsf_trace.c
|
||||
SRC += hci_main.c
|
||||
SRC += cfg_stack.c
|
||||
SRC += amdtp_main.c
|
||||
SRC += svc_amdtp.c
|
||||
SRC += svc_amotas.c
|
||||
SRC += svc_amvole.c
|
||||
SRC += ble_freertos_amdtps.c
|
||||
SRC += radio_task.c
|
||||
SRC += rtos.c
|
||||
SRC += app_disc.c
|
||||
SRC += app_main.c
|
||||
SRC += app_master.c
|
||||
SRC += app_master_leg.c
|
||||
SRC += app_server.c
|
||||
SRC += app_slave.c
|
||||
SRC += app_slave_leg.c
|
||||
SRC += app_terminal.c
|
||||
SRC += event_groups.c
|
||||
SRC += list.c
|
||||
SRC += queue.c
|
||||
SRC += tasks.c
|
||||
SRC += timers.c
|
||||
SRC += svc_batt.c
|
||||
SRC += svc_bps.c
|
||||
SRC += svc_core.c
|
||||
SRC += svc_cps.c
|
||||
SRC += svc_cscs.c
|
||||
SRC += svc_dis.c
|
||||
SRC += svc_gls.c
|
||||
SRC += svc_gyro.c
|
||||
SRC += svc_hid.c
|
||||
SRC += svc_hrs.c
|
||||
SRC += svc_hts.c
|
||||
SRC += svc_ipss.c
|
||||
SRC += svc_plxs.c
|
||||
SRC += svc_px.c
|
||||
SRC += svc_rscs.c
|
||||
SRC += svc_scpss.c
|
||||
SRC += svc_temp.c
|
||||
SRC += svc_uricfg.c
|
||||
SRC += svc_wdxs.c
|
||||
SRC += svc_wp.c
|
||||
SRC += svc_wss.c
|
||||
SRC += am_util_debug.c
|
||||
SRC += am_util_delay.c
|
||||
SRC += am_util_faultisr.c
|
||||
SRC += am_util_stdio.c
|
||||
SRC += am_devices_button.c
|
||||
SRC += am_devices_em9304.c
|
||||
SRC += am_devices_led.c
|
||||
SRC += heap_2.c
|
||||
SRC += startup_gcc.c
|
||||
|
||||
CSRC = $(filter %.c,$(SRC))
|
||||
ASRC = $(filter %.s,$(SRC))
|
||||
|
||||
OBJS = $(CSRC:%.c=$(CONFIG)/%.o)
|
||||
OBJS+= $(ASRC:%.s=$(CONFIG)/%.o)
|
||||
|
||||
DEPS = $(CSRC:%.c=$(CONFIG)/%.d)
|
||||
DEPS+= $(ASRC:%.s=$(CONFIG)/%.d)
|
||||
|
||||
LIBS = ../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a
|
||||
LIBS += ../../../bsp/gcc/bin/libam_bsp.a
|
||||
|
||||
CFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
CFLAGS+= -ffunction-sections -fdata-sections -fomit-frame-pointer
|
||||
CFLAGS+= -MMD -MP -std=c99 -Wall -g
|
||||
CFLAGS+= -O0
|
||||
CFLAGS+= $(DEFINES)
|
||||
CFLAGS+= $(INCLUDES)
|
||||
CFLAGS+=
|
||||
|
||||
LFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
LFLAGS+= -nostartfiles -static
|
||||
LFLAGS+= -Wl,--gc-sections,--entry,am_reset_isr,-Map,$(CONFIG)/$(TARGET).map
|
||||
LFLAGS+= -Wl,--start-group -lm -lc -lgcc $(LIBS) -Wl,--end-group
|
||||
LFLAGS+=
|
||||
|
||||
# Additional user specified CFLAGS
|
||||
CFLAGS+=$(EXTRA_CFLAGS)
|
||||
|
||||
CPFLAGS = -Obinary
|
||||
|
||||
ODFLAGS = -S
|
||||
|
||||
#### Rules ####
|
||||
all: directories $(CONFIG)/$(TARGET).bin
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
$(CONFIG)/%.o: %.c $(CONFIG)/%.d
|
||||
@echo " Compiling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/%.o: %.s $(CONFIG)/%.d
|
||||
@echo " Assembling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/$(TARGET).axf: $(OBJS) $(LIBS)
|
||||
@echo " Linking $(COMPILERNAME) $@" ;\
|
||||
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
|
||||
|
||||
$(CONFIG)/$(TARGET).bin: $(CONFIG)/$(TARGET).axf
|
||||
@echo " Copying $(COMPILERNAME) $@..." ;\
|
||||
$(CP) $(CPFLAGS) $< $@ ;\
|
||||
$(OD) $(ODFLAGS) $< > $(CONFIG)/$(TARGET).lst
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..." ;\
|
||||
$(RM) -f $(OBJS) $(DEPS) \
|
||||
$(CONFIG)/$(TARGET).bin $(CONFIG)/$(TARGET).axf \
|
||||
$(CONFIG)/$(TARGET).lst $(CONFIG)/$(TARGET).map
|
||||
|
||||
$(CONFIG)/%.d: ;
|
||||
|
||||
../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/gcc/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
# Automatically include any generated dependencies
|
||||
-include $(DEPS)
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* ble_freertos_amdtps.ld - Linker script for applications using startup_gnu.c
|
||||
*
|
||||
*****************************************************************************/
|
||||
ENTRY(am_reset_isr)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text)
|
||||
*(.text*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > FLASH
|
||||
|
||||
/* User stack section initialized by startup code. */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack)
|
||||
*(.stack*)
|
||||
. = ALIGN(8);
|
||||
} > SRAM
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
*(.data)
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} > SRAM AT>FLASH
|
||||
|
||||
/* used by startup to initialize data */
|
||||
_init_data = LOADADDR(.data);
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} > SRAM
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_gcc.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of interrupt handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void am_reset_isr(void) __attribute ((naked));
|
||||
extern void am_nmi_isr(void) __attribute ((weak));
|
||||
extern void am_fault_isr(void) __attribute ((weak));
|
||||
extern void am_mpufault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_busfault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_usagefault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_svcall_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_debugmon_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pendsv_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_systick_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_brownout_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_watchdog_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_clkgen_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_vcomp_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_ios_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_acc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_gpio_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ctimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_adc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pdm0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr6_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr7_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_flash_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_default_isr(void) __attribute ((weak));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int main(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".stack")))
|
||||
static uint32_t g_pui32Stack[0xac0];
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_am_pfnVectors[])(void) =
|
||||
{
|
||||
(void (*)(void))((uint32_t)g_pui32Stack + sizeof(g_pui32Stack)),
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART
|
||||
am_uart1_isr, // 15: UART
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: SYSTEM TIMER
|
||||
am_stimer_cmpr0_isr, // 19: SYSTEM TIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: SYSTEM TIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: SYSTEM TIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: SYSTEM TIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: SYSTEM TIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: SYSTEM TIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: SYSTEM TIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: SYSTEM TIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are constructs created by the linker, indicating where the
|
||||
// the "data" and "bss" segments reside in memory. The initializers for the
|
||||
// "data" segment resides immediately following the "text" segment.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t _etext;
|
||||
extern uint32_t _sdata;
|
||||
extern uint32_t _edata;
|
||||
extern uint32_t _sbss;
|
||||
extern uint32_t _ebss;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined(__GNUC_STDC_INLINE__)
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Set the vector table pointer.
|
||||
//
|
||||
__asm(" ldr r0, =0xE000ED08\n"
|
||||
" ldr r1, =g_am_pfnVectors\n"
|
||||
" str r1, [r0]");
|
||||
|
||||
//
|
||||
// Set the stack pointer.
|
||||
//
|
||||
__asm(" ldr sp, [r1]");
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the FPU.
|
||||
//
|
||||
__asm("ldr r0, =0xE000ED88\n"
|
||||
"ldr r1,[r0]\n"
|
||||
"orr r1,#(0xF << 20)\n"
|
||||
"str r1,[r0]\n"
|
||||
"dsb\n"
|
||||
"isb\n");
|
||||
#endif
|
||||
//
|
||||
// Copy the data segment initializers from flash to SRAM.
|
||||
//
|
||||
__asm(" ldr r0, =_init_data\n"
|
||||
" ldr r1, =_sdata\n"
|
||||
" ldr r2, =_edata\n"
|
||||
"copy_loop:\n"
|
||||
" ldr r3, [r0], #4\n"
|
||||
" str r3, [r1], #4\n"
|
||||
" cmp r1, r2\n"
|
||||
" blt copy_loop\n");
|
||||
//
|
||||
// Zero fill the bss segment.
|
||||
//
|
||||
__asm(" ldr r0, =_sbss\n"
|
||||
" ldr r1, =_ebss\n"
|
||||
" mov r2, #0\n"
|
||||
"zero_loop:\n"
|
||||
" cmp r0, r1\n"
|
||||
" it lt\n"
|
||||
" strlt r2, [r0], #4\n"
|
||||
" blt zero_loop");
|
||||
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
main();
|
||||
|
||||
//
|
||||
// If main returns then execute a break point instruction
|
||||
//
|
||||
__asm(" bkpt ");
|
||||
}
|
||||
#else
|
||||
#error GNU STDC inline not supported.
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtps
|
||||
COMPILERNAME := iar
|
||||
PROJECT := ble_freertos_amdtps_iar
|
||||
CONFIG := bin
|
||||
AM_SoftwareRoot ?= ../../../..
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p IarBuild.exe)
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
IarBuild.exe ble_freertos_amdtps.ewp -make Debug -log info
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
IarBuild.exe ble_freertos_amdtps.ewp -clean Debug -log all
|
||||
|
||||
|
||||
../../../bsp/iar/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
../../../../../mcu/apollo2/hal/iar/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+63486
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+2810
File diff suppressed because it is too large
Load Diff
+2663
File diff suppressed because it is too large
Load Diff
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\ble_freertos_amdtps.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ble_freertos_amdtps.icf
|
||||
//
|
||||
// IAR linker Configuration File
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Define a memory section that covers the entire 4 GB addressable space of the
|
||||
// processor. (32-bit can address up to 4GB)
|
||||
//
|
||||
define memory mem with size = 4G;
|
||||
|
||||
//
|
||||
// Define a region for the flash.
|
||||
//
|
||||
define region FLASH = mem:[from 0x00000000 to 0x00100000];
|
||||
|
||||
//
|
||||
// Define a region for the SRAM.
|
||||
//
|
||||
define region SRAM = mem:[from 0x10000000 to 0x10040000];
|
||||
|
||||
//
|
||||
// Define a block for the heap.
|
||||
//
|
||||
define block HEAP with alignment = 0x8, size = 0x00000000 { };
|
||||
|
||||
//
|
||||
// Define a block for the stack.
|
||||
//
|
||||
define block CSTACK with alignment = 0x8, size = 0xac0 { };
|
||||
|
||||
//
|
||||
// Read/Write values should be initialized by copying from flash.
|
||||
//
|
||||
initialize by copy { readwrite };
|
||||
|
||||
//
|
||||
// Indicate that the noinit values should be left alone.
|
||||
//
|
||||
do not initialize { section .noinit };
|
||||
|
||||
//
|
||||
// Place the interrupt vectors at the start of flash.
|
||||
//
|
||||
place at start of FLASH { readonly section .intvec };
|
||||
|
||||
//
|
||||
// Place the remainder of the read-only items into flash.
|
||||
//
|
||||
place in FLASH { readonly };
|
||||
|
||||
//
|
||||
// Place the stack at the start of SRAM.
|
||||
//
|
||||
place at start of SRAM { block CSTACK, section .noinit };
|
||||
|
||||
//
|
||||
// Place all read/write items into SRAM.
|
||||
//
|
||||
place in SRAM { block HEAP, readwrite };
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_iar.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable the IAR extensions for this source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma language = extended
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Weak function links.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma weak am_mpufault_isr = am_fault_isr
|
||||
#pragma weak am_busfault_isr = am_fault_isr
|
||||
#pragma weak am_usagefault_isr = am_fault_isr
|
||||
#pragma weak am_svcall_isr = am_default_isr
|
||||
#pragma weak am_debugmon_isr = am_default_isr
|
||||
#pragma weak am_pendsv_isr = am_default_isr
|
||||
#pragma weak am_systick_isr = am_default_isr
|
||||
#pragma weak am_brownout_isr = am_default_isr
|
||||
#pragma weak am_watchdog_isr = am_default_isr
|
||||
#pragma weak am_clkgen_isr = am_default_isr
|
||||
#pragma weak am_vcomp_isr = am_default_isr
|
||||
#pragma weak am_ioslave_ios_isr = am_default_isr
|
||||
#pragma weak am_ioslave_acc_isr = am_default_isr
|
||||
#pragma weak am_iomaster0_isr = am_default_isr
|
||||
#pragma weak am_iomaster1_isr = am_default_isr
|
||||
#pragma weak am_iomaster2_isr = am_default_isr
|
||||
#pragma weak am_iomaster3_isr = am_default_isr
|
||||
#pragma weak am_iomaster4_isr = am_default_isr
|
||||
#pragma weak am_iomaster5_isr = am_default_isr
|
||||
#pragma weak am_gpio_isr = am_default_isr
|
||||
#pragma weak am_ctimer_isr = am_default_isr
|
||||
#pragma weak am_uart_isr = am_default_isr
|
||||
#pragma weak am_uart1_isr = am_default_isr
|
||||
#pragma weak am_adc_isr = am_default_isr
|
||||
#pragma weak am_pdm0_isr = am_default_isr
|
||||
#pragma weak am_stimer_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr0_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr1_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr2_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr3_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr4_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr5_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr6_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr7_isr = am_default_isr
|
||||
#pragma weak am_flash_isr = am_default_isr
|
||||
#pragma weak am_software0_isr = am_default_isr
|
||||
#pragma weak am_software1_isr = am_default_isr
|
||||
#pragma weak am_software2_isr = am_default_isr
|
||||
#pragma weak am_software3_isr = am_default_isr
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the default fault handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __stackless void am_reset_isr(void);
|
||||
extern __weak void am_nmi_isr(void);
|
||||
extern __weak void am_fault_isr(void);
|
||||
extern void am_mpufault_isr(void);
|
||||
extern void am_busfault_isr(void);
|
||||
extern void am_usagefault_isr(void);
|
||||
extern void am_svcall_isr(void);
|
||||
extern void am_debugmon_isr(void);
|
||||
extern void am_pendsv_isr(void);
|
||||
extern void am_systick_isr(void);
|
||||
extern void am_brownout_isr(void);
|
||||
extern void am_watchdog_isr(void);
|
||||
extern void am_clkgen_isr(void);
|
||||
extern void am_vcomp_isr(void);
|
||||
extern void am_ioslave_ios_isr(void);
|
||||
extern void am_ioslave_acc_isr(void);
|
||||
extern void am_iomaster0_isr(void);
|
||||
extern void am_iomaster1_isr(void);
|
||||
extern void am_iomaster2_isr(void);
|
||||
extern void am_iomaster3_isr(void);
|
||||
extern void am_iomaster4_isr(void);
|
||||
extern void am_iomaster5_isr(void);
|
||||
extern void am_gpio_isr(void);
|
||||
extern void am_ctimer_isr(void);
|
||||
extern void am_uart_isr(void);
|
||||
extern void am_uart1_isr(void);
|
||||
extern void am_adc_isr(void);
|
||||
extern void am_pdm0_isr(void);
|
||||
extern void am_stimer_isr(void);
|
||||
extern void am_stimer_cmpr0_isr(void);
|
||||
extern void am_stimer_cmpr1_isr(void);
|
||||
extern void am_stimer_cmpr2_isr(void);
|
||||
extern void am_stimer_cmpr3_isr(void);
|
||||
extern void am_stimer_cmpr4_isr(void);
|
||||
extern void am_stimer_cmpr5_isr(void);
|
||||
extern void am_stimer_cmpr6_isr(void);
|
||||
extern void am_stimer_cmpr7_isr(void);
|
||||
extern void am_flash_isr(void);
|
||||
extern void am_software0_isr(void);
|
||||
extern void am_software1_isr(void);
|
||||
extern void am_software2_isr(void);
|
||||
extern void am_software3_isr(void);
|
||||
|
||||
extern void am_default_isr(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application startup code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void __iar_program_start(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t pui32Stack[0xac0] @ ".noinit";
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// A union that describes the entries of the vector table. The union is needed
|
||||
// since the first entry is the stack pointer and the remainder are function
|
||||
// pointers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef union
|
||||
{
|
||||
void (*pfnHandler)(void);
|
||||
uint32_t ui32Ptr;
|
||||
}
|
||||
uVectorEntry;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__root const uVectorEntry __vector_table[] @ ".intvec" =
|
||||
{
|
||||
{ .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) },
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART0
|
||||
am_uart1_isr, // 15: UART1
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: STIMER
|
||||
am_stimer_cmpr0_isr, // 19: STIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: STIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: STIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: STIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: STIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: STIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: STIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: STIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Note - The template for this function is originally found in IAR's module,
|
||||
// low_level_init.c. As supplied by IAR, it is an empty function.
|
||||
//
|
||||
// This module contains the function `__low_level_init', a function
|
||||
// that is called before the `main' function of the program. Normally
|
||||
// low-level initializations - such as setting the prefered interrupt
|
||||
// level or setting the watchdog - can be performed here.
|
||||
//
|
||||
// Note that this function is called before the data segments are
|
||||
// initialized, this means that this function cannot rely on the
|
||||
// values of global or static variables.
|
||||
//
|
||||
// When this function returns zero, the startup code will inhibit the
|
||||
// initialization of the data segments. The result is faster startup,
|
||||
// the drawback is that neither global nor static data will be
|
||||
// initialized.
|
||||
//
|
||||
// Copyright 1999-2017 IAR Systems AB.
|
||||
//
|
||||
// $Revision: 112610 $
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AM_REGVAL(x) (*((volatile uint32_t *)(x)))
|
||||
#define VTOR_ADDR 0xE000ED08
|
||||
|
||||
__interwork int __low_level_init(void)
|
||||
{
|
||||
|
||||
AM_REGVAL(VTOR_ADDR) = (uint32_t)&__vector_table;
|
||||
|
||||
/*==================================*/
|
||||
/* Choose if segment initialization */
|
||||
/* should be done or not. */
|
||||
/* Return: 0 to omit seg_init */
|
||||
/* 1 to run seg_init */
|
||||
/*==================================*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
__iar_program_start();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Name: Dbg_RAM.ini
|
||||
* Purpose: RAM Debug Initialization File
|
||||
* Note(s):
|
||||
*----------------------------------------------------------------------------
|
||||
* This file is part of the uVision/ARM development tools.
|
||||
* This software may only be used under the terms of a valid, current,
|
||||
* end user licence from KEIL for a compatible version of KEIL software
|
||||
* development tools. Nothing else gives you the right to use this software.
|
||||
*
|
||||
* This software is supplied "AS IS" without warranties of any kind.
|
||||
*
|
||||
* Copyright (c) 2008-2013 Keil - An ARM Company. All rights reserved.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
TraceSetup() Turn on ITM clocks, etc.
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void TraceSetup (void)
|
||||
{
|
||||
// turn on the ITM/TPIU clock
|
||||
_WDWORD(0x40020250, 0x00000201); // TPIU clock enabled at 3MHz
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Setup() configure PC & SP for RAM Debug
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void Setup (void) {
|
||||
SP = _RDWORD(0x00000000+0x0); // Setup Stack Pointer
|
||||
PC = _RDWORD(0x00000000+0x4); // Setup Program Counter
|
||||
_WDWORD(0xE000ED08, 0x00000000+0x0); // Setup Vector Table Offset Register (done in system file)
|
||||
}
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL // load the application
|
||||
|
||||
|
||||
// Executed after reset via uVision's 'Reset'-button
|
||||
FUNC void OnResetExec (void)
|
||||
{
|
||||
//Set_ui32HALflags();
|
||||
//TraceSetup();
|
||||
}
|
||||
|
||||
FUNC void Set_ui32HALflags (void)
|
||||
{
|
||||
TraceSetup();
|
||||
//g_ui32HALflags = 0x00000001;
|
||||
_break_ = 1;
|
||||
}
|
||||
|
||||
Setup(); // Setup for Running
|
||||
BS main, 1, "Set_ui32HALflags()";
|
||||
|
||||
g
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 1
|
||||
Device="AMAPH1KK-KBR"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amdtps
|
||||
COMPILERNAME := Keil
|
||||
PROJECT := ble_freertos_amdtps_Keil
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p UV4.exe)
|
||||
RM := $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
UV4.exe -b -t "ble_freertos_amdtps" ble_freertos_amdtps.uvprojx -j0 || [ $$? -eq 1 ]
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
$(RM) -rf $(CONFIG)
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/keil/bin/libam_bsp.lib:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
|
||||
+49672
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; ble_freertos_amdtps.sct
|
||||
;
|
||||
; Scatter file for Keil linker configuration.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
LR_1 0x00000000
|
||||
{
|
||||
FLASH 0x00000000 0x00100000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
SRAM 0x10000000 0x00040000
|
||||
{
|
||||
* (+RW, +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
+3163
File diff suppressed because it is too large
Load Diff
+1409
File diff suppressed because it is too large
Load Diff
+351
@@ -0,0 +1,351 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
;! @file startup_keil.s
|
||||
;!
|
||||
;! @brief Definitions for Apollo2 interrupt handlers, the vector table, and the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;************************************************************************
|
||||
Stack EQU 0x00002B00
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
;
|
||||
;******************************************************************************
|
||||
Heap EQU 0x00000000
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
StackMem
|
||||
SPACE Stack
|
||||
__initial_sp
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Allocate space for the heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
HeapMem
|
||||
SPACE Heap
|
||||
__heap_limit
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Indicate that the code in this file preserves 8-byte alignment of the stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
PRESERVE8
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Place code into the reset code section.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA RESET, CODE, READONLY
|
||||
THUMB
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; The vector table.
|
||||
;
|
||||
;******************************************************************************
|
||||
;
|
||||
; Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
; am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
; Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
;
|
||||
|
||||
EXPORT __Vectors
|
||||
__Vectors
|
||||
DCD StackMem + Stack ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD am_nmi_isr ; NMI Handler
|
||||
DCD am_fault_isr ; Hard Fault Handler
|
||||
DCD am_fault_isr ; The MPU fault handler
|
||||
DCD am_fault_isr ; The bus fault handler
|
||||
DCD am_fault_isr ; The usage fault handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD am_svcall_isr ; SVCall handler
|
||||
DCD am_debugmon_isr ; Debug monitor handler
|
||||
DCD 0 ; Reserved
|
||||
DCD am_pendsv_isr ; The PendSV handler
|
||||
DCD am_systick_isr ; The SysTick handler
|
||||
|
||||
;
|
||||
; Peripheral Interrupts
|
||||
;
|
||||
DCD am_brownout_isr ; 0: Reserved
|
||||
DCD am_watchdog_isr ; 1: Reserved
|
||||
DCD am_clkgen_isr ; 2: CLKGEN
|
||||
DCD am_vcomp_isr ; 3: Voltage Comparator
|
||||
DCD am_ioslave_ios_isr ; 4: I/O Slave general
|
||||
DCD am_ioslave_acc_isr ; 5: I/O Slave access
|
||||
DCD am_iomaster0_isr ; 6: I/O Master 0
|
||||
DCD am_iomaster1_isr ; 7: I/O Master 1
|
||||
DCD am_iomaster2_isr ; 8: I/O Master 2
|
||||
DCD am_iomaster3_isr ; 9: I/O Master 3
|
||||
DCD am_iomaster4_isr ; 10: I/O Master 4
|
||||
DCD am_iomaster5_isr ; 11: I/O Master 5
|
||||
DCD am_gpio_isr ; 12: GPIO
|
||||
DCD am_ctimer_isr ; 13: CTIMER
|
||||
DCD am_uart_isr ; 14: UART0
|
||||
DCD am_uart1_isr ; 15: UART1
|
||||
DCD am_adc_isr ; 16: ADC
|
||||
DCD am_pdm0_isr ; 17: PDM
|
||||
DCD am_stimer_isr ; 18: SYSTEM TIMER
|
||||
DCD am_stimer_cmpr0_isr ; 19: SYSTEM TIMER COMPARE0
|
||||
DCD am_stimer_cmpr1_isr ; 20: SYSTEM TIMER COMPARE1
|
||||
DCD am_stimer_cmpr2_isr ; 21: SYSTEM TIMER COMPARE2
|
||||
DCD am_stimer_cmpr3_isr ; 22: SYSTEM TIMER COMPARE3
|
||||
DCD am_stimer_cmpr4_isr ; 23: SYSTEM TIMER COMPARE4
|
||||
DCD am_stimer_cmpr5_isr ; 24: SYSTEM TIMER COMPARE5
|
||||
DCD am_stimer_cmpr6_isr ; 25: SYSTEM TIMER COMPARE6
|
||||
DCD am_stimer_cmpr7_isr ; 26: SYSTEM TIMER COMPARE7
|
||||
DCD am_flash_isr ; 27: FLASH
|
||||
DCD am_software0_isr ; 28: SOFTWARE0
|
||||
DCD am_software1_isr ; 29: SOFTWARE1
|
||||
DCD am_software2_isr ; 30: SOFTWARE2
|
||||
DCD am_software3_isr ; 31: SOFTWARE3
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; This is the code that gets called when the processor first starts execution
|
||||
; following a reset event.
|
||||
;
|
||||
;******************************************************************************
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
|
||||
;
|
||||
; Enable the FPU.
|
||||
;
|
||||
MOVW R0, #0xED88
|
||||
MOVT R0, #0xE000
|
||||
LDR R1, [R0]
|
||||
ORR R1, #0x00F00000
|
||||
STR R1, [R0]
|
||||
DSB
|
||||
ISB
|
||||
|
||||
;
|
||||
; Branch to main.
|
||||
;
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Weak Exception Handlers.
|
||||
;
|
||||
;******************************************************************************
|
||||
am_nmi_isr PROC
|
||||
EXPORT am_nmi_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_fault_isr\
|
||||
PROC
|
||||
EXPORT am_fault_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_memmanage_isr\
|
||||
PROC
|
||||
EXPORT am_memmanage_isr [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
am_default_isr\
|
||||
PROC
|
||||
EXPORT am_svcall_isr [WEAK]
|
||||
EXPORT am_debugmon_isr [WEAK]
|
||||
EXPORT am_pendsv_isr [WEAK]
|
||||
EXPORT am_systick_isr [WEAK]
|
||||
EXPORT am_brownout_isr [WEAK]
|
||||
EXPORT am_adc_isr [WEAK]
|
||||
EXPORT am_watchdog_isr [WEAK]
|
||||
EXPORT am_clkgen_isr [WEAK]
|
||||
EXPORT am_vcomp_isr [WEAK]
|
||||
EXPORT am_ioslave_ios_isr [WEAK]
|
||||
EXPORT am_ioslave_acc_isr [WEAK]
|
||||
EXPORT am_iomaster0_isr [WEAK]
|
||||
EXPORT am_iomaster1_isr [WEAK]
|
||||
EXPORT am_iomaster2_isr [WEAK]
|
||||
EXPORT am_iomaster3_isr [WEAK]
|
||||
EXPORT am_iomaster4_isr [WEAK]
|
||||
EXPORT am_iomaster5_isr [WEAK]
|
||||
EXPORT am_gpio_isr [WEAK]
|
||||
EXPORT am_ctimer_isr [WEAK]
|
||||
EXPORT am_uart_isr [WEAK]
|
||||
EXPORT am_uart0_isr [WEAK]
|
||||
EXPORT am_uart1_isr [WEAK]
|
||||
EXPORT am_pdm0_isr [WEAK]
|
||||
EXPORT am_stimer_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr0_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr1_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr2_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr3_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr4_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr5_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr6_isr [WEAK]
|
||||
EXPORT am_stimer_cmpr7_isr [WEAK]
|
||||
EXPORT am_flash_isr [WEAK]
|
||||
EXPORT am_software0_isr [WEAK]
|
||||
EXPORT am_software1_isr [WEAK]
|
||||
EXPORT am_software2_isr [WEAK]
|
||||
EXPORT am_software3_isr [WEAK]
|
||||
|
||||
am_svcall_isr
|
||||
am_debugmon_isr
|
||||
am_pendsv_isr
|
||||
am_systick_isr
|
||||
am_brownout_isr
|
||||
am_adc_isr
|
||||
am_watchdog_isr
|
||||
am_clkgen_isr
|
||||
am_vcomp_isr
|
||||
am_ioslave_ios_isr
|
||||
am_ioslave_acc_isr
|
||||
am_iomaster0_isr
|
||||
am_iomaster1_isr
|
||||
am_iomaster2_isr
|
||||
am_iomaster3_isr
|
||||
am_iomaster4_isr
|
||||
am_iomaster5_isr
|
||||
am_gpio_isr
|
||||
am_ctimer_isr
|
||||
am_uart_isr
|
||||
am_uart0_isr
|
||||
am_uart1_isr
|
||||
am_pdm0_isr
|
||||
am_stimer_isr
|
||||
am_stimer_cmpr0_isr
|
||||
am_stimer_cmpr1_isr
|
||||
am_stimer_cmpr2_isr
|
||||
am_stimer_cmpr3_isr
|
||||
am_stimer_cmpr4_isr
|
||||
am_stimer_cmpr5_isr
|
||||
am_stimer_cmpr6_isr
|
||||
am_stimer_cmpr7_isr
|
||||
am_flash_isr
|
||||
am_software0_isr
|
||||
am_software1_isr
|
||||
am_software2_isr
|
||||
am_software3_isr
|
||||
|
||||
; all device interrupts go here unless the weak label is over
|
||||
; ridden in the linker hard spin so the debugger will know it
|
||||
; was an unhandled interrupt request a come-from-buffer or
|
||||
; instruction trace hardware would sure be nice if you get here
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Initialization of the heap and stack.
|
||||
;
|
||||
;******************************************************************************
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; User Initial Stack & Heap.
|
||||
;
|
||||
;******************************************************************************
|
||||
IF :DEF: __MICROLIB
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
ELSE
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap PROC
|
||||
LDR R0, =HeapMem
|
||||
LDR R1, =(StackMem + Stack)
|
||||
LDR R2, =(HeapMem + Heap)
|
||||
LDR R3, =StackMem
|
||||
BX LR
|
||||
|
||||
ENDP
|
||||
|
||||
ENDIF
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Align the end of the section.
|
||||
;
|
||||
;******************************************************************************
|
||||
ALIGN
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; All Done
|
||||
;
|
||||
;******************************************************************************
|
||||
END
|
||||
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file FreeRTOSConfig.h
|
||||
//!
|
||||
//! @brief Configuration options for FreeRTOS
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
|
||||
#ifdef AM_PART_APOLLO
|
||||
#define configCPU_CLOCK_HZ 24000000UL
|
||||
#else
|
||||
#define configCPU_CLOCK_HZ 48000000UL
|
||||
#endif
|
||||
#define configTICK_RATE_HZ 1000
|
||||
#define configMAX_PRIORITIES 4
|
||||
#define configMINIMAL_STACK_SIZE (256)
|
||||
#define configTOTAL_HEAP_SIZE (16 * 1024)
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
#define configUSE_MUTEXES 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 3
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Interrupt nesting behaviour configuration. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY (0x7 << 5)
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (0x4 << 5)
|
||||
|
||||
/* Define to trap errors during development. */
|
||||
#define configASSERT(x) if (( x ) == 0) while(1);
|
||||
|
||||
/* FreeRTOS MPU specific definitions. */
|
||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 0
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
#define vPortSVCHandler am_svcall_isr
|
||||
#define xPortPendSVHandler am_pendsv_isr
|
||||
#define xPortSysTickHandler am_systick_isr
|
||||
|
||||
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 // Enable non-SysTick based Tick
|
||||
#define configUSE_TICKLESS_IDLE 2 // Ambiq specific implementation for Tickless
|
||||
|
||||
#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
|
||||
extern uint32_t am_freertos_sleep(uint32_t);
|
||||
extern void am_freertos_wakeup(uint32_t);
|
||||
|
||||
#define configPRE_SLEEP_PROCESSING( time ) \
|
||||
do { \
|
||||
(time) = am_freertos_sleep(time); \
|
||||
} while (0);
|
||||
|
||||
#define configPOST_SLEEP_PROCESSING(time) am_freertos_wakeup(time)
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
#ifndef AM_PART_APOLLO
|
||||
#define AM_FREERTOS_USE_STIMER_FOR_TICK
|
||||
#endif
|
||||
|
||||
#ifdef AM_FREERTOS_USE_STIMER_FOR_TICK
|
||||
#define configSTIMER_CLOCK_HZ 32768
|
||||
#else // Use CTimer
|
||||
#define configCTIMER_CLOCK_HZ 32768
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FREERTOS_CONFIG_H
|
||||
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file freertos_amdtp.c
|
||||
//!
|
||||
//! @brief AMDTP example.
|
||||
//!
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This application has a large number of common include files. For
|
||||
// convenience, we'll collect them all together in a single header and include
|
||||
// that everywhere.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "ble_freertos_amdtps.h"
|
||||
#include "rtos.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable printing to the console.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
enable_print_interface(void)
|
||||
{
|
||||
//
|
||||
// Initialize a debug printing interface.
|
||||
//
|
||||
am_hal_itm_enable();
|
||||
am_bsp_debug_printf_enable();
|
||||
am_util_debug_printf_init(am_hal_itm_print);
|
||||
am_util_stdio_terminal_clear();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Main Function
|
||||
//
|
||||
//*****************************************************************************
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
//
|
||||
// Set the clock frequency
|
||||
//
|
||||
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
|
||||
|
||||
//
|
||||
// Set the default cache configuration
|
||||
//
|
||||
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
|
||||
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the floating point module, and configure the core for lazy
|
||||
// stacking.
|
||||
//
|
||||
am_hal_sysctrl_fpu_enable();
|
||||
am_hal_sysctrl_fpu_stacking_enable(true);
|
||||
#else
|
||||
am_hal_sysctrl_fpu_disable();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Configure the board for low power.
|
||||
//
|
||||
am_bsp_low_power_init();
|
||||
|
||||
// Turn off unused Flash & SRAM
|
||||
|
||||
#ifdef AM_PART_APOLLO
|
||||
//
|
||||
// SRAM bank power setting.
|
||||
// Need to match up with actual SRAM usage for the program
|
||||
// Current usage is between 32K and 40K - so disabling upper 3 banks
|
||||
//
|
||||
am_hal_mcuctrl_sram_power_set(AM_HAL_MCUCTRL_SRAM_POWER_DOWN_5 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_6 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_7,
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_5 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_6 |
|
||||
AM_HAL_MCUCTRL_SRAM_POWER_DOWN_7);
|
||||
|
||||
#if 0 // Not turning off the Flash as it may be needed to download the image
|
||||
//
|
||||
// Flash bank power set.
|
||||
//
|
||||
am_hal_mcuctrl_flash_power_set(AM_HAL_MCUCTRL_FLASH_POWER_DOWN_1);
|
||||
#endif
|
||||
#endif // AM_PART_APOLLO
|
||||
#ifdef AM_PART_APOLLO2
|
||||
#if 0 // Not turning off the Flash as it may be needed to download the image
|
||||
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_FLASH512K);
|
||||
#endif
|
||||
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM256K);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable printing to the console.
|
||||
//
|
||||
#ifdef AM_DEBUG_PRINTF
|
||||
enable_print_interface();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Initialize plotting interface.
|
||||
//
|
||||
am_util_debug_printf("FreeRTOS AMDTP Example\n");
|
||||
|
||||
//
|
||||
// Run the application.
|
||||
//
|
||||
run_tasks();
|
||||
|
||||
//
|
||||
// We shouldn't ever get here.
|
||||
//
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file freertos_amdtp.h
|
||||
//!
|
||||
//! @brief Global includes for the freertos_amdtps app.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef FREERTOS_AMDTP_H
|
||||
#define FREERTOS_AMDTP_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Required built-ins.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Standard AmbiqSuite includes.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_bsp.h"
|
||||
#include "am_util.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// FreeRTOS include files.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "portmacro.h"
|
||||
#include "portable.h"
|
||||
#include "semphr.h"
|
||||
#include "event_groups.h"
|
||||
//#include "rtos.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Task include files.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "radio_task.h"
|
||||
|
||||
#endif // FREERTOS_AMDTP_H
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file hci_apollo_config.h
|
||||
//!
|
||||
//! @brief This file describes the physical aspects of the HCI conection.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
#include "am_bsp.h"
|
||||
|
||||
#ifndef HCI_APOLLO_CONFIG_H
|
||||
#define HCI_APOLLO_CONFIG_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Pin numbers and configuration.
|
||||
//
|
||||
// NOTE: RTS, CTS, and RESET are implemented as GPIOs, so no "CFG" field is
|
||||
// needed.
|
||||
//
|
||||
//*****************************************************************************
|
||||
//#define HCI_APOLLO_POWER_PIN AM_BSP_GPIO_EM9304_POWER
|
||||
//#define HCI_APOLLO_POWER_CFG AM_BSP_GPIO_CFG_EM9304_POWER
|
||||
|
||||
#define HCI_APOLLO_RESET_PIN AM_BSP_GPIO_EM9304_RESET
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Other options.
|
||||
//
|
||||
// These options are provided in case your board setup is a little more
|
||||
// unusual. Most boards shouldn't need these features. If in doubt, leave all
|
||||
// of these features disabled.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define HCI_APOLLO_CFG_OVERRIDE_ISR 0 // Override the exactle UART ISR
|
||||
|
||||
#endif // HCI_APOLLO_CONFIG_H
|
||||
+366
@@ -0,0 +1,366 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file radio_task.c
|
||||
//!
|
||||
//! @brief Task to handle radio operation.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Global includes for this project.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "ble_freertos_amdtps.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// WSF standard includes.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "wsf_types.h"
|
||||
#include "wsf_trace.h"
|
||||
#include "wsf_buf.h"
|
||||
#include "wsf_timer.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Includes for operating the ExactLE stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "hci_handler.h"
|
||||
#include "dm_handler.h"
|
||||
#include "l2c_handler.h"
|
||||
#include "att_handler.h"
|
||||
#include "smp_handler.h"
|
||||
#include "l2c_api.h"
|
||||
#include "att_api.h"
|
||||
#include "smp_api.h"
|
||||
#include "app_api.h"
|
||||
#include "hci_core.h"
|
||||
#include "hci_drv.h"
|
||||
#include "hci_drv_apollo.h"
|
||||
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_util.h"
|
||||
#include "am_bsp.h"
|
||||
|
||||
#include "hci_apollo_config.h"
|
||||
|
||||
#include "wsf_msg.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Includes for the AMDTP profile.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#include "amdtp_api.h"
|
||||
#include "amdtps_api.h"
|
||||
#include "app_ui.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Radio task handle.
|
||||
//
|
||||
//*****************************************************************************
|
||||
TaskHandle_t radio_task_handle;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
void exactle_stack_init(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// WSF buffer pools.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define WSF_BUF_POOLS 4
|
||||
|
||||
// Important note: the size of g_pui32BufMem should includes both overhead of internal
|
||||
// buffer management structure, wsfBufPool_t (up to 16 bytes for each pool), and pool
|
||||
// description (e.g. g_psPoolDescriptors below).
|
||||
|
||||
// Memory for the buffer pool
|
||||
// extra AMOTA_PACKET_SIZE bytes for OTA handling
|
||||
static uint32_t g_pui32BufMem[
|
||||
(WSF_BUF_POOLS*16
|
||||
+ 16*8 + 32*4 + 64*6 + 280*8) / sizeof(uint32_t)];
|
||||
|
||||
// Default pool descriptor.
|
||||
static wsfBufPoolDesc_t g_psPoolDescriptors[WSF_BUF_POOLS] =
|
||||
{
|
||||
{ 16, 8 },
|
||||
{ 32, 4 },
|
||||
{ 64, 6 },
|
||||
{ 280, 8 }
|
||||
};
|
||||
|
||||
wsfHandlerId_t g_bleDataReadyHandlerId;
|
||||
/*! Event types for ble rx data handler */
|
||||
#define BLE_DATA_READY_EVENT 0x01 /*! Trigger Rx data path */
|
||||
|
||||
void radio_timer_handler(void);
|
||||
|
||||
void ble_data_ready_handler(wsfEventMask_t event, wsfMsgHdr_t *pMsg)
|
||||
{
|
||||
if (FALSE == HciDataReadyISR())
|
||||
{
|
||||
// trigger event again to handle pending data from BLE controller
|
||||
WsfSetEvent(g_bleDataReadyHandlerId, BLE_DATA_READY_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Initialization for the ExactLE stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
exactle_stack_init(void)
|
||||
{
|
||||
wsfHandlerId_t handlerId;
|
||||
uint16_t wsfBufMemLen;
|
||||
//
|
||||
// Set up timers for the WSF scheduler.
|
||||
//
|
||||
WsfOsInit();
|
||||
WsfTimerInit();
|
||||
|
||||
//
|
||||
// Initialize a buffer pool for WSF dynamic memory needs.
|
||||
//
|
||||
wsfBufMemLen = WsfBufInit(sizeof(g_pui32BufMem), (uint8_t *)g_pui32BufMem, WSF_BUF_POOLS,
|
||||
g_psPoolDescriptors);
|
||||
|
||||
if (wsfBufMemLen > sizeof(g_pui32BufMem))
|
||||
{
|
||||
am_util_debug_printf("Memory pool is too small by %d\r\n",
|
||||
wsfBufMemLen - sizeof(g_pui32BufMem));
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the WSF security service.
|
||||
//
|
||||
SecInit();
|
||||
SecAesInit();
|
||||
SecCmacInit();
|
||||
SecEccInit();
|
||||
|
||||
//
|
||||
// Set up callback functions for the various layers of the ExactLE stack.
|
||||
//
|
||||
handlerId = WsfOsSetNextHandler(HciHandler);
|
||||
HciHandlerInit(handlerId);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(DmHandler);
|
||||
DmDevVsInit(0);
|
||||
DmAdvInit();
|
||||
DmConnInit();
|
||||
DmConnSlaveInit();
|
||||
DmSecInit();
|
||||
DmSecLescInit();
|
||||
DmPrivInit();
|
||||
DmHandlerInit(handlerId);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(L2cSlaveHandler);
|
||||
L2cSlaveHandlerInit(handlerId);
|
||||
L2cInit();
|
||||
L2cSlaveInit();
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AttHandler);
|
||||
AttHandlerInit(handlerId);
|
||||
AttsInit();
|
||||
AttsIndInit();
|
||||
AttcInit();
|
||||
|
||||
handlerId = WsfOsSetNextHandler(SmpHandler);
|
||||
SmpHandlerInit(handlerId);
|
||||
SmprInit();
|
||||
SmprScInit();
|
||||
HciSetMaxRxAclLen(251);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AppHandler);
|
||||
AppHandlerInit(handlerId);
|
||||
|
||||
handlerId = WsfOsSetNextHandler(AmdtpHandler);
|
||||
AmdtpHandlerInit(handlerId);
|
||||
|
||||
g_bleDataReadyHandlerId = WsfOsSetNextHandler(ble_data_ready_handler);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// UART interrupt handler.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_uart_isr(void)
|
||||
{
|
||||
uint32_t ui32Status;
|
||||
|
||||
//
|
||||
// Read and save the interrupt status, but clear out the status register.
|
||||
//
|
||||
ui32Status = AM_REGn(UART, 0, MIS);
|
||||
AM_REGn(UART, 0, IEC) = ui32Status;
|
||||
|
||||
//
|
||||
// Allow the HCI driver to respond to the interrupt.
|
||||
//
|
||||
//HciDrvUartISR(ui32Status);
|
||||
|
||||
// Signal radio task to run
|
||||
|
||||
WsfTaskSetReady(0, 0);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the CTS pin
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
radio_cts_handler(void)
|
||||
{
|
||||
// Signal radio task to run
|
||||
|
||||
WsfTaskSetReady(0, 0);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the GPIO pins.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_gpio_isr(void)
|
||||
{
|
||||
uint64_t ui64Status;
|
||||
|
||||
//
|
||||
// Read and clear the GPIO interrupt status.
|
||||
//
|
||||
ui64Status = am_hal_gpio_int_status_get(false);
|
||||
am_hal_gpio_int_clear(ui64Status);
|
||||
|
||||
//
|
||||
// Check to see if this was a wakeup event from the BLE radio.
|
||||
//
|
||||
if ( ui64Status & AM_HAL_GPIO_BIT(AM_BSP_GPIO_EM9304_INT) )
|
||||
{
|
||||
WsfSetEvent(g_bleDataReadyHandlerId, BLE_DATA_READY_EVENT);
|
||||
}
|
||||
|
||||
//
|
||||
// Call the individual pin interrupt handlers for any pin that triggered an
|
||||
// interrupt.
|
||||
//
|
||||
am_hal_gpio_int_service(ui64Status);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Perform initial setup for the radio task.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
RadioTaskSetup(void)
|
||||
{
|
||||
am_util_debug_printf("RadioTask: setup\r\n");
|
||||
//
|
||||
// Boot the radio.
|
||||
//
|
||||
HciDrvRadioBoot(0);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Short Description.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
RadioTask(void *pvParameters)
|
||||
{
|
||||
am_hal_interrupt_priority_set(AM_HAL_INTERRUPT_GPIO, configMAX_SYSCALL_INTERRUPT_PRIORITY);
|
||||
//
|
||||
// Register an interrupt handler for BLE event
|
||||
//
|
||||
am_hal_gpio_int_register(AM_BSP_GPIO_EM9304_INT, radio_cts_handler);
|
||||
|
||||
#if WSF_TRACE_ENABLED == TRUE
|
||||
//
|
||||
// Enable ITM
|
||||
//
|
||||
am_util_debug_printf("Starting wicentric trace:\n\n");
|
||||
#endif
|
||||
|
||||
//
|
||||
// Initialize the main ExactLE stack.
|
||||
//
|
||||
exactle_stack_init();
|
||||
|
||||
//
|
||||
// Enable BLE data ready interrupt
|
||||
//
|
||||
am_hal_interrupt_enable(AM_HAL_INTERRUPT_GPIO);
|
||||
|
||||
//
|
||||
// Start the "Amdtp" profile.
|
||||
//
|
||||
AmdtpStart();
|
||||
|
||||
while (1)
|
||||
{
|
||||
//
|
||||
// Calculate the elapsed time from our free-running timer, and update
|
||||
// the software timers in the WSF scheduler.
|
||||
//
|
||||
wsfOsDispatcher();
|
||||
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file radio_task.h
|
||||
//!
|
||||
//! @brief Functions and variables related to the radio task.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#ifndef RADIO_TASK_H
|
||||
#define RADIO_TASK_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Radio task handle.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern TaskHandle_t radio_task_handle;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// External function definitions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void RadioTaskSetup(void);
|
||||
extern void RadioTask(void *pvParameters);
|
||||
|
||||
#endif // RADIO_TASK_H
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file rtos.c
|
||||
//!
|
||||
//! @brief Essential functions to make the RTOS run correctly.
|
||||
//!
|
||||
//! These functions are required by the RTOS for ticking, sleeping, and basic
|
||||
//! error checking.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "am_mcu_apollo.h"
|
||||
#include "am_bsp.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "portmacro.h"
|
||||
#include "portable.h"
|
||||
#include "ble_freertos_amdtps.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Task handle for the initial setup task.
|
||||
//
|
||||
//*****************************************************************************
|
||||
TaskHandle_t xSetupTask;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Interrupt handler for the CTIMER module.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_ctimer_isr(void)
|
||||
{
|
||||
uint32_t ui32Status;
|
||||
|
||||
//
|
||||
// Check the timer interrupt status.
|
||||
//
|
||||
ui32Status = am_hal_ctimer_int_status_get(false);
|
||||
am_hal_ctimer_int_clear(ui32Status);
|
||||
|
||||
//
|
||||
// Run handlers for the various possible timer events.
|
||||
//
|
||||
am_hal_ctimer_int_service(ui32Status);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Sleep function called from FreeRTOS IDLE task.
|
||||
// Do necessary application specific Power down operations here
|
||||
// Return 0 if this function also incorporates the WFI, else return value same
|
||||
// as idleTime
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t am_freertos_sleep(uint32_t idleTime)
|
||||
{
|
||||
am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Recovery function called from FreeRTOS IDLE task, after waking up from Sleep
|
||||
// Do necessary 'wakeup' operations here, e.g. to power up/enable peripherals etc.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void am_freertos_wakeup(uint32_t idleTime)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// FreeRTOS debugging functions.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
vApplicationMallocFailedHook(void)
|
||||
{
|
||||
//
|
||||
// Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
// free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
// internally by FreeRTOS API functions that create tasks, queues, software
|
||||
// timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
// configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
|
||||
//
|
||||
while (1);
|
||||
}
|
||||
|
||||
void
|
||||
vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName)
|
||||
{
|
||||
(void) pcTaskName;
|
||||
(void) pxTask;
|
||||
|
||||
//
|
||||
// Run time stack overflow checking is performed if
|
||||
// configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
// function is called if a stack overflow is detected.
|
||||
//
|
||||
while (1)
|
||||
{
|
||||
__asm("BKPT #0\n") ; // Break into the debugger
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// High priority task to run immediately after the scheduler starts.
|
||||
//
|
||||
// This task is used for any global initialization that must occur after the
|
||||
// scheduler starts, but before any functional tasks are running. This can be
|
||||
// useful for enabling events, semaphores, and other global, RTOS-specific
|
||||
// features.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
setup_task(void *pvParameters)
|
||||
{
|
||||
//
|
||||
// Print a debug message.
|
||||
//
|
||||
am_util_debug_printf("Running setup tasks...\r\n");
|
||||
|
||||
//
|
||||
// Run setup functions.
|
||||
//
|
||||
RadioTaskSetup();
|
||||
|
||||
//
|
||||
// Create the functional tasks
|
||||
//
|
||||
xTaskCreate(RadioTask, "RadioTask", 512, 0, 3, &radio_task_handle);
|
||||
//
|
||||
// The setup operations are complete, so suspend the setup task now.
|
||||
//
|
||||
vTaskSuspend(NULL);
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Initializes all tasks
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
run_tasks(void)
|
||||
{
|
||||
//
|
||||
// Set some interrupt priorities before we create tasks or start the scheduler.
|
||||
//
|
||||
// Note: Timer priority is handled by the FreeRTOS kernel, so we won't
|
||||
// touch it here.
|
||||
//
|
||||
|
||||
//
|
||||
// Create essential tasks.
|
||||
//
|
||||
xTaskCreate(setup_task, "Setup", 512, 0, 3, &xSetupTask);
|
||||
|
||||
|
||||
//
|
||||
// Start the scheduler.
|
||||
//
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file rtos.h
|
||||
//!
|
||||
//! @brief Essential functions to make the RTOS run
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifndef RTOS_H
|
||||
#define RTOS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Macro definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
// External variable definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// External function definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
void run_tasks(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RTOS_H
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for compiling
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
||||
# Include rules specific to this board
|
||||
-include ../../board-defs.mk
|
||||
-include example-defs.mk
|
||||
|
||||
# All makefiles use this to find the top level directory.
|
||||
SWROOT?=../../../..
|
||||
|
||||
# Include rules for building generic examples.
|
||||
include $(SWROOT)/makedefs/example.mk
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
Name:
|
||||
=====
|
||||
ble_freertos_amota
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
Example of the freertos amota app running under FreeRTOS.
|
||||
|
||||
|
||||
This example implements a BLE heart rate sensor within the FreeRTOS
|
||||
framework. To save power, this application is compiled without print
|
||||
statements by default. To enable them, add the following project-level
|
||||
macro definitions.
|
||||
|
||||
AM_DEBUG_PRINTF
|
||||
WSF_TRACE_ENABLED=1
|
||||
|
||||
If enabled, debug messages will be sent over ITM.
|
||||
|
||||
|
||||
******************************************************************************
|
||||
|
||||
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amota
|
||||
COMPILERNAME := gcc
|
||||
PROJECT := ble_freertos_amota_gcc
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Setup ####
|
||||
|
||||
TOOLCHAIN ?= arm-none-eabi
|
||||
PART = apollo2
|
||||
CPU = cortex-m4
|
||||
FPU = fpv4-sp-d16
|
||||
#FABI = softfp
|
||||
FABI = hard
|
||||
|
||||
LINKER_FILE := ./ble_freertos_amota.ld
|
||||
STARTUP_FILE := ./startup_$(COMPILERNAME).c
|
||||
|
||||
#### Required Executables ####
|
||||
CC = $(TOOLCHAIN)-gcc
|
||||
GCC = $(TOOLCHAIN)-gcc
|
||||
CPP = $(TOOLCHAIN)-cpp
|
||||
LD = $(TOOLCHAIN)-ld
|
||||
CP = $(TOOLCHAIN)-objcopy
|
||||
OD = $(TOOLCHAIN)-objdump
|
||||
RD = $(TOOLCHAIN)-readelf
|
||||
AR = $(TOOLCHAIN)-ar
|
||||
SIZE = $(TOOLCHAIN)-size
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
EXECUTABLES = CC LD CP OD AR RD SIZE GCC
|
||||
K := $(foreach exec,$(EXECUTABLES),\
|
||||
$(if $(shell which $($(exec)) 2>/dev/null),,\
|
||||
$(info $(exec) not found on PATH ($($(exec))).)$(exec)))
|
||||
$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
|
||||
|
||||
ifneq ($(strip $(value K)),)
|
||||
all clean:
|
||||
$(info Tools $(TOOLCHAIN)-$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
DEFINES = -DPART_$(PART)
|
||||
DEFINES+= -DAM_PACKAGE_BGA
|
||||
DEFINES+= -DWSF_TRACE_ENABLED
|
||||
DEFINES+= -D'AM_MULTIBOOT_CONFIG_FILE="amota_profile_config.h"'
|
||||
DEFINES+= -DAM_FREERTOS
|
||||
DEFINES+= -DAM_PART_APOLLO2
|
||||
DEFINES+= -DAM_DEBUG_PRINTF
|
||||
DEFINES+= -DSEC_ECC_CFG=SEC_ECC_CFG_UECC
|
||||
DEFINES+= -Dgcc
|
||||
|
||||
INCLUDES = -I../../../../../third_party/exactle/wsf/include
|
||||
INCLUDES+= -I../../../../../ambiq_ble/profiles/amota
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/rscp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
INCLUDES+= -I../../../../../third_party/uecc
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
INCLUDES+= -I../../../../../devices
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
INCLUDES+= -I../../../../../ambiq_ble/em9304
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
INCLUDES+= -I../../../../../third_party/FreeRTOSv10.1.1/Source/include
|
||||
INCLUDES+= -I../../../../../ambiq_ble/apps/amota
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/hrps
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles
|
||||
INCLUDES+= -I../../../../../mcu/apollo2
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
INCLUDES+= -I../../../../../ambiq_ble/services
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
INCLUDES+= -I../../../../../utils
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/apps
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/hci/include
|
||||
INCLUDES+= -I../../../bsp
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/uribeacon
|
||||
INCLUDES+= -I../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/include/app
|
||||
INCLUDES+= -I../src
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-profiles/sources/profiles/include
|
||||
INCLUDES+= -I../../../../../third_party/exactle/wsf/sources/util
|
||||
INCLUDES+= -I../../../../../bootloader
|
||||
INCLUDES+= -I../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
|
||||
VPATH = ../../../../../third_party/exactle/ble-profiles/sources/apps/app/common
|
||||
VPATH+=:../../../../../ambiq_ble/profiles/amota
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/cfg
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/smp
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/port/freertos
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/rscp
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/bas
|
||||
VPATH+=:../../../../../third_party/uecc
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/app
|
||||
VPATH+=:../../../../../devices
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/gatt
|
||||
VPATH+=:../../../../../ambiq_ble/em9304
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/services
|
||||
VPATH+=:../../../../../ambiq_ble/apps/amota
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/hci/ambiq/em9304
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/hrps
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/att
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/l2c
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/apps/hidapp
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/dm
|
||||
VPATH+=:../../../../../ambiq_ble/services
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/hid
|
||||
VPATH+=:../../../../../utils
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/common
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/sec/uecc
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/MemMang
|
||||
VPATH+=:../../../../../third_party/FreeRTOSv10.1.1/Source/portable/GCC/AMapollo2
|
||||
VPATH+=:../src
|
||||
VPATH+=:../../../../../third_party/exactle/ble-profiles/sources/profiles/gap
|
||||
VPATH+=:../../../../../third_party/exactle/wsf/sources/util
|
||||
VPATH+=:../../../../../bootloader
|
||||
VPATH+=:../../../../../third_party/exactle/ble-host/sources/stack/hci
|
||||
|
||||
SRC = app_db.c
|
||||
SRC += app_hw.c
|
||||
SRC += app_ui.c
|
||||
SRC += ui_console.c
|
||||
SRC += ui_lcd.c
|
||||
SRC += ui_main.c
|
||||
SRC += ui_platform.c
|
||||
SRC += ui_timer.c
|
||||
SRC += amotas_main.c
|
||||
SRC += dm_adv.c
|
||||
SRC += dm_adv_ae.c
|
||||
SRC += dm_adv_leg.c
|
||||
SRC += dm_conn.c
|
||||
SRC += dm_conn_cte.c
|
||||
SRC += dm_conn_master.c
|
||||
SRC += dm_conn_master_ae.c
|
||||
SRC += dm_conn_master_leg.c
|
||||
SRC += dm_conn_slave.c
|
||||
SRC += dm_conn_slave_ae.c
|
||||
SRC += dm_conn_slave_leg.c
|
||||
SRC += dm_conn_sm.c
|
||||
SRC += dm_dev.c
|
||||
SRC += dm_dev_priv.c
|
||||
SRC += dm_main.c
|
||||
SRC += dm_past.c
|
||||
SRC += dm_phy.c
|
||||
SRC += dm_priv.c
|
||||
SRC += dm_scan.c
|
||||
SRC += dm_scan_ae.c
|
||||
SRC += dm_scan_leg.c
|
||||
SRC += dm_sec.c
|
||||
SRC += dm_sec_lesc.c
|
||||
SRC += dm_sec_master.c
|
||||
SRC += dm_sec_slave.c
|
||||
SRC += dm_sync_ae.c
|
||||
SRC += hci_cmd.c
|
||||
SRC += hci_cmd_ae.c
|
||||
SRC += hci_cmd_cte.c
|
||||
SRC += hci_cmd_past.c
|
||||
SRC += hci_cmd_phy.c
|
||||
SRC += hci_core.c
|
||||
SRC += hci_core_ps.c
|
||||
SRC += hci_evt.c
|
||||
SRC += hci_tr.c
|
||||
SRC += hci_vs.c
|
||||
SRC += hci_vs_ae.c
|
||||
SRC += svc_amdtp.c
|
||||
SRC += svc_amotas.c
|
||||
SRC += svc_amvole.c
|
||||
SRC += cfg_stack.c
|
||||
SRC += wsf_assert.c
|
||||
SRC += wsf_buf.c
|
||||
SRC += wsf_efs.c
|
||||
SRC += wsf_math.c
|
||||
SRC += wsf_msg.c
|
||||
SRC += wsf_os.c
|
||||
SRC += wsf_queue.c
|
||||
SRC += wsf_timer.c
|
||||
SRC += wsf_trace.c
|
||||
SRC += hid_main.c
|
||||
SRC += rscps_main.c
|
||||
SRC += sec_aes.c
|
||||
SRC += sec_aes_rev.c
|
||||
SRC += sec_ccm_hci.c
|
||||
SRC += sec_cmac_hci.c
|
||||
SRC += sec_ecc_debug.c
|
||||
SRC += sec_ecc_hci.c
|
||||
SRC += sec_main.c
|
||||
SRC += bas_main.c
|
||||
SRC += sec_ecc.c
|
||||
SRC += uECC.c
|
||||
SRC += uECC_ll.c
|
||||
SRC += gatt_main.c
|
||||
SRC += em9304_init.c
|
||||
SRC += em9304_patches.c
|
||||
SRC += hidapp_main.c
|
||||
SRC += amota_main.c
|
||||
SRC += hci_drv_em9304.c
|
||||
SRC += hrps_main.c
|
||||
SRC += ble_freertos_amota.c
|
||||
SRC += extflash.c
|
||||
SRC += radio_task.c
|
||||
SRC += rtos.c
|
||||
SRC += gap_main.c
|
||||
SRC += attc_disc.c
|
||||
SRC += attc_main.c
|
||||
SRC += attc_proc.c
|
||||
SRC += attc_read.c
|
||||
SRC += attc_sign.c
|
||||
SRC += attc_write.c
|
||||
SRC += atts_ccc.c
|
||||
SRC += atts_csf.c
|
||||
SRC += atts_dyn.c
|
||||
SRC += atts_ind.c
|
||||
SRC += atts_main.c
|
||||
SRC += atts_proc.c
|
||||
SRC += atts_read.c
|
||||
SRC += atts_sign.c
|
||||
SRC += atts_write.c
|
||||
SRC += att_main.c
|
||||
SRC += att_uuid.c
|
||||
SRC += bda.c
|
||||
SRC += bstream.c
|
||||
SRC += calc128.c
|
||||
SRC += crc32.c
|
||||
SRC += print.c
|
||||
SRC += terminal.c
|
||||
SRC += wstr.c
|
||||
SRC += port.c
|
||||
SRC += l2c_coc.c
|
||||
SRC += l2c_main.c
|
||||
SRC += l2c_master.c
|
||||
SRC += l2c_slave.c
|
||||
SRC += smpi_act.c
|
||||
SRC += smpi_sc_act.c
|
||||
SRC += smpi_sc_sm.c
|
||||
SRC += smpi_sm.c
|
||||
SRC += smpr_act.c
|
||||
SRC += smpr_sc_act.c
|
||||
SRC += smpr_sc_sm.c
|
||||
SRC += smpr_sm.c
|
||||
SRC += smp_act.c
|
||||
SRC += smp_db.c
|
||||
SRC += smp_main.c
|
||||
SRC += smp_non.c
|
||||
SRC += smp_sc_act.c
|
||||
SRC += smp_sc_main.c
|
||||
SRC += hci_main.c
|
||||
SRC += am_util_debug.c
|
||||
SRC += am_util_delay.c
|
||||
SRC += am_util_faultisr.c
|
||||
SRC += am_util_stdio.c
|
||||
SRC += event_groups.c
|
||||
SRC += list.c
|
||||
SRC += queue.c
|
||||
SRC += tasks.c
|
||||
SRC += timers.c
|
||||
SRC += am_devices_button.c
|
||||
SRC += am_devices_em9304.c
|
||||
SRC += am_devices_led.c
|
||||
SRC += am_devices_spiflash.c
|
||||
SRC += svc_batt.c
|
||||
SRC += svc_bps.c
|
||||
SRC += svc_core.c
|
||||
SRC += svc_cps.c
|
||||
SRC += svc_cscs.c
|
||||
SRC += svc_dis.c
|
||||
SRC += svc_gls.c
|
||||
SRC += svc_gyro.c
|
||||
SRC += svc_hid.c
|
||||
SRC += svc_hrs.c
|
||||
SRC += svc_hts.c
|
||||
SRC += svc_ipss.c
|
||||
SRC += svc_plxs.c
|
||||
SRC += svc_px.c
|
||||
SRC += svc_rscs.c
|
||||
SRC += svc_scpss.c
|
||||
SRC += svc_temp.c
|
||||
SRC += svc_uricfg.c
|
||||
SRC += svc_wdxs.c
|
||||
SRC += svc_wp.c
|
||||
SRC += svc_wss.c
|
||||
SRC += am_bootloader.c
|
||||
SRC += am_multi_boot.c
|
||||
SRC += app_disc.c
|
||||
SRC += app_main.c
|
||||
SRC += app_master.c
|
||||
SRC += app_master_leg.c
|
||||
SRC += app_server.c
|
||||
SRC += app_slave.c
|
||||
SRC += app_slave_leg.c
|
||||
SRC += app_terminal.c
|
||||
SRC += heap_2.c
|
||||
SRC += startup_gcc.c
|
||||
|
||||
CSRC = $(filter %.c,$(SRC))
|
||||
ASRC = $(filter %.s,$(SRC))
|
||||
|
||||
OBJS = $(CSRC:%.c=$(CONFIG)/%.o)
|
||||
OBJS+= $(ASRC:%.s=$(CONFIG)/%.o)
|
||||
|
||||
DEPS = $(CSRC:%.c=$(CONFIG)/%.d)
|
||||
DEPS+= $(ASRC:%.s=$(CONFIG)/%.d)
|
||||
|
||||
LIBS = ../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a
|
||||
LIBS += ../../../bsp/gcc/bin/libam_bsp.a
|
||||
|
||||
CFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
CFLAGS+= -ffunction-sections -fdata-sections -fomit-frame-pointer
|
||||
CFLAGS+= -MMD -MP -std=c99 -Wall -g
|
||||
CFLAGS+= -O0
|
||||
CFLAGS+= $(DEFINES)
|
||||
CFLAGS+= $(INCLUDES)
|
||||
CFLAGS+=
|
||||
|
||||
LFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
|
||||
LFLAGS+= -nostartfiles -static
|
||||
LFLAGS+= -Wl,--gc-sections,--entry,am_reset_isr,-Map,$(CONFIG)/$(TARGET).map
|
||||
LFLAGS+= -Wl,--start-group -lm -lc -lgcc $(LIBS) -Wl,--end-group
|
||||
LFLAGS+=
|
||||
|
||||
# Additional user specified CFLAGS
|
||||
CFLAGS+=$(EXTRA_CFLAGS)
|
||||
|
||||
CPFLAGS = -Obinary
|
||||
|
||||
ODFLAGS = -S
|
||||
|
||||
#### Rules ####
|
||||
all: directories $(CONFIG)/$(TARGET).bin
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
$(CONFIG)/%.o: %.c $(CONFIG)/%.d
|
||||
@echo " Compiling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/%.o: %.s $(CONFIG)/%.d
|
||||
@echo " Assembling $(COMPILERNAME) $<" ;\
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(CONFIG)/$(TARGET).axf: $(OBJS) $(LIBS)
|
||||
@echo " Linking $(COMPILERNAME) $@" ;\
|
||||
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
|
||||
|
||||
$(CONFIG)/$(TARGET).bin: $(CONFIG)/$(TARGET).axf
|
||||
@echo " Copying $(COMPILERNAME) $@..." ;\
|
||||
$(CP) $(CPFLAGS) $< $@ ;\
|
||||
$(OD) $(ODFLAGS) $< > $(CONFIG)/$(TARGET).lst
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..." ;\
|
||||
$(RM) -f $(OBJS) $(DEPS) \
|
||||
$(CONFIG)/$(TARGET).bin $(CONFIG)/$(TARGET).axf \
|
||||
$(CONFIG)/$(TARGET).lst $(CONFIG)/$(TARGET).map
|
||||
|
||||
$(CONFIG)/%.d: ;
|
||||
|
||||
../../../../../mcu/apollo2/hal/gcc/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/gcc/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
# Automatically include any generated dependencies
|
||||
-include $(DEPS)
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* ble_freertos_amota.ld - Linker script for applications using startup_gnu.c
|
||||
*
|
||||
*****************************************************************************/
|
||||
ENTRY(am_reset_isr)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 1024K
|
||||
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 256K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text)
|
||||
*(.text*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > FLASH
|
||||
|
||||
/* User stack section initialized by startup code. */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack)
|
||||
*(.stack*)
|
||||
. = ALIGN(8);
|
||||
} > SRAM
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .;
|
||||
*(.data)
|
||||
*(.data*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} > SRAM AT>FLASH
|
||||
|
||||
/* used by startup to initialize data */
|
||||
_init_data = LOADADDR(.data);
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = .;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} > SRAM
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_gcc.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of interrupt handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void am_reset_isr(void) __attribute ((naked));
|
||||
extern void am_nmi_isr(void) __attribute ((weak));
|
||||
extern void am_fault_isr(void) __attribute ((weak));
|
||||
extern void am_mpufault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_busfault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_usagefault_isr(void) __attribute ((weak, alias ("am_fault_isr")));
|
||||
extern void am_svcall_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_debugmon_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pendsv_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_systick_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_brownout_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_watchdog_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_clkgen_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_vcomp_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_ios_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ioslave_acc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_iomaster5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_gpio_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_ctimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_uart1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_adc_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_pdm0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr4_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr5_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr6_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_stimer_cmpr7_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_flash_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software0_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software1_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software2_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
extern void am_software3_isr(void) __attribute ((weak, alias ("am_default_isr")));
|
||||
|
||||
extern void am_default_isr(void) __attribute ((weak));
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern int main(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".stack")))
|
||||
static uint32_t g_pui32Stack[0xac0];
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_am_pfnVectors[])(void) =
|
||||
{
|
||||
(void (*)(void))((uint32_t)g_pui32Stack + sizeof(g_pui32Stack)),
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART
|
||||
am_uart1_isr, // 15: UART
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: SYSTEM TIMER
|
||||
am_stimer_cmpr0_isr, // 19: SYSTEM TIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: SYSTEM TIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: SYSTEM TIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: SYSTEM TIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: SYSTEM TIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: SYSTEM TIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: SYSTEM TIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: SYSTEM TIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The following are constructs created by the linker, indicating where the
|
||||
// the "data" and "bss" segments reside in memory. The initializers for the
|
||||
// "data" segment resides immediately following the "text" segment.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern uint32_t _etext;
|
||||
extern uint32_t _sdata;
|
||||
extern uint32_t _edata;
|
||||
extern uint32_t _sbss;
|
||||
extern uint32_t _ebss;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined(__GNUC_STDC_INLINE__)
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Set the vector table pointer.
|
||||
//
|
||||
__asm(" ldr r0, =0xE000ED08\n"
|
||||
" ldr r1, =g_am_pfnVectors\n"
|
||||
" str r1, [r0]");
|
||||
|
||||
//
|
||||
// Set the stack pointer.
|
||||
//
|
||||
__asm(" ldr sp, [r1]");
|
||||
#ifndef NOFPU
|
||||
//
|
||||
// Enable the FPU.
|
||||
//
|
||||
__asm("ldr r0, =0xE000ED88\n"
|
||||
"ldr r1,[r0]\n"
|
||||
"orr r1,#(0xF << 20)\n"
|
||||
"str r1,[r0]\n"
|
||||
"dsb\n"
|
||||
"isb\n");
|
||||
#endif
|
||||
//
|
||||
// Copy the data segment initializers from flash to SRAM.
|
||||
//
|
||||
__asm(" ldr r0, =_init_data\n"
|
||||
" ldr r1, =_sdata\n"
|
||||
" ldr r2, =_edata\n"
|
||||
"copy_loop:\n"
|
||||
" ldr r3, [r0], #4\n"
|
||||
" str r3, [r1], #4\n"
|
||||
" cmp r1, r2\n"
|
||||
" blt copy_loop\n");
|
||||
//
|
||||
// Zero fill the bss segment.
|
||||
//
|
||||
__asm(" ldr r0, =_sbss\n"
|
||||
" ldr r1, =_ebss\n"
|
||||
" mov r2, #0\n"
|
||||
"zero_loop:\n"
|
||||
" cmp r0, r1\n"
|
||||
" it lt\n"
|
||||
" strlt r2, [r0], #4\n"
|
||||
" blt zero_loop");
|
||||
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
main();
|
||||
|
||||
//
|
||||
// If main returns then execute a break point instruction
|
||||
//
|
||||
__asm(" bkpt ");
|
||||
}
|
||||
#else
|
||||
#error GNU STDC inline not supported.
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amota
|
||||
COMPILERNAME := iar
|
||||
PROJECT := ble_freertos_amota_iar
|
||||
CONFIG := bin
|
||||
AM_SoftwareRoot ?= ../../../..
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p IarBuild.exe)
|
||||
RM = $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
IarBuild.exe ble_freertos_amota.ewp -make Debug -log info
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
IarBuild.exe ble_freertos_amota.ewp -clean Debug -log all
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/iar/bin/libam_hal.a:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/iar/bin/libam_bsp.a:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
+63308
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+2810
File diff suppressed because it is too large
Load Diff
+2686
File diff suppressed because it is too large
Load Diff
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\ble_freertos_amota.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
// ble_freertos_amota.icf
|
||||
//
|
||||
// IAR linker Configuration File
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Define a memory section that covers the entire 4 GB addressable space of the
|
||||
// processor. (32-bit can address up to 4GB)
|
||||
//
|
||||
define memory mem with size = 4G;
|
||||
|
||||
//
|
||||
// Define a region for the flash.
|
||||
//
|
||||
define region FLASH = mem:[from 0x00008000 to 0x00108000];
|
||||
|
||||
//
|
||||
// Define a region for the SRAM.
|
||||
//
|
||||
define region SRAM = mem:[from 0x10000000 to 0x10040000];
|
||||
|
||||
//
|
||||
// Define a block for the heap.
|
||||
//
|
||||
define block HEAP with alignment = 0x8, size = 0x00000000 { };
|
||||
|
||||
//
|
||||
// Define a block for the stack.
|
||||
//
|
||||
define block CSTACK with alignment = 0x8, size = 0xac0 { };
|
||||
|
||||
//
|
||||
// Read/Write values should be initialized by copying from flash.
|
||||
//
|
||||
initialize by copy { readwrite };
|
||||
|
||||
//
|
||||
// Indicate that the noinit values should be left alone.
|
||||
//
|
||||
do not initialize { section .noinit };
|
||||
|
||||
//
|
||||
// Place the interrupt vectors at the start of flash.
|
||||
//
|
||||
place at start of FLASH { readonly section .intvec };
|
||||
|
||||
//
|
||||
// Place the remainder of the read-only items into flash.
|
||||
//
|
||||
place in FLASH { readonly };
|
||||
|
||||
//
|
||||
// Place the stack at the start of SRAM.
|
||||
//
|
||||
place at start of SRAM { block CSTACK, section .noinit };
|
||||
|
||||
//
|
||||
// Place all read/write items into SRAM.
|
||||
//
|
||||
place in SRAM { block HEAP, readwrite };
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file startup_iar.c
|
||||
//!
|
||||
//! @brief Definitions for interrupt handlers, the vector table, and the stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Enable the IAR extensions for this source file.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma language = extended
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Weak function links.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma weak am_mpufault_isr = am_fault_isr
|
||||
#pragma weak am_busfault_isr = am_fault_isr
|
||||
#pragma weak am_usagefault_isr = am_fault_isr
|
||||
#pragma weak am_svcall_isr = am_default_isr
|
||||
#pragma weak am_debugmon_isr = am_default_isr
|
||||
#pragma weak am_pendsv_isr = am_default_isr
|
||||
#pragma weak am_systick_isr = am_default_isr
|
||||
#pragma weak am_brownout_isr = am_default_isr
|
||||
#pragma weak am_watchdog_isr = am_default_isr
|
||||
#pragma weak am_clkgen_isr = am_default_isr
|
||||
#pragma weak am_vcomp_isr = am_default_isr
|
||||
#pragma weak am_ioslave_ios_isr = am_default_isr
|
||||
#pragma weak am_ioslave_acc_isr = am_default_isr
|
||||
#pragma weak am_iomaster0_isr = am_default_isr
|
||||
#pragma weak am_iomaster1_isr = am_default_isr
|
||||
#pragma weak am_iomaster2_isr = am_default_isr
|
||||
#pragma weak am_iomaster3_isr = am_default_isr
|
||||
#pragma weak am_iomaster4_isr = am_default_isr
|
||||
#pragma weak am_iomaster5_isr = am_default_isr
|
||||
#pragma weak am_gpio_isr = am_default_isr
|
||||
#pragma weak am_ctimer_isr = am_default_isr
|
||||
#pragma weak am_uart_isr = am_default_isr
|
||||
#pragma weak am_uart1_isr = am_default_isr
|
||||
#pragma weak am_adc_isr = am_default_isr
|
||||
#pragma weak am_pdm0_isr = am_default_isr
|
||||
#pragma weak am_stimer_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr0_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr1_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr2_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr3_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr4_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr5_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr6_isr = am_default_isr
|
||||
#pragma weak am_stimer_cmpr7_isr = am_default_isr
|
||||
#pragma weak am_flash_isr = am_default_isr
|
||||
#pragma weak am_software0_isr = am_default_isr
|
||||
#pragma weak am_software1_isr = am_default_isr
|
||||
#pragma weak am_software2_isr = am_default_isr
|
||||
#pragma weak am_software3_isr = am_default_isr
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the default fault handlers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __stackless void am_reset_isr(void);
|
||||
extern __weak void am_nmi_isr(void);
|
||||
extern __weak void am_fault_isr(void);
|
||||
extern void am_mpufault_isr(void);
|
||||
extern void am_busfault_isr(void);
|
||||
extern void am_usagefault_isr(void);
|
||||
extern void am_svcall_isr(void);
|
||||
extern void am_debugmon_isr(void);
|
||||
extern void am_pendsv_isr(void);
|
||||
extern void am_systick_isr(void);
|
||||
extern void am_brownout_isr(void);
|
||||
extern void am_watchdog_isr(void);
|
||||
extern void am_clkgen_isr(void);
|
||||
extern void am_vcomp_isr(void);
|
||||
extern void am_ioslave_ios_isr(void);
|
||||
extern void am_ioslave_acc_isr(void);
|
||||
extern void am_iomaster0_isr(void);
|
||||
extern void am_iomaster1_isr(void);
|
||||
extern void am_iomaster2_isr(void);
|
||||
extern void am_iomaster3_isr(void);
|
||||
extern void am_iomaster4_isr(void);
|
||||
extern void am_iomaster5_isr(void);
|
||||
extern void am_gpio_isr(void);
|
||||
extern void am_ctimer_isr(void);
|
||||
extern void am_uart_isr(void);
|
||||
extern void am_uart1_isr(void);
|
||||
extern void am_adc_isr(void);
|
||||
extern void am_pdm0_isr(void);
|
||||
extern void am_stimer_isr(void);
|
||||
extern void am_stimer_cmpr0_isr(void);
|
||||
extern void am_stimer_cmpr1_isr(void);
|
||||
extern void am_stimer_cmpr2_isr(void);
|
||||
extern void am_stimer_cmpr3_isr(void);
|
||||
extern void am_stimer_cmpr4_isr(void);
|
||||
extern void am_stimer_cmpr5_isr(void);
|
||||
extern void am_stimer_cmpr6_isr(void);
|
||||
extern void am_stimer_cmpr7_isr(void);
|
||||
extern void am_flash_isr(void);
|
||||
extern void am_software0_isr(void);
|
||||
extern void am_software1_isr(void);
|
||||
extern void am_software2_isr(void);
|
||||
extern void am_software3_isr(void);
|
||||
|
||||
extern void am_default_isr(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application startup code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void __iar_program_start(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Reserve space for the system stack.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t pui32Stack[0xac0] @ ".noinit";
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// A union that describes the entries of the vector table. The union is needed
|
||||
// since the first entry is the stack pointer and the remainder are function
|
||||
// pointers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
typedef union
|
||||
{
|
||||
void (*pfnHandler)(void);
|
||||
uint32_t ui32Ptr;
|
||||
}
|
||||
uVectorEntry;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table. Note that the proper constructs must be placed on this to
|
||||
// ensure that it ends up at physical address 0x0000.0000.
|
||||
//
|
||||
// Note: Aliasing and weakly exporting am_mpufault_isr, am_busfault_isr, and
|
||||
// am_usagefault_isr does not work if am_fault_isr is defined externally.
|
||||
// Therefore, we'll explicitly use am_fault_isr in the table for those vectors.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__root const uVectorEntry __vector_table[] @ ".intvec" =
|
||||
{
|
||||
{ .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) },
|
||||
// The initial stack pointer
|
||||
am_reset_isr, // The reset handler
|
||||
am_nmi_isr, // The NMI handler
|
||||
am_fault_isr, // The hard fault handler
|
||||
am_fault_isr, // The MPU fault handler
|
||||
am_fault_isr, // The bus fault handler
|
||||
am_fault_isr, // The usage fault handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
am_svcall_isr, // SVCall handle
|
||||
am_debugmon_isr, // Debug monitor handler
|
||||
0, // Reserved
|
||||
am_pendsv_isr, // The PendSV handler
|
||||
am_systick_isr, // The SysTick handler
|
||||
|
||||
//
|
||||
// Peripheral Interrupts
|
||||
//
|
||||
am_brownout_isr, // 0: Brownout
|
||||
am_watchdog_isr, // 1: Watchdog
|
||||
am_clkgen_isr, // 2: CLKGEN
|
||||
am_vcomp_isr, // 3: Voltage Comparator
|
||||
am_ioslave_ios_isr, // 4: I/O Slave general
|
||||
am_ioslave_acc_isr, // 5: I/O Slave access
|
||||
am_iomaster0_isr, // 6: I/O Master 0
|
||||
am_iomaster1_isr, // 7: I/O Master 1
|
||||
am_iomaster2_isr, // 8: I/O Master 2
|
||||
am_iomaster3_isr, // 9: I/O Master 3
|
||||
am_iomaster4_isr, // 10: I/O Master 4
|
||||
am_iomaster5_isr, // 11: I/O Master 5
|
||||
am_gpio_isr, // 12: GPIO
|
||||
am_ctimer_isr, // 13: CTIMER
|
||||
am_uart_isr, // 14: UART0
|
||||
am_uart1_isr, // 15: UART1
|
||||
am_adc_isr, // 16: ADC
|
||||
am_pdm0_isr, // 17: PDM
|
||||
am_stimer_isr, // 18: STIMER
|
||||
am_stimer_cmpr0_isr, // 19: STIMER COMPARE0
|
||||
am_stimer_cmpr1_isr, // 20: STIMER COMPARE1
|
||||
am_stimer_cmpr2_isr, // 21: STIMER COMPARE2
|
||||
am_stimer_cmpr3_isr, // 22: STIMER COMPARE3
|
||||
am_stimer_cmpr4_isr, // 23: STIMER COMPARE4
|
||||
am_stimer_cmpr5_isr, // 24: STIMER COMPARE5
|
||||
am_stimer_cmpr6_isr, // 25: STIMER COMPARE6
|
||||
am_stimer_cmpr7_isr, // 26: STIMER COMPARE7
|
||||
am_flash_isr, // 27: FLASH
|
||||
am_software0_isr, // 28: SOFTWARE0
|
||||
am_software1_isr, // 29: SOFTWARE1
|
||||
am_software2_isr, // 30: SOFTWARE2
|
||||
am_software3_isr // 31: SOFTWARE3
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Note - The template for this function is originally found in IAR's module,
|
||||
// low_level_init.c. As supplied by IAR, it is an empty function.
|
||||
//
|
||||
// This module contains the function `__low_level_init', a function
|
||||
// that is called before the `main' function of the program. Normally
|
||||
// low-level initializations - such as setting the prefered interrupt
|
||||
// level or setting the watchdog - can be performed here.
|
||||
//
|
||||
// Note that this function is called before the data segments are
|
||||
// initialized, this means that this function cannot rely on the
|
||||
// values of global or static variables.
|
||||
//
|
||||
// When this function returns zero, the startup code will inhibit the
|
||||
// initialization of the data segments. The result is faster startup,
|
||||
// the drawback is that neither global nor static data will be
|
||||
// initialized.
|
||||
//
|
||||
// Copyright 1999-2017 IAR Systems AB.
|
||||
//
|
||||
// $Revision: 112610 $
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//*****************************************************************************
|
||||
#define AM_REGVAL(x) (*((volatile uint32_t *)(x)))
|
||||
#define VTOR_ADDR 0xE000ED08
|
||||
|
||||
__interwork int __low_level_init(void)
|
||||
{
|
||||
|
||||
AM_REGVAL(VTOR_ADDR) = (uint32_t)&__vector_table;
|
||||
|
||||
/*==================================*/
|
||||
/* Choose if segment initialization */
|
||||
/* should be done or not. */
|
||||
/* Return: 0 to omit seg_init */
|
||||
/* 1 to run seg_init */
|
||||
/*==================================*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor first starts execution
|
||||
// following a reset event. Only the absolutely necessary set is performed,
|
||||
// after which the application supplied entry() routine is called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
am_reset_isr(void)
|
||||
{
|
||||
//
|
||||
// Call the application's entry point.
|
||||
//
|
||||
__iar_program_start();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a NMI. This
|
||||
// simply enters an infinite loop, preserving the system state for examination
|
||||
// by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_nmi_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives a fault
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__weak void
|
||||
am_fault_isr(void)
|
||||
{
|
||||
//
|
||||
// Enter an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// This is the code that gets called when the processor receives an unexpected
|
||||
// interrupt. This simply enters an infinite loop, preserving the system state
|
||||
// for examination by a debugger.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static void
|
||||
am_default_isr(void)
|
||||
{
|
||||
//
|
||||
// Go into an infinite loop.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Name: Dbg_RAM.ini
|
||||
* Purpose: RAM Debug Initialization File
|
||||
* Note(s):
|
||||
*----------------------------------------------------------------------------
|
||||
* This file is part of the uVision/ARM development tools.
|
||||
* This software may only be used under the terms of a valid, current,
|
||||
* end user licence from KEIL for a compatible version of KEIL software
|
||||
* development tools. Nothing else gives you the right to use this software.
|
||||
*
|
||||
* This software is supplied "AS IS" without warranties of any kind.
|
||||
*
|
||||
* Copyright (c) 2008-2013 Keil - An ARM Company. All rights reserved.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
TraceSetup() Turn on ITM clocks, etc.
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void TraceSetup (void)
|
||||
{
|
||||
// turn on the ITM/TPIU clock
|
||||
_WDWORD(0x40020250, 0x00000201); // TPIU clock enabled at 3MHz
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Setup() configure PC & SP for RAM Debug
|
||||
*----------------------------------------------------------------------------*/
|
||||
FUNC void Setup (void) {
|
||||
SP = _RDWORD(0x00008000+0x0); // Setup Stack Pointer
|
||||
PC = _RDWORD(0x00008000+0x4); // Setup Program Counter
|
||||
_WDWORD(0xE000ED08, 0x00008000+0x0); // Setup Vector Table Offset Register (done in system file)
|
||||
}
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL // load the application
|
||||
|
||||
|
||||
// Executed after reset via uVision's 'Reset'-button
|
||||
FUNC void OnResetExec (void)
|
||||
{
|
||||
//Set_ui32HALflags();
|
||||
//TraceSetup();
|
||||
}
|
||||
|
||||
FUNC void Set_ui32HALflags (void)
|
||||
{
|
||||
TraceSetup();
|
||||
//g_ui32HALflags = 0x00000001;
|
||||
_break_ = 1;
|
||||
}
|
||||
|
||||
Setup(); // Setup for Running
|
||||
BS main, 1, "Set_ui32HALflags()";
|
||||
|
||||
g
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 1
|
||||
Device="AMAPH1KK-KBR"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#******************************************************************************
|
||||
#
|
||||
# Makefile - Rules for building the libraries, examples and docs.
|
||||
#
|
||||
# Copyright (c) 2020, Ambiq Micro
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# Third party software included in this distribution is subject to the
|
||||
# additional license terms as defined in the /docs/licenses directory.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
#
|
||||
#******************************************************************************
|
||||
TARGET := ble_freertos_amota
|
||||
COMPILERNAME := Keil
|
||||
PROJECT := ble_freertos_amota_Keil
|
||||
CONFIG := bin
|
||||
|
||||
SHELL:=/bin/bash
|
||||
#### Required Executables ####
|
||||
K := $(shell type -p UV4.exe)
|
||||
RM := $(shell which rm 2>/dev/null)
|
||||
|
||||
ifeq ($(K),)
|
||||
all clean:
|
||||
$(info Tools w/$(COMPILERNAME) not installed.)
|
||||
$(RM) -rf bin
|
||||
else
|
||||
|
||||
all: directories binary
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
UV4.exe -b -t "ble_freertos_amota" ble_freertos_amota.uvprojx -j0 || [ $$? -eq 1 ]
|
||||
|
||||
directories: $(CONFIG)
|
||||
|
||||
$(CONFIG):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@echo Cleaning... ;\
|
||||
$(RM) -rf $(CONFIG)
|
||||
|
||||
|
||||
../../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib:
|
||||
$(MAKE) -C ../../../../../mcu/apollo2/hal
|
||||
|
||||
../../../bsp/keil/bin/libam_bsp.lib:
|
||||
$(MAKE) -C ../../../bsp
|
||||
|
||||
endif
|
||||
.PHONY: all clean directories
|
||||
|
||||
+50055
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
;******************************************************************************
|
||||
;
|
||||
; ble_freertos_amota.sct
|
||||
;
|
||||
; Scatter file for Keil linker configuration.
|
||||
;
|
||||
;******************************************************************************
|
||||
|
||||
;******************************************************************************
|
||||
;
|
||||
; Copyright (c) 2020, Ambiq Micro
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
;
|
||||
; 2. Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; 3. Neither the name of the copyright holder nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from this
|
||||
; software without specific prior written permission.
|
||||
;
|
||||
; Third party software included in this distribution is subject to the
|
||||
; additional license terms as defined in the /docs/licenses directory.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
; POSSIBILITY OF SUCH DAMAGE.
|
||||
;
|
||||
; This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
;
|
||||
;******************************************************************************
|
||||
LR_1 0x00008000
|
||||
{
|
||||
FLASH 0x00008000 0x00100000
|
||||
{
|
||||
*.o (RESET, +First)
|
||||
* (+RO)
|
||||
}
|
||||
|
||||
SRAM 0x10000000 0x00040000
|
||||
{
|
||||
* (+RW, +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
+3259
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user