Author Topic: MPLAB X a PIC inhibitor! Alternatives ?  (Read 77327 times)

0 Members and 1 Guest are viewing this topic.

Offline gocemk

  • Regular Contributor
  • *
  • Posts: 84
  • Country: mk
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #175 on: November 24, 2017, 01:21:06 pm »
After reading some of the benchmarks and timings for starting MPLABX posted here, i am starting to think that perhaps my PC (or the OS) is the problem for the slow experience i have.
Starting MPLABX from a fresh restart of the PC and waiting for it to start all the modules, parsing, etc... takes 1m and 16s. I have 3 projects, only one of them open. After i close MPLABX and then start it again, the whole procedure takes ~44s.

My laptop is Dell E6330:
CPU: i5 3340m
RAN: 8GB
SSD Hard Drive: Kingston HyperX Fury 128GB
OS: Windows 10

Based on what i read here, i should be able to start MPLABX much faster.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #176 on: November 24, 2017, 02:40:22 pm »
this happens many times..
and with routine calls too.. WTF?

This doesn't happen many times. Just the encompassing routine has been inlined several times here and there, so there are several copies of the code.

Look at the addresses - they're not consecutive, they're different invocations from different places.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #177 on: November 24, 2017, 03:14:02 pm »
Quote
Based on what i read here, i should be able to start MPLABX much faster.
'Should' is the key word. With Windows, one never knows what is also running in the background (antivirus, toolbars, adware, every other program that wants to run in the background checking into the mother ship every 5 minutes, etc.). I clean up pc's all the time, and in most cases it can be done, but sometimes a clean install is required. Every version of Windows is the same- you start out thinking this is the fastest/best os ever, then over time it gets worse like there is a molasses leak somewhere.

Your os install may be just fine, and there could be other reasons, but it would be hard for anyone to pinpoint 'why' it is slower than it should be. If you really want to know what it 'should' run like- grab a spare drive, do a clean install of Win10 (no extra stuff after), install MPLABX and see how it runs- that is the best you will get. You can then see how much worse your current MPLABX is.

I run MPLABX on linux (core i3/8GB/ssd), and it runs pretty good but there are times that it seems to start consuming excessive memory and I have to kill it.  I also have an older pc with 4GB, some cpu which Win10 will only install the 32bit version,  and it runs ok but runs at about 2/3 the speed of my linux pc.


Quote
forgotten how to set optimisation for individual project files
Right-click the source file, properties, select override build options.
I would also create a new project (not copy the project), then add your files from the current project and see what happens. You will then be dealing with a 'clean' project rather than competing with MPLABX to see who gets to modify the build files last.
« Last Edit: November 24, 2017, 03:17:06 pm by cv007 »
 

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1059
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #178 on: November 24, 2017, 03:14:09 pm »
2.3GHz i5 Mac with 9Gb RAM, and MPLABX opens, and is ready to type in the current open file in 15 seconds.
 

Offline gocemk

  • Regular Contributor
  • *
  • Posts: 84
  • Country: mk
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #179 on: November 24, 2017, 08:15:32 pm »
I think the problem is (suprise, suprise) Windows 10 Fall Creators update. The service "Service host internet connection sharing" was constantly drawing 35% CPU power! It's state was always "Starting". And as far as i could read on the Microsoft forums, i am not the only one with this problem, it seems to be very common on this last update. After i disabled the service, the CPU usage dropped between 1-10% in idle.

Starting MPLABX with 3 objects in the workspace now takes ~35s (including waiting for "Opening Projects", "Background scanning of projects", and "Parsing" to finish). Not a huge improvement, but definitely noticeable.

Also, i can too start typing in the text editor in the current opened file ~15s after starting it, but i consider MPLABX is "properly" started only after those 3 aforementioned tasks are finished.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #180 on: November 24, 2017, 11:16:56 pm »
Quote
Disregard my previous scripts (unless they decide to remove the -mafrlcsj option in later builds).
There are several advantages to using the scripts, though-
1. you do not need the specs file and global option for every project (even though minimal)
2. xclm is not called every time you compile- which may mean a speedup if you compile lots of files
 (XC16 does not call get_license when -mafrlcsj is set, and XC32 does not exec xclm if mchp_pic32_license_valid is already set)

In my setup at least, MPLABX is fussy about the xc include file- if I use any global option, MPLABX loses its ability to view include file symbols (cannot find include file <xc.h> error), although it compiles fine. So, when using the -scripts= global option, half the words in the c file get highlighted in red. With the script mods, it works fine as no global option is required.

For the Windows user, the specs method is easist because the command line tools in Windows are horrible compared to linux.



I have several more ways (how many do you want? tell me when to quit)

another option for XC32-

tools- options- embedded- build tools- Toolchain- select compiler
C Compiler - /opt/microchip/xc32/v1.44/bin/xc32-gcc
add another /bin in that line like so-
C Compiler - /opt/microchip/xc32/v1.44/bin/bin/xc32-gcc
(also do for xc32-g++ if using c++)

