Skip to content
ASN1SCC: An open source ASN.1 compiler for embedded systems
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci updated to CircleCI 2.0 Sep 10, 2018
ADA_RTL
Antlr acn present-when expression (not completed, but first code is generat… May 25, 2019
Asn1f2 typo fix: Assigment -> Assignment Jan 31, 2018
Asn1f4 updating version number (mantis 0000872, 0000873) Jun 17, 2019
Ast Fix some typos Mar 10, 2019
Backend.c.ST Fix for FSC internal error appearing on Travis Jan 17, 2018
Backend.c typo fix: Assigment -> Assignment Jan 31, 2018
Backend2.ST typo fix: Assigment -> Assignment Jan 31, 2018
Backend2 typo fix: Assigment -> Assignment Jan 31, 2018
BackendAst mantis 0000872 Jun 17, 2019
CommonTypes acn present-when expression (not completed, but first code is generat… May 25, 2019
Daemon.ExampleClient
Daemon asn1scc REST service placeholder Jan 29, 2018
Docs mantis 0000566 May 13, 2018
FrontEndAst acn present when expression May 26, 2019
SPARK_RTL Support for both IDENTIFIER and Relative-OID in both languages (C,Ada) Oct 20, 2018
ST code cleanup - remove unused code Jul 23, 2018
Service.Implementation object identifier and relative oid types Oct 7, 2018
Service asn1scc REST service placeholder Jan 29, 2018
StgAda acn present when expression May 26, 2019
StgC acn present when expression May 26, 2019
StgVarious mantis 0000873 Jun 16, 2019
Tests Fix some typos Mar 10, 2019
asn1crt work on with component constraints Apr 1, 2019
asn1scc mantis issue 0000482 Jan 26, 2016
contrib add CDT project for asn1crt Oct 29, 2016
github-issues issue 186 May 2, 2019
mantis mantis 0000872 Jun 17, 2019
packages/Argu.3.7.0 First successful attempt to export in XML the combined ASN.1 ACN AST Jun 4, 2017
parseStg2 code cleanup - remove unused code Jul 23, 2018
v4Tests acn present when expression May 26, 2019
.gitattributes Properly attribute languages used Nov 12, 2016
.gitignore mantis 864 May 7, 2019
.travis.yml asn1scc REST service placeholder Jan 29, 2018
Asn1.sln work on unique type names Jul 15, 2018
CHANGELOG Configure python3 env in CircleCI,install GNAT too Jun 16, 2016
Dockerfile
Dockerfile.runtime Restored original Dockerfile May 3, 2019
LICENSE.txt LICENSE.txt updated Nov 21, 2015
Makefile Update build instructions for OS/X (#176) Dec 10, 2018
Makefile.Release Remove -al from cp in Makefile.Release Dec 10, 2018
README.md
appveyor.yml asn1scc REST service placeholder Jan 29, 2018
asn1-docker.sh Restored original Dockerfile May 3, 2019
build.sh antlr-3.2 patched for Java 1.8.x Mar 18, 2015
circleci-build.sh Add the CircleCI workaround for GitVersionTask as an official part of… Mar 14, 2018

README.md

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 (gmamais@gmail.com), Thanassis Tsiodras (ttsiodras@gmail.com)

You can’t perform that action at this time.