Author Topic: PIC32 evolution  (Read 19073 times)

0 Members and 1 Guest are viewing this topic.

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1140
  • Country: fi
 
The following users thanked this post: jesuscf, evb149

Offline jesuscf

  • Regular Contributor
  • *
  • Posts: 230
  • Country: ca
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline evb149

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: us
Re: PIC32 evolution
« Reply #52 on: August 18, 2016, 06:07:46 am »
Thanks to you both for the information about the integrated debuggers on those kits.
I'll check them out.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #53 on: August 18, 2016, 03:52:09 pm »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):

- save the hash: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/xclm

- compile a new "xclm" binary using the following C code:

Code: [Select]
int main(void)
{
  return 6;
}

and copy it to /opt/microchip/xc32/v1.42/bin/

- save also the hash of the new binary: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1

- open /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1 with a hexeditor and
  replace the three occurrences of the old hash with the new hash.

That's it.  Works fine here with all optimization settings.


 
The following users thanked this post: jesuscf, evb149, JPortici

Offline jesuscf

  • Regular Contributor
  • *
  • Posts: 230
  • Country: ca
Re: PIC32 evolution
« Reply #54 on: August 19, 2016, 02:59:38 am »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):
.
.
.
That's it.  Works fine here with all optimization settings.

Works like a charm!  Orders of magnitude faster than building from source.  On windows, Karel's instructions have to be applied to files cc1.exe, cc1plus.exe, and lto1.exe in folder xc32\v1.42\bin\bin\gcc\pic32mx\4.8.3.
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline Sal Ammoniac

  • Frequent Contributor
  • **
  • Posts: 989
  • Country: us
    • Embedded Tales Blog
Re: PIC32 evolution
« Reply #55 on: August 19, 2016, 03:16:49 am »
What compiler did you use to compile xclm.c with on Windows?
Nothing lasts as long as a workaround.
 

Offline ale500

  • Frequent Contributor
  • **
  • Posts: 347
Re: PIC32 evolution
« Reply #56 on: August 19, 2016, 04:09:29 am »
I used gcc under mingw :).
 

Offline Sal Ammoniac

  • Frequent Contributor
  • **
  • Posts: 989
  • Country: us
    • Embedded Tales Blog
Re: PIC32 evolution
« Reply #57 on: July 11, 2017, 06:00:42 pm »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):
.
.
.
That's it.  Works fine here with all optimization settings.

Works like a charm!  Orders of magnitude faster than building from source.  On windows, Karel's instructions have to be applied to files cc1.exe, cc1plus.exe, and lto1.exe in folder xc32\v1.42\bin\bin\gcc\pic32mx\4.8.3.

Has anyone tried this procedure with XC32 v1.43 on Windows? I followed Karel's instructions, but could not find the sha256 hash of xclm anywhere in cc1.exe, cc1plus.exe, or lto1.exe in xc/v1.43/bin/bin/gcc/pic32mx/4.8.3
Nothing lasts as long as a workaround.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #58 on: July 17, 2017, 10:40:46 am »
Has anyone tried this procedure with XC32 v1.43 on Windows?

Because I don't use windows, I can only confirm it still works with XC32 v1.43 on Linux.
 

Offline JanJansen

  • Frequent Contributor
  • **
  • Posts: 386
  • Country: nl
Re: PIC32 evolution
« Reply #59 on: July 17, 2017, 11:49:44 am »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):
- save the hash: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- save also the hash of the new binary: sha256sum /opt/microchip/xc32/v1.42/bin/xclm
Hi Karel, what do you mean with save the hash ?, how can i do that ?
And does this trick also works for XC8 and XC16 ?

I need to squeeze the power out my DSPIC33, with your trick i dont need stuff from hackers so its safe, lets try it.
aliexpress parachute
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #60 on: July 17, 2017, 03:51:42 pm »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):
- save the hash: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- save also the hash of the new binary: sha256sum /opt/microchip/xc32/v1.42/bin/xclm
Hi Karel, what do you mean with save the hash ?, how can i do that ?
And does this trick also works for XC8 and XC16 ?

