Allow putchar() to be defined as a macro to pass regression test using older version of the toolchain.

This commit is contained in:
Renaud 2021-02-25 10:15:55 +08:00
parent 946e95591a
commit 726f4bf316
2 changed files with 23 additions and 13 deletions

View File

@ -5,23 +5,29 @@
ifeq (linux, $(findstring linux, $(MAKE_HOST))) ifeq (linux, $(findstring linux, $(MAKE_HOST)))
INSTALLDIR = $(HOME)/Packages INSTALLDIR = $(HOME)/Packages
#GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-9-2019-q4-major #REVDIR = gcc-arm-none-eabi-9-2019-q4-major
#GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-9-2020-q2-update #REVDIR = gcc-arm-none-eabi-9-2020-q2-update
GCCDIR = $(INSTALLDIR)/gcc-arm-none-eabi-10-2020-q4-major REVDIR = gcc-arm-none-eabi-10-2020-q4-major
else else
DRIVE = d
ifeq (cygwin, $(findstring cygwin, $(MAKE_HOST))) ifeq (cygwin, $(findstring cygwin, $(MAKE_HOST)))
DRIVE = /cygdrive/d OSDRIVE = /cygdrive/$(DRIVE)
else ifeq (msys, $(findstring msys, $(MAKE_HOST))) else ifeq (msys, $(findstring msys, $(MAKE_HOST)))
DRIVE = /d OSDRIVE = /$(DRIVE)
else else
DRIVE = D: OSDRIVE = $(DRIVE):
endif endif
INSTALLDIR = $(DRIVE)/Program Files (x86) INSTALLDIR = $(OSDRIVE)/Program Files (x86)
#GCCDIR = $(INSTALLDIR)/GNU Tools ARM Embedded/9 2019-q4-major #REVDIR = GNU Tools ARM Embedded/5.4 2016q2
#GCCDIR = $(INSTALLDIR)/GNU Arm Embedded Toolchain/9 2020-q2-update #REVDIR = GNU Tools ARM Embedded/6 2017-q2-update
GCCDIR = $(INSTALLDIR)/GNU Arm Embedded Toolchain/10 2020-q4-major #REVDIR = GNU Tools ARM Embedded/7 2017-q4-major
#REVDIR = GNU Tools ARM Embedded/7 2018-q2-update
#REVDIR = GNU Tools ARM Embedded/9 2019-q4-major
#REVDIR = GNU Arm Embedded Toolchain/9 2020-q2-update
REVDIR = GNU Arm Embedded Toolchain/10 2020-q4-major
endif endif
GCCDIR = $(INSTALLDIR)/$(REVDIR)
export PATH := $(GCCDIR)/bin:$(PATH) export PATH := $(GCCDIR)/bin:$(PATH)
BINPFX = @arm-none-eabi- BINPFX = @arm-none-eabi-
@ -62,10 +68,14 @@ LIBS = -l$(LIBSTEM)
### Build rules ### Build rules
.PHONY: clean all .PHONY: clean all version
all: $(PROJECT).hex $(PROJECT).bin all: $(PROJECT).hex $(PROJECT).bin
version:
@echo make $(MAKE_VERSION) $(MAKE_HOST)
@echo PATH="$(PATH)"
clean: clean:
@echo CLEAN @echo CLEAN
@rm -f *.o *.elf *.map *.lst *.bin *.hex *.a @rm -f *.o *.elf *.map *.lst *.bin *.hex *.a

View File

@ -1,10 +1,10 @@
/* putchar.c -- write a character to stdout */ /* putchar.c -- write a character to stdout */
/* Copyright (c) 2020 Renaud Fivet */ /* Copyright (c) 2020-2021 Renaud Fivet */
#include <stdio.h> #include <stdio.h>
#include "system.h" /* kputc() */ #include "system.h" /* kputc() */
int putchar( int c) { int (putchar)( int c) { /* putchar may be defined as macro in stdio.h */
kputc( c) ; kputc( c) ;
return c ; return c ;
} }