This repository has been archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.py
43 lines (36 loc) · 1.63 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
import sys
import os
import ftplib
import glob
BASE_ADDRESS = 0x080C3EE0
CC = "arm-none-eabi-gcc"
CP = "arm-none-eabi-g++"
OC = "arm-none-eabi-objcopy"
LD = "arm-none-eabi-ld"
CTRULIB = '../libctru'
DEVKITARM = 'c:/devkitPro/devkitARM'
LIBPATH = '-L .'
def allFile(pattern):
s = "";
for file in glob.glob(pattern):
s += file + " ";
return s;
def run(cmd):
os.system(cmd)
with open('include/gen.h', 'w') as f:
f.write('');
cwd = os.getcwd()
run("rm obj/*.o")
run("rm bin/*.elf")
run(CC+ " -O3 -s -g -I include -I include/jpeg -I/c/devkitPro/portlibs/armv6k/include " + allFile('source/dsp/*.c') + " -c -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard ");
run(CC+ " -Os -s -g -I include -I include/jpeg -I/c/devkitPro/portlibs/armv6k/include " + allFile('source/ns/*.c') + allFile('source/*.c') + allFile('source/libctru/*.c') + " -c -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard ");
run(CC+" -Os " + allFile('source/ns/*.s') + allFile('source/*.s') + allFile('source/libctru/*.s') + " -c -s -march=armv6 -mlittle-endian -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard ");
run(LD + ' ' + LIBPATH + " -g -A armv6k -pie --print-gc-sections -T 3ds.ld -Map=test.map " + allFile("*.o") + " -lc -lm -lgcc --nostdlib" )
run("cp -r *.o obj/ ")
run("cp a.out bin/homebrew.elf ")
run(OC+" -O binary a.out payload.bin -S")
run("rm *.o")
run("rm *.out")
# run('copy payload.bin \\\\3DS-8141\\microSD\\ntr.bin');
run('copy payload.bin release\\ntr.o3ds.bin');