2013-01-08 22:40:58 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH='ia32'
|
|
|
|
CPU=''
|
2021-08-22 07:03:16 +08:00
|
|
|
CROSS_TOOL= os.getenv('RTT_CC') or 'gcc'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
# cross_tool provides the cross compiler
|
|
|
|
# EXEC_PATH is the compiler execute path, for example, CodeSourcery,
|
|
|
|
|
|
|
|
if CROSS_TOOL == 'gcc':
|
2021-02-19 23:55:17 +08:00
|
|
|
PLATFORM = 'gcc'
|
2021-08-22 07:03:16 +08:00
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
|
|
|
|
else:
|
|
|
|
print('Unknown toolchains, only support GCC')
|
2013-01-08 22:40:58 +08:00
|
|
|
exit(0)
|
|
|
|
|
|
|
|
BUILD = 'debug'
|
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
2021-08-22 07:03:16 +08:00
|
|
|
PREFIX = 'i386-unknown-elf-'
|
2021-02-19 23:55:17 +08:00
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
AS = PREFIX + 'gcc'
|
2013-01-08 22:40:58 +08:00
|
|
|
AR = PREFIX + 'ar'
|
2021-02-19 23:55:17 +08:00
|
|
|
LINK = PREFIX + 'gcc'
|
2013-01-08 22:40:58 +08:00
|
|
|
TARGET_EXT = 'elf'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
|
2021-02-19 23:55:17 +08:00
|
|
|
DEVICE = ' -mtune=generic'
|
2013-01-08 22:40:58 +08:00
|
|
|
CFLAGS = DEVICE + ' -Wall'
|
|
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
2021-02-19 23:55:17 +08:00
|
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T x86_ram.lds -nostartfiles'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|