Skip to content

Svl updates #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ad2b6d1
Delete Artemis_SVL_V2.ino.bin
oclyke Jul 24, 2019
03353f2
Create artemis_svl.bin
oclyke Jul 24, 2019
73f4ff2
bootloader burning tool to use 'artemis_svl.bin'
oclyke Jul 24, 2019
4bd6c86
Delete artemis_svl.py
oclyke Jul 24, 2019
2c8f173
Create artemis_svl.py
oclyke Jul 24, 2019
e5b4a00
Remove old bootloader binaries
oclyke Jul 24, 2019
fff5e39
regenerate 'artemis_svl.exe' for version 3+
oclyke Jul 24, 2019
8b82eae
Revert "regenerate 'artemis_svl.exe' for version 3+"
oclyke Jul 24, 2019
2545bfb
fix 'exit()' error
oclyke Jul 24, 2019
e9c6aff
regenerate 'artemis_svl.exe' for version 3+
oclyke Jul 24, 2019
ef99c95
Add STimer initialization to SVL binary
oclyke Jul 24, 2019
e279a63
regenerate macosx and linux binaries for 'artemis_svl' v3+
oclyke Jul 24, 2019
d05d2d8
Merge branch 'svl_updates' of https://github.com/sparkfun/Arduino_Apo…
oclyke Jul 24, 2019
8b28c37
Add artemis_svl source code
oclyke Jul 24, 2019
30f7e96
Prevent 'burn bootloader' from overwriting user's sketch at USERCODE_…
oclyke Jul 24, 2019
3918090
Improve verbose print support
oclyke Jul 24, 2019
a3599f3
Move debug statements to verbose print
Jul 24, 2019
31e440c
Revert "Add artemis_svl source code"
oclyke Jul 24, 2019
b5d809f
Recompile SVL python for windows
Jul 24, 2019
d28f9eb
Add Artemis SVL source code
oclyke Jul 24, 2019
19268a4
Improve verboseprint support in artemis_svl.py
oclyke Jul 24, 2019
8503f15
Merge branch 'svl_updates' of https://github.com/sparkfun/Arduino_Apo…
oclyke Jul 24, 2019
f54d01b
Prepare to regenerate bootloader binaries
oclyke Jul 24, 2019
3fac151
regenerate 'artemis_svl.exe' after STimer init fix
oclyke Jul 24, 2019
da540aa
remove old binaries
oclyke Jul 24, 2019
8e4576c
add fixed 'artemis_svl.bin' (STimer init fix)
oclyke Jul 24, 2019
e5ae995
Revert "regenerate 'artemis_svl.exe' after STimer init fix"
oclyke Jul 24, 2019
0167b58
Printing format changes
oclyke Jul 24, 2019
a278eb9
regenerate 'artemis_svl.exe'
oclyke Jul 24, 2019
d54fa85
Revert "regenerate 'artemis_svl.exe'"
oclyke Jul 24, 2019
f99db83
Revert "Revert "regenerate 'artemis_svl.exe'""
oclyke Jul 24, 2019
d2f4945
regenerate 'artemis_svl' binaries for macosx and linux
oclyke Jul 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions bootloaders/artemis/!artemis_svl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#******************************************************************************
#
# Makefile - Rules for compiling
#
# Copyright (c) 2019, 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.1.0 of the AmbiqSuite Development Package.
#
#******************************************************************************

# All makefiles use this to find the top level directory.
SWROOT?=../../../..

# Include rules for building generic examples.
include $(SWROOT)/makedefs/example.mk
21 changes: 21 additions & 0 deletions bootloaders/artemis/!artemis_svl/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Name:
=====
hello_world_uart


Description:
============
A simple "Hello World" example using the UART peripheral.


Purpose:
========
This example prints a "Hello World" message with some device info
over UART at 115200 baud. To see the output of this program, run AMFlash,
and configure the console for UART. The example sleeps after it is done
printing.


******************************************************************************


1 change: 1 addition & 0 deletions bootloaders/artemis/!artemis_svl/gcc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*bin*
244 changes: 244 additions & 0 deletions bootloaders/artemis/!artemis_svl/gcc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
#******************************************************************************
#
# Makefile - Rules for building the libraries, examples and docs.
#
# Copyright (c) 2019, 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.1.0 of the AmbiqSuite Development Package.
#
#******************************************************************************

# ARTEMIS_BIN2BOARD is the command to run the combined Ambiq tools (bin to ota blob,
# ota blob to wired blob, wired update). You'll need to determine how to engage it
# for your own system. (You might use pyinstaller to create a binary executable, or)
# call it via python3
# Examples:
# (via python) ARTEMIS_BIN2BOARD=python "path_to_tool/ambiq_bin2board.py"
# (via executable [windows]) ARTEMIS_BIN2BOARD="path_to_tool/ambiq_bin2board_installed.exe"
# (via executable [*nix]) ARTEMIS_BIN2BOARD=./path_to_tool/ambiq_bin2board_installed
# (via executable on in the default search path) ARTEMIS_BIN2BOARD=ambiq_bin2board_installed
ARTEMIS_SVL=
# COM_PORT is the serial port to use for uploading. For example COM#### on Windows or /dev/cu.usbserial-#### on *nix
COM_PORT=
ifeq ($(ARTEMIS_SVL),)
$(warning warning: you have not defined ARTEMIS_SVL so bootloading will not work)
endif
ifeq ($(COM_PORT),)
$(warning warning: you have not defined COM_PORT so bootloading will not work)
endif

