mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 06:12:43 +01:00
cpu/mips: Integrate better with RIOT newlib layer
- Copied the relevant parts of mipshal.mk from the toolchain - Cleaned up CFLAGS and more in Makefile.include - Added empty syscalls implementation which can be used to interface with the UHI system - Added a note on why -std=gnu99 is necessary for this CPU presently
This commit is contained in:
parent
12a9c5e3b4
commit
14ec5237a1
@ -1,4 +1,4 @@
|
||||
MODULE = cpu
|
||||
DIRS = periph
|
||||
DIRS = periph newlib_syscalls_mips_uhi
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
@ -6,3 +6,5 @@ include $(RIOTMAKE)/arch/mips.inc.mk
|
||||
|
||||
export LINKFLAGS += -Tuhi32.ld
|
||||
export USEMODULE += periph
|
||||
export USEMODULE += newlib
|
||||
export USEMODULE += newlib_syscalls_mips_uhi
|
||||
|
@ -60,10 +60,6 @@ void mips_start(void)
|
||||
{
|
||||
board_init();
|
||||
|
||||
#if MODULE_NEWLIB
|
||||
#error "This Port is designed to work with the (newlib) C library provided with the mips sdk toolchain"
|
||||
#endif
|
||||
|
||||
/* kernel_init */
|
||||
kernel_init();
|
||||
}
|
||||
|
1
cpu/mips32r2_common/newlib_syscalls_mips_uhi/Makefile
Normal file
1
cpu/mips32r2_common/newlib_syscalls_mips_uhi/Makefile
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTBASE)/Makefile.base
|
11
cpu/mips32r2_common/newlib_syscalls_mips_uhi/syscalls.c
Normal file
11
cpu/mips32r2_common/newlib_syscalls_mips_uhi/syscalls.c
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2017 whoever implements this
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
/**
|
||||
* @todo Here there should be a syscall implementation for use with the mips-mti-elf toolchain newlib
|
||||
*/
|
||||
typedef int dont_be_pedantic;
|
@ -12,7 +12,7 @@ export CFLAGS += -march=m4k -DSKIP_COPY_TO_RAM
|
||||
export USEMODULE += periph
|
||||
|
||||
export LINKFLAGS += -Wl,--defsym,__use_excpt_boot=0 $(CFLAGS)
|
||||
export LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ldscripts/pic32mx512_12_128_uhi.ld
|
||||
export LINKFLAGS += -Tpic32mx512_12_128_uhi.ld
|
||||
|
||||
# the pickit programmer (MPLAB-IPE) wants physical addresses in the hex file!!
|
||||
export OBJCOPY = objcopy #use system objcopy as toolchain one is broken.
|
||||
|
@ -13,7 +13,7 @@ export CFLAGS += -DMIPS_MICROMIPS
|
||||
export USEMODULE += periph
|
||||
|
||||
export LINKFLAGS += -Wl,--defsym,__use_excpt_boot=0 $(CFLAGS)
|
||||
export LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ldscripts/pic32mz2048_uhi.ld
|
||||
export LINKFLAGS += -Tpic32mz2048_uhi.ld
|
||||
|
||||
# the pickit programmer (MPLAB-IPE) wants physical addresses in the hex file!!
|
||||
export OBJCOPY = objcopy #use system objcopy as toolchain one is broken.
|
||||
|
@ -1,31 +1,47 @@
|
||||
ifndef MIPS_ELF_ROOT
|
||||
ifneq ($(BUILD_IN_DOCKER),1) #Don't error when BUILD_IN_DOCKER=1 as it _is_ set in DOCKER
|
||||
$(error "Please set $$(MIPS_ELF_ROOT) and ensure $$(MIPS_ELF_ROOT)/bin is on your PATH")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Target triple for the build.
|
||||
export TARGET_ARCH ?= mips-mti-elf
|
||||
|
||||
export ABI=32
|
||||
|
||||
ifneq ($(BUILD_IN_DOCKER),1) #Don't error when BUILD_IN_DOCKER=1 as MIPS_ELF_ROOT _is_ set in DOCKER
|
||||
include $(MIPS_ELF_ROOT)/share/mips/rules/mipshal.mk
|
||||
endif
|
||||
# Portable 'lowercase' func.
|
||||
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
|
||||
|
||||
# Default values for the linker script symbols listed below are
|
||||
# defined in the linker script.
|
||||
|
||||
# These are linker script symbols that are prefixed with '__"
|
||||
priv_symbols = MEMORY_BASE MEMORY_SIZE STACK
|
||||
priv_symbols += ENABLE_XPA
|
||||
priv_symbols += FLUSH_TO_ZERO
|
||||
priv_symbols += FLASH_START APP_START FLASH_APP_START
|
||||
priv_symbols += ISR_VEC_SPACE ISR_VECTOR_COUNT
|
||||
|
||||
comma := ,
|
||||
|
||||
# A bit of makefile magic:
|
||||
# foreach symbol in overridable ld-symbols :
|
||||
# If symbol has a value, produce a linker argument for that symbol.
|
||||
MIPS_HAL_LDFLAGS = $(foreach a,$(priv_symbols),$(if $($a),-Wl$(comma)--defsym$(comma)__$(call lc,$(a))=$($a)))
|
||||
|
||||
# define build specific options
|
||||
export CFLAGS_CPU = -EL -std=gnu99
|
||||
# Remove -std=gnu99 once the MIPS toolchain headers are updated to include upstream
|
||||
# newlib commit 81c17949f0419d1c4fee421c60987ea1149522ae
|
||||
# https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commitdiff;h=81c17949f0419d1c4fee421c60987ea1149522ae
|
||||
# Otherwise we get an error about a missing declaration of strnlen in some parts.
|
||||
export CFLAGS += -std=gnu99
|
||||
export CFLAGS_CPU = -EL -mabi=$(ABI)
|
||||
# Why not -fdata-sections?? /JN
|
||||
export CFLAGS_LINK = -ffunction-sections -fno-builtin -fshort-enums #-fdata-sections
|
||||
export CFLAGS_DBG = -O0 -g2
|
||||
export CFLAGS_OPT = -Os -g2
|
||||
export CFLAGS_DBG = -g3
|
||||
export CFLAGS_OPT = -Os
|
||||
|
||||
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_OPT)
|
||||
#$(CFLAGS_DBG)
|
||||
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_OPT) $(CFLAGS_DBG)
|
||||
|
||||
ifeq ($(USE_HARD_FLOAT),1)
|
||||
export CFLAGS += -mhard-float
|
||||
else
|
||||
export CFLAGS += -msoft-float #hard-float is the default so we must set soft-float
|
||||
#hard-float is the default so we must set soft-float
|
||||
export CFLAGS += -msoft-float
|
||||
export LINKFLAGS += -msoft-float
|
||||
endif
|
||||
|
||||
@ -33,9 +49,10 @@ ifeq ($(USE_DSP),1)
|
||||
export CFLAGS += -mdsp
|
||||
endif
|
||||
|
||||
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_OPT) #$(CFLAGS_DBG)
|
||||
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_OPT) $(CFLAGS_DBG)
|
||||
|
||||
export LINKFLAGS += $(MIPS_HAL_LDFLAGS) -mabi=$(ABI)
|
||||
export LINKFLAGS += $(MIPS_HAL_LDFLAGS)
|
||||
export LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts
|
||||
export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
export LINKFLAGS += -Wl,--gc-sections
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user