Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Strange Error While Compiling

‘Building target: STM32F401RE-Nucleo_Application.elf’
‘Invoking: MCU GCC Linker’
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostdlib -specs=nano.specs -T”C:\temp\AC6\Path_to_Linker_Script\LinkerScript.ld” -Wl,-Map=output.map -Wl,minus minus gc-sections -lm -o “STM32F401RE-Nucleo_Application.elf” @”objects.list” -lm -lc--
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-init.o): In function `__libc_init_array’:
init.c:(.text.__libc_init_array+0x1c): undefined reference to `_init’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-sbrkr.o): In function `_sbrk_r’:
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-writer.o): In function `_write_r’:
writer.c:(.text._write_r+0x10): undefined reference to `_write’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-closer.o): In function `_close_r’:
closer.c:(.text._close_r+0xc): undefined reference to `_close’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-fstatr.o): In function `_fstat_r’:
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-isattyr.o): In function `_isatty_r’:
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-lseekr.o): In function `_lseek_r’:
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek’
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.3.0.201507241045/tools/compiler/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc_nano.a(lib_a-readr.o): In function `_read_r’:
readr.c:(.text._read_r+0x10): undefined reference to `_read’
collect2.exe: error: ld returned 1 exit status
make: *** STM32F401RE-Nucleo_Application.elf Error 1

Ask me for any information !

I have put “minus minus gc-sections..” above because putting two minus together was striking all the text infront of it.

Tunisia

Not that strange,
You need to add “-specs=nano.specs” “-specs=nosys.specs” in your miscellaneous linker flags or add syscalls.c to your project


-specs=nano.specs
can this be put in the any GUI Setting TAB? Where?

Tunisia
sorry, it is “-specs=nosys.specs” and it can be added in : Project, Properties, C/C++ Build, Settings, MCU GCC Linker, Miscellaneous, Linker flags

Now I get this error in the syscall.c


‘end’ undeclared (first use in this function) syscalls.c /STM32F401RE-Nucleo_Application/Projects/Multi/Applications/STM32_Nucleo_Application/User line 103 C/C++ Problem
‘stack_ptr’ undeclared (first use in this function) syscalls.c /STM32F401RE-Nucleo_Application/Projects/Multi/Applications/STM32_Nucleo_Application/User line 106 C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘asm’ syscalls.c /STM32F401RE-Nucleo_Application/Projects/Multi/Applications/STM32_Nucleo_Application/User line 45 C/C++ Problem
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘asm’ syscalls.c /STM32F401RE-Nucleo_Application/Projects/Multi/Applications/STM32_Nucleo_Application/User line 98 C/C++ Problem
make: *** Projects/Multi/Applications/STM32_Nucleo_Application/User/syscalls.o Error 1 STM32F401RE-Nucleo_Application C/C++ Problem


Thanks for the comments !!
I resolved it.
register char * stack_ptr asm(“sp”);
has to be
register char * stack_ptr __asm(“sp”);


and

extern char end asm(“end”);

has to be

extern char end __asm(“end”);


I have to prepend __(double underscores) before asm() references.!

Tunisia

Strange ! the double underscore are not mandatory.
You can check UART_printf example (CubeF4\Projects\STM32F401RE-Nucleo\Examples\UART\UART_Printf\SW4STM32\syscalls.c).

Note: If you are not using FreeRTOS, you do not need the stack_ptr (comment #define FreeRTOS)


I pretty much got the same error and had to comment out any printf statements and the error went away.

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs