Giter Site home page Giter Site logo

m2tools's Introduction

Portable toolchain

What is this? Well, very simple toolchain for custom CPU architectures, it contain everything for writing programs in assembler. Whole toolchain is written in pure C99 so, once you will port C compiler for your architecture you should be able to run this toolchain on your platform too.

Documentation

Documentation can be found in form of markdown files in doc folder. Following links bring you to individual chapters.

Build

As build environment CMake is used. So basically you just

$ cmake -S . -B build && cmake --build build/

and you are done. For more details please visit build help.

Supported architectures

  • i8080

License

Copyright © 2021 Vladislav Mlejnecký [email protected]

This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See COPYING file for more details.

m2tools's People

Contributors

vladism avatar

Stargazers

 avatar

Watchers

 avatar  avatar

m2tools's Issues

Bug in comments

For some reason comments in assembler source code doesn't work. They get treated as with potential instructions and then back-end going to throw syntax error as its input isn't valid instruction.

According to usage document comment start with semicolon and continues till end of line. But for example source, file test.asm containing following:

; This is comment

parsed by assembler like so:

$ i8080-assembler -o test.o test.asm

will emit following.

Token ';' from test.asm+1 is not recognized as valid instruction, label or pseudoinstruction!
Failed to complete pass1 on file test.asm!
Failed to run assembler on test.asm

Missing features of linker script for crt0

With capabilities that linker script and its set eval is offering at this moment it is not possible to write fully functional crt0 routine as there is no way to get informations about how big BSS section is. There should be commands in eval environment that will return size of section or memory. Also start address of section or memory.

Another missing feature of linker script is ability to put data into two memories. Because, data section have to be stored in memory where code is located, thus it will be distributed with binary, and have to be linker against RAM as data section is used for initialized variables and its content is often copied from read only memory into read write memory.

TODO list

  • Add mem_size() and mem_begin()
  • Add section_size() and section_begin()
  • Add relevant information about functions above into doc
  • Find and implement best way to deal with data in two memories problem

Linker script eval symbols

Symbols from linker script, computed one, will get evaluated in order as they appear in linker script file. But when symbol that is not evaluated yet is used in another, zero value is used and no warning or error is emitted.

Expected behaviour: Error will be emitted.

Following sequence in linker script will cause this behaviour.

SET FOO 1
SET VAR_A EVAL VAR_B ENDEVAL
SET VAR_B EVAL FOO ENDEVAL

Improvement of linker - symbols in binary tree

At this moment, linker is storing symbols in double linked list. It is easy and lazy way, but performance is suffering from this solution. It would be great to generate binary tree from symbols and use this for searching symbols in linking phase.

Missing tools for working with linker output

At this moment, linker is emitting LDM file, which is custom format used in place where ELF format usually can be found. But for some real work with this toolchain, way to handle LDM files and convert it to some useful format is needed. I would like to see tool for at least MIF files used by Quartus and binary files.

  • Add support for MIF files into filelib
  • Add support for intel hex file into filelib
  • Add tool to convert ldm to mif
  • Add tool that dump ldm into ihex

Also consider possibility of binary output.

Support for i8085

As i8080 support exist try to find a way how to elegantly add support for i8085 CPU. Maybe use some optional argument to assembler and linker to be passed into platformlib? Something like --arch=i8085?

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.