1
0
mirror of https://github.com/rfivet/stm32bringup.git synced 2024-12-18 06:46:23 -05:00

Update GNU ARM Embedded Toolchain to release 10 major

This commit is contained in:
Renaud 2021-02-13 10:47:22 +08:00
parent 4098e6e6af
commit 946e95591a
2 changed files with 40 additions and 15 deletions

View File

@ -1,21 +1,32 @@
# Makefile -- stm32bringup # Makefile -- stm32bringup
# Copyright (c) 2020 Renaud Fivet # Copyright (c) 2020-2021 Renaud Fivet
### Build environment selection ### Build environment selection
ifeq (linux, $(findstring linux, $(MAKE_HOST))) ifeq (linux, $(findstring linux, $(MAKE_HOST)))
#GCCDIR = ~/Packages/gcc-arm-none-eabi-9-2019-q4-major INSTALLDIR = $(HOME)/Packages
#GCCDIR = ~/Packages/gcc-arm-none-eabi-9-2020-q2-update #GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-9-2019-q4-major
GCCDIR = $(HOME)/Packages/gcc-arm-none-eabi-9-2020-q2-update #GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-9-2020-q2-update
GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-10-2020-q4-major
else else
#GCCDIR = "D:/Program Files (x86)/GNU Tools ARM Embedded/9 2019-q4-major" ifeq (cygwin, $(findstring cygwin, $(MAKE_HOST)))
GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update" DRIVE = /cygdrive/d
else ifeq (msys, $(findstring msys, $(MAKE_HOST)))
DRIVE = /d
else
DRIVE = D:
endif
INSTALLDIR = $(DRIVE)/Program Files (x86)
#GCCDIR = $(INSTALLDIR)/GNU Tools ARM Embedded/9 2019-q4-major
#GCCDIR = $(INSTALLDIR)/GNU Arm Embedded Toolchain/9 2020-q2-update
GCCDIR = $(INSTALLDIR)/GNU Arm Embedded Toolchain/10 2020-q4-major
endif endif
BINPFX = @$(GCCDIR)/bin/arm-none-eabi- export PATH := $(GCCDIR)/bin:$(PATH)
BINPFX = @arm-none-eabi-
AR = $(BINPFX)ar AR = $(BINPFX)ar
CC = $(BINPFX)gcc CC = $(BINPFX)gcc
LD = $(BINPFX)ld
OBJCOPY = $(BINPFX)objcopy OBJCOPY = $(BINPFX)objcopy
OBJDUMP = $(BINPFX)objdump OBJDUMP = $(BINPFX)objdump
SIZE = $(BINPFX)size SIZE = $(BINPFX)size
@ -42,14 +53,12 @@ PROJECT = f030f4
#SRCS = startup.txeie.c adc.c adcmain.c #SRCS = startup.txeie.c adc.c adcmain.c
SRCS = startup.txeie.c adc.c adccalib.c ds18b20.c SRCS = startup.txeie.c adc.c adccalib.c ds18b20.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
LIBOBJS = printf.o putchar.o puts.o LIBOBJS = printf.o putchar.o puts.o memset.o
CPU = -mthumb -mcpu=cortex-m0 CPU = -mthumb -mcpu=cortex-m0
CFLAGS = $(CPU) -g -Wall -Wextra -Os CFLAGS = $(CPU) -g -Wall -Wextra -Os
LD_SCRIPT = $(PROJECT).ld LD_SCRIPT = $(PROJECT).ld
LIBDIR = $(GCCDIR)/lib/gcc/arm-none-eabi/9.3.1/thumb/v6-m/nofp
LIB_PATHS = -L. -L$(LIBDIR)
LIBSTEM = stm32 LIBSTEM = stm32
LIBS = -l$(LIBSTEM) -lgcc LIBS = -l$(LIBSTEM)
### Build rules ### Build rules
@ -63,13 +72,15 @@ clean:
$(PROJECT).elf: $(OBJS) lib$(LIBSTEM).a $(PROJECT).elf: $(OBJS) lib$(LIBSTEM).a
@echo $@ @echo $@
$(LD) -T$(LD_SCRIPT) $(LIB_PATHS) -Map=$(PROJECT).map -cref -o $@ $(OBJS) $(LIBS) $(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,-Map=$(PROJECT).map,-cref \
-nostartfiles -o $@ $(OBJS) $(LIBS)
$(SIZE) $@ $(SIZE) $@
$(OBJDUMP) -hS $@ > $(PROJECT).lst $(OBJDUMP) -hS $@ > $(PROJECT).lst
%.elf: %.o %.elf: %.o lib$(LIBSTEM).a
@echo $@ @echo $@
$(LD) -T$(LD_SCRIPT) -Map=$*.map -cref -o $@ $< $(CC) $(CPU) -T$(LD_SCRIPT) -L. -Wl,-Map=$*.map,-cref -nostartfiles \
-o $@ $< $(LIBS)
$(SIZE) $@ $(SIZE) $@
$(OBJDUMP) -hS $@ > $*.lst $(OBJDUMP) -hS $@ > $*.lst

14
memset.c Normal file
View File

@ -0,0 +1,14 @@
/* memset.c -- fill memory area */
/* Copyright (c) 2021 Renaud Fivet */
#include <string.h>
void *memset( void *s, int c, size_t n) {
char *p = s ;
while( n--)
*p++ = c ;
return s ;
}
/* end of memset.c */