stable
parent
5d4b6ea448
commit
e93f47cac7
@ -1,6 +0,0 @@
|
|||||||
!.gitignore
|
|
||||||
!system_same54.c
|
|
||||||
!Makefile
|
|
||||||
!gcc/*
|
|
||||||
|
|
||||||
*
|
|
@ -1,281 +0,0 @@
|
|||||||
################################################################################
|
|
||||||
# Automatically-generated file. Do not edit!
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
ifdef SystemRoot
|
|
||||||
SHELL = cmd.exe
|
|
||||||
MK_DIR = mkdir
|
|
||||||
else
|
|
||||||
ifeq ($(shell uname), Linux)
|
|
||||||
MK_DIR = mkdir -p
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell uname | cut -d _ -f 1), CYGWIN)
|
|
||||||
MK_DIR = mkdir -p
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell uname | cut -d _ -f 1), MINGW32)
|
|
||||||
MK_DIR = mkdir -p
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell uname | cut -d _ -f 1), MINGW64)
|
|
||||||
MK_DIR = mkdir -p
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell uname | cut -d _ -f 1), DARWIN)
|
|
||||||
MK_DIR = mkdir -p
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# List the subdirectories for creating object files
|
|
||||||
SUB_DIRS += \
|
|
||||||
\
|
|
||||||
hpl/pm \
|
|
||||||
build \
|
|
||||||
hpl/osc32kctrl \
|
|
||||||
hpl/ramecc \
|
|
||||||
hpl/dmac \
|
|
||||||
hal/src \
|
|
||||||
hpl/mclk \
|
|
||||||
hpl/systick \
|
|
||||||
hal/utils/src \
|
|
||||||
hpl/sercom \
|
|
||||||
examples \
|
|
||||||
hpl/gclk \
|
|
||||||
hpl/oscctrl \
|
|
||||||
build/gcc \
|
|
||||||
hpl/core \
|
|
||||||
hpl/cmcc \
|
|
||||||
shared \
|
|
||||||
shared/devices \
|
|
||||||
shared/drivers \
|
|
||||||
shared/util
|
|
||||||
|
|
||||||
# List the object files
|
|
||||||
OBJS += \
|
|
||||||
hal/src/hal_io.o \
|
|
||||||
hpl/systick/hpl_systick.o \
|
|
||||||
hpl/core/hpl_core_m4.o \
|
|
||||||
hal/utils/src/utils_syscalls.o \
|
|
||||||
hal/src/hal_spi_m_sync.o \
|
|
||||||
build/system_same54.o \
|
|
||||||
hal/src/hal_delay.o \
|
|
||||||
hpl/pm/hpl_pm.o \
|
|
||||||
hpl/core/hpl_init.o \
|
|
||||||
hpl/gclk/hpl_gclk.o \
|
|
||||||
hal/utils/src/utils_list.o \
|
|
||||||
hal/utils/src/utils_assert.o \
|
|
||||||
hpl/dmac/hpl_dmac.o \
|
|
||||||
hpl/oscctrl/hpl_oscctrl.o \
|
|
||||||
hal/src/hal_usart_sync.o \
|
|
||||||
hpl/mclk/hpl_mclk.o \
|
|
||||||
hpl/ramecc/hpl_ramecc.o \
|
|
||||||
hal/src/hal_init.o \
|
|
||||||
build/gcc/startup_same54.o \
|
|
||||||
main.o \
|
|
||||||
hpl/osc32kctrl/hpl_osc32kctrl.o \
|
|
||||||
examples/driver_examples.o \
|
|
||||||
driver_init.o \
|
|
||||||
hpl/sercom/hpl_sercom.o \
|
|
||||||
hal/src/hal_gpio.o \
|
|
||||||
hal/utils/src/utils_event.o \
|
|
||||||
hal/src/hal_sleep.o \
|
|
||||||
hal/src/hal_cache.o \
|
|
||||||
hpl/cmcc/hpl_cmcc.o \
|
|
||||||
atmel_start.o \
|
|
||||||
hal/src/hal_atomic.o \
|
|
||||||
shared/util/pdebug.o
|
|
||||||
|
|
||||||
OBJS_AS_ARGS += \
|
|
||||||
"hal/src/hal_io.o" \
|
|
||||||
"hpl/systick/hpl_systick.o" \
|
|
||||||
"hpl/core/hpl_core_m4.o" \
|
|
||||||
"hal/utils/src/utils_syscalls.o" \
|
|
||||||
"hal/src/hal_spi_m_sync.o" \
|
|
||||||
"build/system_same54.o" \
|
|
||||||
"hal/src/hal_delay.o" \
|
|
||||||
"hpl/pm/hpl_pm.o" \
|
|
||||||
"hpl/core/hpl_init.o" \
|
|
||||||
"hpl/gclk/hpl_gclk.o" \
|
|
||||||
"hal/utils/src/utils_list.o" \
|
|
||||||
"hal/utils/src/utils_assert.o" \
|
|
||||||
"hpl/dmac/hpl_dmac.o" \
|
|
||||||
"hpl/oscctrl/hpl_oscctrl.o" \
|
|
||||||
"hal/src/hal_usart_sync.o" \
|
|
||||||
"hpl/mclk/hpl_mclk.o" \
|
|
||||||
"hpl/ramecc/hpl_ramecc.o" \
|
|
||||||
"hal/src/hal_init.o" \
|
|
||||||
"build/gcc/startup_same54.o" \
|
|
||||||
"main.o" \
|
|
||||||
"hpl/osc32kctrl/hpl_osc32kctrl.o" \
|
|
||||||
"examples/driver_examples.o" \
|
|
||||||
"driver_init.o" \
|
|
||||||
"hpl/sercom/hpl_sercom.o" \
|
|
||||||
"hal/src/hal_gpio.o" \
|
|
||||||
"hal/utils/src/utils_event.o" \
|
|
||||||
"hal/src/hal_sleep.o" \
|
|
||||||
"hal/src/hal_cache.o" \
|
|
||||||
"hpl/cmcc/hpl_cmcc.o" \
|
|
||||||
"atmel_start.o" \
|
|
||||||
"hal/src/hal_atomic.o" \
|
|
||||||
"shared/util/pdebug.o"
|
|
||||||
|
|
||||||
|
|
||||||
# List the directories containing header files
|
|
||||||
DIR_INCLUDES += \
|
|
||||||
-I"../" \
|
|
||||||
-I"../config" \
|
|
||||||
-I"../examples" \
|
|
||||||
-I"../hal/include" \
|
|
||||||
-I"../hal/utils/include" \
|
|
||||||
-I"../hpl/cmcc" \
|
|
||||||
-I"../hpl/core" \
|
|
||||||
-I"../hpl/dmac" \
|
|
||||||
-I"../hpl/gclk" \
|
|
||||||
-I"../hpl/mclk" \
|
|
||||||
-I"../hpl/osc32kctrl" \
|
|
||||||
-I"../hpl/oscctrl" \
|
|
||||||
-I"../hpl/pm" \
|
|
||||||
-I"../hpl/port" \
|
|
||||||
-I"../hpl/ramecc" \
|
|
||||||
-I"../hpl/sercom" \
|
|
||||||
-I"../hpl/systick" \
|
|
||||||
-I"../hri" \
|
|
||||||
-I"../" \
|
|
||||||
-I"../CMSIS/Core/Include" \
|
|
||||||
-I"../include" \
|
|
||||||
-I"../shared" \
|
|
||||||
-I"../shared/drivers" \
|
|
||||||
-I"../shared/devices" \
|
|
||||||
-I"../shared/util"
|
|
||||||
|
|
||||||
# List the dependency files
|
|
||||||
DEPS := $(OBJS:%.o=%.d)
|
|
||||||
|
|
||||||
DEPS_AS_ARGS += \
|
|
||||||
"hal/utils/src/utils_event.d" \
|
|
||||||
"hal/src/hal_io.d" \
|
|
||||||
"hpl/ramecc/hpl_ramecc.d" \
|
|
||||||
"hpl/systick/hpl_systick.d" \
|
|
||||||
"hpl/core/hpl_core_m4.d" \
|
|
||||||
"hal/utils/src/utils_syscalls.d" \
|
|
||||||
"hal/src/hal_spi_m_sync.d" \
|
|
||||||
"hal/utils/src/utils_list.d" \
|
|
||||||
"hpl/cmcc/hpl_cmcc.d" \
|
|
||||||
"hpl/dmac/hpl_dmac.d" \
|
|
||||||
"hal/utils/src/utils_assert.d" \
|
|
||||||
"hal/src/hal_delay.d" \
|
|
||||||
"hpl/core/hpl_init.d" \
|
|
||||||
"hpl/pm/hpl_pm.d" \
|
|
||||||
"hpl/gclk/hpl_gclk.d" \
|
|
||||||
"build/gcc/startup_same54.d" \
|
|
||||||
"hal/src/hal_init.d" \
|
|
||||||
"hal/src/hal_usart_sync.d" \
|
|
||||||
"hpl/mclk/hpl_mclk.d" \
|
|
||||||
"driver_init.d" \
|
|
||||||
"hpl/osc32kctrl/hpl_osc32kctrl.d" \
|
|
||||||
"main.d" \
|
|
||||||
"examples/driver_examples.d" \
|
|
||||||
"hal/src/hal_cache.d" \
|
|
||||||
"hal/src/hal_sleep.d" \
|
|
||||||
"hpl/sercom/hpl_sercom.d" \
|
|
||||||
"hal/src/hal_gpio.d" \
|
|
||||||
"hal/src/hal_atomic.d" \
|
|
||||||
"hpl/oscctrl/hpl_oscctrl.d" \
|
|
||||||
"build/system_same54.d" \
|
|
||||||
"atmel_start.d" \
|
|
||||||
"shared/util/pdebug.d"
|
|
||||||
|
|
||||||
OUTPUT_FILE_NAME :=spi_sd_mmc_lib
|
|
||||||
QUOTE := "
|
|
||||||
OUTPUT_FILE_PATH +=$(OUTPUT_FILE_NAME).elf
|
|
||||||
OUTPUT_FILE_PATH_AS_ARGS +=$(OUTPUT_FILE_NAME).elf
|
|
||||||
|
|
||||||
vpath %.c ../
|
|
||||||
vpath %.s ../
|
|
||||||
vpath %.S ../
|
|
||||||
|
|
||||||
# All Target
|
|
||||||
all: $(SUB_DIRS) $(OUTPUT_FILE_PATH)
|
|
||||||
|
|
||||||
# Linker target
|
|
||||||
|
|
||||||
$(OUTPUT_FILE_PATH): $(OBJS)
|
|
||||||
@echo Building target: $@
|
|
||||||
@echo Invoking: ARM/GNU Linker
|
|
||||||
$(QUOTE)arm-none-eabi-gcc$(QUOTE) -o $(OUTPUT_FILE_NAME).elf $(OBJS_AS_ARGS) -Wl,--start-group -lm -Wl,--end-group -mthumb \
|
|
||||||
-Wl,-Map="$(OUTPUT_FILE_NAME).map" --specs=nano.specs -Wl,--gc-sections -mcpu=cortex-m4 \
|
|
||||||
\
|
|
||||||
-T"../build/gcc/same54p20a_flash.ld" \
|
|
||||||
-L"../build/gcc"
|
|
||||||
@echo Finished building target: $@
|
|
||||||
|
|
||||||
"arm-none-eabi-objcopy" -O binary "$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).bin"
|
|
||||||
"arm-none-eabi-objcopy" -O ihex -R .eeprom -R .fuse -R .lock -R .signature \
|
|
||||||
"$(OUTPUT_FILE_NAME).elf" "$(OUTPUT_FILE_NAME).hex"
|
|
||||||
"arm-none-eabi-objcopy" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma \
|
|
||||||
.eeprom=0 --no-change-warnings -O binary "$(OUTPUT_FILE_NAME).elf" \
|
|
||||||
"$(OUTPUT_FILE_NAME).eep" || exit 0
|
|
||||||
"arm-none-eabi-objdump" -h -S "$(OUTPUT_FILE_NAME).elf" > "$(OUTPUT_FILE_NAME).lss"
|
|
||||||
"arm-none-eabi-size" "$(OUTPUT_FILE_NAME).elf"
|
|
||||||
|
|
||||||
|
|
||||||
# Compiler targets
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
@echo Building file: $<
|
|
||||||
@echo ARM/GNU C Compiler
|
|
||||||
$(QUOTE)arm-none-eabi-gcc$(QUOTE) -x c -mthumb -DDEBUG -Os -ffunction-sections -mlong-calls -g3 -Wall -c -std=gnu99 \
|
|
||||||
-D__SAME54P20A__ -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 \
|
|
||||||
$(DIR_INCLUDES) \
|
|
||||||
-MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
|
|
||||||
@echo Finished building: $<
|
|
||||||
|
|
||||||
%.o: %.s
|
|
||||||
@echo Building file: $<
|
|
||||||
@echo ARM/GNU Assembler
|
|
||||||
$(QUOTE)arm-none-eabi-as$(QUOTE) -x c -mthumb -DDEBUG -Os -ffunction-sections -mlong-calls -g3 -Wall -c -std=gnu99 \
|
|
||||||
-D__SAME54P20A__ -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 \
|
|
||||||
$(DIR_INCLUDES) \
|
|
||||||
-MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
|
|
||||||
@echo Finished building: $<
|
|
||||||
|
|
||||||
%.o: %.S
|
|
||||||
@echo Building file: $<
|
|
||||||
@echo ARM/GNU Preprocessing Assembler
|
|
||||||
$(QUOTE)arm-none-eabi-gcc$(QUOTE) -x c -mthumb -DDEBUG -Os -ffunction-sections -mlong-calls -g3 -Wall -c -std=gnu99 \
|
|
||||||
-D__SAME54P20A__ -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 \
|
|
||||||
$(DIR_INCLUDES) \
|
|
||||||
-MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
|
|
||||||
@echo Finished building: $<
|
|
||||||
|
|
||||||
# Detect changes in the dependent files and recompile the respective object files.
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
|
||||||
ifneq ($(strip $(DEPS)),)
|
|
||||||
-include $(DEPS)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(SUB_DIRS):
|
|
||||||
$(MK_DIR) "$@"
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJS_AS_ARGS)
|
|
||||||
rm -f $(OUTPUT_FILE_PATH)
|
|
||||||
rm -f $(DEPS_AS_ARGS)
|
|
||||||
rm -f $(OUTPUT_FILE_NAME).a $(OUTPUT_FILE_NAME).hex $(OUTPUT_FILE_NAME).bin \
|
|
||||||
$(OUTPUT_FILE_NAME).lss $(OUTPUT_FILE_NAME).eep $(OUTPUT_FILE_NAME).map \
|
|
||||||
$(OUTPUT_FILE_NAME).srec
|
|
||||||
debug: $(OUTPUT_FILE_NAME).elf
|
|
||||||
@$(QUOTE)arm-none-eabi-gdb$(QUOTE) $(OUTPUT_FILE_NAME).elf -x scripts/debug.gdb
|
|
||||||
|
|
||||||
push: $(OUTPUT_FILE_NAME).elf
|
|
||||||
@echo $(QUOTE)$(QUOTE)
|
|
||||||
@echo $(QUOTE)Uploading $(OUTPUT_FILE_NAME).elf...$(QUOTE)
|
|
||||||
@$(QUOTE)arm-none-eabi-gdb$(QUOTE) $(OUTPUT_FILE_NAME).elf -x scripts/push.gdb >/dev/null
|
|
||||||
@echo $(QUOTE)$(QUOTE)$(OUTPUT_FILE_NAME).elf$(QUOTE) uploaded!$(QUOTE)
|
|
||||||
@$(QUOTE)arm-none-eabi-size$(QUOTE) $(QUOTE)$(OUTPUT_FILE_NAME).elf$(QUOTE)
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file
|
|
||||||
*
|
|
||||||
* \brief Low-level initialization functions called upon chip startup.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2019 Microchip Technology Inc.
|
|
||||||
*
|
|
||||||
* \asf_license_start
|
|
||||||
*
|
|
||||||
* \page License
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the Licence at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
* \asf_license_stop
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "same54.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initial system clock frequency. The System RC Oscillator (RCSYS) provides
|
|
||||||
* the source for the main clock at chip startup.
|
|
||||||
*/
|
|
||||||
#define __SYSTEM_CLOCK (48000000)
|
|
||||||
|
|
||||||
uint32_t SystemCoreClock = __SYSTEM_CLOCK; /*!< System Clock Frequency (Core Clock)*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the system
|
|
||||||
*
|
|
||||||
* @brief Setup the microcontroller system.
|
|
||||||
* Initialize the System and update the SystemCoreClock variable.
|
|
||||||
*/
|
|
||||||
void SystemInit(void)
|
|
||||||
{
|
|
||||||
// Keep the default device state after reset
|
|
||||||
SystemCoreClock = __SYSTEM_CLOCK;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update SystemCoreClock variable
|
|
||||||
*
|
|
||||||
* @brief Updates the SystemCoreClock with current core Clock
|
|
||||||
* retrieved from cpu registers.
|
|
||||||
*/
|
|
||||||
void SystemCoreClockUpdate(void)
|
|
||||||
{
|
|
||||||
// Not implemented
|
|
||||||
SystemCoreClock = __SYSTEM_CLOCK;
|
|
||||||
return;
|
|
||||||
}
|
|
Loading…
Reference in New Issue