# SDKPATH =C:/Users/owen.lyke/AppData/Roaming/AmbiqSDK/AmbiqSuite-Rel2.1.0# Note that if you copy/paste a windows file path here you need to change backslashes to forward slashes
SDKPATH =
ifeq ($(SDKPATH),)
SDKPATH =../../../../..
$(warning warning: you have not defined SDK_PATH so will continue assuming that the SDK root is at $(SDKPATH))

endif

BOARDPATH =${SDKPATH}/boards/artemis# Set this as the path to the Artemis BSP (Board Support Package) directory. Initially assumes that you put the BSP under the 'boards' directory in the SDK


USER_INCLUDE_DIRS = -I../src/svl_ringbuf
USER_INCLUDE_DIRS += -I../src/svl_packet
USER_INCLUDE_DIRS += -I../src/svl_uart
USER_INCLUDE_DIRS += -I../src/svl_utils

USER_SOURCEDIRS = ../src
USER_SOURCEDIRS += ../src/svl_ringbuf
USER_SOURCEDIRS += ../src/svl_packet
USER_SOURCEDIRS += ../src/svl_uart
USER_SOURCEDIRS += ../src/svl_utils

USER_MAIN_SRC = main.c
USER_SOURCE_FILES = svl_ringbuf.c
USER_SOURCE_FILES += svl_packet.c
USER_SOURCE_FILES += svl_uart.c
USER_SOURCE_FILES += svl_utils.c


#### Names ####
TARGET := artemis_svl
COMPILERNAME := gcc
PROJECT := artemis_svl_gcc
CONFIG := bin

SHELL:=/bin/bash
#### Setup ####

TOOLCHAIN ?= arm-none-eabi
PART = apollo3
CPU = cortex-m4
FPU = fpv4-sp-d16
# Default to FPU hardware calling convention. However, some customers and/or
# applications may need the software calling convention.
#FABI = softfp
FABI = hard

LINKER_FILE := ./artemis_svl_gcc.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_APOLLO3
DEFINES+= -DAM_PACKAGE_BGA

# Includes from the SDK
# INCLUDES+= -I../../../../.. # This one doesn't make much sense to me
INCLUDES = -I${SDKPATH}/CMSIS/AmbiqMicro/Include
INCLUDES+= -I${SDKPATH}/mcu/apollo3
INCLUDES+= -I${SDKPATH}/CMSIS/ARM/Include
INCLUDES+= -I${SDKPATH}/utils
INCLUDES+= -I${SDKPATH}/devices

# Includes for the board you've chosen
INCLUDES+= -I../src # This is where the source for the particular project is
INCLUDES+= -I${BOARDPATH}/bsp

INCLUDES+= ${USER_INCLUDE_DIRS}

VPATH = ${SDKPATH}/devices
VPATH+= ${SDKPATH}/utils
VPATH+= ${USER_SOURCEDIRS}

SRC = ${USER_MAIN_SRC}
SRC += am_devices_led.c
SRC += am_util_delay.c
SRC += am_util_faultisr.c
SRC += am_util_stdio.c
SRC += am_util_id.c
SRC += startup_gcc.c
SRC += ${USER_SOURCE_FILES}

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/apollo3/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
CFLAGS+= -MMD -MP -std=c99 -Wall -g
CFLAGS+= -O1
# CFLAGS+= -O0
CFLAGS+= $(DEFINES)
CFLAGS+= $(INCLUDES)
CFLAGS+=

LFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
LFLAGS+= -nostartfiles -static
LFLAGS+= -Wl,--gc-sections,--entry,Reset_Handler,-Map,$(CONFIG)/$(TARGET).map
LFLAGS+= -Wl,--start-group -lm -lc -lgcc $(LIBS) -Wl,--end-group
LFLAGS+= -specs=nano.specs -specs=nosys.specs

# 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

bootload: all
C:\Users\owen.lyke\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.2/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\owen.lyke\AppData\Roaming\AmbiqSDK\AmbiqSuite-Rel2.2.0\boards\artemis\examples\!artemis_svl\gcc\bin\artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\owen.lyke\AppData\Roaming\AmbiqSDK\AmbiqSuite-Rel2.2.0\boards\artemis\examples\!artemis_svl\gcc\bin\artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM4 -r 2 -v

$(CONFIG)/%.d: ;

../../../../../mcu/apollo3/hal/gcc/bin/libam_hal.a:
$(MAKE) -C ../../../../../mcu/apollo3/hal

../../../bsp/gcc/bin/libam_bsp.a:
$(MAKE) -C ../../../bsp

# Automatically include any generated dependencies
-include $(DEPS)
endif
.PHONY: all clean directories
79 changes: 79 additions & 0 deletions bootloaders/artemis/!artemis_svl/gcc/artemis_svl_gcc.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/******************************************************************************
*
* artemis_svl_gcc.ld - Linker script for the artemis svl (provides _sbrk for vsnprintf)
*
*****************************************************************************/
ENTRY(Reset_Handler)

MEMORY
{
FLASH (rx) : ORIGIN = 0x0000C000, LENGTH = 960K
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 384K
}

SECTIONS
{
.text :
{
. = ALIGN(4);
KEEP(*(.isr_vector))
KEEP(*(.patch))
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)

/*
. = ALIGN(4);
__init_array_start = .;
KEEP(*(.init_array)) C++ constructors
KEEP(*(.ctors)) and vtable init
__init_array_end = .;
*/

_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

.heap (COPY):
{
__end__ = .;
PROVIDE(end = .);
*(.heap*)
__HeapLimit = .;
} > SRAM

.ARM.attributes 0 : { *(.ARM.attributes) }
}
Loading