Compiling a MPLABX pic 18 project using cli, without opening MPLABX - Page 1
Forum section: electronics / general

author: cedric-air
author_rank: Newbie
timestamp: April 20, 2024, 10:43:07 am
content: I'm trying to compile a PIC18 hex file by running MPLABX and XC8 in a ubuntu 22.04 virtual machine, in a github action. Therefore I'm unable to run MPLABX there.I'm starting with these files:Code:$ find../Airco./Airco/nbproject./Airco/nbproject/configurations.xml./Airco/nbproject/project.xmlAfter running prjMakefilesGenerator.sh I have a number of makefiles:Code:werk@cedric cicd]$ /opt/microchip/mplabx/v5.50/mplab_platform/bin/prjMakefilesGenerator.sh Airco/werk@cedric cicd]$ find../Airco./Airco/nbproject./Airco/nbproject/configurations.xml./Airco/nbproject/project.xml./Airco/nbproject/Makefile-impl.mk./Airco/nbproject/Makefile-variables.mk./Airco/nbproject/Makefile-genesis.properties.This is not yet enough to compile the project:Code:$ cd Airco/[werk@cedric Airco]$ makemake: *** No targets specified and no makefile found. Stop.For reference here's the github action:Code:name: Aircorun-name: ${{ github.actor }} is building Aircoon: jobs:tutorial:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4- uses: actions/setup-node@v4with:node-version: '20'- run: npm install -g bats- run: bats -vtutorial2:runs-on: ubuntu-lateststeps:- name: Checkout repouses: actions/checkout@v2with:submodules: 'recursive'- name: Install dependenciesrun: |sudo apt-get update && \sudo apt-get install -y libc6 libx11-6 libxext6 libstdc++6 libexpat1 libusb-dev git make && \sudo apt-get clean && \sudo apt-get autoremove && \sudo rm -rf /var/lib/apt/lists/*- name: Install XC8run: |wget https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v2.36-full-install-linux-x64-installer.run &&chmod +x xc8-v2.36-full-install-linux-x64-installer.run && \sudo ./xc8-v2.36-full-install-linux-x64-installer.run --mode unattended --unattendedmodeui none --netservername localhost --prefix "/opt/microchip-mplabxc8-bin/"- name: Install MPLABXrun: |wget -U "Mozilla" https://www.microchip.com/bin/download?f=aHR0cHM6Ly93dzEubWljcm9jaGlwLmNvbS9kb3dubG9hZHMvYWVtRG9jdW1lbnRzL2RvY3VtZW50cy9ERVYvUHJvZHVjdERvY3VtZW50cy9Tb2Z0d2FyZVRvb2xzL01QTEFCWC12Ni4xMC1saW51eC1pbnN0YWxsZXIudGFy -O MPLABX-v6.10-linux-installer.tar &&tar -xf MPLABX-v6.10-linux-installer.tar &&sudo ./MPLABX-v6.10-linux-installer.sh --nox11 -- --unattendedmodeui none --mode unattended --ipe 0 --collectInfo 0 --installdir /opt/mplabx- name: install device packrun: |wget -U "Mozilla" https://packs.download.microchip.com/Microchip.PIC18F-J_DFP.1.4.41.atpack &&sh /opt/mplabx/mplab_platform/bin/packmanagercli.sh --install-from-disk Microchip.PIC18F-J_DFP.1.4.41.atpack- name: Output resultsrun: |ls -l- name: Compile Sourcerun: |sh /opt/mplabx/mplab_platform/bin/prjMakefilesGenerator.sh Airco/ &&cd cicd/Airco/ &&make clean &&make &&cd ../../ &&cp cicd/Airco/dist/default/production/Airco.production.hex . &&ls -l- name: Store Artifactsuses: actions/upload-artifact@v2with:name: Hex-filespath: |*.hexhow can I generate all the makefiles?Is there an example with a working github action file?

author: The Chump
author_rank: Contributor
timestamp: April 21, 2024, 10:20:16 pm
content: Hi Cedric,The command to use for building on windows is (after setting up PATH to include the path to make.exe)make.exe -B -f Makefile CONF=default -j 8You need to run this from the project directory (/Airco)so I suspect the equivalent on Linux is:make -B -f Makefile CONF=default -j 8"default" is the configuration name specified when you used Mplab X to create the project"Makefile" is a file called "Makefile" in the project directory, which Mplab X should have created for you.ie there should be a "Makefile" in the /Airco directoryGood Luck,Alex

author: cedric-air
author_rank: Newbie
timestamp: April 22, 2024, 09:43:45 am
content: Thank you Alex,I have solved it by opening it in MPLABX on ubuntu 22.04, and then have the following steps in my build.yml file:Code:name: Revomaxrun-name: ${{ github.actor }} is building Revomaxon: jobs:Revomax:runs-on: ubuntu-lateststeps:- name: Checkout repouses: actions/checkout@v2with:submodules: 'recursive'- name: Install dependenciesrun: |sudo apt-get update && \sudo apt-get install -y libc6 libx11-6 libxext6 libstdc++6 libexpat1 libusb-dev git make && \sudo apt-get clean && \sudo apt-get autoremove && \sudo rm -rf /var/lib/apt/lists/*- name: Install XC8run: |wget https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v2.36-full-install-linux-x64-installer.run &&chmod +x xc8-v2.36-full-install-linux-x64-installer.run && \sudo ./xc8-v2.36-full-install-linux-x64-installer.run --mode unattended --unattendedmodeui none --netservername localhost --prefix "/opt/microchip-mplabxc8-bin/"- name: Install MPLABXrun: |wget -U "Mozilla" https://www.microchip.com/bin/download?f=aHR0cHM6Ly93dzEubWljcm9jaGlwLmNvbS9kb3dubG9hZHMvYWVtRG9jdW1lbnRzL2RvY3VtZW50cy9ERVYvUHJvZHVjdERvY3VtZW50cy9Tb2Z0d2FyZVRvb2xzL01QTEFCWC12Ni4xMC1saW51eC1pbnN0YWxsZXIudGFy -O MPLABX-v6.10-linux-installer.tar &&tar -xf MPLABX-v6.10-linux-installer.tar &&sudo ./MPLABX-v6.10-linux-installer.sh --nox11 -- --unattendedmodeui none --mode unattended --ipe 0 --collectInfo 0 --installdir /opt/mplabx- name: install device packrun: |wget -U "Mozilla" https://packs.download.microchip.com/Microchip.PIC18F-J_DFP.1.4.41.atpack &&sh /opt/mplabx/mplab_platform/bin/packmanagercli.sh --install-from-disk Microchip.PIC18F-J_DFP.1.4.41.atpack- name: Compile Sourcerun: |sh /opt/mplabx/mplab_platform/bin/prjMakefilesGenerator.sh cicd/Bootload/ &&sh /opt/mplabx/mplab_platform/bin/prjMakefilesGenerator.sh cicd/Airco/ &&sudo mkdir /opt/PIC18F-J_DFPsudo sh /opt/mplabx/mplab_platform/bin/packmanagercli.sh --install-from-disk Microchip.PIC18F-J_DFP.1.4.41.atpack --location /opt/PIC18F-J_DFPsudo mkdir /opt/DFP &&sudo sh /opt/mplabx/mplab_platform/bin/packmanagercli.sh --install-from-disk Microchip.PIC18F-J_DFP.1.4.41.atpack --location =/opt/microchip &&export MP_CC="/opt/microchip-mplabxc8-bin/bin/xc8-cc" &&export DFP_DIR="/opt/PIC18F-J_DFP/Microchip/PIC18F-J_DFP/1.4.41/" &&find &&cd ./cicd/Bootload/ &&find &&make clean &&make &&cd ../../ &&cp cicd/Bootload/dist/default/production/Bootload.production.unified.hex . &&cp cicd/Airco/dist/default/production/Airco.production.hex . &&ls -l- name: Store Artifactsuses: actions/upload-artifact@v2with:name: Hex-filespath: |*.hex

author: NorthGuy
author_rank: Super Contributor
timestamp: April 23, 2024, 03:37:32 am
content: Wouldn't that be easier to write your own makefile? It's just a few lines of text.