mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2025-12-06 07:02:00 +01:00
Adding support for STM32F4 and STM32F7 (first part…)
This commit is contained in:
parent
8bcf38a414
commit
58d732660c
4
BitRB.h
4
BitRB.h
|
|
@ -24,6 +24,10 @@ Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include <stm32f10x.h>
|
#include <stm32f10x.h>
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#include "string.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
|
#include "string.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD) || defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
|
|
||||||
403
Makefile
403
Makefile
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2016 by Andy Uribe CA6JAU
|
# Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
# Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
# Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -15,6 +15,72 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# MMDVM source files
|
||||||
|
MMDVM_HS_PATH=.
|
||||||
|
|
||||||
|
# STM32 library paths
|
||||||
|
F1_LIB_PATH=./STM32F10X_Lib
|
||||||
|
F4_LIB_PATH=./STM32F4XX_Lib
|
||||||
|
F7_LIB_PATH=./STM32F7XX_Lib
|
||||||
|
|
||||||
|
# MCU external clock frequency (Hz)
|
||||||
|
CLK_PI_F4=12000000
|
||||||
|
CLK_DEF=8000000
|
||||||
|
|
||||||
|
# Directory Structure
|
||||||
|
BINDIR=bin
|
||||||
|
OBJDIR_F1=obj_f1
|
||||||
|
OBJDIR_F4=obj_f4
|
||||||
|
OBJDIR_F7=obj_f7
|
||||||
|
|
||||||
|
# Output files
|
||||||
|
BINELF_F1=mmdvm_f1.elf
|
||||||
|
BINHEX_F1=mmdvm_f1.hex
|
||||||
|
BINBIN_F1=mmdvm_f1.bin
|
||||||
|
BINELF_F4=mmdvm_f4.elf
|
||||||
|
BINHEX_F4=mmdvm_f4.hex
|
||||||
|
BINBIN_F4=mmdvm_f4.bin
|
||||||
|
BINELF_F7=mmdvm_f7.elf
|
||||||
|
BINHEX_F7=mmdvm_f7.hex
|
||||||
|
BINBIN_F7=mmdvm_f7.bin
|
||||||
|
|
||||||
|
# Header directories
|
||||||
|
INC_F1= . $(F1_LIB_PATH)/CMSIS/ $(F1_LIB_PATH)/Device/ $(F1_LIB_PATH)/STM32F10x_StdPeriph_Driver/inc/ $(F1_LIB_PATH)/usb/inc/
|
||||||
|
INCLUDES_F1=$(INC_F1:%=-I%)
|
||||||
|
INC_F4= . $(F4_LIB_PATH)/CMSIS/Include/ $(F4_LIB_PATH)/Device/ $(F4_LIB_PATH)/STM32F4xx_StdPeriph_Driver/include/
|
||||||
|
INCLUDES_F4=$(INC_F4:%=-I%)
|
||||||
|
INC_F7= . $(F7_LIB_PATH)/CMSIS/Include/ $(F7_LIB_PATH)/Device/ $(F7_LIB_PATH)/STM32F7xx_StdPeriph_Driver/inc/
|
||||||
|
INCLUDES_F7=$(INC_F7:%=-I%)
|
||||||
|
|
||||||
|
# CMSIS libraries
|
||||||
|
INCLUDES_LIBS_F1=
|
||||||
|
INCLUDES_LIBS_F4=$(F4_LIB_PATH)/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a
|
||||||
|
INCLUDES_LIBS_F7=$(F7_LIB_PATH)/CMSIS/Lib/GCC/libarm_cortexM7lfsp_math.a
|
||||||
|
|
||||||
|
# STM32F1 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F1=$(F1_LIB_PATH)/STM32F10x_StdPeriph_Driver/src
|
||||||
|
|
||||||
|
# STM32F1 USB support source path
|
||||||
|
USB_F1=$(F1_LIB_PATH)/usb
|
||||||
|
|
||||||
|
# STM32F4 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F4=$(F4_LIB_PATH)/STM32F4xx_StdPeriph_Driver/source
|
||||||
|
|
||||||
|
# STM32F7 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F7=$(F7_LIB_PATH)/STM32F7xx_StdPeriph_Driver/src
|
||||||
|
|
||||||
|
# STM32F1 system source path
|
||||||
|
SYS_DIR_F1=$(F1_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F1=$(F1_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
|
# STM32F4 system source path
|
||||||
|
SYS_DIR_F4=$(F4_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F4=$(F4_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
|
# STM32F7 system source path
|
||||||
|
SYS_DIR_F7=$(F7_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F7=$(F7_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
# GNU ARM Embedded Toolchain
|
# GNU ARM Embedded Toolchain
|
||||||
CC=arm-none-eabi-gcc
|
CC=arm-none-eabi-gcc
|
||||||
CXX=arm-none-eabi-g++
|
CXX=arm-none-eabi-g++
|
||||||
|
|
@ -27,210 +93,323 @@ NM=arm-none-eabi-nm
|
||||||
SIZE=arm-none-eabi-size
|
SIZE=arm-none-eabi-size
|
||||||
A2L=arm-none-eabi-addr2line
|
A2L=arm-none-eabi-addr2line
|
||||||
|
|
||||||
# Directory Structure
|
|
||||||
BINDIR=bin
|
|
||||||
|
|
||||||
OPTFLAG=-Os
|
|
||||||
|
|
||||||
# Configure vars depending on OS
|
# Configure vars depending on OS
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
ASOURCES=$(shell dir /S /B *.s)
|
CLEANCMD=del /S *.o *.hex *.bin *.elf
|
||||||
CSOURCES=$(shell dir /S /B *.c)
|
MDDIRS=md $@
|
||||||
CXXSOURCES=$(shell dir /S /B *.cpp)
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/win/dfu-util.exe
|
||||||
CLEANCMD=del /S *.o *.hex *.bin *.elf *.d
|
STM32FLASH=./$(F1_LIB_PATH)/utils/win/stm32flash.exe
|
||||||
MDBIN=md $@
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/win/dfu-util.exe
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/win/stm32flash.exe
|
|
||||||
else
|
else
|
||||||
ASOURCES=$(shell find . -name '*.s')
|
CLEANCMD=rm -f $(OBJ_F1) $(OBJ_F4) $(OBJ_F7) $(BINDIR)/*.hex $(BINDIR)/*.bin $(BINDIR)/*.elf
|
||||||
CSOURCES=$(shell find . -name '*.c')
|
MDDIRS=mkdir $@
|
||||||
CXXSOURCES=$(shell find . -name '*.cpp')
|
|
||||||
CLEANCMD=rm -f $(OBJECTS) $(BINDIR)/$(BINELF) $(BINDIR)/$(BINHEX) $(BINDIR)/$(BINBIN) *.d
|
|
||||||
MDBIN=mkdir $@
|
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Linux)
|
ifeq ($(shell uname -s),Linux)
|
||||||
ifeq ($(shell uname -m),x86_64)
|
ifeq ($(shell uname -m),x86_64)
|
||||||
DFU_RST=./STM32F10X_Lib/utils/linux64/upload-reset
|
DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/linux64/dfu-util
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/linux64/st-flash
|
ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/linux64/stm32flash
|
STM32FLASH=./$(F1_LIB_PATH)/utils/linux64/stm32flash
|
||||||
else ifeq ($(shell uname -m),armv7l)
|
else ifeq ($(shell uname -m),armv7l)
|
||||||
DFU_RST=./STM32F10X_Lib/utils/rpi32/upload-reset
|
DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/rpi32/dfu-util
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/rpi32/st-flash
|
ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/rpi32/stm32flash
|
STM32FLASH=./$(F1_LIB_PATH)/utils/rpi32/stm32flash
|
||||||
else ifeq ($(shell uname -m),armv6l)
|
else ifeq ($(shell uname -m),armv6l)
|
||||||
DFU_RST=./STM32F10X_Lib/utils/rpi32/upload-reset
|
DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/rpi32/dfu-util
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/rpi32/st-flash
|
ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/rpi32/stm32flash
|
STM32FLASH=./$(F1_LIB_PATH)/utils/rpi32/stm32flash
|
||||||
else
|
else
|
||||||
DFU_RST=./STM32F10X_Lib/utils/linux/upload-reset
|
DFU_RST=./$(F1_LIB_PATH)/utils/linux/upload-reset
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/linux/dfu-util
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux/dfu-util
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/linux/st-flash
|
ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/linux/stm32flash
|
STM32FLASH=./$(F1_LIB_PATH)/utils/linux/stm32flash
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Darwin)
|
ifeq ($(shell uname -s),Darwin)
|
||||||
DFU_RST=./STM32F10X_Lib/utils/macosx/upload-reset
|
DFU_RST=./$(F1_LIB_PATH)/utils/macosx/upload-reset
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/macosx/dfu-util
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/macosx/dfu-util
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/macosx/st-flash
|
ST_FLASH=./$(F1_LIB_PATH)/utils/macosx/st-flash
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/macosx/stm32flash
|
STM32FLASH=./$(F1_LIB_PATH)/utils/macosx/stm32flash
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Default reference oscillator frequencies
|
# Default reference oscillator frequencies
|
||||||
ifndef $(OSC)
|
ifndef $(OSC)
|
||||||
OSC=8000000
|
ifeq ($(MAKECMDGOALS),pi-f4)
|
||||||
|
OSC=$(CLK_PI_F4)
|
||||||
|
else
|
||||||
|
OSC=$(CLK_DEF)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Find header directories
|
# Build object lists
|
||||||
INC= . STM32F10X_Lib/CMSIS/ STM32F10X_Lib/Device/ STM32F10X_Lib/STM32F10x_StdPeriph_Driver/inc/ STM32F10X_Lib/usb/inc/
|
CXXSRC=$(wildcard $(MMDVM_HS_PATH)/*.cpp)
|
||||||
INCLUDES=$(INC:%=-I%)
|
CSRC_STD_F1=$(wildcard $(STD_LIB_F1)/*.c)
|
||||||
|
SYS_F1=$(wildcard $(SYS_DIR_F1)/*.c)
|
||||||
|
STARTUP_F1=$(wildcard $(STARTUP_DIR_F1)/*.c)
|
||||||
|
CXX_USB_F1=$(wildcard $(USB_F1)/*.cpp)
|
||||||
|
C_USB_F1=$(wildcard $(USB_F1)/*.c)
|
||||||
|
CSRC_STD_F4=$(wildcard $(STD_LIB_F4)/*.c)
|
||||||
|
SYS_F4=$(wildcard $(SYS_DIR_F4)/*.c)
|
||||||
|
STARTUP_F4=$(wildcard $(STARTUP_DIR_F4)/*.c)
|
||||||
|
CSRC_STD_F7=$(wildcard $(STD_LIB_F7)/*.c)
|
||||||
|
SYS_F7=$(wildcard $(SYS_DIR_F7)/*.c)
|
||||||
|
STARTUP_F7=$(wildcard $(STARTUP_DIR_F7)/*.c)
|
||||||
|
OBJ_F1=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F1)/%.o) $(CSRC_STD_F1:$(STD_LIB_F1)/%.c=$(OBJDIR_F1)/%.o) $(SYS_F1:$(SYS_DIR_F1)/%.c=$(OBJDIR_F1)/%.o) $(STARTUP_F1:$(STARTUP_DIR_F1)/%.c=$(OBJDIR_F1)/%.o) $(CXX_USB_F1:$(USB_F1)/%.cpp=$(OBJDIR_F1)/%.o) $(C_USB_F1:$(USB_F1)/%.c=$(OBJDIR_F1)/%.o)
|
||||||
|
OBJ_F4=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F4)/%.o) $(CSRC_STD_F4:$(STD_LIB_F4)/%.c=$(OBJDIR_F4)/%.o) $(SYS_F4:$(SYS_DIR_F4)/%.c=$(OBJDIR_F4)/%.o) $(STARTUP_F4:$(STARTUP_DIR_F4)/%.c=$(OBJDIR_F4)/%.o)
|
||||||
|
OBJ_F7=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F7)/%.o) $(CSRC_STD_F7:$(STD_LIB_F7)/%.c=$(OBJDIR_F7)/%.o) $(SYS_F7:$(SYS_DIR_F7)/%.c=$(OBJDIR_F7)/%.o) $(STARTUP_F7:$(STARTUP_DIR_F7)/%.c=$(OBJDIR_F7)/%.o)
|
||||||
|
|
||||||
# Find libraries
|
# MCU flags
|
||||||
INCLUDES_LIBS=
|
MCFLAGS_F1=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
||||||
LINK_LIBS=
|
MCFLAGS_F4=-mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb-interwork
|
||||||
|
MCFLAGS_F7=-mcpu=cortex-m7 -mthumb -mlittle-endian -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb-interwork
|
||||||
|
|
||||||
# Create object list
|
# Compile flags
|
||||||
OBJECTS=$(ASOURCES:%.s=%.o)
|
DEFS_F1_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0 -DMADEBYMAKEFILE
|
||||||
OBJECTS+=$(CSOURCES:%.c=%.o)
|
DEFS_F1_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000 -DMADEBYMAKEFILE
|
||||||
OBJECTS+=$(CXXSOURCES:%.cpp=%.o)
|
# STM32F446 Pi-Hat board:
|
||||||
|
DEFS_PI_F4=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# STM32F4 Nucleo-64 F446RE board:
|
||||||
|
DEFS_F446=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# STM32F7 Nucleo-144 F767ZI board:
|
||||||
|
DEFS_F767=-DUSE_HAL_DRIVER -DSTM32F767xx -DSTM32F7XX -DSTM32F7_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
|
||||||
# Define output files ELF & IHEX
|
# Build compiler flags
|
||||||
BINELF=outp.elf
|
CFLAGS_F1=-c $(MCFLAGS_F1) $(INCLUDES_F1)
|
||||||
BINHEX=outp.hex
|
CXXFLAGS_F1=-c $(MCFLAGS_F1) $(INCLUDES_F1)
|
||||||
BINBIN=outp.bin
|
CFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||||
|
CXXFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||||
|
CFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)
|
||||||
|
CXXFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)
|
||||||
|
|
||||||
# MCU FLAGS
|
# Linker flags
|
||||||
MCFLAGS=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
LDFLAGS_F1_N =-T normal.ld $(MCFLAGS_F1) $(INCLUDES_LIBS_F1)
|
||||||
|
LDFLAGS_F1_BL =-T bootloader.ld $(MCFLAGS_F1) $(INCLUDES_LIBS_F1)
|
||||||
|
LDFLAGS_F4 =-T stm32f4xx_link.ld $(MCFLAGS_F4) $(INCLUDES_LIBS_F4)
|
||||||
|
LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) $(INCLUDES_LIBS_F7)
|
||||||
|
|
||||||
# COMPILE FLAGS
|
# Common flags
|
||||||
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0 -DMADEBYMAKEFILE
|
CFLAGS=-Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -nostdlib
|
||||||
DEFS_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000 -DMADEBYMAKEFILE
|
CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
||||||
|
LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs
|
||||||
CFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
|
||||||
CXXFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
|
||||||
|
|
||||||
# LINKER FLAGS
|
|
||||||
LDSCRIPT_N=normal.ld
|
|
||||||
LDSCRIPT_BL=bootloader.ld
|
|
||||||
LDFLAGS=$(MCFLAGS) --specs=nosys.specs $(INCLUDES_LIBS) $(LINK_LIBS)
|
|
||||||
|
|
||||||
# Build Rules
|
# Build Rules
|
||||||
.PHONY: all release hs bl debug clean
|
.PHONY: all release_f1 release_f4 release_f7 hs bl pi-f4 f446 f767 clean
|
||||||
|
|
||||||
all: hs
|
all: hs
|
||||||
|
|
||||||
hs: CFLAGS+=$(DEFS_HS) $(OPTFLAG) -ffunction-sections -fdata-sections -nostdlib
|
pi-f4: CFLAGS+=$(CFLAGS_F4) $(DEFS_PI_F4)
|
||||||
hs: CXXFLAGS+=$(DEFS_HS) $(OPTFLAG) -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti
|
pi-f4: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_PI_F4)
|
||||||
hs: LDFLAGS+=-T $(LDSCRIPT_N) $(OPTFLAG) --specs=nano.specs
|
pi-f4: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
hs: release
|
pi-f4: release_f4
|
||||||
|
|
||||||
bl: CFLAGS+=$(DEFS_HS_BL) -Os -ffunction-sections -fdata-sections -nostdlib
|
f446: CFLAGS+=$(CFLAGS_F4) $(DEFS_F446)
|
||||||
bl: CXXFLAGS+=$(DEFS_HS_BL) -Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti
|
f446: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_F446)
|
||||||
bl: LDFLAGS+=-T $(LDSCRIPT_BL) -Os --specs=nano.specs
|
f446: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
bl: release
|
f446: release_f4
|
||||||
|
|
||||||
debug: CFLAGS+=-g $(DEFS_HS)
|
f767: CFLAGS+=$(CFLAGS_F7) $(DEFS_F767)
|
||||||
debug: CXXFLAGS+=-g $(DEFS_HS)
|
f767: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F767)
|
||||||
debug: LDFLAGS+=-g
|
f767: LDFLAGS+=$(LDFLAGS_F7)
|
||||||
debug: release
|
f767: release_f7
|
||||||
|
|
||||||
release: GitVersion.h
|
hs: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS)
|
||||||
release: $(BINDIR)
|
hs: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS)
|
||||||
release: $(BINDIR)/$(BINHEX)
|
hs: LDFLAGS+=$(LDFLAGS_F1_N)
|
||||||
release: $(BINDIR)/$(BINBIN)
|
hs: release_f1
|
||||||
|
|
||||||
|
bl: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS_BL)
|
||||||
|
bl: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS_BL)
|
||||||
|
bl: LDFLAGS+=$(LDFLAGS_F1_BL)
|
||||||
|
bl: release_f1
|
||||||
|
|
||||||
|
release_f1: GitVersion.h
|
||||||
|
release_f1: $(BINDIR)
|
||||||
|
release_f1: $(OBJDIR_F1)
|
||||||
|
release_f1: $(BINDIR)/$(BINHEX_F1)
|
||||||
|
release_f1: $(BINDIR)/$(BINBIN_F1)
|
||||||
|
|
||||||
|
release_f4: GitVersion.h
|
||||||
|
release_f4: $(BINDIR)
|
||||||
|
release_f4: $(OBJDIR_F4)
|
||||||
|
release_f4: $(BINDIR)/$(BINHEX_F4)
|
||||||
|
release_f4: $(BINDIR)/$(BINBIN_F4)
|
||||||
|
|
||||||
|
release_f7: GitVersion.h
|
||||||
|
release_f7: $(BINDIR)
|
||||||
|
release_f7: $(OBJDIR_F7)
|
||||||
|
release_f7: $(BINDIR)/$(BINHEX_F7)
|
||||||
|
release_f7: $(BINDIR)/$(BINBIN_F7)
|
||||||
|
|
||||||
$(BINDIR):
|
$(BINDIR):
|
||||||
$(MDBIN)
|
$(MDDIRS)
|
||||||
|
|
||||||
$(BINDIR)/$(BINHEX): $(BINDIR)/$(BINELF)
|
$(OBJDIR_F1):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(OBJDIR_F4):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(OBJDIR_F7):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F1): $(BINDIR)/$(BINELF_F1)
|
||||||
$(CP) -O ihex $< $@
|
$(CP) -O ihex $< $@
|
||||||
@echo "Objcopy from ELF to IHEX complete!\n"
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINBIN): $(BINDIR)/$(BINELF)
|
$(BINDIR)/$(BINBIN_F1): $(BINDIR)/$(BINELF_F1)
|
||||||
$(CP) -O binary $< $@
|
$(CP) -O binary $< $@
|
||||||
@echo "Objcopy from ELF to BINARY complete!\n"
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINELF): $(OBJECTS)
|
$(BINDIR)/$(BINELF_F1): $(OBJ_F1)
|
||||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
$(CXX) $(OBJ_F1) $(LDFLAGS) -o $@
|
||||||
@echo "Linking complete!\n"
|
@echo "Linking complete!\n"
|
||||||
$(SIZE) $(BINDIR)/$(BINELF)
|
$(SIZE) $(BINDIR)/$(BINELF_F1)
|
||||||
|
|
||||||
%.o: %.cpp
|
$(BINDIR)/$(BINHEX_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F4): $(OBJ_F4)
|
||||||
|
$(CXX) $(OBJ_F4) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F4)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F7): $(OBJ_F7)
|
||||||
|
$(CXX) $(OBJ_F7) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F7)
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
$(CXX) $(CXXFLAGS) $< -o $@
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
@echo "Compiled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
%.o: %.c
|
$(OBJDIR_F4)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(STD_LIB_F1)/%.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
@echo "Compiled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
%.o: %.s
|
$(OBJDIR_F4)/%.o: $(STD_LIB_F4)/%.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
@echo "Assambled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(STD_LIB_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(SYS_DIR_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(STARTUP_DIR_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F4)/%.o: $(SYS_DIR_F4)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F4)/%.o: $(STARTUP_DIR_F4)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(SYS_DIR_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(STARTUP_DIR_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(USB_F1)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(USB_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(CLEANCMD)
|
$(CLEANCMD)
|
||||||
$(RM) GitVersion.h
|
$(RM) GitVersion.h
|
||||||
|
|
||||||
stlink:
|
stlink:
|
||||||
$(ST_FLASH) write bin/$(BINBIN) 0x8000000
|
$(ST_FLASH) write bin/$(BINBIN_F1) 0x8000000
|
||||||
|
|
||||||
stlink-bl:
|
stlink-bl:
|
||||||
$(ST_FLASH) write STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin 0x8000000
|
$(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000
|
||||||
$(ST_FLASH) write bin/$(BINBIN) 0x8002000
|
$(ST_FLASH) write bin/$(BINBIN_F1) 0x8002000
|
||||||
|
|
||||||
serial:
|
serial:
|
||||||
$(STM32FLASH) -v -w bin/$(BINBIN) -g 0x0 $(devser)
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser)
|
||||||
|
|
||||||
serial-bl:
|
serial-bl:
|
||||||
$(STM32FLASH) -v -w STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser)
|
$(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser)
|
||||||
$(STM32FLASH) -v -w bin/$(BINBIN) -g 0x0 -S 0x08002000 $(devser)
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 -S 0x08002000 $(devser)
|
||||||
|
|
||||||
zumspot-pi:
|
zumspot-pi:
|
||||||
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
/usr/local/bin/stm32flash -v -w bin/$(BINBIN) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/bin/stm32flash),)
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
/usr/bin/stm32flash -v -w bin/$(BINBIN) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dfu:
|
dfu:
|
||||||
ifdef devser
|
ifdef devser
|
||||||
$(DFU_RST) $(devser) 750
|
$(DFU_RST) $(devser) 750
|
||||||
endif
|
endif
|
||||||
$(DFU_UTIL) -D bin/$(BINBIN) -d 1eaf:0003 -a 2 -R -R
|
$(DFU_UTIL) -D bin/$(BINBIN_F1) -d 1eaf:0003 -a 2 -R -R
|
||||||
|
|
||||||
ocd:
|
ocd:
|
||||||
ifneq ($(wildcard /usr/bin/openocd),)
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/local/bin/openocd),)
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ocd-bl:
|
ocd-bl:
|
||||||
ifneq ($(wildcard /usr/bin/openocd),)
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/local/bin/openocd),)
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Export the current git version if the index file exists, else 000...
|
# Export the current git version if the index file exists, else 000...
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
4
Utils.h
4
Utils.h
|
|
@ -21,6 +21,10 @@
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
138
stm32f4xx_link.ld
Normal file
138
stm32f4xx_link.ld
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Required amount of heap and stack */
|
||||||
|
_min_heap_size = 0x1000;
|
||||||
|
_min_stack_size = 0x0800;
|
||||||
|
|
||||||
|
/* The entry point in the interrupt vector table */
|
||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* FLASH */
|
||||||
|
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K /* Core Coupled Memory (CPU only access) */
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K /* Main RAM (bus matrix)*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stack start address (end of 128K RAM) */
|
||||||
|
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
/* The interrupt vector table */
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector .isr_vector.*))
|
||||||
|
|
||||||
|
/* The program code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text .text*)
|
||||||
|
*(.rodata .rodata*)
|
||||||
|
|
||||||
|
/* ARM-Thumb code */
|
||||||
|
*(.glue_7) *(.glue_7t)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.init))
|
||||||
|
KEEP(*(.fini))
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__preinit_array_start = .;
|
||||||
|
KEEP (*(.preinit_array))
|
||||||
|
__preinit_array_end = .;
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__init_array_start = .;
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array))
|
||||||
|
__init_array_end = .;
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__fini_array_start = .;
|
||||||
|
KEEP (*(.fini_array))
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* ARM sections containing exception unwinding information */
|
||||||
|
.ARM.extab : {
|
||||||
|
__extab_start = .;
|
||||||
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||||
|
__extab_end = .;
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* ARM index entries for section unwinding */
|
||||||
|
.ARM.exidx : {
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* Start address for the initialization values of the .data section */
|
||||||
|
_sidata = .;
|
||||||
|
|
||||||
|
/* The .data section (initialized data) */
|
||||||
|
.data : AT ( _sidata )
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = . ; /* Start address for the .data section */
|
||||||
|
*(.data .data*)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = . ; /* End address for the .data section */
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* The .bss section (uninitialized data) */
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sbss = .; /* Start address for the .bss section */
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = . ; /* End address for the .bss section */
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* Space for heap and stack */
|
||||||
|
.heap_stack :
|
||||||
|
{
|
||||||
|
end = . ; /* 'end' symbol defines heap location */
|
||||||
|
_end = end ;
|
||||||
|
. = . + _min_heap_size; /* Additional space for heap and stack */
|
||||||
|
. = . + _min_stack_size;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* Remove information from the standard libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
}
|
||||||
137
stm32f7xx_link.ld
Normal file
137
stm32f7xx_link.ld
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Required amount of heap and stack */
|
||||||
|
_min_heap_size = 0x1000;
|
||||||
|
_min_stack_size = 0x0800;
|
||||||
|
|
||||||
|
/* The entry point in the interrupt vector table */
|
||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* FLASH */
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K /* Main RAM */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stack start address (end of 512K RAM) */
|
||||||
|
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
/* The interrupt vector table */
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector .isr_vector.*))
|
||||||
|
|
||||||
|
/* The program code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text .text*)
|
||||||
|
*(.rodata .rodata*)
|
||||||
|
|
||||||
|
/* ARM-Thumb code */
|
||||||
|
*(.glue_7) *(.glue_7t)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.init))
|
||||||
|
KEEP(*(.fini))
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__preinit_array_start = .;
|
||||||
|
KEEP (*(.preinit_array))
|
||||||
|
__preinit_array_end = .;
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__init_array_start = .;
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array))
|
||||||
|
__init_array_end = .;
|
||||||
|
|
||||||
|
/* EABI C++ global constructors support */
|
||||||
|
. = ALIGN(4);
|
||||||
|
__fini_array_start = .;
|
||||||
|
KEEP (*(.fini_array))
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* ARM sections containing exception unwinding information */
|
||||||
|
.ARM.extab : {
|
||||||
|
__extab_start = .;
|
||||||
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||||
|
__extab_end = .;
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* ARM index entries for section unwinding */
|
||||||
|
.ARM.exidx : {
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
/* Start address for the initialization values of the .data section */
|
||||||
|
_sidata = .;
|
||||||
|
|
||||||
|
/* The .data section (initialized data) */
|
||||||
|
.data : AT ( _sidata )
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = . ; /* Start address for the .data section */
|
||||||
|
*(.data .data*)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = . ; /* End address for the .data section */
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* The .bss section (uninitialized data) */
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sbss = .; /* Start address for the .bss section */
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = . ; /* End address for the .bss section */
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* Space for heap and stack */
|
||||||
|
.heap_stack :
|
||||||
|
{
|
||||||
|
end = . ; /* 'end' symbol defines heap location */
|
||||||
|
_end = end ;
|
||||||
|
. = . + _min_heap_size; /* Additional space for heap and stack */
|
||||||
|
. = . + _min_stack_size;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* Remove information from the standard libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue