cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube example to eclipse+gcc based toolchains

totti001
Associate II
Posted on March 04, 2014 at 17:51

Hello everybody!

I try the new stm32cube examples, with CoIDE. I check the truestudio example, and make the CoIDE project same for this, but I have linker error and I dont know what is the problem. This is the stm32f4-discovery demonstration project.

[cc] Starting link
[cc] arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -g -nostartfiles -Wl,-Map=cubetest.map -O0 -Wl,--gc-sections -LC:/CooCox/CoIDE/workspace/cubetest -Wl,-TC:/CooCox/CoIDE/workspace/cubetest/stm32f407vg_flash.ld -g -o cubetest.elf ..\obj\stm32f4xx_hal_spi.o ..\obj\stm32f4xx_hal_i2c.o ..\obj\stm32f4xx_hal_ltdc.o ..\obj\stm32f4xx_hal_rng.o ..\obj\stm32f4xx_hal_msp.o ..\obj\stm32f4xx_hal_iwdg.o ..\obj\stm32f4xx_hal_eth.o ..\obj\stm32f4xx_ll_fsmc.o ..\obj\stm32f4xx_hal_rtc.o ..\obj\stm32f4xx_hal_uart.o ..\obj\stm32f4xx_hal_tim.o ..\obj\usbd_hid.o ..\obj\stm32f4xx_ll_usb.o ..\obj\stm32f4xx_hal_smartcard.o ..\obj\stm32f4xx_hal_usart.o ..\obj\stm32f4_discovery.o ..\obj\usbd_core.o ..\obj\main.o ..\obj\stm32f4xx_it.o ..\obj\stm32f4xx_hal_flash.o ..\obj\stm32f4xx_hal_pwr.o ..\obj\stm32f4xx_hal_can.o ..\obj\stm32f4xx_hal_irda.o ..\obj\stm32f4xx_hal_dac.o ..\obj\lis3dsh.o ..\obj\stm32f4xx_hal_sd.o ..\obj\stm32f4xx_hal.o ..\obj\usbd_desc.o ..\obj\lis302dl.o ..\obj\usbd_conf.o ..\obj\stm32f4xx_hal_crc.o ..\obj\stm32f4xx_hal_sdram.o ..\obj\stm32f4xx_hal_dcmi.o ..\obj\stm32f4xx_hal_rcc.o ..\obj\stm32f4xx_hal_cortex.o ..\obj\stm32f4_discovery_accelerometer.o ..\obj\system_stm32f4xx.o ..\obj\stm32f4xx_hal_adc.o ..\obj\stm32f4xx_hal_i2s.o ..\obj\stm32f4xx_hal_pcd.o ..\obj\stm32f4xx_hal_cryp.o ..\obj\stm32f4xx_hal_gpio.o ..\obj\startup_stm32f407xx.o ..\obj\stm32f4xx_hal_nor.o ..\obj\stm32f4xx_hal_nand.o ..\obj\stm32f4xx_hal_pccard.o ..\obj\stm32f4xx_hal_sram.o ..\obj\stm32f4xx_hal_hcd.o ..\obj\stm32f4xx_hal_tim_ex.o ..\obj\stm32f4xx_ll_sdmmc.o ..\obj\usbd_ctlreq.o ..\obj\stm32f4xx_hal_hash.o ..\obj\stm32f4xx_hal_sai.o ..\obj\stm32f4xx_hal_dma.o ..\obj\usbd_ioreq.o ..\obj\stm32f4xx_hal_wwdg.o
[cc] c:/program files (x86)/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-init.o): In function `__libc_init_array':
[cc] init.c:(.text.__libc_init_array+0x22): undefined reference to `_init'
[cc] c:/program files (x86)/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
[cc] sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'

6 REPLIES 6
fauvarque.daniel
ST Employee
Posted on March 04, 2014 at 19:54

You can try to use the files generated for the Atollic toolchain as this toolchain uses the same

kind of compiler.

Regards

Daniel


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
totti001
Associate II
Posted on March 04, 2014 at 20:04

I use the attolic files. I try and the problem with startup file. I dont use startup file before, I use systeminit function at the begining of main. What is the difference of startup file use or call systeminit at the main function?

Posted on March 04, 2014 at 20:04

for _sbrk() look to syscalls.c used for newlib support ?

for __libc_init_array consider if you're using C++ constructors, and if you can remove the call from startup_stm32f4xx.s ?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
totti001
Associate II
Posted on March 04, 2014 at 20:11

I don't see syscalls.c at the project files. Maybe the atollic add this file for the project?

Ohh so I need to modife the startup file or install g++ compiler?

Posted on March 04, 2014 at 21:45

It's in several dozen of the projects:

STM32Cube_FW_F4_V1.1.0\Projects\STM324x9I_EVAL\Applications\Audio\Audio_playback_and_record\TrueSTUDIO\syscalls.c

I've built similar support files for GNU/GCC projects where I want to support printf(), scanf(), putchar(), etc in

https://drive.google.com/file/d/0B7OY5pub_GfIc2JZMks1UzdsOTA/edit?usp=sharing

, though I've modelled things more closely with RiDE rather than Atollic
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
totti001
Associate II
Posted on March 04, 2014 at 23:46

Thats ok, I have syscalls.c but in demonstration project not included. I don't no how the truestudio compile the project without this.