![]() |
Forum Index : Microcontroller and PC projects : MPLAB XC32 compiler changes
Author | Message | ||||
trippyben![]() Regular Member ![]() Joined: 26/06/2011 Location: AustraliaPosts: 91 |
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. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3269 |
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: AustraliaPosts: 91 |
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: RomaniaPosts: 1697 |
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: AustraliaPosts: 91 |
Looks like 1.31 fixes it. Works now with the original code. Go figure. ![]() |
||||
vasi![]() Guru ![]() Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
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. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3269 |
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: GermanyPosts: 723 |
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: AustraliaPosts: 3269 |
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: AustraliaPosts: 91 |
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 ![]() 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....... |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |