Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Issue 160, 161, 153, 164, 165, 167: Proof properties for applications #173

Merged
merged 40 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
90ada30
proof of log proxy (WIP)
jklmnn Mar 26, 2020
9680145
prove message tests
jklmnn Mar 26, 2020
c5ef73d
prove Rom test
jklmnn Mar 26, 2020
4636623
prove Memory tests
jklmnn Mar 26, 2020
1d70759
fix log proxy proof
jklmnn Apr 1, 2020
6abcfe7
allow editing and proving with subcommands
jklmnn Apr 3, 2020
262de0a
prove broker packages (WIP)
jklmnn Apr 3, 2020
1e81735
fix test script
jklmnn Apr 7, 2020
1867325
prove broker with only low checks missing
jklmnn Apr 7, 2020
f780796
fix broken loop condition
jklmnn Apr 8, 2020
3e97b53
custom parameter for memory client callback
jklmnn Apr 15, 2020
b78fdd1
split up event procedures
jklmnn Apr 15, 2020
8e9b2b9
improve error messages
jklmnn Apr 15, 2020
45e8750
custom parameter for rom client callback
jklmnn Apr 15, 2020
9ed538f
custom parameters for log server
jklmnn Apr 16, 2020
f4c409e
custom parameter and proof for memory server
jklmnn Apr 16, 2020
cfd24cd
custom parameter and proof for message server
jklmnn Apr 16, 2020
39da7ad
make log session generic
jklmnn Apr 17, 2020
d720fa4
prove main properties of log dispatcher
jklmnn Apr 17, 2020
7987012
implement custom parameters on Genode
jklmnn Apr 17, 2020
71ef6fc
improve proof state of test components
jklmnn Apr 17, 2020
a4190b7
Restructure internal Linux implementation to allow hidden platform state
jklmnn Apr 22, 2020
1be59d1
prove global state of hello world example
jklmnn Apr 24, 2020
de32987
prove global state of log proxy
jklmnn Apr 24, 2020
6d21dfa
prove global state of memory client
jklmnn Apr 24, 2020
1f13eed
prove global state of memory server
jklmnn Apr 24, 2020
0b56cc1
prove global state of message client
jklmnn Apr 24, 2020
53b38ad
prove global state of message server
jklmnn Apr 24, 2020
a9c15d9
prove global state of rom client
jklmnn Apr 24, 2020
a8cd42f
prove global state of timer client
jklmnn Apr 24, 2020
8b96895
prove components with GNAT Community 2019
jklmnn Apr 24, 2020
39f7f75
Correctly detect EOF
jklmnn Apr 24, 2020
427f2e0
Move init to src/core/linux, rename init to core
jklmnn Apr 24, 2020
aaafec1
Update ada-runtime to 1.2
jklmnn Apr 27, 2020
324c6c9
Fix broken Genode test
jklmnn Apr 29, 2020
2252f14
Update ada-runtime to 1.2.1
jklmnn May 12, 2020
8f820cd
Update readme, add example build instructions
jklmnn May 15, 2020
3919174
Unify duplicated helper functions
jklmnn May 18, 2020
aaa74c5
Add clarifications, fix indentation
jklmnn May 19, 2020
a4d2d52
Clarifications in Readme
jklmnn May 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ada-runtime
Submodule ada-runtime updated 40 files
+43 −0 .github/workflows/ci.yml
+0 −26 .travis.yml
+14 −1 Makefile
+5 −1 README.md
+54 −0 build/nrf52/Makefile
+38 −0 build/nrf52/rts.gpr
+49 −0 build/stm32f0/Makefile
+30 −0 build/stm32f0/rts.gpr
+12 −2 platform/gnat_helpers.ads
+45 −0 platform/nrf52/bluefruit_feather/componolit-runtime-board.adb
+12 −0 platform/nrf52/componolit-runtime-board.ads
+94 −0 platform/nrf52/componolit_runtime.adb
+22 −0 platform/nrf52/default/componolit-runtime-board.adb
+8 −0 platform/nrf52/drivers.gpr
+98 −0 platform/nrf52/drivers/componolit-runtime-drivers-gpio.adb
+90 −0 platform/nrf52/drivers/componolit-runtime-drivers-gpio.ads
+22 −0 platform/nrf52/drivers/componolit-runtime-drivers-power.adb
+17 −0 platform/nrf52/drivers/componolit-runtime-drivers-power.ads
+15 −0 platform/nrf52/drivers/componolit-runtime-drivers.ads
+20 −0 platform/nrf52/nrf52.gpr
+29 −0 platform/nrf52/sparkfun/componolit-runtime-board.adb
+91 −0 platform/stm32f0/componolit_runtime.adb
+8 −0 platform/stm32f0/drivers.gpr
+169 −0 platform/stm32f0/drivers/componolit-runtime-drivers-gpio.adb
+192 −0 platform/stm32f0/drivers/componolit-runtime-drivers-gpio.ads
+26 −0 platform/stm32f0/drivers/componolit-runtime-drivers-rcc.adb
+39 −0 platform/stm32f0/drivers/componolit-runtime-drivers-rcc.ads
+10 −0 platform/stm32f0/drivers/componolit-runtime-drivers.ads
+20 −0 platform/stm32f0/stm32f0.gpr
+15 −0 tests/arm.sh
+1 −0 tests/esp8266.sh
+1 −1 tests/genode.sh
+150 −0 tests/platform/nrf52/crt0.S
+119 −0 tests/platform/nrf52/link.ld
+14 −0 tests/platform/nrf52/main.adb
+36 −0 tests/platform/nrf52/test.gpr
+145 −0 tests/platform/stm32f0/crt0.S
+119 −0 tests/platform/stm32f0/link.ld
+14 −0 tests/platform/stm32f0/main.adb
+35 −0 tests/platform/stm32f0/test.gpr
85 changes: 61 additions & 24 deletions cement
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,38 @@ import logging
import xml.etree.ElementTree as ET

