应用模块编译出问题

发布于 2017-05-22 10:19:44
想在正点原子的阿波罗开发板上使用应用模块,参考最新的realboard板子,
模块程序目录D:
t-thread_dev
t-threadexamplesmoduleasicapp
BSP目录下用scons --target=ua -s生成了rtua.py

rtconfig.py 如下:

import os
cwd = os.path.split(os.path.realpath(__file__))[0]

# RT-Thread root directory
RTT_ROOT = 'D:/rt-thread_dev/rt-thread'
BSP_ROOT = 'D:/rt-thread_dev/rt-thread/bsp/stm32f767-apollo'
# toolchains
EXEC_PATH = 'C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3'

if os.getenv('RTT_ROOT'): RTT_ROOT = os.getenv('RTT_ROOT')
if os.getenv('BSP_ROOT'): BSP_ROOT = os.getenv('BSP_ROOT')
if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH')

PLATFORM = 'gcc'
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'mo'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'

DEVICE = ' -mcpu=cortex-m7'
CFLAGS = DEVICE + ' -mthumb -mlong-calls -O0 -fPIC -fno-exceptions'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -mthumb -Wl,-z,max-page-size=0x4 -shared -fPIC -e main -nostdlib'

CPATH = ''
LPATH = ''


SConstruct如下:

import os
import sys

import rtconfig

sconstruct = File('SConstruct')
fn = sconstruct.rfile()
name = fn.name
building_dir = os.path.dirname(fn.abspath)
program_dir = '../bin'

from rtconfig import RTT_ROOT
from rtconfig import BSP_ROOT

sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools'), BSP_ROOT]
from building import *
from rtua import GetCPPPATH
from rtua import GetCPPDEFINES

Export('RTT_ROOT')
Export('BSP_ROOT')

# add target option
AddOption('--app',
dest='app',
nargs=1, type='string',
action='store',
metavar='DIR',
help='installation prefix')

# add target option
AddOption('--type',
dest='type',
nargs=1, type='string',
action='store',
metavar='DIR',
help='installation prefix')

if GetOption('type') == 'ext':
linkflags = rtconfig.LFLAGS + ' -e 0'
else:
linkflags = rtconfig.LFLAGS + ' -e main'

CPPPATH = GetCPPPATH(BSP_ROOT, RTT_ROOT)

env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = linkflags,
CPPPATH = CPPPATH)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)

PrepareModuleBuilding(env, RTT_ROOT, BSP_ROOT)

app = GetOption('app')
if app:
objs = SConscript(os.path.join(app, 'D:/rt-thread_dev/rt-thread/examples/module/basicapp/SConscript'))
TARGET = os.path.join(app , app + '.' + rtconfig.TARGET_EXT)

# build program
target = env.Program(TARGET, objs)
env.Command("$TARGET", target, action = Copy(program_dir, TARGET))


D:
t-thread_dev
t-threadexamplesmoduleasicapp下运行 scons --app=basicapp报错

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
arm-none-eabi-gcc -o basicapp.o -c -mcpu=cortex-m7 -mthumb -mlong-calls -O0 -fPIC -fno-exceptions -ID:
t-thread_dev
t-threadspstm32f767-apollo -ID:
t-thread_dev
t-threadspstm32f767-apolloapplications -ID:
t-thread_dev
t-threadspstm32f767-apollodrivers -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemsdevfs -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemselmfat -ID:
t-thread_dev
t-threadcomponentsdfsinclude -ID:
t-thread_dev
t-threadcomponentsdriversinclude -ID:
t-thread_dev
t-threadcomponentsdriversspi -ID:
t-thread_dev
t-threadcomponentsexternalluaapplications -ID:
t-thread_dev
t-threadcomponentsexternalluaexlibs -ID:
t-thread_dev
t-threadcomponentsexternallualua -ID:
t-thread_dev
t-threadcomponentsexternallua est -ID:
t-thread_dev
t-threadcomponentsfinsh -ID:
t-thread_dev
t-threadcomponentslibc
ewlib -ID:
t-thread_dev
t-threadcomponentslibcpthreads -ID:
t-thread_dev
t-threadinclude -ID:
t-thread_dev
t-threadlibcpuarmcommon -ID:
t-thread_dev
t-threadlibcpuarmcortex-m7 basicapp.c
Error in calling:
arm-none-eabi-gcc -o "basicapp.o" -c -mcpu=cortex-m7 -mthumb -mlong-calls -O0 -fPIC -fno-exceptions -ID:
t-thread_dev
t-threadspstm32f767-apollo -ID:
t-thread_dev
t-threadspstm32f767-apolloapplications -ID:
t-thread_dev
t-threadspstm32f767-apollodrivers -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemsdevfs -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemselmfat -ID:
t-thread_dev
t-threadcomponentsdfsinclude -ID:
t-thread_dev
t-threadcomponentsdriversinclude -ID:
t-thread_dev
t-threadcomponentsdriversspi -ID:
t-thread_dev
t-threadcomponentsexternalluaapplications -ID:
t-thread_dev
t-threadcomponentsexternalluaexlibs -ID:
t-thread_dev
t-threadcomponentsexternallualua -ID:
t-thread_dev
t-threadcomponentsexternallua est -ID:
t-thread_dev
t-threadcomponentsfinsh -ID:
t-thread_dev
t-threadcomponentslibc
ewlib -ID:
t-thread_dev
t-threadcomponentslibcpthreads -ID:
t-thread_dev
t-threadinclude -ID:
t-thread_dev
t-threadlibcpuarmcommon -ID:
t-thread_dev
t-threadlibcpuarmcortex-m7 "basicapp.c"
Exception: [Error 2] : No such file or directory
scons: building terminated because of errors.

但是命令行运行单独这个命令可以生成basicapp.o arm-none-eabi-gcc -o basicapp.o -c -mcpu=cortex-m7 -mthumb -mlong-calls -O0 -fPIC -fno-exceptions -ID:
t-thread_dev
t-threadspstm32f767-apollo -ID:
t-thread_dev
t-threadspstm32f767-apolloapplications -ID:
t-thread_dev
t-threadspstm32f767-apollodrivers -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemsdevfs -ID:
t-thread_dev
t-threadcomponentsdfsfilesystemselmfat -ID:
t-thread_dev
t-threadcomponentsdfsinclude -ID:
t-thread_dev
t-threadcomponentsdriversinclude -ID:
t-thread_dev
t-threadcomponentsdriversspi -ID:
t-thread_dev
t-threadcomponentsexternalluaapplications -ID:
t-thread_dev
t-threadcomponentsexternalluaexlibs -ID:
t-thread_dev
t-threadcomponentsexternallualua -ID:
t-thread_dev
t-threadcomponentsexternallua est -ID:
t-thread_dev
t-threadcomponentsfinsh -ID:
t-thread_dev
t-threadcomponentslibc
ewlib -ID:
t-thread_dev
t-threadcomponentslibcpthreads -ID:
t-thread_dev
t-threadinclude -ID:
t-thread_dev
t-threadlibcpuarmcommon -ID:
t-thread_dev
t-threadlibcpuarmcortex-m7 basicapp.c

发现tools下的building.py等有变化,不知道是不是有影响。

查看更多

关注者
0
被浏览
1.8k
3 个回答
bernard
bernard 2017-05-22
scons用的arm-none-eabi-gcc都不是命令行路径里配置的,需要在配置文件里制定,所以依然还是gcc未找到
jeffwei
jeffwei 2017-05-22
在rtconfig.py配置了GCC路径的,缺少/bin
# toolchains
EXEC_PATH = 'C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3'


EXEC_PATH = 'C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3/bin'

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览