mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-28 23:29:45 +01:00
native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround. The files in `boards/native64` are more or less dummy files and just include the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`). The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native` and `boards/native`. The remaining changes concern the build system, and change native board checks to native CPU checks to cover both boards.
This commit is contained in:
parent
22dbbf4a07
commit
0c2cfe99e6
@ -204,7 +204,7 @@ include $(RIOTMAKE)/boards.inc.mk
|
||||
include $(RIOTMAKE)/dependencies_debug.inc.mk
|
||||
|
||||
# Use TOOLCHAIN environment variable to select the toolchain to use.
|
||||
ifeq ($(BOARD),native)
|
||||
ifneq (,$(filter native native64,$(BOARD)))
|
||||
ifeq ($(OS),Darwin)
|
||||
$(shell $(COLOR_ECHO) "$(COLOR_RED)"Buildin on macOS is not supported."\
|
||||
"We recommend vagrant for building:$(COLOR_RESET)"\
|
||||
|
@ -1,14 +1,6 @@
|
||||
CPU = native
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_rtc
|
||||
FEATURES_PROVIDED += periph_rtc_ms
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
FEATURES_PROVIDED += periph_gpio
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_qdec
|
||||
FEATURES_PROVIDED += arch_32bit
|
||||
NATIVE_ARCH_BIT = 32
|
||||
|
||||
# Various other features (if any)
|
||||
FEATURES_PROVIDED += ethernet
|
||||
FEATURES_PROVIDED += motor_driver
|
||||
include $(RIOTBOARD)/native/common_features.inc.mk
|
||||
|
@ -1,17 +1,4 @@
|
||||
NATIVEINCLUDES += -DNATIVE_INCLUDES
|
||||
NATIVEINCLUDES += -I$(RIOTBOARD)/native/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/core/lib/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/core/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/
|
||||
|
||||
# Set "NATIVE_64BIT=1" to compile for x86_64
|
||||
NATIVE_64BIT ?= 0
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
DEBUGGER ?= lldb
|
||||
else
|
||||
DEBUGGER ?= gdb
|
||||
endif
|
||||
|
||||
# only use pyterm wrapper if term target is requested
|
||||
ifeq (,$(filter term,$(MAKECMDGOALS)))
|
||||
@ -48,93 +35,6 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
export VALGRIND ?= valgrind
|
||||
export CGANNOTATE ?= cg_annotate
|
||||
export GPROF ?= gprof
|
||||
|
||||
# basic cflags:
|
||||
CFLAGS += -Wall -Wextra -pedantic $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
CFLAGS += -U_FORTIFY_SOURCE
|
||||
CFLAGS_DBG ?= -g3
|
||||
|
||||
ifneq (,$(filter backtrace,$(USEMODULE)))
|
||||
$(warning module backtrace is used, do not omit frame pointers)
|
||||
CFLAGS_OPT ?= -Og -fno-omit-frame-pointer
|
||||
else
|
||||
CFLAGS_OPT ?= -Og
|
||||
endif
|
||||
|
||||
# default std set to gnu11 if not overwritten by user
|
||||
ifeq (,$(filter -std=%, $(CFLAGS)))
|
||||
CFLAGS += -std=gnu11
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),x86_64)
|
||||
ifeq ($(NATIVE_64BIT), 1)
|
||||
CFLAGS += -m64
|
||||
else
|
||||
CFLAGS += -m32
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(filter -DDEVELHELP,$(CFLAGS)))
|
||||
CFLAGS += -fstack-protector-all
|
||||
endif
|
||||
ifeq ($(OS),FreeBSD)
|
||||
ifeq ($(OS_ARCH),amd64)
|
||||
ifeq ($(NATIVE_64BIT), 1)
|
||||
CFLAGS += -m64
|
||||
else
|
||||
CFLAGS += -m32 -DCOMPAT_32BIT -B/usr/lib32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS),Darwin)
|
||||
CFLAGS += -Wno-deprecated-declarations
|
||||
endif
|
||||
|
||||
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
||||
CXXUWFLAGS +=
|
||||
CXXEXFLAGS +=
|
||||
|
||||
ifeq ($(OS_ARCH),x86_64)
|
||||
ifeq ($(NATIVE_64BIT), 1)
|
||||
LINKFLAGS += -m64
|
||||
else
|
||||
LINKFLAGS += -m32
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS),FreeBSD)
|
||||
ifeq ($(OS_ARCH),amd64)
|
||||
ifeq ($(NATIVE_64BIT), 1)
|
||||
LINKFLAGS += -m64
|
||||
else
|
||||
LINKFLAGS += -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
|
||||
endif
|
||||
endif
|
||||
LINKFLAGS += -L $(BINDIR)
|
||||
else
|
||||
LINKFLAGS += -ldl
|
||||
endif
|
||||
|
||||
# XFA (cross file array) support
|
||||
LINKFLAGS += -T$(RIOTBASE)/cpu/native/ldscripts/xfa.ld
|
||||
|
||||
# fix this warning:
|
||||
# ```
|
||||
# /usr/bin/ld: examples/hello-world/bin/native/cpu/tramp.o: warning: relocation against `_native_saved_eip' in read-only section `.text'
|
||||
# /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
|
||||
# ```
|
||||
LINKFLAGS += -no-pie
|
||||
|
||||
# clean up unused functions
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
ifeq ($(OS),Darwin)
|
||||
LINKFLAGS += -Wl,-dead_strip
|
||||
else
|
||||
LINKFLAGS += -Wl,--gc-sections
|
||||
endif
|
||||
LINKFLAGS += -ffunction-sections
|
||||
|
||||
# set the tap interface for term/valgrind
|
||||
PORT ?= tap0
|
||||
TERMFLAGS += $(PROCARGS) $(PORT)
|
||||
@ -160,80 +60,3 @@ ifneq (,$(filter periph_can,$(FEATURES_USED)))
|
||||
PERIPH_CAN_FLAGS ?= --can $(VCAN_IFACE)
|
||||
TERMFLAGS += $(PERIPH_CAN_FLAGS)
|
||||
endif
|
||||
|
||||
|
||||
ASFLAGS =
|
||||
ifeq ($(shell basename $(DEBUGGER)),lldb)
|
||||
DEBUGGER_FLAGS = -- $(ELFFILE) $(TERMFLAGS)
|
||||
else
|
||||
DEBUGGER_FLAGS = -q --args $(ELFFILE) $(TERMFLAGS)
|
||||
endif
|
||||
term-valgrind: export VALGRIND_FLAGS ?= \
|
||||
--leak-check=full \
|
||||
--track-origins=yes \
|
||||
--fullpath-after=$(RIOTBASE)/ \
|
||||
--read-var-info=yes
|
||||
debug-valgrind-server: export VALGRIND_FLAGS ?= --vgdb=yes --vgdb-error=0 -v \
|
||||
--leak-check=full --track-origins=yes --fullpath-after=$(RIOTBASE) \
|
||||
--read-var-info=yes
|
||||
term-cachegrind: export CACHEGRIND_FLAGS += --tool=cachegrind
|
||||
term-gprof: TERMPROG = GMON_OUT_PREFIX=gmon.out $(ELFFILE)
|
||||
all-valgrind: CFLAGS += -DHAVE_VALGRIND_H
|
||||
all-valgrind: NATIVEINCLUDES += $(shell pkg-config valgrind --cflags)
|
||||
all-gprof: CFLAGS += -pg
|
||||
all-gprof: LINKFLAGS += -pg
|
||||
|
||||
CFLAGS_ASAN += -fsanitize=address -fno-omit-frame-pointer -DNATIVE_MEMORY
|
||||
LINKFLAGS_ASAN += -fsanitize=address -fno-omit-frame-pointer
|
||||
all-asan: CFLAGS += $(CFLAGS_ASAN)
|
||||
all-asan: LINKFLAGS += $(LINKFLAGS_ASAN)
|
||||
all-asan: export AFL_USE_ASAN=1
|
||||
|
||||
INCLUDES += $(NATIVEINCLUDES)
|
||||
|
||||
CFLAGS += -DDEBUG_ASSERT_VERBOSE
|
||||
|
||||
# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
|
||||
ifneq ($(shell gcc --version | head -1 | grep -E ' (4.6|4.7)'),)
|
||||
CFLAGS += -DHAVE_NO_BUILTIN_BSWAP16
|
||||
endif
|
||||
|
||||
# clumsy way to enable building native on osx:
|
||||
BUILDOSXNATIVE = 0
|
||||
ifeq ($(CPU),native)
|
||||
ifeq ($(OS),Darwin)
|
||||
BUILDOSXNATIVE = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
all: # do not override first target
|
||||
|
||||
all-gprof: all
|
||||
|
||||
all-asan: all
|
||||
|
||||
all-valgrind: all
|
||||
|
||||
all-cachegrind: all
|
||||
|
||||
term-valgrind:
|
||||
$(VALGRIND) $(VALGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
debug-valgrind-server:
|
||||
$(VALGRIND) $(VALGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
debug-valgrind:
|
||||
$(eval VALGRIND_PID ?= $(shell pgrep -n memcheck-x86-li -u $(USER) | cut -d" " -f1))
|
||||
$(eval DEBUGGER_FLAGS := -ex "target remote | vgdb --pid=$(VALGRIND_PID)" $(DEBUGGER_FLAGS))
|
||||
$(DEBUGGER) $(DEBUGGER_FLAGS)
|
||||
|
||||
term-cachegrind:
|
||||
$(VALGRIND) $(CACHEGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
term-gprof: term
|
||||
|
||||
eval-gprof:
|
||||
$(GPROF) $(ELFFILE) $(shell ls -rt gmon.out* | tail -1)
|
||||
|
||||
eval-cachegrind:
|
||||
$(CGANNOTATE) $(shell ls -rt cachegrind.out* | tail -1)
|
||||
|
12
boards/native/common_features.inc.mk
Normal file
12
boards/native/common_features.inc.mk
Normal file
@ -0,0 +1,12 @@
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_rtc
|
||||
FEATURES_PROVIDED += periph_rtc_ms
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
FEATURES_PROVIDED += periph_gpio
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_qdec
|
||||
|
||||
# Various other features (if any)
|
||||
FEATURES_PROVIDED += ethernet
|
||||
FEATURES_PROVIDED += motor_driver
|
@ -25,8 +25,6 @@
|
||||
|
||||
# Required packages
|
||||
|
||||
The `native` version of RIOT will produce a 32 bit binary by default.
|
||||
To compile for x86_64 set the environment variable `NATIVE_64BIT=1`.
|
||||
On Debian/Ubuntu you can install the required libraries with
|
||||
|
||||
```
|
||||
|
30
boards/native64/Kconfig
Normal file
30
boards/native64/Kconfig
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2020 HAW Hamburg
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
config BOARD
|
||||
default "native64" if BOARD_NATIVE64
|
||||
|
||||
config BOARD_NATIVE64
|
||||
bool
|
||||
default y
|
||||
select CPU_MODEL_NATIVE
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
select HAS_PERIPH_RTC
|
||||
select HAS_PERIPH_RTC_MS
|
||||
select HAS_PERIPH_TIMER
|
||||
select HAS_PERIPH_UART
|
||||
select HAS_PERIPH_GPIO
|
||||
select HAS_PERIPH_PWM
|
||||
select HAS_PERIPH_QDEC
|
||||
|
||||
# Various other features (if any)
|
||||
select HAS_ETHERNET
|
||||
select HAS_MOTOR_DRIVER
|
||||
select HAVE_SDL
|
||||
|
||||
rsource "../native/drivers/Kconfig"
|
3
boards/native64/Makefile
Normal file
3
boards/native64/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
DIRS = $(RIOTBOARD)/native
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
1
boards/native64/Makefile.dep
Normal file
1
boards/native64/Makefile.dep
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTBOARD)/native/Makefile.dep
|
6
boards/native64/Makefile.features
Normal file
6
boards/native64/Makefile.features
Normal file
@ -0,0 +1,6 @@
|
||||
CPU = native
|
||||
|
||||
FEATURES_PROVIDED += arch_64bit
|
||||
NATIVE_ARCH_BIT = 64
|
||||
|
||||
include $(RIOTBOARD)/native/common_features.inc.mk
|
1
boards/native64/Makefile.include
Normal file
1
boards/native64/Makefile.include
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTBOARD)/native/Makefile.include
|
13
boards/native64/doc.txt
Normal file
13
boards/native64/doc.txt
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
@defgroup boards_native64 Native64 Board
|
||||
@ingroup boards
|
||||
@brief Support for running RIOT in native64
|
||||
|
||||
[Family: native](https://github.com/RIOT-OS/RIOT/wiki/Family:-native)
|
||||
|
||||
Same board as \ref boards_native "native", but compiled for 64-bit instead of 32-bit.
|
||||
Currently only Linux x86-64 is supported, and Rust support is missing.
|
||||
Otherwise, everything works the same as for the 32-bit version.
|
||||
For more information on this board, see the \ref boards_native "native board" documentation.
|
||||
|
||||
*/
|
@ -27,7 +27,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_NATIVE
|
||||
#ifdef CPU_NATIVE
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
@ -56,7 +56,7 @@ inline int sched_yield(void)
|
||||
* thread_arch.c.
|
||||
*/
|
||||
extern int sched_yield(void);
|
||||
#endif /* BOARD_NATIVE */
|
||||
#endif /* CPU_NATIVE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
config CPU_ARCH_NATIVE
|
||||
bool
|
||||
select HAS_ARCH_32BIT if "$(NATIVE_64BIT)" != "1"
|
||||
select HAS_ARCH_64BIT if "$(NATIVE_64BIT)" = "1"
|
||||
select HAS_ARCH_32BIT if BOARD_NATIVE
|
||||
select HAS_ARCH_64BIT if BOARD_NATIVE64
|
||||
select HAS_ARCH_NATIVE
|
||||
select HAS_CPP
|
||||
select HAS_CPU_NATIVE
|
||||
|
@ -2,11 +2,6 @@ ifeq (FreeBSD,$(OS))
|
||||
DISABLE_LIBSTDCPP ?= 1
|
||||
endif
|
||||
|
||||
ifeq ($(NATIVE_64BIT), 1)
|
||||
FEATURES_PROVIDED += arch_64bit
|
||||
else
|
||||
FEATURES_PROVIDED += arch_32bit
|
||||
endif
|
||||
FEATURES_PROVIDED += arch_native
|
||||
FEATURES_PROVIDED += cpp
|
||||
ifneq ($(DISABLE_LIBSTDCPP),1)
|
||||
@ -25,7 +20,7 @@ FEATURES_PROVIDED += periph_timer_periodic
|
||||
FEATURES_PROVIDED += periph_timer_query_freqs
|
||||
ifeq ($(OS) $(OS_ARCH),Linux x86_64)
|
||||
# TODO: Add rust support for native 64 bit.
|
||||
ifneq ($(NATIVE_64BIT), 1)
|
||||
ifneq ($(BOARD),native64)
|
||||
FEATURES_PROVIDED += rust_target
|
||||
endif
|
||||
endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
NATIVEINCLUDES += -I$(RIOTCPU)/native/include -I$(RIOTBASE)/sys/include
|
||||
NATIVEINCLUDES += -I$(RIOTCPU)/native/include/
|
||||
|
||||
ifneq (,$(filter periph_can,$(USEMODULE)))
|
||||
ifeq (,$(filter libsocketcan,$(USEPKG)))
|
||||
@ -17,3 +17,5 @@ ifeq ($(OS) $(OS_ARCH),Linux x86_64)
|
||||
RUST_TARGET = x86_64-unknown-linux-gnu
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(RIOTMAKE)/arch/native.inc.mk
|
||||
|
@ -28,8 +28,12 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#ifndef THREAD_STACKSIZE_DEFAULT
|
||||
#if (__SIZEOF_POINTER__ == 8)
|
||||
#define THREAD_STACKSIZE_DEFAULT (16384)
|
||||
#else
|
||||
#define THREAD_STACKSIZE_DEFAULT (8192)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef THREAD_STACKSIZE_IDLE
|
||||
#define THREAD_STACKSIZE_IDLE (THREAD_STACKSIZE_DEFAULT)
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ volatile int _native_in_syscall;
|
||||
|
||||
static sigset_t _native_sig_set, _native_sig_set_dint;
|
||||
|
||||
char __isr_stack[SIGSTKSZ];
|
||||
char __isr_stack[THREAD_STACKSIZE_DEFAULT];
|
||||
ucontext_t native_isr_context;
|
||||
ucontext_t *_native_cur_ctx, *_native_isr_ctx;
|
||||
|
||||
@ -524,7 +524,7 @@ void native_interrupt_init(void)
|
||||
|
||||
static stack_t sigstk;
|
||||
sigstk.ss_sp = sigalt_stk;
|
||||
sigstk.ss_size = sizeof(__isr_stack);
|
||||
sigstk.ss_size = sizeof(sigalt_stk);
|
||||
sigstk.ss_flags = 0;
|
||||
|
||||
if (sigaltstack(&sigstk, NULL) < 0) {
|
||||
|
164
makefiles/arch/native.inc.mk
Normal file
164
makefiles/arch/native.inc.mk
Normal file
@ -0,0 +1,164 @@
|
||||
NATIVEINCLUDES += -DNATIVE_INCLUDES
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/core/lib/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/core/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/sys/include/
|
||||
NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
DEBUGGER ?= lldb
|
||||
else
|
||||
DEBUGGER ?= gdb
|
||||
endif
|
||||
|
||||
|
||||
export VALGRIND ?= valgrind
|
||||
export CGANNOTATE ?= cg_annotate
|
||||
export GPROF ?= gprof
|
||||
|
||||
# basic cflags:
|
||||
CFLAGS += -Wall -Wextra -pedantic $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
CFLAGS += -U_FORTIFY_SOURCE
|
||||
CFLAGS_DBG ?= -g3
|
||||
|
||||
ifneq (,$(filter backtrace,$(USEMODULE)))
|
||||
$(warning module backtrace is used, do not omit frame pointers)
|
||||
CFLAGS_OPT ?= -Og -fno-omit-frame-pointer
|
||||
else
|
||||
CFLAGS_OPT ?= -Og
|
||||
endif
|
||||
|
||||
# default std set to gnu11 if not overwritten by user
|
||||
ifeq (,$(filter -std=%, $(CFLAGS)))
|
||||
CFLAGS += -std=gnu11
|
||||
endif
|
||||
|
||||
ifeq ($(NATIVE_ARCH_BIT),64)
|
||||
CFLAGS += -m64
|
||||
LINKFLAGS += -m64
|
||||
else ifeq ($(NATIVE_ARCH_BIT),32)
|
||||
CFLAGS += -m32
|
||||
LINKFLAGS += -m32
|
||||
else
|
||||
$(error Unsupported native architecture)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter -DDEVELHELP,$(CFLAGS)))
|
||||
CFLAGS += -fstack-protector-all
|
||||
endif
|
||||
ifeq ($(OS),FreeBSD)
|
||||
ifeq ($(OS_ARCH),amd64)
|
||||
ifeq ($(NATIVE_ARCH_BIT),32)
|
||||
CFLAGS += -DCOMPAT_32BIT -B/usr/lib32
|
||||
LINKFLAGS += -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS),Darwin)
|
||||
CFLAGS += -Wno-deprecated-declarations
|
||||
endif
|
||||
|
||||
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
||||
CXXUWFLAGS +=
|
||||
CXXEXFLAGS +=
|
||||
|
||||
ifeq ($(OS),FreeBSD)
|
||||
LINKFLAGS += -L $(BINDIR)
|
||||
else
|
||||
LINKFLAGS += -ldl
|
||||
endif
|
||||
|
||||
# XFA (cross file array) support
|
||||
LINKFLAGS += -T$(RIOTBASE)/cpu/native/ldscripts/xfa.ld
|
||||
|
||||
# fix this warning:
|
||||
# ```
|
||||
# /usr/bin/ld: examples/hello-world/bin/native/cpu/tramp.o: warning: relocation against `_native_saved_eip' in read-only section `.text'
|
||||
# /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
|
||||
# ```
|
||||
LINKFLAGS += -no-pie
|
||||
|
||||
# clean up unused functions
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
ifeq ($(OS),Darwin)
|
||||
LINKFLAGS += -Wl,-dead_strip
|
||||
else
|
||||
LINKFLAGS += -Wl,--gc-sections
|
||||
endif
|
||||
LINKFLAGS += -ffunction-sections
|
||||
|
||||
|
||||
ASFLAGS =
|
||||
ifeq ($(shell basename $(DEBUGGER)),lldb)
|
||||
DEBUGGER_FLAGS = -- $(ELFFILE) $(TERMFLAGS)
|
||||
else
|
||||
DEBUGGER_FLAGS = -q --args $(ELFFILE) $(TERMFLAGS)
|
||||
endif
|
||||
term-valgrind: export VALGRIND_FLAGS ?= \
|
||||
--leak-check=full \
|
||||
--track-origins=yes \
|
||||
--fullpath-after=$(RIOTBASE)/ \
|
||||
--read-var-info=yes
|
||||
debug-valgrind-server: export VALGRIND_FLAGS ?= --vgdb=yes --vgdb-error=0 -v \
|
||||
--leak-check=full --track-origins=yes --fullpath-after=$(RIOTBASE) \
|
||||
--read-var-info=yes
|
||||
term-cachegrind: export CACHEGRIND_FLAGS += --tool=cachegrind
|
||||
term-gprof: TERMPROG = GMON_OUT_PREFIX=gmon.out $(ELFFILE)
|
||||
all-valgrind: CFLAGS += -DHAVE_VALGRIND_H
|
||||
all-valgrind: NATIVEINCLUDES += $(shell pkg-config valgrind --cflags)
|
||||
all-gprof: CFLAGS += -pg
|
||||
all-gprof: LINKFLAGS += -pg
|
||||
|
||||
CFLAGS_ASAN += -fsanitize=address -fno-omit-frame-pointer -DNATIVE_MEMORY
|
||||
LINKFLAGS_ASAN += -fsanitize=address -fno-omit-frame-pointer
|
||||
all-asan: CFLAGS += $(CFLAGS_ASAN)
|
||||
all-asan: LINKFLAGS += $(LINKFLAGS_ASAN)
|
||||
all-asan: export AFL_USE_ASAN=1
|
||||
|
||||
INCLUDES += $(NATIVEINCLUDES)
|
||||
|
||||
CFLAGS += -DDEBUG_ASSERT_VERBOSE
|
||||
|
||||
# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
|
||||
ifneq ($(shell gcc --version | head -1 | grep -E ' (4.6|4.7)'),)
|
||||
CFLAGS += -DHAVE_NO_BUILTIN_BSWAP16
|
||||
endif
|
||||
|
||||
# clumsy way to enable building native on osx:
|
||||
BUILDOSXNATIVE = 0
|
||||
ifeq ($(CPU),native)
|
||||
ifeq ($(OS),Darwin)
|
||||
BUILDOSXNATIVE = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
all: # do not override first target
|
||||
|
||||
all-gprof: all
|
||||
|
||||
all-asan: all
|
||||
|
||||
all-valgrind: all
|
||||
|
||||
all-cachegrind: all
|
||||
|
||||
term-valgrind:
|
||||
$(VALGRIND) $(VALGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
debug-valgrind-server:
|
||||
$(VALGRIND) $(VALGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
debug-valgrind:
|
||||
$(eval VALGRIND_PID ?= $(shell pgrep -n memcheck-x86-li -u $(USER) | cut -d" " -f1))
|
||||
$(eval DEBUGGER_FLAGS := -ex "target remote | vgdb --pid=$(VALGRIND_PID)" $(DEBUGGER_FLAGS))
|
||||
$(DEBUGGER) $(DEBUGGER_FLAGS)
|
||||
|
||||
term-cachegrind:
|
||||
$(VALGRIND) $(CACHEGRIND_FLAGS) $(ELFFILE) $(PORT)
|
||||
|
||||
term-gprof: term
|
||||
|
||||
eval-gprof:
|
||||
$(GPROF) $(ELFFILE) $(shell ls -rt gmon.out* | tail -1)
|
||||
|
||||
eval-cachegrind:
|
||||
$(CGANNOTATE) $(shell ls -rt cachegrind.out* | tail -1)
|
@ -11,7 +11,7 @@ UBSAN_MODE ?= msg_exit
|
||||
CFLAGS_UBSAN = -fsanitize=undefined
|
||||
|
||||
ifeq (gnu,$(TOOLCHAIN))
|
||||
ifeq (native,$(BOARD))
|
||||
ifeq (native,$(CPU))
|
||||
ifneq (,$(filter msg_%,$(UBSAN_MODE)))
|
||||
LINKFLAGS_UBSAN += -lubsan
|
||||
ifneq (msg_recover,$(UBSAN_MODE))
|
||||
|
@ -24,7 +24,7 @@ ifneq (,$(filter flashdb_mtd,$(USEMODULE)))
|
||||
USEMODULE += flashdb_fal
|
||||
USEMODULE += mtd
|
||||
else
|
||||
ifeq (native, $(BOARD))
|
||||
ifeq ($(CPU),native)
|
||||
CFLAGS += -DFDB_USING_FILE_POSIX_MODE
|
||||
else
|
||||
CFLAGS += -DFDB_USING_FILE_LIBC_MODE
|
||||
|
@ -16,10 +16,10 @@ EXT_CFLAGS := -D__TARGET_RIOT
|
||||
CFLAGS += -Wno-cast-align
|
||||
|
||||
# disable warnings when compiling with LLVM for board native
|
||||
ifeq ($(TOOLCHAIN)_$(BOARD),llvm_native)
|
||||
ifeq ($(TOOLCHAIN)_$(CPU),llvm_native)
|
||||
CFLAGS += -Wno-macro-redefined -Wno-gnu-folding-constant
|
||||
EXT_CFLAGS += -Wno-conversion
|
||||
else ifeq ($(OS)_$(BOARD),FreeBSD_native)
|
||||
else ifeq ($(OS)_$(CPU),FreeBSD_native)
|
||||
EXT_CFLAGS += -Wno-conversion
|
||||
else ifeq (esp32,$(CPU))
|
||||
# The ESP-IDF uses #include_next that causes errors when compiling with warnings
|
||||
|
@ -6,5 +6,5 @@
|
||||
#
|
||||
|
||||
config PACKAGE_LIBSOCKETCAN
|
||||
bool "libsocketcan2 32bit for native Linux builds"
|
||||
depends on BOARD_NATIVE
|
||||
bool "libsocketcan2 for native Linux builds"
|
||||
depends on HAS_ARCH_NATIVE
|
||||
|
@ -16,9 +16,9 @@ if PACKAGE_TLSF
|
||||
|
||||
config MODULE_TLSF_MALLOC
|
||||
bool "TLSF malloc"
|
||||
depends on MODULE_NEWLIB || BOARD_NATIVE
|
||||
depends on MODULE_NEWLIB || HAS_ARCH_NATIVE
|
||||
select MODULE_TLSF_MALLOC_NEWLIB if MODULE_NEWLIB
|
||||
select MODULE_TLSF_MALLOC_NATIVE if BOARD_NATIVE
|
||||
select MODULE_TLSF_MALLOC_NATIVE if HAS_ARCH_NATIVE
|
||||
|
||||
config MODULE_TLSF_MALLOC_NEWLIB
|
||||
bool
|
||||
|
@ -1,7 +1,7 @@
|
||||
ifneq (,$(filter tlsf-malloc,$(USEMODULE)))
|
||||
ifneq (,$(filter newlib,$(USEMODULE)))
|
||||
USEMODULE += tlsf-malloc_newlib
|
||||
else ifneq (,$(filter native,$(BOARD)))
|
||||
else ifneq (,$(filter native,$(CPU)))
|
||||
USEMODULE += tlsf-malloc_native
|
||||
else
|
||||
$(warning tlsf-malloc can only be used on native or on platforms using newlib)
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@ ifeq (llvm,$(TOOLCHAIN))
|
||||
CFLAGS += -Wno-unused-parameter
|
||||
endif
|
||||
|
||||
ifeq (native,$(BOARD))
|
||||
ifeq (native,$(CPU))
|
||||
CFLAGS += -Wno-array-parameter
|
||||
endif
|
||||
|
||||
|
@ -135,7 +135,7 @@ ifneq (,$(filter ssp,$(USEMODULE)))
|
||||
include $(RIOTBASE)/sys/ssp/Makefile.include
|
||||
endif
|
||||
|
||||
ifneq (native,$(BOARD))
|
||||
ifneq (native,$(CPU))
|
||||
INCLUDES += -I$(RIOTBASE)/sys/libc/include
|
||||
endif
|
||||
|
||||
|
@ -4,6 +4,6 @@ ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||
DEFAULT_MODULE += vfs_auto_mount
|
||||
endif
|
||||
|
||||
ifeq (native, $(BOARD))
|
||||
ifeq (native,$(CPU))
|
||||
USEMODULE += native_vfs
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user