应用模块找不到符号表

发布于 2017-05-23 10:58:26
报错内容:
Module: can't find led1_on in kernel symbol table
Module: can't find rt_thread_delay in kernel symbol table


平台是STM32F767正点原子阿波罗,IAR编译主程序,icf文件已经添加keep { section RTMSymTab };
编译产生的rtthread.map文件可以找到
__rtmsym_rt_thread_delay
0x0804116c 0x8 Data Gb thread.o [1]
__rtmsym_rt_thread_delay_name
0x08049cec 0x10 Data Gb thread.o [1]

__rtmsym_led1_off       0x08040a94      0x8  Data  Gb  drv_led.o [1]
__rtmsym_led1_off_name 0x0804a08c 0xc Data Gb drv_led.o [1]
__rtmsym_led1_on 0x08040a8c 0x8 Data Gb drv_led.o [1]
__rtmsym_led1_on_name 0x0804a6d0 0x8 Data Gb drv_led.o [1]

RTMSymTab$$Base         0x0804090c            --   Gb  - Linker created -
RTMSymTab$$Limit 0x080411d4 -- Gb - Linker created -


模块的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/bin'

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))


确定rt_system_module_init函数运行到了下面代码:
#elif defined (__IAR_SYSTEMS_ICC__)
_rt_module_symtab_begin = __section_begin("RTMSymTab");
_rt_module_symtab_end = __section_begin("RTMSymTab");
#endif

rtua.y是自动生成的。
确定报错函数是这个
static struct rt_module *_load_shared_object(const char *name,
void *module_ptr)
求教下一步怎么查?

查看更多

关注者
0
被浏览
2.2k
10 个回答
jeffwei
jeffwei 2017-05-23
用mdk试了一下,一加载就死了:

\ | /
- RT - Thread Operating System
/ | \ 2.1.0 build May 23 2017
2006 - 2017 Copyright by rt-thread team
found part[0], begin: 32256, size: 14.857GB
dfs initialized!
msh />psr: 0x41000000
pc: 0xc1002ccc
lr: 0x0800fca1
r12: 0x00000000
r03: 0x00000000
r02: 0xc1002ccd
r01: 0x00000000
r00: 0x00000000
hard fault on thread: basicapp
thread pri status sp stack size max used left tick error
-------- --- ------- ---------- ---------- ------ ---------- ---
basicapp 30 ready 0x00000048 0x00002000 01% 0x0000000a 000
led 12 suspend 0x00000078 0x00000100 46% 0x00000005 000
tshell 10 suspend 0x0000008c 0x00000400 20% 0x0000000a 000
tidle 31 ready 0x0000005c 0x00000200 17% 0x0000001e 000
timer 4 suspend 0x00000060 0x00000200 18% 0x00000009 000
main 10 suspend 0x00000084 0x00000800 43% 0x00000012 000


吐槽一下mdk速度问题,同样的工程,mdk编译链接要一刻钟,IAR只要一分钟。
------------------------------------------------------------------------------------
忘了一条,由于编译时报错,暂时屏蔽了LIBC代码
/* import the full stdio for printf */
#if defined(RT_USING_MODULE) && defined(__MICROLIB)
#error "[RT_USING_LIBC] Please use standard libc but not microlib."
#endif
aozima
aozima 2017-05-23
拒绝白嫖,拒绝键盘侠!
关掉符号浏览就快了,MDK是在编译时生成符号信号,IAR是编译完成后再生成。
所以在运算量一样的情况下,IAR先完成。
jeffwei
jeffwei 2017-05-23
关掉符号浏览就快了,MDK是在编译时生成符号信号,IAR是编译完成后再生成。
所以在运算量一样的情况下,IAR先完成。

没找到在哪里关闭啊!
jeffwei
jeffwei 2017-05-24
用 list_symbol
iar编译的主程序没列出符号
mdk编译的主程序就直接死在tshell了

----------------------------------------------
既然map文件有
RTMSymTab$$Base         0x08041d9c           Data  Gb  - Linker created -
RTMSymTab$$Limit 0x08042664 Data Gb - Linker created -


把rt_system_module_init里面IAR的程序换成和MDK一样,然后list_symbol就出来一大堆了
用rt_module_open也会死。把rt_module_open导出到msh,运行后报错乱码
rt_kprintf("Module: access %s failed
", path);

Module: access 劭Ⅴ#H肗I ?g_贜縥蛮E7?V?挖S薇鮡鍊atR?tR??6钲舦??T??`鶰阪W蕖 failed


--------------------------------------------------------------------------

单步发现main程序使用 rt_module_open正常的,死在了startup_stm32f767xx.s中: B MemManage_Handler

MemManage_Handler
B MemManage_Handler
jeffwei
jeffwei 2017-05-25
昨天下午培训易控软件去了,晚上吃虾喝酒,早上继续,因为是死在内存问题上,
就把SDRAM先关了,然后模块运行正常了。继续找SDRAM问题。
bernard
bernard 2017-05-25
难道mpu的权限没配置?
jeffwei
jeffwei 2017-05-25
难道mpu的权限没配置?

上午又折腾选型买一堆样品,没时间搞程序,休息一下,
下午看看MPU配置再给你汇报结果。
--------------------------------------------------------
没等到下午,刚刚看了MPU配置,0xC0000000起始地址,
我在board.h里面设置的0xC1000000开始,因为分了一半SDRAM
给emwin用了。以前没用过带MPU的CPU,还是老大威武,一句话搞定!
softwind
softwind 2017-06-01
难道mpu的权限没配置?

上午又折腾选型买一堆样品,没时间搞程序,休息一下,
下午看看MPU配置再给你汇报结果。
--------------------------------------------------------
没等到下午,刚刚看了MPU配置,0xC0000000起始地址,
我在board.h里面设置的0xC1000000开始,因为分了一半SDRAM
给emwin用了。以前没用过带MPU的CPU,还是老大威武,一句话搞定!


@jeffwei,
我这边也准备采用RT-Thread+emWin,SDRAM做显存,想请教一下,您这边的SDRAM的MPU属性是怎么配置的?另外SDRAM是否也有一部分用作System Heap,这部分的MPU属性又是怎么设置的?
qiousanxi
qiousanxi 2018-03-16
softwind 发表于 2017-6-1 11:05
上午又折腾选型买一堆样品,没时间搞程序,休息一下,
下午看看MPU配置再给你汇报结果。
------------------ ...


看看 原子的例程,你做程序区的SDRAM和内部RAM 应该是一样的,

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览