Franco Milich
Franco Milich

Reputation: 31

How to compile PIC microcontroller assembly code via command line?

I am using Microchip's MPASM compiler to program PIC microcontrollers in assembly language. However, I would like the option of using a text editor of my choice and compiling my code from the command line instead of compiling in the MPLAB IDE development environment.

My question is: Are there any alternatives or methods to compile assembly code for PIC microcontrollers outside of the MPLAB IDE environment using the MPASM compiler via the command line? I'd like to be able to write my code in a text editor and then compile it from the command line for more flexibility. (It doesn't necessarily have to be mpasm, it could be another compiler)

I would appreciate if anyone could provide information, examples, or resources that can help me achieve this goal.

Upvotes: 1

Views: 806

Answers (1)

ilyar
ilyar

Reputation: 1401

I use https://gputils.sourceforge.io/ and gputils.pdf here is Makefile

TARGET := firmware.hex

all: $(TARGET)

%.hex: %.o
    gplink --map --object --optimize 2 --output $@ $^

%.o: %.asm
    gpasm --object --output $@ $<

clean:
    rm -f *.o *.lst *.map *.hex *.cod

sudo apt-get -y install gputils sdcc

Upvotes: 0

Related Questions