module to handle assembler

Posted on
  • For some time now, Espruino supports inline assembler.
    To get some experience, I created a replacement for STM32F1 Flash Memory module.
    Idea was to have a binary file on SD which is loaded at runtime which would replace Gordons module.
    First a new module had to be created which supports loading binarys, please see attached ASM-module.
    Commands are:
    var asm = require("ASM") //loads module
    asm.setup(listON) // if true creates a list of loaded assembler functions, used to safe some memory)
    asm.listBinaries() // if setup with true, list all loaded functions
    asm.loadArray(varName,format,arr) //creates a function named by varName, using format to describe in/out values and is given by binary in arr
    asm.loadSD(varName,format,fileName) //loads a binary file given by fileName, from SD-card, creates a function named by varName, using format to describe in/out values
    asm.loadLibrary(lib) // loads a library of functions.
    Next post will give a description about lib object for the Flash assembler module.


    1 Attachment

  • The next post (about lib) is at: http://forum.espruino.com/conversations/257273

    This looks really cool - I'm a bit busy now but this seems like it could make loading assembler modules a lot easier.

    I wonder - this is slightly different, but what do you think about using the same file format as GCC? It contains the function names and argument types, and would make loading C or Assembler code trivial... You'd just compile it directly and then load the '.o' file into Espruino.

    I don't know if that's possible or not or whether some other linkage is required, but it could be possible?

  • I'm using flat assembler from Thomasz Grysztar.
    This was the only free assembler I found for ARM supporting thumb and running on windows.
    It creates a bin-file which is used to upload binary data to Espruino.
    My sources are short, using pc-relative adressing, so I don't need linking.
    There is another file with extension .fas, but I don't find a tool to interpret this.

  • I guess if the flat assembler works... Being written in assembler itself it's not that portable though :) The Web IDE assembler now does labels and quite a large amount of assembler instructions - if you find something that won't compile I'd be interested to see what it is.

  • Just to add: The ASM module referenced here is probably not needed any more.

    When you write assembler it's now assembled into a 'flat string' which is stored in the RAM dedicated to variable storage. It means that you can now save() assembled code and it'll 'just work'.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

module to handle assembler

Posted by Avatar for JumJum @JumJum

Actions