parser = argparse.ArgumentParser()
parser.add_argument("config", help="gneiss config file")
parser.add_argument("gneiss_root", help="gneiss repository")
parser.add_argument("-b", "--build_dir", help="build directory", default="build")
parser.add_argument("-r", "--root_fs", help="use separate rootfs", default="build")
parser.add_argument("-v", "--verbose", help="verbose output", action="store_true")
parser.add_argument("paths", help="component search paths", nargs="*")
subparsers = parser.add_subparsers(dest='command')
build_parser = subparsers.add_parser("build")
build_parser.add_argument("config", help="gneiss config file")
build_parser.add_argument("gneiss_root", help="gneiss repository")
build_parser.add_argument("-b", "--build_dir", help="build directory", default="build")
build_parser.add_argument("-r", "--root_fs", help="use separate rootfs", default="build")
build_parser.add_argument("-p", "--platform", help="target platform", default="linux")
build_parser.add_argument("paths", help="component search paths", nargs="*")
edit_parser = subparsers.add_parser("edit")
edit_parser.add_argument("project", help="GPR project file")
edit_parser.add_argument("gneiss_root", help="gneiss repository")
edit_parser.add_argument("-b", "--build_dir", help="build directory", default="build")
edit_parser.add_argument("paths", help="component search paths", nargs="*")
prove_parser = subparsers.add_parser("prove")
prove_parser.add_argument("project", help="GPR project file")
prove_parser.add_argument("gneiss_root", help="gneiss repository")
prove_parser.add_argument("-b", "--build_dir", help="build directory", default="build")
prove_parser.add_argument("-u", "--unit", help="ada unit")
prove_parser.add_argument("-s", "--steps", help="prove steps", default="8000")
prove_parser.add_argument("paths", help="component search paths", nargs="*")

def get_component_name(libname):
return libname[13:-3]

