User forums > Embedded development
How to force CB compile sequence (generally) to mimic makefile on STM32F4
osdt:
As stahta01 posted:
--- Quote from: stahta01 on April 20, 2013, 08:59:20 am ---Step 1: Learn how the Compiler and Linker works using the normal two step process (compile then link as the two steps)
Step 2: Write the compile step on the command line so it works
Step 3: Write the linker step on the command line so it works
Step 4: Write the objcopy step on the command line so it works
Step 5: Post the commands that work on the command line so you can ask how to do this using Code::Blocks.
--- End quote ---
This is the first real information to work with:
--- Quote from: philcal on April 21, 2013, 04:33:34 am ---single command line command produces a single output file: arm-none-eabi-gcc -g -v -O2 -Wall -Tstm32_flash.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals src/system_stm32f4xx.c src/main.c src/stm32f4xx_it.c lib/startup_stm32f4xx.s -o main.elf -Llib -lstm32f4
--- End quote ---
Next step: compile + link:
--- Code: ---# compile
arm-none-eabi-gcc -c -g -v -O2 -Wall -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals src/system_stm32f4xx.c src/main.c src/stm32f4xx_it.c lib/startup_stm32f4xx.s
#link
arm-none-eabi-gcc -Tstm32_flash.ld system_stm32f4xx.o main.o stm32f4xx_it.o startup_stm32f4xx.o -o main.elf -Llib -lstm32f4
--- End code ---
... and post the result.
Edit:
--- Quote from: philcal on April 20, 2013, 05:50:03 am ---...
((link))
arm-none-eabi-ld list-of-source-objectfilesfrom above -s -Tstm32_flash.ld ....libraries
((resultingerror))
main.o uses VFP register arguments, cbjh does not
((note: in CB compiler toolchain executables settings arm-none-eabi-ld is not set (arm-none-eabi-objcopy is set for static linker) yet somehow CB invokes ld and its this part that is causing the grief))
--- End quote ---
If it is not set for the toolchain, you'll probably find it in 'Advanced compiler options->Command line macros'. Use $linker instead of 'arm-none-eabi-ld'
- osdt
philcal:
Thanks osdt,
I really needed some encouragement after Tims reply. He is obviously well intentioned and I'm sorry I caused him grief and lose patience. He actually helped me a year ago when I was trying to program avr's as a raw beginner
However I think what we are now discussing is compiler specific and thus not really CB forum related. So no further posts on this from me. However I'd like to continue by PM after digesting the hints you posted if you would be so kind .
Now, my asking whether CB could invoke this "combined"compiler command I posted I think is still reasonable but my motive was flawed. I was attempting a work around to substitute for the conventional compile link approach which I couldn't get going.
My general approach to programing is to initially get somebody's simple project going that is known to work and expand from there. I'm the first to admit I'm not knowledgeable enough to start from scratch but contrary to Tims impression know what the linker is supposed to do. A solid two weeks in on this microprocessor and I still cant get an environment suitable for the equivalent humble 'hello world'. Since I've never found a CB .cbp project example on the net for STM32 I was trying to work back from a makefile. I'd love to obtain a complete environmental setup -CB OpenOCD the works! and was even considering how to put out a 'bounty'.
Aelxx:
Have you looked at emIDE (http://emide.org/) ?
It's C::B fork with goal to compile ARM-NONE-EABI projects. I use it with STM32F405/407.
Navigation
[0] Message Index
[*] Previous page
Go to full version