forked from vial-kb/vial-qmk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompile.sh
executable file
·43 lines (32 loc) · 1.06 KB
/
compile.sh
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
#!/bin/bash -f
kb=${1:-'reccarz/kw75s'}
kb=${kb//\//_}
km=${2:-'default'}
#km=${2:-'vial'}
#qmk clean
#qmk generate-compilation-database
#qmk compile
echo "Check if BIT_BANK is used:"
rg '\bbits\b' -t asm .build/obj_${kb}_${km} | rg -v ';|special function bits'
./util/del_bit_bank_area.py .build/obj_${kb}_${km}/protocol/ch555/usb_device.asm
./util/del_bit_bank_area.py .build/obj_${kb}_${km}/lib/ch555/uart_hs6620b.asm
# Assemble:
echo -e "\\nAssembling..."
asmlist=$(find .build/obj_${kb}_${km} -name "*asm" -type f)
for file in $asmlist
do
# compile from .asm to .rel :
sdas8051 -plosgffw "${file%.asm}.rel" "$file"
done
# Link:
echo -e "\\nLinking..."
rellist=$(find .build/obj_${kb}_${km} -name "*rel" -type f)
sdcc --verbose -V \
-mmcs51 --model-large --iram-size 0x0100 --xram-size 0x1f00 --xram-loc 0x0100 --code-size 0xf000 \
--opt-code-speed \
$rellist \
-o ${kb}_${km}.ihx
# Create .hex and .bin:
echo -e "\\nCreate .hex and .bin files..."
packihx ${kb}_${km}.ihx > ${kb}_${km}.hex
objcopy -I ihex -O binary ${kb}_${km}.ihx ${kb}_${km}.bin