Author Topic: How to preprocess assembler and other files?  (Read 4772 times)

Offline kontrastblick

  • Single posting newcomer
  • *
  • Posts: 3
How to preprocess assembler and other files?
« on: June 13, 2013, 02:31:28 pm »
I am running Code::Blocks svn build 8982 (Apr 12th 2013) on Windows 7 64bit. The compiler I use is gcc 4.7.3 (targeting m68k-elf or "coldfire").
My Project compiles fine with a custom Makefile, but I'd like to move to the Code::Blocks build system.


The project has a couple of asm files that need to be preprocessed, for example "crt0.s.S", "dvectors.s.S" and a linker script that needs to be preprocessed, called "api.lds.S".
(The files end with .s.S instead of just .S because I'm using windows and NTFS is not a case-sensitive file system. Preprocessing .S to .s would overwrite the original files).

I try to implement the preprocessing by adding a custom compiler command.
Settings->Compiler->Global compiler settings->Other Settings->Advanced Options->Commands
I added a source extension "S" to the command "Compile single file to object file".

Command line macro:
$compiler -E -Wp,-P $includes $file -o $objects_output_dir$file_name
Generated files (to be further compiled):
$file_name

Info: gcc -E -Wp,-P are options for calling and controlling the preprocessor


I do not want to put the intermediate files (crt0.s, api.lds) into the source tree, so I put them into the $objects_output_dir (maybe I should put them somewhere else?). Unfortunately, Code::Blocks doesn't allow the $objects_output_dir in the "Generated files" field (strange things happened when I tried), so C::B doesn't know, where the generated files reside.

As expected, building fails:
Code
m68k-elf-g++.exe -E -Wp,-P -Iinc -Iheaders crt\crt0.s.S -o CodeBlocks\objs\Debug\crt0.s
m68k-elf-g++.exe -mcpu=5372  -g    -Iinc -Iheaders -c crt\crt0.s -o CodeBlocks\objs\Debug\crt\crt0.o
m68k-elf-g++.exe: error: crt\crt0.s: No such file or directory

So how do I tell C::B where to find the files?
Or should I take a different approach? (putting intermediate files into the sources tree is not an option for me).

Christoph
Trying to use Code::Blocks for embedded development on "coldfire" (m68k-elf).