0

我正在尝试为 Renesas RL78/G13 系列 MCU 构建 C++ 程序。我以前使用 IAR 工具链没有问题,但现在我想使用 GNU RL78 工具链,这样我就可以使用一些 Renesas 库。

我的问题是我现在无法让程序链接,似乎是因为缺少符号。任何建议将不胜感激。

这是链接器的控制台输出:

'Invoking: Linker'
'Building target:'
rl78-elf-ld -o "firmware_2.x" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\firmware_2_HardwareDebug_auto.gsi" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\LinkerSubCommand.tmp"    libfirmware_2.a  -M=firmware_2.map -e_PowerON_Reset -L"C:\Projects\ms_monitor\firmware_2\lib" -L"C:\Projects\ms_monitor\firmware_2\HardwareDebug" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\rl78-elf\lib" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\lib\gcc\rl78-elf\4.8-GNURL78_v13.01" --start-group -lstdc++ -lfirmware_2 -lgcc --end-group
rl78-elf-ld: section .vects loaded at [00000004,0000007f] overlaps section .vec loaded at [00000000,00000005]
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x2): undefined reference to `_stack'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x9): undefined reference to `_datastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0xc): undefined reference to `_romdatastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x11): undefined reference to `_romdatacopysize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x29): undefined reference to `_bssstart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x31): undefined reference to `_bsssize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x4c): undefined reference to `etext'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x65): undefined reference to `exit'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x69): undefined reference to `_preinit_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x6c): undefined reference to `_preinit_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x74): undefined reference to `_init_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x77): undefined reference to `_init_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x7f): undefined reference to `_fini_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x82): undefined reference to `_fini_array_end'
./src/utilities/csv_loader.o: In function `CsvLoader_Create':
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0xe): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x18): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x1d): relocation truncated to fit: R_RL78_DIR16S against `.LC1'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x31): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x3b): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x40): relocation truncated to fit: R_RL78_DIR16S against `.LC2'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x56): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x60): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x65): relocation truncated to fit: R_RL78_DIR16S against `.LC3'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x79): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x83): additional relocation overflows omitted from the output
libfirmware_2.a(mcount.o): In function `_monstartup':
(.text+0x67b): undefined reference to `ffs'
libfirmware_2.a(printf.o): In function `_printf_r':
(.text+0x30): undefined reference to `_vfprintf_r'
libfirmware_2.a(printf.o): In function `printf':
(.text+0x75): undefined reference to `_vfprintf_r'
libfirmware_2.a(snprintf.o): In function `_snprintf_r':
(.text+0x8d): undefined reference to `_svfprintf_r'
libfirmware_2.a(snprintf.o): In function `snprintf':
(.text+0x165): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `_sprintf_r':
(.text+0x4f): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `sprintf':
(.text+0xbf): undefined reference to `_svfprintf_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1bed): undefined reference to `_free_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1c83): undefined reference to `_free_r'
libfirmware_2.a(wsetup.o): In function `__swsetup_r':
(.text+0xf8): undefined reference to `_free_r'
libfirmware_2.a(calloc.o): In function `calloc':
(.text+0x16): undefined reference to `_calloc_r'
libfirmware_2.a(fflush.o): In function `__sflush_r':
(.text+0x324): undefined reference to `_free_r'
libfirmware_2.a(findfp.o): In function `__sfmoreglue':
(.text+0xf2): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x25e): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2de): undefined reference to `_realloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2ff): undefined reference to `_free_r'
libfirmware_2.a(makebuf.o): In function `__smakebuf_r':
(.text+0x1a2): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `malloc':
(.text+0x10): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `free':
(.text+0x26): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `cleanup_glue':
(.text+0x3c): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xb1): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xe6): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0x111): undefined reference to `_free_r'
libfirmware_2.a(reent.o):(.text+0x172): more undefined references to `_free_r' follow
C:\Projects\ms_monitor\firmware_2\HardwareDebug\libfirmware_2.a(realloc.o): In function `realloc':
(.text+0x16): undefined reference to `_realloc_r'
make: *** [firmware_2.x] Error 1
4

1 回答 1

0

在 KPIT GNU 团队的大力支持下,这个问题得到了解答。

我尝试编译的处理器的链接器文件不正确(例如,链接器文件正确但其内容不正确)。不仅如此,一些缺失的符号还取决于工作区的配置方式。

如果您自己发现此问题,第一步是联系 KPIT GNU,因为如果不询问文件,我不会知道文件存在问题。

于 2013-03-12T13:58:39.393 回答