Console output by printf for debug via stlink
Hello,
I want to debug application by some output in console in linux.
I have chip STM32F103C8T6. Chip is connected to PC via Stlink v2.
I want to use function printf (or something like this) to see output in consile on PC.
As I undersnand I have to set gcc linker flags
-specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon
But if I set flag -specs=rdimon.specs I get “multiple definition of `initialise_monitor_handles’ syscalls.c /ProceC/src line 71 C/C++ Problem”
in main.c I declare “extern void initialise_monitor_handles(void);”
I found here http://www.openstm32.org/forumthread2948 that it is C++ problem. But I have C project and extern “C” void initialise_monitor_handles(void); does not work by syntax error.
Is anywhere some example with printf output ?
Here is Eclipse console listing
/home/evgsurf/workspace/ProceC/Debug
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -DSTM32 -DSTM32F1 -DSTM32F103C8Tx -DDEBUG -DSTM32F103xB -DUSE_HAL_DRIVER -I”/home/evgsurf/workspace/ProceC/HAL_Driver/Inc/Legacy” -I”/home/evgsurf/workspace/ProceC/inc” -I”/home/evgsurf/workspace/ProceC/CMSIS/device” -I”/home/evgsurf/workspace/ProceC/CMSIS/core” -I”/home/evgsurf/workspace/ProceC/HAL_Driver/Inc” -O0 -g3 -Wall -fmessage-length=0 -ffunction-sections -c -MMD -MP -MF”src/main.d” -MT”src/main.o” -o “src/main.o” “../src/main.c”
Finished building: ../src/main.c
Building target: ProceC.elf
Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft specs=rdimon.specs -lc -lrdimon -T”/home/evgsurf/workspace/ProceC/LinkerScript.ld” -Wl,-Map=output.map -Wl,gc-sections -o “ProceC.elf” @”objects.list” -lm
src/syscalls.o: In function `initialise_monitor_handles’:
/home/evgsurf/workspace/ProceC/Debug/../src/syscalls.c:71: multiple definition of `initialise_monitor_handles’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text.initialise_monitor_handles+0x0): first defined here
src/syscalls.o: In function `_kill’:
syscalls.c:(.text._kill+0x0): multiple definition of `_kill’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-_kill.o):_kill.c:(.text._kill+0x0): first defined here
makefile:35: ошибка выполнения рецепта для цели «ProceC.elf»
src/syscalls.o: In function `_exit’:
syscalls.c:(.text._exit+0x0): multiple definition of `_exit’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-_exit.o):_exit.c:(.text._exit+0x0): first defined here
src/syscalls.o: In function `_close’:
syscalls.c:(.text._close+0x0): multiple definition of `_close’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._close+0x0): first defined here
src/syscalls.o: In function `_isatty’:
syscalls.c:(.text._isatty+0x0): multiple definition of `_isatty’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._isatty+0x0): first defined here
src/syscalls.o: In function `_lseek’:
syscalls.c:(.text._lseek+0x0): multiple definition of `_lseek’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._lseek+0x0): first defined here
src/syscalls.o: In function `_open’:
syscalls.c:(.text._open+0x0): multiple definition of `_open’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._open+0x0): first defined here
src/syscalls.o: In function `_unlink’:
syscalls.c:(.text._unlink+0x0): multiple definition of `_unlink’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._unlink+0x0): first defined here
src/syscalls.o: In function `_times’:
syscalls.c:(.text._times+0x0): multiple definition of `_times’
/home/evgsurf/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/librdimon.a(rdimon-syscalls.o):syscalls.c:(.text._times+0x0): first defined here
collect2: error: ld returned 1 exit status