With "save the hash" I meant: calculate the checksum of a file, in this case using a program named "sha256sum".
When you run this program with an argument (the name of the file of interest: xclm) it will calculate a so-called "hash" using the sha256 algorithm.
It's a string of 64 hexadecimal characters that uniquely identifies a file (at least in theory till we have faster computers).

It should work also for XC16 because it uses the same compiler.
The XC8 compiler is different, so this trick doesn't work there.


 
The following users thanked this post: JanJansen

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #61 on: August 24, 2017, 03:16:06 pm »
For your info, I just installed a newer version of xc32 (v1.44) and patched it as described above.
 

Offline JanJansen

  • Frequent Contributor
  • **
  • Posts: 386
  • Country: nl
Re: PIC32 evolution
« Reply #62 on: August 24, 2017, 03:38:39 pm »
Suppose you ask Microchip if its legal ?, what do they say ?
aliexpress parachute
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #63 on: August 24, 2017, 04:14:37 pm »
Check the file /opt/microchip/xc32/v1.44/docs/MPLAB_XC32_Compiler_License.txt:

Quote
4. Open Source Components.  Notwithstanding the license grant in Section 2 above, Licensee further acknowledges that certain components of the Software may be covered by so-called "open source" software licenses ("Open Source Components"). Open Source Components means any software licenses approved as open source licenses by the Open Source Initiative or any substantially similar licenses, including without limitation any license that, as a condition of distribution of the software licensed under such license, requires that the distributor make the software available in source code format. To the extent required by the licenses covering Open Source Components, the terms of such license will apply in lieu of the terms of this Agreement. To the extent the terms of the licenses applicable to Open Source Components prohibit any of the restrictions in this Agreement with respect to such Open Source Components, such restrictions will not apply to such Open Source Component.

It's my opinion that I patch an open source (GPL) component, so I don't worry. If they dare to break balls about it, the free software foundation will be happy to drag them into court...

You have to decide for yourself, I can't do that for you, I'm not a lawyer.




 

Offline jesuscf

  • Regular Contributor
  • *
  • Posts: 230
  • Country: ca
Re: PIC32 evolution
« Reply #64 on: March 30, 2018, 05:59:04 pm »
Just patched XC32 V2.05.  The instructions above still work.
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3316
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: PIC32 evolution
« Reply #65 on: March 30, 2018, 08:16:48 pm »
If you are brave enough to poke around the source code (also released under GPL) you can comment out all the code related to license checking. It will make compiling even faster since it is no longer calling to the xclm binary. Or you can just replace xc32 with a standard mips-gcc too (which both compiles faster due to the lack of license check, and emits better code due to the more efficient interrupt entry and exit.)

The same applies to xc16 too actually, since that too is GCC based.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 502
Re: PIC32 evolution
« Reply #66 on: March 30, 2018, 09:34:45 pm »
Or just do it the 'better/newer' way-
https://github.com/cv007/XC3216/blob/master/xc32xc16-info-rev4.txt
(OSX info is lacking for the xc32 binary mods, if wanted I would need the 3 binary files, then I can decompile and update the info)

No need to deal with xclm (section1 binary mod), or even do any mods (section2 simple txt file).
In the case of 'section1', the xclm file has to be present (but can be blank), but is never called (speedy compile). The no-mod 'section2' still calls xclm but the results are overridden. XC16 is a little different, and if I recall either method will not even bother with xclm at all.

The latest source mchp released for xc32 also appears to have the build scripts now included, but I have not tried it.  In some ways, it is better to be working with the same version as 'everyone' else, where the available documentation also matches, and any problems can be reproduced by others if needed.
 
The following users thanked this post: Karel, TomS_

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1557
  • Country: 00
Re: PIC32 evolution
« Reply #67 on: June 21, 2018, 03:33:26 pm »
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):

- save the hash: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/xclm

- compile a new "xclm" binary using the following C code:

Code: [Select]
int main(void)
{
  return 6;
}

and copy it to /opt/microchip/xc32/v1.42/bin/

- save also the hash of the new binary: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1

- open /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1 with a hexeditor and
  replace the three occurrences of the old hash with the new hash.

That's it.  Works fine here with all optimization settings.

This method stopped working with XC32 v2.10.

The solution is to simply change the return value in the C code from 6 to 2.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf