Code::Blocks Forums

User forums => Embedded development => Topic started by: obiCB on June 16, 2011, 06:06:44 pm

Title: Selecting CPU architecture for cross compile in CB
Post by: obiCB on June 16, 2011, 06:06:44 pm
Hi

I am using CB to compile for ARM7 architecture (Windows host).  

In CB I have set the following:
In "Project->build options",  selected the GNU ARM GCC compiler, and in the "Compiler Flags" folder I have selected the compiler option "-march=NAME [-march=NAME]".

The question is how can I set NAME=arm7tdmis?

For the moment the compiler complains "error: bad value (NAME) for -march switch". I tried adding NAME in the folder "Custom variables" but no luck
Using CB Build Mar 29 2011
Title: Re: Selecting CPU architecture for cross compile in CB
Post by: oBFusCATed on June 16, 2011, 06:51:31 pm
You can set it in "Build options -> Compiler -> Other options"
Title: Re: Selecting CPU architecture for cross compile in CB
Post by: scarphin on June 16, 2011, 10:51:58 pm
I guess u have to define them in 'project\build options\custom variables' like
Code
NAME=arm7tdmis
then use in the compiler flags like
Code
-march=$NAME
Title: Re: Selecting CPU architecture for cross compile in CB
Post by: obiCB on June 17, 2011, 10:11:43 am
Thanks

That helped. What I exactly had to do was:

- In Project build options->Compiler settings->Categories, do NOT select "-march=NAME [-march=NAME] (somewhat confusing)
- In Project build options->Compiler settings->Other options enter the line "-mcpu=arm7tdmi"

If I had started the project the correct way (selected a ARM project, AND the correct processor template) This had been automatically set up for me.