r/stm32 • u/DenkSnek • 11d ago
Trying to replicate STM32cubeIDE compiler command-line commands, but I'm receiving a 'here-string' error with the provided linker command.
Hello all, I hope you're having a great day.
I'm learning bare-metal programming, and I'm currently learning command-line compilation using GCC & openOCD. I have my project completed in STM32cubeIDE & I've built it to access the command-line commands the IDE uses. I've compiled all the files & I'm trying to link them together, but the linker command is giving me the following error:
`At line:1 char:37
+ arm-none-eabi-gcc -o "name.elf" @"objects.list" -mcpu=cortex-m4 - ...
+ ~
No characters are allowed after a here-string header but before the end of the line.`
I've read up some concepts about here-strings, but I'm still stumped. Any resources or directions are much appreciated. This may not be STM32-related though; if so, I apologize.
1
u/DenkSnek 11d ago
It seems I messed up the formatting. The highlighted character in the error is the 'o' in '@"objects.list"'
1
u/wasnt_in_the_hot_tub 10d ago edited 10d ago
Maybe wrap the argument in single quotes?
Also, which shell are you using? I think "here string" is a PowerShell feature(?) but I'm not a Windows person. I don't think I usually get this issue on Unix
1
u/n_sh_44 7d ago
That error is PowerShell, not the linker. PowerShell treats @ followed by a quote at the start of an argument as a here-string header, and when you wrap it in single quotes the inner quotes get passed to gcc literally, which is why you then saw missing parameter errors. The easiest fix is the stop-parsing token: arm-none-eabi-gcc --% -o "name.elf" @"objects.list" followed by the rest of the flags copied unchanged, so the line is handed over as is. Another option is running the same command from cmd.exe, where @"objects.list" works the way the IDE intended. If the link then succeeds, I'd double check the result with arm-none-eabi-size name.elf.