Assembler Errors

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Loxy618
Posts: 5
Joined: Wed Apr 24, 2019 2:01 am

Assembler Errors

Post by Loxy618 » Fri May 03, 2019 4:16 pm

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.

Loxy618
Posts: 5
Joined: Wed Apr 24, 2019 2:01 am

Re: Assembler Errors

Post by Loxy618 » Fri May 03, 2019 7:21 pm

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

User avatar
dhylands
Posts: 3204
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assembler Errors

Post by dhylands » Sat May 04, 2019 2:28 pm

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.

WRR
Posts: 7
Joined: Wed Jan 09, 2019 8:33 pm

Re: Assembler Errors

Post by WRR » Mon May 06, 2019 3:20 pm

'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.

Post Reply