60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
import os
|
|
|
|
# toolchains options
|
|
ARCH='ia32'
|
|
CPU=''
|
|
CROSS_TOOL='gcc'
|
|
|
|
if os.getenv('RTT_CC'):
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
# cross_tool provides the cross compiler
|
|
# EXEC_PATH is the compiler execute path, for example, CodeSourcery,
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
PLATFORM = 'gcc'
|
|
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
|
|
elif CROSS_TOOL == 'keil':
|
|
print('================ERROR============================')
|
|
print('Not support keil yet!')
|
|
print('=================================================')
|
|
exit(0)
|
|
elif CROSS_TOOL == 'iar':
|
|
print('================ERROR============================')
|
|
print('Not support iar yet!')
|
|
print('=================================================')
|
|
exit(0)
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
BUILD = 'debug'
|
|
|
|
if PLATFORM == 'gcc':
|
|
# toolchains
|
|
PREFIX = ''
|
|
CC = PREFIX + 'gcc -m32 -fno-builtin -fno-stack-protector -nostdinc'
|
|
AS = PREFIX + 'gcc -m32'
|
|
AR = PREFIX + 'ar'
|
|
LINK = PREFIX + 'ld -melf_i386'
|
|
TARGET_EXT = 'elf'
|
|
SIZE = PREFIX + 'size'
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
DEVICE = ''
|
|
CFLAGS = DEVICE + ' -Wall'
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
|
LFLAGS = DEVICE + ' -Map rtthread-ia32.map -T x86_ram.lds -nostdlib'
|
|
|
|
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'
|