mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-12-15 16:49:15 -05:00
build: Use only one Makefile for apps
- Use one common Makefile for all test device apps. - Use a single copy of syscall.[Sh]. - Update docs for building.
This commit is contained in:
parent
6e3034c3ce
commit
ba17a2b29e
13 changed files with 165 additions and 403 deletions
|
|
@ -1,73 +0,0 @@
|
|||
P := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
LIBDIR ?= ../../tkey-libs
|
||||
OBJCOPY ?= llvm-objcopy
|
||||
CC = clang
|
||||
CFLAGS = \
|
||||
-target riscv32-unknown-none-elf \
|
||||
-march=rv32iczmmul \
|
||||
-mabi=ilp32 \
|
||||
-mcmodel=medany \
|
||||
-static \
|
||||
-std=gnu99 \
|
||||
-Os \
|
||||
-ffast-math \
|
||||
-fno-common \
|
||||
-fno-builtin-printf \
|
||||
-fno-builtin-putchar \
|
||||
-fno-builtin-memcpy \
|
||||
-nostdlib \
|
||||
-mno-relax \
|
||||
-Wall \
|
||||
-Wpedantic \
|
||||
-Wno-language-extension-token \
|
||||
-Werror \
|
||||
-flto \
|
||||
-g \
|
||||
-I $(LIBDIR)/include \
|
||||
-I $(LIBDIR)
|
||||
|
||||
AS = clang
|
||||
|
||||
ASFLAGS = \
|
||||
-target riscv32-unknown-none-elf \
|
||||
-march=rv32iczmmul \
|
||||
-mabi=ilp32 \
|
||||
-mno-relax
|
||||
|
||||
LDFLAGS = \
|
||||
-T $(LIBDIR)/app.lds \
|
||||
-L $(LIBDIR) -lcrt0 -lcommon -lmonocypher -lblake2s
|
||||
|
||||
.PHONY: all
|
||||
all: defaultapp.bin
|
||||
|
||||
# Turn elf into bin for device
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) --input-target=elf32-littleriscv --output-target=binary $^ $@
|
||||
chmod a-x $@
|
||||
|
||||
.PHONY: tkey-libs
|
||||
tkey-libs:
|
||||
make -C $(LIBDIR)
|
||||
|
||||
DEFAULTAPP_FMTFILES = *.[ch]
|
||||
|
||||
DEFAULTAPP_OBJS = \
|
||||
$(P)/main.o \
|
||||
../testapp/syscall.o \
|
||||
|
||||
defaultapp.elf: tkey-libs $(DEFAULTAPP_OBJS)
|
||||
$(CC) $(CFLAGS) $(DEFAULTAPP_OBJS) $(LDFLAGS) -o $@
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
clang-format --dry-run --ferror-limit=0 $(DEFAULTAPP_FMTFILES)
|
||||
clang-format --verbose -i $(DEFAULT_FMTFILES)
|
||||
|
||||
.PHONY: checkfmt
|
||||
checkfmt:
|
||||
clang-format --dry-run --ferror-limit=0 --Werror $(DEFAULT_FMTFILES)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f defaultapp.* $(DEFAULTAPP_OBJS)
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
// Copyright (C) 2025 - Tillitis AB
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <fw/tk1/reset.h>
|
||||
#include <fw/tk1/syscall_num.h>
|
||||
#include <syscall.h>
|
||||
#include <tkey/debug.h>
|
||||
#include <tkey/led.h>
|
||||
|
||||
#include "../testapp/syscall.h"
|
||||
#include "../tk1/reset.h"
|
||||
#include "../tk1/syscall_num.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct reset rst = {0};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue