Rakefile: switch from clang to gcc because fot clang uint64_t is only 4 bytes long

This commit is contained in:
King Kévin 2017-10-09 17:59:12 +02:00
parent d8830f3114
commit 256363bd15
1 changed files with 7 additions and 9 deletions

View File

@ -29,7 +29,8 @@ SRC_DIRS = [".", "lib"]
# cross-compiler environment
PREFIX = ENV["PREFIX"] || "arm-none-eabi"
CC = "clang -target #{PREFIX}" # use clang instead of gcc
CC = PREFIX+"-gcc"
#CC = "clang -target #{PREFIX}" # to use clang instead of gcc
LD = PREFIX+"-ld"
AR = PREFIX+"-ar"
AS = PREFIX+"-as"
@ -53,10 +54,6 @@ cflags << "-fno-common -ffunction-sections -fdata-sections"
cflags << "-fshort-enums"
# don't use system main definition (the starting point)
cflags << "-ffreestanding"
# don't use the standard library (only if you provide an alternative libc library)
cflags << "-nostdlib -nostdinc"
# standard C library (use musl libc)
cflags << "-I /usr/lib/musl/include/"
# include own libraries
cflags += SRC_DIRS.collect {|srd_dir| "-I #{srd_dir}"}
# include libopencm3 library
@ -74,10 +71,11 @@ ldflags << "-static"
ldflags << "-nostartfiles"
# only keep used sections
ldflags << "--gc-sections"
# don't use system libraries (only if you provide an alternative libc library)
ldflags << "-nostdlib -nostdinc -nosys"
# add standard libraries (for libc, libm, libnosys, libgcc) and libopencm3
library_paths = ["/usr/arm-none-eabi/lib/armv7-m/", "/usr/lib/gcc/arm-none-eabi/*/armv7-m/", LIBOPENCM3_LIB]
# add standard libraries (for libc, libm, libnosys, libgcc) because we don't use arm-none-eabi-gcc to locate them
library_paths = ["/usr/arm-none-eabi/lib/armv7-m/", "/usr/lib/gcc/arm-none-eabi/*/armv7-m/"]
# add libopencm3
library_paths += [LIBOPENCM3_LIB]
# include libraries in flags
ldflags += library_paths.collect {|library_path| "--library-path #{library_path}"}
ldflags *= ' '
# used libraries (gcc provides the ARM ABI)