pinephone-keyboard/firmware/build.sh
Ondrej Jirman 6a5fe581b9 Implement flashing over I2C and user/stock firmware support
I2C register layout changed a bit to make various operations easier
to implement in FW and for the user.

Flashing/debugging tools now share more code. Firmware is now more
configurable (it's now possible to compile-out various features).

Self-testing for column-shorts is implemented.

Firmware is optimized for low power consumption.
2021-06-28 15:09:47 +02:00

49 lines
999 B
Bash
Executable file

#!/bin/bash
set -e
rm -rf build
mkdir -p build
hex2bin()
{
local name="$1"
makebin build/$name.ihx build/$name.bin
dd if=bootloader.bin of=build/$name.bin conv=notrunc &>/dev/null
}
# build stock FW
cpp -P -nostdinc -I. -D__ASM_ONLY__ stock-ivt.asm build/stock-ivt.asm
sdas8051 -plosgff build/stock-ivt.rel build/stock-ivt.asm
echo Stock FW
sdcc \
-mmcs51 --iram-size 256 --xram-size 2048 \
--code-size 0x2000 --code-loc 0x2130 \
-Wl-bIVECT=0x2000 \
-I. \
-DFW_REVISION_STR="\"$(git describe) $(git log -1 --format=%cd --date=iso)\"" \
-DCONFIG_STOCK_FW=1 \
build/stock-ivt.rel main.c \
-o build/fw-stock.ihx
hex2bin fw-stock
# build user FW
echo User FW
sdcc \
-mmcs51 --iram-size 255 --xram-size 2048 \
--code-size 0x4000 --code-loc 0x4000 \
-I. \
-DFW_REVISION_STR="\"$(git describe) $(git log -1 --format=%cd --date=iso)\"" \
-DCONFIG_STOCK_FW=0 \
-DCONFIG_USB_STACK=0 \
-DCONFIG_DEBUG_LOG=1 \
-DCONFIG_SELFTEST=0 \
main.c \
-o build/fw-user.ihx
hex2bin fw-user