assemblymicrocontrollerpicxc8

How do I configure my code in MPLAB X if it is completely written in assembly?


I am writing an assembly code in MPLAB X with XC8. These are the lines that I've written to configure my code.

#include "pic10f200.inc"
#pragma CONFIG WDT=OFF
#pragma config CP=OFF
#pragma config MCLRE=ON

I am getting errors on lines that are not even in the range of lines that my code is on. I suspect that it is something wrong with how I configured the code. I have seen in other places online that this is how you would write these lines, but in the examples I've seen, the person is writing in C code. Does this matter? I am getting the following errors for reference:

Main.s:2:: error: (876) syntax error
Main.s:177:: error: (876) syntax error
Main.s:215:: error: (876) syntax error
Main.s:230:: error: (876) syntax error
Main.s:245:: error: (876) syntax error
Main.s:260:: error: (876) syntax error
Main.s:275:: error: (876) syntax error
Main.s:290:: error: (876) syntax error
Main.s:175:: error: (800) undefined symbol "T0CS"
Main.s:209:: error: (840) phase error
Main.s:212:: error: (840) phase error
Main.s:213:: error: (840) phase error
Main.s:216:: error: (840) phase error
Main.s:217:: error: (840) phase error
Main.s:218:: error: (840) phase error
Main.s:219:: error: (840) phase error
Main.s:220:: error: (840) phase error
Main.s:221:: error: (840) phase error
Main.s:222:: error: (840) phase error
Main.s:223:: error: (840) phase error
Main.s:224:: advisory: (1) too many errors (21)
(908) exit status = 1
nbproject/Makefile-default.mk:113: recipe for target 'build/default/production/Main.o' failed
make[2]: Leaving directory 'C:/Users/build/MPLABXProjects/FinalDemo.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/build/MPLABXProjects/FinalDemo.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [build/default/production/Main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 567ms)

I asked a similar question earlier and it was suggested that I alter my filetype to something other .s. Should it be .asm or .as? Thank you for your help, I'm pretty new to this.


Solution

  • The answer to your question is that you need to study a working example of what the "new" method that Microchip supports for assembly language programming using the pic-as(v2.20) tool chain.

    This tool chain only works with MPLABX v5.40 and later.

    I want to point out that my only affiliation with Microchip is as a customer. At present I am cursed with porting several legacy MPASM project to build with this "new" method. The documentation available from Microchip is sketchy at best.

    Just for you I have created an MPLABX v5.40 assembly language project for the PIC10F200 you can access here on git hub.

    Warning: The XC8 v2.20 installer does not always install the pic-as(v2.20) tool chain automatically. You may need to use the manual method to add tool chains to MPLABX v5.40, I leave this as an exercise for the student.