Unknown assembler option when compiling main.cpp and .asm

Hi All,

Just trying to meld the worlds of CPP and assembler for the arduino uno (atmel328p). So far the platformio has been fantastic and i’m really enjoying the experience.

One issue that I have come across is when trying to compile with an assembler file, avr-asm emits a series of unknown option error messages, halting assembly and compilation.

avr-as -x assembler-with-cpp -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -o .pioenvs/uno/src/AVRContextSwitch.o src/AVRContextSwitch.asm

avr-as: unrecognized option '-x'

I have used build unflags to remove the -x flag, which then causes the same issue with the -Os flag. If I unflag the -Os flag, then that will apply to ALL command line compilation and assembly, resulting in unoptimised code which is less than ideal.

Any ideas?

Platformio version: version 3.1.0
Install via PIP

Hi,

The extension of ASM file should be .S.

Thanks @ivankravets, I’ve made that change, still the same issue.

I’m on Mac OS X El Capitan.

avr-as -x assembler-with-cpp -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -o .pioenvs/uno/src/AVRContextSwitch.o src/AVRContextSwitch.s
  1. What is your OS type?
  2. Please provide test project to reproduce this issue.

@ivankravets

Mac OS X El Capitan (v10.11.6)

Steps to reproduce:

  1. init a project:

    pio init -d test-broken-arduino -b uno

  2. Add a main.cpp:

    #include “Arduino.h”

    void setup()
    {

    }

    void loop()
    {

    }

  3. Add any asm file, a blank one will do.

  4. pio run

My local project is on Github here: GitHub - jamesadevine/broken-arduino

Thanks for the assistance!

Big .S. I’ve just tried your project and it works.

@ivankravets Holy carp… that was all it was? Thanks! Is there anyway we could make a message that says something along those lines? Unrecognised option is very misleading.

1 Like