Git Product home page Git Product logo

bogdanni / asn1scc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maxime-esa/asn1scc

0.0 1.0 0.0 11.26 MB

ASN1SCC: An open source ASN.1 compiler for embedded systems

Home Page: https://www.thanassis.space/asn1.html

License: Other

Ada 21.31% C# 1.77% GAP 0.87% Batchfile 0.02% F# 65.42% Python 1.56% Dockerfile 0.01% Makefile 0.48% Shell 0.35% C 4.72% CSS 0.60% HTML 2.89% C++ 0.02%

asn1scc's Introduction

Build and Test Status of ASN1SCC on Circle CI

For the impatient: if you already know what ASN.1 and ASN1SCC is, and just want to run the ASN1SCC compiler:

docker pull ttsiodras/asn1scc
docker run -it ttsiodras/asn1scc

...and follow the instructions shown.

Executive summary

This is the source code of the ASN1SCC compiler - an ASN.1 compiler that targets C and Ada, while placing specific emphasis on embedded systems. You can read a comprehensive paper about it here (PDF), or a blog post with hands-on examples here. Suffice to say, if you are developing for embedded systems, it will probably interest you.

Compilation

Common for all OSes

First, install the Java JRE. This is a compile-time only dependency, required to execute ANTLR.

Then depending on your OS:

Under Windows

Install:

  1. A version of Visual Studio with support for F# .

  2. Open Asn1.sln and build the Asn1f4 project (right-click/build)

Under OSX

  1. Install the Mono MDK.

  2. Execute make - and the compiler will be built.

Under Linux

  1. Install the mono development tools, as well as the FSharp compiler itself. Under Debian-based distributions, as of September 2018, the packages below cover all dependencies:

    sudo apt-get install -y mono-devel mono-complete fsharp mono-xbuild \
       python3 gnat-6 gcc g++ make openjdk-8-jre nuget \
       libgit2-dev libssl-dev
    
    
  2. Build the compiler, via...

    make
    
  3. Then run the tests - if you want to:

    cd v4Tests
    make
    

Note that in order to run the tests you need both GCC and GNAT. The tests will process hundreds of ASN.1 grammars, generate C and Ada source code, compile it, run it, and check the coverage results.

Continuous integration and Docker image

ASN1SCC is setup to use CircleCI for continuous integration. Upon every commit or merge request, we instruct CircleCI to...

  • create on the fly a Docker image based on Debian Stretch
  • build ASN1SCC with the new code inside that image
  • then run all the tests and check the coverage results.

In addition, a runtime docker image can be build with the following command which can then be used instead of installing ASN1SCC on the host (or any of the dependencies or build tools).

DOCKER_BUILDKIT=1 docker build -t asn1scc-runtime -f Dockerfile.asn1scc-runtime .

...and your Docker will build an "asn1scc-runtime" Docker image. This image can be used as if the ASN1SCC is installed on the host system. The asn1-docker.sh bash script can be used to wrap the docker run ... call into a easy to use compiler command. For example, let's assume your ASN.1 files are in a folder as /tmp/myasnfiles/. You can use this script file like calling asn1.exe file as if it is on your host system. The ASN1SCC will be executed inside a docker container and the generated files will appear in the folder where the script was called. Assuming that the ASN.1 file is named sample.asn, here is a sample call of the script (asn1-docker.sh script is inside /opt/asn1scc folder and the docker image named asn1scc-runtime is already built.)

$ pwd
/tmp/myasnfiles
$ cat sample.asn 
MY-MODULE DEFINITIONS AUTOMATIC TAGS ::= BEGIN

Message ::= SEQUENCE {
    msgId INTEGER,
    myflag INTEGER,
    value REAL,
    szDescription OCTET STRING (SIZE(10)),
    isReady BOOLEAN
}

END
$ /opt/asn1scc/asn1-docker.sh -c -uPER sample.asn
$ ls 
acn.c  asn1crt.c  asn1crt.h  real.c  sample.asn  sample.c  sample.h

As can be seen above, the host does not have the ASN1SCC installation, but only the asn1scc-runtime docker image.

Usage

The compiler has many features - documented in Chapter 10 of the TASTE manual, and you can see some simple usage examples in a related blog post.

You can also check out the official TASTE project site.

Credits

George Mamais ([email protected]), Thanassis Tsiodras ([email protected])

asn1scc's People

Contributors

usr3-1415 avatar ttsiodras avatar maxime-esa avatar hcorg avatar bogdanni avatar echatzig avatar alexfmpe avatar hakanurhan avatar realpsyence avatar vgheo avatar

Watchers

 avatar

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.