This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
I am currently trying to write a custom definition for malloc and from what I read, I should not have to do anything special for this compiler. I was able to redefine it in a different project that used this same compiler as well but for this project, it gives me the following error:
error: symbol "_sys_memory" redefined: first defined in "debug\src\memory.obj";
redefined in
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6\lib/rtsv7R4_A_be_v3D16_eabi.lib
<memory.obj>"
error: symbol "malloc" redefined: first defined in "debug\src\memory.obj";
redefined in
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6\lib/rtsv7R4_A_be_v3D16_eabi.lib
<memory.obj>"
>> Compilation failure
>> Compilation failure
scons: building terminated because of errors.
error: errors encountered during linking; "debug\my_out.out" not built
error: symbol "_sys_memory" redefined: first defined in "debug\src\memory.obj";
redefined in
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6\lib/rtsv7R4_A_be_v3D16_eabi.lib
<memory.obj>"
error: symbol "malloc" redefined: first defined in "debug\src\memory.obj";
redefined in
"C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6\lib/rtsv7R4_A_be_v3D16_eabi.lib
<memory.obj>"
error: errors encountered during linking; "debug\my_out.out" not built
It seems to see my definition and the library definition and doesn't choose mine. I tried the '-x' and '-priority' flags but neither of does changed anything. I even changed the ordering of the includes, link, and source files to match my other project but that did not fix the issue.
The most likely explanation ... Some other file calls a function that is defined in RTS memory.obj that is not defined in your custom memory.obj. Possible examples include calloc and realloc. This causes the RTS memory.obj to be brought into the link. In turn, that causes these symbol redefined diagnostics.
To identify all the possible problem symbols, you need to know which global symbols are defined in RTS memory.obj. First, extract memory.obj from the library with a command similar to ...
% armar -x C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/lib/rtsv7R4_A_be_v3D16_eabi.lib memory.obj
Then, to see which global symbols are defined in memory.obj ...
% armnm -g memory.obj 00000000 w Lib$$Request$$armlib 00000000 w Lib$$Request$$cpplib 00000000 U __SYSMEM_SIZE 00000000 D __TI_DW.debug_info.$base_types.c8c38483d660372cd06395436475430b 00000000 D __TI_DW.debug_info.memory.c.5e26099586665ed842c3e104eedb26f0 00000000 D __TI_DW.debug_info.stdlib.h.f65beb9c32b827fb8141906f6cc29560 00000000 U _lock 00000000 B _sys_memory 00000000 U _unlock 000003b3 T calloc 000000f3 T free 0000008b T malloc 000002c5 T memalign 00000000 U memcpy 00000001 T minit 000001b5 T realloc
The first command uses the archiver. The second uses the name utility. Read about both of these tools in the ARM assembly tools manual. In the armnm output, only worry about the symbols marked T or B. T symbols are functions. B symbols (only one) are variables. To avoid this problem, your custom memory.obj needs to provide a definition of all these symbols.
Thanks and regards,
-George