Add files via upload

master
cv007 2018-03-06 17:41:50 -06:00 zatwierdzone przez GitHub
rodzic 1df69f9273
commit 4e099dce5a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 300 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,300 @@
__ __ ___ _ __ __ __ __ ___ _____ ____
\ \/ / / __\/ | / /_ / / \ \/ / / __\|___ / |___ \
\ / / / | || '_ \ / / \ / / / |_ \ __) |
/ \ / /___ | || (_) | / / / \ / /___ ___) | / __/
/_/\_\\____/ |_| \___/ /_/ /_/\_\\____/ |____/ |_____|
r e s t r i c t i o n r e m o v a l r e v 4
....eevblog member cv007.......................................................
section1 -binary mods
section2 -project settings (if not wanting to modify binary file)
section3 -extra info
...............................................................................
///////////////////////////////////////////////////////////////////////////////
Section1
binary mods with hex editor for xc16, xc32, Windows, Linux, OSX
change byte(s) at file offset as specified
make backup copies first in case edit goes wrong
make sure hex editor is REPLACING bytes and not adding additional bytes
the GPL license allows you to modify the binaries listed here
///////////////////////////////////////////////////////////////////////////////
---------------------
| xc16 version 1.33 |
----------------------------------------------------------------------Windows--
File: C:\Program Files\Microchip\xc16\v1.33\bin\bin\elf-cc1.exe
Offset: 0x161E7E
Change: 0x85 to 0x84
-------------------------------------------------------------------------Linux-
File: /opt/microchip/xc16/v1.33/bin/bin/elf-cc1
Offset: 0x42ADBE
Change: 0x85 to 0x84
---------------------------------------------------------------------------OSX-
File: /Applications/microchip/xc16/v1.33/bin/bin/elf-cc1
Offset: 0x64CCC7
Change: 0x85 to 0x84
-------------------------------------------------------------------------------
---------------------
| xc32 version 1.44 |
----------------------------------------------------------------------Windows--
Dir: C:\Program Files\Microchip\xc32\v1.44\bin\bin\gcc\pic32mx\4.8.3\
File: cc1plus Offset: 0x775510 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0x6C4410 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x665010 Change: FFFFFFFFFFFFFFFF to 0600000000000000
-------------------------------------------------------------------------Linux-
Dir: /opt/microchip/xc32/v1.44/bin/bin/gcc/pic32mx/4.8.3/
File: cc1plus Offset: 0xB330B0 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0xA430B0 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x9B1F70 Change: FFFFFFFFFFFFFFFF to 0600000000000000
---------------------------------------------------------------------------OSX-
Dir: /Applications/microchip/xc32/v1.44/bin/bin/gcc/pic32mx/4.8.3/
File: cc1plus Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
-------------------------------------------------------------------------------
-------------------
xc32 version 2.05 |
----------------------------------------------------------------------Windows--
Dir: C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3\
File: cc1plus Offset: 0x774310 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0x6c3210 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x664010 Change: FFFFFFFFFFFFFFFF to 0600000000000000
-------------------------------------------------------------------------Linux-
Dir: /opt/microchip/xc32/v2.05/bin/bin/gcc/pic32mx/4.8.3/
File: cc1plus Offset: 0xB320B0 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0xA420B0 Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x9B0F70 Change: FFFFFFFFFFFFFFFF to 0600000000000000
---------------------------------------------------------------------------OSX-
Dir: /Applications/microchip/xc32/v2.05/bin/bin/gcc/pic32mx/4.8.3/
File: cc1plus Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: cc1 Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
File: lto1 Offset: 0x?????? Change: FFFFFFFFFFFFFFFF to 0600000000000000
///////////////////////////////////////////////////////////////////////////////
Section2
XC32 C Compiler - run without restrictions
tested with v1.44 (should also work with v1.42,1.43)
tested with v2.05
relevant files from the source code-
xc32-v1.44-src/gcc/gcc/config/pic32/mchp.c
xc32-v1.44-src/gcc/gcc/config/pic32/mchp.opt
xc32-v2.05-src/pic32m-source/src48x/gcc/gcc/config/pic32/mchp.c
xc32-v2.05-src/pic32m-source/src48x/gcc/gcc/config/pic32/mchp.opt
///////////////////////////////////////////////////////////////////////////////
create a file in the project folder, name it specs.txt (name not important)
in that file add these three lines (second is blank)-
*cc1:+ -mafrlcsj
*cc1plus:+ -mafrlcsj
then, in the project properites, under Categories, select XC32 (Global Options)
in the Additional options field add the following option-
-specs=specs.txt
then press the OK button to close the dialog box
(specs.txt name has to match the name of the created file)
>>>>>> Explanation
source code shows that MCHP has added an option to override the results of
the license check, the option is -mafrlcsj
the XC32-gcc and XC32-g++ front ends that are first called when compiling
code, check the options provided and specifically remove the -mafrlcsj option
and then exec's /bin/xc32-gcc (or /bin/xc32-g++) with the original options
less the -mafrlcsj option if used
if you can get the -mafrlcsj option to make it past the initial xc32-gcc/g++,
then that option will work- in the case of XC32 the license check will run, but
the results will be overridden if the -mafrlcsj option is present and removes
all restrictions
the way to prevent xc32-gcc/g++ from stripping that option is to instead
provide a specs file that adds to the default specs the -mafrlcsj option
///////////////////////////////////////////////////////////////////////////////
XC16 C Compiler - run without restrictions
tested with v1.33 (should also work with ver 1.26,1.30,1.31,1.32B)
relevant files from the source code-
v1.33.src/src/XC_GCC/gcc/gcc/config/pic30/pic30.c
v1.33.src/src/XC_GCC/gcc/gcc/config/pic30/pic30.opt
///////////////////////////////////////////////////////////////////////////////
****** Simple option, no modification of any files
same as XC32 , except there is no c++, so only the first line of the specs
file is needed-
*cc1:+ -mafrlcsj
///////////////////////////////////////////////////////////////////////////////
// Section3 - extra info
///////////////////////////////////////////////////////////////////////////////
#linux script used to get xc32 file location for 'mchp_pic32_license_valid'
#cd to correct folder
for f in cc1plus cc1 lto1; do
[ -e $f.bak ] || cp $f $f.bak
a=($(objdump -T $f | grep mchp_pic32_license_valid))
b=($(objdump -h $f | grep " .data "))
offset=$((0X${a[0]}-0x${b[4]}+0x${b[5]}))
printf "File: %-8s Offset: 0x%X Change: FFFFFFFFFFFFFFFF to 0600000000000000\n" $f $offset
done
#linux script used to change xc32 initial value for 'mchp_pic32_license_valid'
#(instead of hex editor)
#cd to correct folder
for f in cc1plus cc1 lto1; do
[ -e $f.bak ] || cp $f $f.bak
a=($(objdump -T $f | grep mchp_pic32_license_valid))
b=($(objdump -h $f | grep " .data "))
offset=$((0X${a[0]}-0x${b[4]}+0x${b[5]}))
printf "%0.8x: 0600 0000 0000 0000" $offset | xxd -r - $f
done
#xc16 , linux script to replace jne to je
#looking for jne after move of 'mchp_mafrlcsj' bss var
# 8472db5: 8b 35 a0 25 94 08 mov 0x89425a0,%esi
# 8472dbb: 85 f6 test %esi,%esi
# 8472dbd: 0f 85 d2 05 00 00 jne 8473395 <pic30_override_options+0x895>
#cd to correct folder
for f in elf-cc1 coff-cc1; do
[ -e $f.bak ] || cp $f $f.bak
a=$(objdump -T $f | grep mchp_mafrlcsj)
a=${a:6:2}${a:4:2}${a:2:2}${a:0:2}
old="\(8b..${a}....0f\)85"
new="\184"
xxd -ps $f.bak | sed "s:$old:$new:" | xxd -r -p - $f
done
Windows process used to find var file offset address to change-
using mingw objdump, get disassembly and section info-
(section info appended to end of each file)
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -d cc1.exe > cc1.txt
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -d cc1plus.exe > cc1plus.txt
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -d lto1.exe > lto1.txt
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -h cc1.exe >> cc1.txt
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -h cc1plus.exe >> cc1plus.txt
C:\Program Files\Microchip\xc32\v2.05\bin\bin\gcc\pic32mx\4.8.3>objdump -h lto1.exe >> lto1.txt
open each exe in hex editor, search for string-
Could not retrieve compiler license (%s)
note file offset address
cc1.exe 0x729e54
cc1plus.exe 0x7f2cc8
lto1.exe 0x6d4368
find section address from file offset (from section info )
cc1.exe----------------------------------------\
Idx Name Size VMA LMA File off Algn
2 .rdata 00240cb8 00ace000 00ace000 006cc800 2**5
string-file-offset - section-address = string-section-offset
string-section-offset + section-vma-address = string-vma-address
0x729e54 - 0x6cc800 = 0x5d654 + 0xace000 = 0xb2b654
search for 0xb2b654 in cc1.txt-
653117: 89 44 24 08 mov %eax,0x8(%esp)
65311b: c7 44 24 04 54 b6 b2 movl $0xb2b654,0x4(%esp)
653122: 00
653123: c7 04 24 00 00 00 00 movl $0x0,(%esp)
65312a: c7 05 10 40 ac 00 00 movl $0x0,0xac4010
653131: 00 00 00
653134: c7 05 14 40 ac 00 00 movl $0x0,0xac4014
65313b: 00 00 00
65313e: e8 4d 3b 3b 00 call 0xa06c90
653143: a1 f0 57 e1 00 mov 0xe157f0,%eax
653148: c7 44 24 04 b8 b5 b2 movl $0xb2b5b8,0x4(%esp)
movl's loading 0x0000000000000000 to 0xac4010
0xac4010 is our variable address
now work back that address to file offset
cc1.exe--------------------\
Idx Name Size VMA LMA File off Algn
1 .data 0000c420 00ac1000 00ac1000 006c0200 2**5
var-vma-address - section-vma-address = var-section-offset
var-section-offset + section-file-offset = var-file-offset
0xac4010 - 0xac1000 = 0x3010 + 0x6c0200 = 0x6c3210
0x6c3210 is our file offset address to change
find that address in the hex editor
should be 6 FF bytes, change first one to 06, the next five to 00
do the same procedure for the other two files
results-
cc1.exe 0x6c3210
cc1plus.exe 0x774310
lto1.exe 0x664010
Osx-
need an OSX disassembler to essentially do the same