AVR Development on Microchip's MPLAB X V5.00 setup for ubuntu?

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So with the new release of the beta support on MPLAB X V5.00 I wanted to try it out on my ubuntu OS as I am used to develop PIC MCUs on the same IDE, but the problem is that I don't know how to set everything up so it can work:

Once MPLAB X is installed, if you try starting a new project (using ubuntu) it won't recognize the basic includes like #include <stdint.h> for example, so I downloaded the AVR GCC toolchain and added the compiler path into MPLAB X, but even now that it recognizes the libraries it won't recognize basic registers definitions for the AVR, also  can't compile anything, code and output are:

 

#include <stdio.h>
#include <stdlib.h>

void main(void) {

    DDRB |= 1;
    PORTB |= (1<<1);
    while(1){
        
    }
}

Output:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/vleroy/MPLABXProjects/ada.X'
/home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc: 1: /home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc: �����: not found
/home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc: 2: /home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc: Syntax error: "(" unexpected
make[2]: *** [build/default/production/ada.o] Error 2
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make  -f nbproject/Makefile-default.mk dist/default/production/ada.X.production.hex
make[2]: Entering directory '/home/vleroy/MPLABXProjects/ada.X'
"/home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc"   -mmcu=atmega328p  -I "/opt/microchip/mplabx/v5.00/packs/Atmel/ATmega_DFP/1.2.258/include"  -B "/opt/microchip/mplabx/v5.00/packs/Atmel/ATmega_DFP/1.2.258/gcc/dev/atmega328p"  -x c -c -D__ATmega328P__  -I"../../Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/avr/include" -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums  -I "../" -I "../../Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/avr/include" -Wall -MD -MP -MF "build/default/production/ada.o.d" -MT "build/default/production/ada.o.d" -MT build/default/production/ada.o  -o build/default/production/ada.o ada.c  -DXPRJ_default=default   
nbproject/Makefile-default.mk:116: recipe for target 'build/default/production/ada.o' failed
make[2]: Leaving directory '/home/vleroy/MPLABXProjects/ada.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory '/home/vleroy/MPLABXProjects/ada.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

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

So I want to know if there is any guide from microchip on how to get it working the right way on ubuntu...

I've seen a video where they do it on MAC, but they say they already had AS7 installed so it kind of linked all together, (not my case at least as there is not a linux version of AS7).

 

PD: I posted this forum discussion in this topic as I saw there where another ones talking about MPLAB X here.

PD2: I posted this problem on AVR FREAKS because the microchip's forums can't send me the validation email, it seems to be a problem experienced by many other people.

 

Thanks for your help and time.

Victor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think they've officially rolled out AVR support in MPLAB yet have they? So you may be a little ahead of the curve here. Maybe give it 3..6 months for the dust to settle?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

No compiler will ever support:

#include <stdio.h>
#include <stdlib.h>

void main(void) {

    DDRB |= 1;
    PORTB |= (1<<1);
    while(1){

    }
}

You must include the appropriate hardware header for symbols like DDRB e.g. avr/io.h with AVR-GCC

 

Copy-paste the full command line that the IDE invokes.

Then we can see "what is missing"

 

David.

Last Edited: Fri. Aug 10, 2018 - 06:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I haven't had any issues running MPLAB X 5 on Ubuntu 18.

 

Did you install the AVR toolchain?  If so, is this where you installed it:

/home/vleroy/Documentos/Proyectos MPLAB LINUX/Proyectos con Atmel/Toolchain/bin/avr-gcc

because MPLAB isn't finding it there.  You have the choice of using the XC-8 compiler or the AVR Toolchain for AVR devices.  What happens if you choose the XC-8 compiler?

 

As David stated above, nothing is going to compile without including <avr/io.h>.

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One thing that stands out is I have no spaces in the path to the toolchain:

 

MPLAB-X_project_properties

 

edit: typo

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Vleroylr wrote:
new release of the beta support on MPLAB X V5.00

Surely, the whole point of a beta programme is to get user feedback - so isn't there some specific route to give feedback on this stuff??

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greg_Muth wrote:
no spaces in the path

laugh

See: https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I remember!  wink

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@awneil said:

Surely, the whole point of a beta programme is to get user feedback - so isn't there some specific route to give feedback on this stuff??

 

You mean something like this:

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greg_Muth wrote:
You mean something like this

Yes - but perhaps the OP would like it a little clearer ... ?

 

cheeky

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...