Page 1 of 1

Assembler Errors

Posted: Fri May 03, 2019 4:16 pm
by Loxy618
Trying to compile for a Arm Microcontroller. We are using the following in the makefile

Code: Select all

...
env['AS'] = 'arm-none-eabi-as'  #use as cross compiler
...
if we use 'gcc' instead of 'as' everything works as expected.

The error we get when using 'as' is "receipt for target 'all' failed"

Any help would be greatly appreciated.

Re: Assembler Errors

Posted: Fri May 03, 2019 7:21 pm
by Loxy618
Specifically I'm getting

Code: Select all

arm-none-eabi-as: unrecognized option `-x'
the flags I have are (these I was using for gcc)

Code: Select all

# Assembler flags
env.Append(ASFLAGS = [
	'-mthumb',
	'-x',
	'assembler-with-cpp',
	'-c',
	'-mcpu=%s' % (ARCH),
	'-MD',
	'-MP',
	'-D__%s__' % (PART),
	'-Wa,-g',
])
I tried to remove some of the unneeded ones when I switched from gcc to as with no luck

Re: Assembler Errors

Posted: Sat May 04, 2019 2:28 pm
by dhylands
What I would do is to run gcc with the --verbose option. This will show you what arguments it's calling as with. as doesn't take the same arguments as gcc.

Re: Assembler Errors

Posted: Mon May 06, 2019 3:20 pm
by WRR
'as' is a dedicated assembler, while 'gcc' is more multi-purpose. The '-x' option tells GCC which language it is compiling, and it looks like your current flags tell it that the language is 'assembler-with-cpp' to have GCC act as an assembler. I think that 'as' probably doesn't recognize that option because it only works with one language - assembly :)

You can run 'arm-none-eabi-as --help' and 'man arm-none-eabi-as' to see more information about the individual options. It looks like some of the ones you listed are also synonyms of AS flags, like I think that passing '-Wa,-g' to GCC is the same as passing '-g' to AS.

But GCC should work fine for assembly code if you don't have a specific reason not to use it.