Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:34 18 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MPLAB XC32 compiler changes

Author Message
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 02:03am 18 May 2014
Copy link to clipboard 
Print this post

I've got a program that uses the following definition: (pic32 C program)
#define uSec(us) {volatile unsigned int iii; for(iii = 0; iii < (((FCY/1000) * us) / 9440); iii++);}


FCY is defined earlier as a constant 80000000

When I compile using XC32 version 1.20, all is well. But if I try to compile with XC32 version 1.30 the program fails each time this definition is used. When debugging the reason for stopping is "No source code lines were found at current PC"

I have tried extracting the definition into a function, but same result.

No compile errors are given - it just doesn't work with the later compiler. Any ideas?

Thanks.Edited by trippyben 2014-05-19
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 02:33am 18 May 2014
Copy link to clipboard 
Print this post

It could be that the optimiser optimised the code until there was nothing there (because the code essentially does nothing).

The volatile qualifier should prevent that but maybe not in this case. I would try compiling with no optimisation and see if it worked then.

Geoff
Geoff Graham - http://geoffg.net
 
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 10:12pm 18 May 2014
Copy link to clipboard 
Print this post

When I expanded it into a function, I added a line of code inside some curly brackets so it had something to do while in the for loop, but still didn't work. al-la

void uSec(unsigned int us) {
unsigned int iii,jjj;
for(iii = 0; iii < (((FCY/1000) * us) / 9440); iii++) {
jjj = 0;
}


I'll have a sniff around the optimisation levels, thanks Geoff.

Ben.
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 04:05am 19 May 2014
Copy link to clipboard 
Print this post

XC32 is at 1.31 version. Try that also
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 12:01am 20 May 2014
Copy link to clipboard 
Print this post

Looks like 1.31 fixes it. Works now with the original code.

Go figure.
 
vasi

Guru

Joined: 23/03/2007
Location: Romania
Posts: 1697
Posted: 06:22pm 07 Jun 2014
Copy link to clipboard 
Print this post

Now is at version 1.32
And Harmony (a pic32 collection of libraries and examples) is at 0.80.01b, with support for 170F256B and D and 270F256B and D microcontrollers and a lot of new libraries and examples for all microcontroller peripherals. Worth a try.

Maybe it can be the new foundation for Mico/Maximite.
__________
Man, this forum has a crazy dynamic.Edited by vasi 2014-06-09
Hobbit name: Togo Toadfoot of Frogmorton
Elvish name: Mablung Miriel
Beyound Arduino Lang
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 03:33am 08 Jun 2014
Copy link to clipboard 
Print this post

I know that this is off topic but I am going to have a short rant on the subject of Harmony.

Previously Microchip had a library called MLA which provided an easy interface to the hardware elements like the timers, USB, etc. MMBasic uses it extensively.

With Harmony Microchip has tossed that out and replaced it with a complex system that is intended to run under a real time operating system. It is immensely difficult to use, inefficient and designed to be in control of the processor (instead of your program).

They have also introduced a lower software layer called PLib that is also supposed to do some of the things that MLA did but it is so different that it requires a full rewrite of anything that used MLA.

Unfortunately Microchip do not supply a MLA library for the PIC32MZ series so the only choice when porting software from the PIC32MX series is to learn Harmony and engage in a full rewrite to support it. This is where I currently am with the Maximite MkIII - it is a very slow process.

Geoff (grumble, grumble, moan)
Geoff Graham - http://geoffg.net
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 07:50am 08 Jun 2014
Copy link to clipboard 
Print this post

Maybe time to Switch to AVR;-)...

Ok a joke, but Geoff do you think this would be possible without infinity effort?

THX
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 09:33am 08 Jun 2014
Copy link to clipboard 
Print this post

At this time I am still planning to see it through. But Harmony is still in the beta phase so it will take some time - at least another six months.

Geoff
Geoff Graham - http://geoffg.net
 
trippyben

Regular Member

Joined: 26/06/2011
Location: Australia
Posts: 91
Posted: 01:11pm 08 Jun 2014
Copy link to clipboard 
Print this post

I did have a play with the first beta release of Harmony but really struggled to find a way of getting a module or two going - it just didn't make any sense to a self taught C programmer who doesn't have super programming skills. I'll have another go when my Mikromedia development board turns up - hopefully being a microchip partner the hardware suits the harmony libraries directly.

If somebody who has got Harmony doing something useful had the time it would be a great series of magazine articles detailing some of the steps required to use some of the Harmony modules.

On the microchip ranting bandwagon -- I hate how each time the XC32 compiler is updated some of the commands and functions are either different or deleted. It can take a while to get a previously running program running again. Much annoying. Life seemed so much easier in the 8-bit assembly world.......
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024