To whom it may concern,
I tried to modify the adc_lpmode0_dma example Makefile to upload this example from C code to the red board Artemis ATP. I added the board_sfe, with the SparkFun board definitions, directory to the SDK following a Sparkfun tutorial. I put the modified Makefile in the original directory of the adc_lpmode0_dma example provided by the Ambiq SDK in the Apollo3_evb directory.
I attached a copy of my make file to this post. When I try to load this example to the board I get the following output from the make:
"Compiling gcc …/src/adc_lpmode0_dma.c
Compiling gcc …/…/…/…/…/utils/am_util_delay.c
Compiling gcc …/…/…/…/…/utils/am_util_faultisr.c
Compiling gcc …/…/…/…/…/utils/am_util_stdio.c
Compiling gcc …/…/…/…/…/devices/am_devices_led.c
Compiling gcc startup_gcc.c
Linking gcc bin/adc_lpmode0_dma_svl.axf with script /Users/miayanyeremi/Downloads/AmbiqSuite-R2.4.2/boards_sfe/common/tools_sfe/templates/asb_svl_linker.ld
/usr/local/gcc_arm/gcc-arm-none-eabi-9-2020-q2-update/bin/…/lib/gcc/arm-none-eabi/9.3.1/…/…/…/…/arm-none-eabi/bin/ld: bin/adc_lpmode0_dma_svl.axf section .stack' will not fit in region
sram’
/usr/local/gcc_arm/gcc-arm-none-eabi-9-2020-q2-update/bin/…/lib/gcc/arm-none-eabi/9.3.1/…/…/…/…/arm-none-eabi/bin/ld: region `sram’ overflowed by 4088 bytes"
I don’t know what to do to try and fix this error I didn’t modify the original c code. Any help or suggestions would be appreciated.
Cheers,
Miayan
I could not get my make file to attach to this post so here it is copy and pasted:
TARGET := adc_lpmode0_dma
COMPILERNAME := gcc
PROJECT := adc_lpmode0_dma_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 := ./adc_lpmode0_dma.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+= -DAM_PART_APOLLO3
DEFINES+= -Dgcc
SDKPATH = /Users/miayanyeremi/Downloads
BOARDPATH = $(SDKPATH)/AmbiqSuite-R2.4.2/boards_sfe/redboard_artemis_atp
#INCLUDES = -I…/…/…/bsp #CHANGED
INCLUDES+= -I$(BOARDPATH)/bsp
INCLUDES+= -I…/src
INCLUDES+= -I…/…/…/…/…/mcu/apollo3
INCLUDES+= -I…/…/…/…/…/CMSIS/AmbiqMicro/Include
INCLUDES+= -I…/…/…/…/…/devices
INCLUDES+= -I…/…/…/…/…
INCLUDES+= -I…/…/…/…/…/utils
INCLUDES+= -I…/…/…/…/…/CMSIS/ARM/Include
VPATH = …/src
VPATH+=:…/…/…/…/…/utils
VPATH+=:…/…/…/…/…/devices
SRC = adc_lpmode0_dma.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 #CHANGED
LIBS = $(BOARDPATH)/bsp/gcc/bin/libam_bsp.a
LIBS += …/…/…/…/…/mcu/apollo3/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,Reset_Handler,-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
COMMONPATH = $(SDKPATH)/AmbiqSuite-R2.4.2/boards_sfe/common
Bootloader Tools
AMBIQ_BIN2BOARD=$(PYTHON3) $(COMMONPATH)/tools_sfe/ambiq/ambiq_bin2board.py
ARTEMIS_SVL=$(PYTHON3) $(COMMONPATH)/tools_sfe/artemis/artemis_svl.py
Rules
#all: directories $(CONFIG)/$(TARGET).bin
all: asb
asb: directories $(CONFIG)/$(TARGET)_asb.bin
svl: directories $(CONFIG)/$(TARGET)_svl.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)_asb.axf: LINKER_FILE = $(COMMONPATH)/tools_sfe/templates/asb_linker.ld
$(CONFIG)/$(TARGET)_asb.axf: $(OBJS) $(LIBS)
@echo " Linking $(COMPILERNAME) $@ with script $(LINKER_FILE)";\
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
$(CONFIG)/$(TARGET)_svl.axf: LINKER_FILE = $(COMMONPATH)/tools_sfe/templates/asb_svl_linker.ld
$(CONFIG)/$(TARGET)_svl.axf: $(OBJS) $(LIBS)
@echo " Linking $(COMPILERNAME) $@ with script $(LINKER_FILE)";\
$(CC) -Wl,-T,$(LINKER_FILE) -o $@ $(OBJS) $(LFLAGS)
$(CONFIG)/$(TARGET)%.bin: $(CONFIG)/$(TARGET)%.axf
@echo " Copying $(COMPILERNAME) $@…" ;\
$(CP) $(CPFLAGS) $< $@ ;\
$(OD) $(ODFLAGS) $< > $(CONFIG)/$(TARGET).lst
#$(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
ASB_UPLOAD_BAUD = 115200
SVL_UPLOAD_BAUD = 921600
COM_PORT = /dev/cu.wchusbserial1410
bootload_asb: directories $(CONFIG)/$(TARGET)_asb.bin
$(AMBIQ_BIN2BOARD) --bin $(CONFIG)/$(TARGET)_asb.bin --load-address-blob 0x20000 --magic-num 0xCB -o $(CONFIG)/$(TARGET) --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b $(ASB_UPLOAD_BAUD) -port $(COM_PORT) -r 2 -v
bootload_svl: directories $(CONFIG)/$(TARGET)_svl.bin
$(ARTEMIS_SVL) $(COM_PORT) -f $(CONFIG)/$(TARGET)_svl.bin -b $(SVL_UPLOAD_BAUD) -v
bootload: bootload_svl
clean:
@echo “Cleaning…” ;\
$(RM) -f $(OBJS) $(DEPS) \
$(CONFIG)/$(TARGET)%.bin $(CONFIG)/$(TARGET)%.axf \
$(CONFIG)/$(TARGET).lst $(CONFIG)/$(TARGET).map
$(RM) -r bin
-$(RM) $(TARGET).ld
$(CONFIG)/%.d: ;
#…/…/…/bsp/gcc/bin/libam_bsp.a:
$(MAKE) -C …/…/…/bsp
#…/…/…/…/…/mcu/apollo3/hal/gcc/bin/libam_hal.a:
$(MAKE) -C …/…/…/…/…/mcu/apollo3/hal
Automatically include any generated dependencies
#-include $(DEPS)
#endif
#.PHONY: all clean directories
$(SDKPATH)/mcu/apollo3/hal/gcc/bin/libam_hal.a:
$(MAKE) -C $(SDKPATH)/mcu/apollo3/hal/gcc
$(SDKPATH)/third_party/uecc/gcc/bin/lib_uecc.a:
$(MAKE) -C $(SDKPATH)/third_party/uecc
$(BOARDPATH)/bsp/gcc/bin/libam_bsp.a:
$(MAKE) -C $(BOARDPATH)/bsp/gcc
Automatically include any generated dependencies
-include $(DEPS)
endif
.PHONY: all clean directories bootload bootload_asb bootload_svl