then add the -mafrlcsj global option to the project
this bypasses the xc32-gcc that is blocking the -mafrlcsj option (and then calling bin/xc32-gcc with the modified options)
(note- the new compiler path may not take effect right away, seems to lag to some degree)
« Last Edit: November 25, 2017, 12:41:28 am by cv007 »
 

Offline eugenenine

  • Frequent Contributor
  • **
  • Posts: 865
  • Country: us
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #181 on: November 25, 2017, 12:52:43 am »
After reading some of the benchmarks and timings for starting MPLABX posted here, i am starting to think that perhaps my PC (or the OS) is the problem for the slow experience i have.
Starting MPLABX from a fresh restart of the PC and waiting for it to start all the modules, parsing, etc... takes 1m and 16s. I have 3 projects, only one of them open. After i close MPLABX and then start it again, the whole procedure takes ~44s.

My laptop is Dell E6330:
CPU: i5 3340m
RAN: 8GB
SSD Hard Drive: Kingston HyperX Fury 128GB
OS: Windows 10

Based on what i read here, i should be able to start MPLABX much faster.

My main machine is  a Dell Latitude E 6230 with 4G of ram and it starts much faster.  I have a Latitude 1100 which is a 1.6 GHz netbook with 2G of RAM and it starts in less than 30 seconds
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #182 on: November 25, 2017, 08:51:50 am »
Who needs rebuilt-from-source licence-check-free versions of XC16 and XC32? I have my 16-core beast machine fixed and it can build packages like those in no time. (two Xeon E5-2680's, 128GB RAM)
 

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1059
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #183 on: November 25, 2017, 09:34:05 am »
I’ll be the first to give you my blessing if what I read here is true :D
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #184 on: November 26, 2017, 12:40:37 am »
Quote
nd it can build packages like those in no time
It just means the compile fails sooner.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #185 on: November 26, 2017, 01:15:40 am »
To make it a little easier, attached is summary of the XC16/XC32 options to remove the restrictions.

(edit- changed text file line endings from UNIX to Windows - sorry, but not terribly,  to any Windows users using notepad)
« Last Edit: November 27, 2017, 07:22:04 pm by cv007 »
 
The following users thanked this post: thm_w, jaromir, @rt, Karel, Fire Doger

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #186 on: December 03, 2017, 01:19:00 am »
Any C++ users out there? (besides arduino users, I guess :) )

Since I now have a compiler with C++ (without limitations- whatever they were), I have been playing around with it and have a pic32mm usb curiosity board to test with.
A number of C++ features are big consumers of flash/memory (and its obvious when you run into them), but there seems enough there for a microcontroller to put to good use.

I'm a C++ beginner (mostly), and here is a simple project to blink some the led's on the board along with using CP0 timer for all delays-
https://github.com/cv007/PIC32MM_Curiosity_CPP
(I know nothing about GitHub, either- but the files ended up where I wanted anyway)

