Coder Social home page Coder Social logo

pedrolamarao / metal Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 1.0 1.7 MB

Metal is a research project on "bare metal" software engineering.

License: GNU General Public License v3.0

C++ 95.18% CMake 0.01% C 0.10% Kotlin 4.43% Assembly 0.28%
bare-metal gradle cpp asm

metal's Introduction

project metal

ubuntu windows

summary

Welcome to project Metal!

Metal is a research project on "bare metal" software engineering.

For more information on this project’s mission, ambitions and aims, see GOAL.

prepare

Metal is built with an LLVM based toolset.

JDK 17 or newer is required in either environment JAVA_HOME or PATH.

The following tools are required in gradle property metal.path or environment PATH.

  • CMake 3

  • GNU grub 2

  • LLVM 16 or newer

  • Ninja

  • QEMU 6.0 up to 7.2

For more information, see TOOLS.

build

Metal is built by Gradle Metal.

To assemble everything for host: ./gradlew build This task shall compile and run modules and unit test programs.

To assemble everything for target i686-elf: ./gradlew build -Pmetal.target=i686-elf This task shall compile and run modules and QEMU emulated system test programs.

Currently, only targets host and i686-elf are supported. We expect to include target x86_64-elf very soon.

To clean everything: ./gradlew clean

verify

Metal is verified by automated tests.

For more information, see TEST.

The check task runs all verifications, and the test task runs test programs.

metal's People

Contributors

pedrolamarao avatar

Stargazers

Trevor Wang avatar Trevor Jones avatar Daniel Louro Costa avatar

Watchers

 avatar James Cloos avatar Trevor Jones avatar  avatar

Forkers

lopesivan

metal's Issues

Run test suites which assert full machine state

Enhance everything so that Gradle can run test suites with test cases capable of asserting machine status. This implies that, after termination, the test runner must obtain full machine status from the emulator, and compare that to expected values.

Make it comfortable to define hundreds of test cases

Currently, adding a test case requires adding a new Gradle project. True, subproject configuration eases this process. However, one needs to (1) add a new Gradle project, (2) add this new project to the multiproject configuration, (3) update the IDE to perceive the new project. Adding a new test case should require a single step.

Build and install tools inside the tree

Currently, tools scripts have a weird directory setup based on $HOME.
There is no need to share these tools.
Let's just install inside ${projectDir}/tools.

Support pure unit tests

We must support pure unit testing of components. These must target the host with a proper toolset. Then, gtest should be enough.

Update to GCC 10.2

Clang is cool but for some misterious reason does not cross-compile to i386-pc-elf. Go back to GCC with version 10.2.

Explore QEMU `-kernel` without GRUB

According with documentation, QEMU is able to directly load a Multiboot kernel. This way, we could eliminate GRUB from the test equation.

Create new Gradle plugins for native components

In short, Gradle Inc. shows little interest evolving its native tools. Cross compilation is not on the roadmap. The last issue closed on Gradle native was 18 December 2019.

Fundamentally, we need library projects to provide for open sets of targets.

Suppose a fully mature x86 library. It provides for architectures x86_16, x86_32 and x86_64, for any machine, any system and any ABI. If we build x86 unit tests on x86_64-linux-gnu, Gradle must match and build the base library for x86_64-any-any-any. If we build a certain depedent application for x86-pc-none-elf, Gradle must match and build the x86 library for x86-any-any-any.

Currently, Aasgard avoids this need by requiring a x86_64-any-any-any host and lying to Gradle. We tell Gradle that libraries support targetMachines = [ machines.linux.x86, machines.linux.x86_64]. Then, all unit tests require targetMachines = [ machines.linux.x86_64] and all emulator tests require targetMachines = [ machines.linux.x86 ].

Design I/O port concept

In order to decouple interfaces such as pic and cmos from the architecture, these things are currently defined as templates on a "port" type. This allows pure unit tests. We need to specify what, exactly, is a "port".

Add `debian.sh` for preparing Debian to build tools

We have adequate scripts to build the necessary cross tools. Unfortunately, we lost all dependencies installed during development of the scripts. Also, there are some optional but useful stuff missing: gdb could benefit for expat, for example. Rerun the scripts in an empty Debian system and record the necessary dependencies in tools/debian.sh.

Move unit testing experiment to a separate branch

The unit testing experiment is all about cross-compilation.
It requires the build system to be able to build for various targets, including the host.
Currently, we trick the build system to produce the required variants.
This is disturbing other more important experiments.
Moving to a separate branch is appropriate.

Define test cases as artifacts of the main project

Currently, the test machinery requires a new Gradle project per test case. Improve this machinery such that each test case becomes an artifact of the main project -- so that "foo" test cases live inside project "foo".

Deal with "graft syntax" in `GradleStandaloneCompile`

grub-mkstandalone embbeds files with full path in the image. To "relocate" files it is necessary to use a "graft syntaxs". Deal with this somehow in GradleStandaloneCompile. It is unusable as it currently stands.

Define test program protocol

Test programs need to communicate test results to test drivers. Define a protocol for this.

Early experiments indicate it is sufficient to define well known ELF public symbols. Writing on the test result symbol is terminating the test. Proper timeouts shall cover anomalous tests.

GDB is capable of watching for writes on well known locations. This should be sufficient for a driver to program GDB into stopping on write onto the test result locations. With the program stopped, the driver has full access to the machine state via GDB.

Run cross pure tests with qemu-user

Currently, I can't run unit tests built for x86(32) architectures. My development environment is Windows Subsystem for Linux version 1 which emulates x86(64) exclusively.

Although it is a sad limitation, this brings to light the need to emulate pure tests also. We could do that with QEMU user emulation.

We need a test plugin capable of running tests in QEMU user emulation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.