-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_ep2.bat
66 lines (51 loc) · 1.94 KB
/
make_ep2.bat
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
:: This make_ep2.bat script was created by EXL, 02-Dec-2024.
:: Default platform is Motorola P2K, ElfPack v2.x, devkitARM release 26 (GCC 4.4.0) on Windows.
:: Uncomment it for disable verbose output.
:: @echo off
if /I "%1"=="clean" (
if exist *.o del *.o
if exist *.obj del *.obj
if exist *.elfp del *.elfp
if exist *.elf del *.elf
exit /b 0
)
:: Compiler path.
set ARM_PATH=C:\devkitARM
:: SDK path.
set SDK_PATH=%ARM_PATH%\SDK
:: Libraries path.
set LIB_PATH=%ARM_PATH%\lib
:: Main link library.
set LIB_MAIN=std.sa
:: Libc link library.
set LIB_LIBC=libc.a
:: Defines.
set DEFINES=-D__P2K__ -DEP2 -DROT_0 -DFPS_15
:: set DEFINES=-D__P2K__ -DEP2 -DROT_0 -DFPS_15 -DFTR_L7E
:: set DEFINES=-D__P2K__ -DEP2 -DROT_90 -DFPS_30 -DJAVA_HEAP
:: set DEFINES=-DDEBUG
:: set DEFINES=-DFPS_METER
:: set DEFINES=-DMEMORY_MANUAL_ALLOCATION
:: set DEFINES=-DSEARCH_LONG_RANGE
:: Includes.
set INCLUDES=-I.
:: Optimization.
set OPTIM=-O3
:: Project/ELF name.
set ELF_NAME=vNesC
:: Compiling step.
%ARM_PATH%\bin\arm-eabi-gcc -std=c99 -c -mbig-endian -mthumb -mthumb-interwork -nostdlib ^
-fshort-wchar -fshort-enums -fpack-struct=4 -fno-builtin -fvisibility=hidden ^
-I%SDK_PATH% %INCLUDES% %DEFINES% %OPTIM% vNesC.c -o vNesC.o
%ARM_PATH%\bin\arm-eabi-gcc -std=c99 -c -mbig-endian -mthumb -mthumb-interwork -nostdlib ^
-fshort-wchar -fshort-enums -fpack-struct=4 -fno-builtin -fvisibility=hidden ^
-I%SDK_PATH% %INCLUDES% %DEFINES% %OPTIM% vP2k.c -o vP2k.o
:: HACK:
:: Highly intelligent GCC compiler optimizes struct arguments in variadic functions
:: using the explicit `memcpy()` call and this feature can't be disabled.
%ARM_PATH%\bin\arm-eabi-objcopy --redefine-sym memcpy=__rt_memcpy vNesC.o
:: Linking step.
%ARM_PATH%\bin\arm-eabi-ld -pie -EB %OPTIM% -nostdlib --allow-multiple-definition vNesC.o vP2k.o ^
%LIB_PATH%\%LIB_MAIN% %LIB_PATH%\%LIB_LIBC% -o %ELF_NAME%.elfp
:: Post linking step.
%ARM_PATH%\libgen\postlink.exe %ELF_NAME%.elfp -o %ELF_NAME%.elf