def build_init(root, outdir, default_args, logger):
args = default_args + ["-P", "init",
def build_init(root, outdir, default_args, platform, logger):
args = default_args + ["-P", f"core",
"-aP", root,
"-aP", root + "/init",
"-aP", root + f"/src/core/{platform}",
"-aP", root + "/lib",
"-XGNEISS_ROOT=" + root,
"-XCEMENT_OBJECT_DIR=" + os.path.join(outdir, "init"),
"-XCEMENT_OBJECT_DIR=" + os.path.join(outdir, f"core_{platform}"),
"-XCEMENT_LIB_OBJECT_DIR=" + os.path.join(outdir, "libobjects/"),
"-XCEMENT_LIBRARY_DIR=" + os.path.join(outdir, "libs")]
logger.debug(args)
Expand All @@ -51,12 +66,12 @@ def find(name, path):
if name in files:
return os.path.join(root, name)

def extract_init(build_dir, target_dir):
def extract_init(build_dir, target_dir, platform):
try:
os.mkdir(target_dir)
except FileExistsError:
pass
shutil.copy2(find("init", os.path.join(build_dir, "init")), target_dir)
shutil.copy2(find("core", os.path.join(build_dir, f"core_{platform}")), target_dir)

def extract_components(build_dir, target_dir, components):
try:
Expand All @@ -77,15 +92,15 @@ def get_component_files(xml_file):
raise ValueError(c)
return components

def gpr_compile(config, gneiss_root, build_dir, root_dir, paths, logger, verbose):
def gpr_compile(config, gneiss_root, build_dir, root_dir, paths, platform, logger, verbose):
logger.info("Compiling...")
components = get_component_files(config)
logger.info("Preparing init...")
default_args = ["-p", "-XCEMENT_BUILD_STEP=prepare", "--db", os.path.join(gneiss_root, "gprconfig_db")]
if args.verbose:
default_args.append("-v")
if build_init(gneiss_root, build_dir, default_args, logger) > 0:
logger.error("Preparation of init failed")
if build_init(gneiss_root, build_dir, default_args, platform, logger) > 0:
logger.error("Preparation of core failed")
exit(1)
for c in components:
logger.info("Preparing " + c + "...")
Expand All @@ -101,7 +116,7 @@ def gpr_compile(config, gneiss_root, build_dir, root_dir, paths, logger, verbose
default_args = ["-p", "-XCEMENT_BUILD_STEP=compile"]
if verbose:
default_args.append("-v")
if build_init(gneiss_root, build_dir, default_args, logger) > 0:
if build_init(gneiss_root, build_dir, default_args, platform, logger) > 0:
logger.error("Compilation of init failed")
exit(1)
for c in components:
Expand Down Expand Up @@ -129,12 +144,11 @@ def gpr_compile(config, gneiss_root, build_dir, root_dir, paths, logger, verbose
os.mkdir(libdir)
except FileExistsError:
pass
extract_init(build_dir, bindir)
extract_init(build_dir, bindir, platform)
extract_components(build_dir, libdir, components)
logger.info("Finished.")

def gpr_edit(name, root, build_dir, paths, logger):
logger.info("Editing...")
def gpr_prepare(name, root, build_dir, paths):
step_compile = ["-XCEMENT_BUILD_STEP=compile"]
step_prepare = ["-XCEMENT_BUILD_STEP=prepare",
"--db", os.path.join(root, "gprconfig_db")]
Expand All @@ -152,12 +166,32 @@ def gpr_edit(name, root, build_dir, paths, logger):
env["GPR_PROJECT_PATH_FILE"] = project_path_file
gprbuild(["-p"] + args + step_prepare, env);
gprbuild(["-p"] + args + step_compile, env);
return args, env, project_path_file


def gpr_edit(name, root, build_dir, paths, logger):
logger.info("Editing...")
args, env, project_path_file = gpr_prepare(name, root, build_dir, paths)
logger.debug(args)
logger.debug(env["GPR_PROJECT_PATH_FILE"])
proc = subprocess.Popen(["gnatstudio"] + args + ["-XCEMENT_BUILD_STEP=compile"], env=env)
logger.debug(f"Popen: {proc.args}")
proc.communicate()
os.remove(project_path_file)

def gpr_prove(name, root, build_dir, paths, steps, unit, logger):
logger.info("Editing...")
args, env, project_path_file = gpr_prepare(name, root, build_dir, paths)
logger.debug(args)
logger.debug(env["GPR_PROJECT_PATH_FILE"])
proc = subprocess.Popen(["gnatstudio"] + args + step_compile, env=env)
args.extend(["-j0", f"--steps={steps}", "--checks-as-errors", "--prover=cvc4,z3,altergo"])
if unit:
args.extend(["-u", unit])
proc = subprocess.Popen(["gnatprove"] + args + ["-XCEMENT_BUILD_STEP=compile"], env=env)
logger.debug(f"Popen: {proc.args}")
proc.communicate()
os.remove(project_path_file)
return proc.returncode

if __name__ == "__main__":
args = parser.parse_args(sys.argv[1:])
Expand All @@ -170,17 +204,20 @@ if __name__ == "__main__":
gprargs = ["-XGNEISS_ROOT=" + os.path.abspath(args.gneiss_root)]
logger.info("Gneiss root at " + gprargs[0])
build_dir = os.path.abspath(args.build_dir)
root_dir = os.path.abspath(args.root_fs)
if args.config.endswith(".xml"):
if args.command == "build":
root_dir = os.path.abspath(args.root_fs)
gpr_compile(args.config,
os.path.abspath(args.gneiss_root),
build_dir,
root_dir,
args.paths,
args.platform,
logger,
args.verbose)
elif args.config.endswith(".gpr"):
gpr_edit(args.config, os.path.abspath(args.gneiss_root), build_dir, args.paths, logger)
elif args.command == "edit":
gpr_edit(args.project, os.path.abspath(args.gneiss_root), build_dir, args.paths, logger)
elif args.command == "prove":
exit(gpr_prove(args.project, os.path.abspath(args.gneiss_root), build_dir, args.paths, args.steps, args.unit, logger))
else:
logger.error("Unknown file type: " + args.config)
logger.error(f"Command {args.command} not implemented")
exit(1)
116 changes: 0 additions & 116 deletions init/gneiss-broker-main.adb

This file was deleted.

16 changes: 0 additions & 16 deletions init/gneiss-broker-main.ads

This file was deleted.

77 changes: 0 additions & 77 deletions init/gneiss-broker-message.ads

This file was deleted.

Loading