The normal include file <xc.h> is not used, and one goal I have is to eliminate as much as possible defines/macros (maybe not a good goal, but I dislike digging through layers of macros). I also was going to try to do the same simple project in C to compare, but I got stuck thinking about how to create the 6 delays all using CP0 (but didn't try very hard). The compile size is about 3k and an empty project is 1.7k- I doubt the C version would be much different.

Anyway, there was a usb headset demo project available for this curiosity board, and here is a comparison of the compile sizes
Code: [Select]
ISO = isolate functions into sections/remove unused sections
-O0         -> 32k
ISO         -> 29k
-O1         -> 22k
ISO + -O1   -> 20k
ISO + -O2   -> 19k
ISO + -O3   -> 20k
ISO + -Os   -> 17.5k
So, it looks like you gain about ~2.5k on this project with the 'unrestricted' version. Probably not a big deal on a 64k part (the smallest available with usb), but if you start using the smallest mm chips, then it could make a difference.



 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #187 on: December 03, 2017, 04:22:08 am »
So, it looks like you gain about ~2.5k on this project with the 'unrestricted' version. Probably not a big deal on a 64k part (the smallest available with usb), but if you start using the smallest mm chips, then it could make a difference.

Not much. Not surprising.

As flash gets cheaper, it is not as important how big the code is - in the vast majority of cases you can get a bigger part which costs just few extra pennies.

Speed may be more important (costs more), but I expect the improvements speedwise will be even more modest.
 

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1059
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #188 on: December 03, 2017, 05:22:27 am »
Something I’ve wondered for some time..
A program is full when my indicator says program memory is 90%.
Where did the other 10% go? What is not being counted?
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #189 on: December 03, 2017, 07:26:23 pm »
??? more details please

an empty project is 1.7k

why. WHY?
« Last Edit: December 03, 2017, 07:29:21 pm by JPortici »
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #190 on: December 03, 2017, 08:27:42 pm »
why. WHY?
Assuming the target device is the PIC32MM0256GPM064, just the vector table will be almost half that (101 vectors * 8 bytes each). The crt0 startup code adds a bit over half a kilo.
 
The following users thanked this post: JPortici

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #191 on: December 03, 2017, 08:41:22 pm »
Quote
why. WHY?
101 interrupt vectors x 8 bytes each is a good start, then throw in 450 bytes for startup code,  another 128 for general exception context, then add more for a handful of other exception/default interrupt stuff, and before long you are at 1.7k. My github code example (c++) doubles that number.

Although there is not much to do on these chips to get them going (in user code), there is still a fair amount of work done before 'main'. Once into main, you basically have a souped up pic16, it seems.
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #192 on: December 04, 2017, 02:06:31 am »
Ah, IVT. Makes sense. To he completely honest i haven't had a chance to use a MM yet, so please forgive me :) they looked nice at first but i really can't think of a project where i would use them, instead of a pic18 K22/K42.. (there could be a couple but redesigning the board for 3V operation, just to get a faster divide... nnaaah)
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #193 on: December 04, 2017, 02:59:15 am »
The smallest mm part I think is a 16k/4k part, and if using only a few vectors and need the space you can switch to single vector mode (linker needs to know, not sure of all the details).

The reason I ordered an mm usb curiosity board, was I now have an unrestricted compiler (they can get me in $1-$30 increments), and I was looking for a way to possibly do something like a pcm2706 with a micro/dac combo instead (need usb+i2s)-
https://goo.gl/photos/NeTGW3yKBvwEHDzG8  (bottom row, 2 on left - pcm2706 does sound good, even with the simple board I made)

I wanted to try the SAMD21, but after reading the datasheet a few times I still don't understand the clock system, and couldn't find any usb audio example code. The mm usb board had a usb headset demo that actually compiled without any errors (quite unusual), so I figured I could hook up my own dac and give it a try. Whatever one thinks of MPLABX, I already use it and can find my way around so nothing really to learn except the chip itself.

The only problems I have so far, is the datasheet had bad numbers for the interrupt register map- there is a gap they don't show so the numbers are off starting with IEC0. The defines they have show the true addresses (I'm not using xc.h, but am now double checking addresses). The debugging is a little sluggish, but that is a known thing with pickit3 type debuggers- no surprise. Other than the wrong addresses. my simple code blinking lights, reading switches is working and the chip is quite simple  to use not unlike a pic16. I'm also liking c++ although I'm relatively new to using it.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2299
  • Country: gb
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #194 on: December 04, 2017, 11:38:43 am »
Nicely presented schematic and layout.
What ECAD package are you using?
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #195 on: December 04, 2017, 01:33:57 pm »
Quote
What ECAD package are you using
Sprint Layout 6, sPlan 7

These are about the only ones I can use without much thinking, and the price is right. Combined, these two programs are a little over 10MB in size (that's an M), and run in Linux (Wine) so I can run on any of my pc's. I go a little overboard with the colors on the schematics, but just like to see what is possible. There is an interesting youtube channel with Sprint Layout 'tips' using it to create audio amplifiers.

some more stuff-
https://goo.gl/photos/jXXJuEtBk9RpjLer6
 
The following users thanked this post: splin

Offline picdev

  • Contributor
  • Posts: 14
  • Country: gr
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #196 on: December 05, 2017, 11:22:48 pm »
I thought that mikroc is crap, (IDE bugs, bugs on debuging)And i was planing to move to mplabx because I have start to write big projects,
no I am reading that mplab is crap too, (also I hate code generator).
 :-// So what about css with mplabx ? css has a very old Ide too  :palm:
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #197 on: December 06, 2017, 12:13:08 am »
Quote
I am reading that mplab is crap too
Like most things, what you read and what you may experience yourself are not always the same thing. In this case, you don't have to pay to find out. Download MPLABX and test it out, then you will know firsthand. Using a code generator is not a requirement (I don't use it).
 

Offline picdev

  • Contributor
  • Posts: 14
  • Country: gr
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #198 on: December 06, 2017, 06:18:31 am »
Quote
I am reading that mplab is crap too
Like most things, what you read and what you may experience yourself are not always the same thing. In this case, you don't have to pay to find out. Download MPLABX and test it out, then you will know firsthand. Using a code generator is not a requirement (I don't use it).
What about libraries ?
Sometimes you need something ready

Sent from my Redmi 4 using Tapatalk

 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: MPLAB X a PIC inhibitor! Alternatives ?
« Reply #199 on: December 06, 2017, 07:31:37 am »
What about libraries ?
Sometimes you need something ready

Apart from USB and TCP/IP-stack, you write them yourself. At least I do. If there's a bug, I can blame myself instead of others.
Besides, what you have made, you can fix. The time I need to read and understand somebody elses code, I can write it from scratch.
 
The following users thanked this post: hans, Siwastaja, JPortici


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf