You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • @Gordon, you opened Pandora's box, so I decided to "let's see what inside".
    My background is assembler long time ago, but not ARM.

    1. first step playing around with given example.
      It works, good news. So have a look at minor changes.
      Add 7 instead of 2 is simple by altering first command to movs r2, #7 .
      Double given parameter simply add this adds r0,r0,r0
      BTW, interesting to work with 3 parameters.
    2. switch to external assembler.
      The internal assembler, even if limited is a good starting point.
      By searching for a "full blown" assembler I found http://flatassembler.net/
      At this point I learned something about THUMBS and ARM commands.
      To get same results as in Gordons example this needs to be done.

      thumb;
          ldr    r2, [hugo]
          mov.w    r3, #57344
          str    r3, [r2, #0]
          str    r3, [r2, #4]
          bx lr
      hugo:   dw 0x40010810
      

    As you can see, first line switches to thumb mode.
    One of the main futures of an assembler is last line. You don't have to count the number of word ´s to get the adress of GPIO adress.
    Ok, there is another difference, use dw instead of .word

    1. after compilation we get a bin file.
      Right now I read this with Hex Editor and type it in manually. Don't forget to switch the bytes ;-)
    2. What about using 2 parameters for a function like this adder(2,3)

      var adder = E.asm("long(long,long)",
      "bx  lr");
      adder(2,3);
      

    And I get an error no caller for argument 438

    1. tried with all given datatypes, to see whats given by
      int, bool and Pin return an error.
    2. Where are the parameters, and how could I interpret those ?
      Big question, as far as I can see, r0 is used in the example for input and return value
      If somebody has more examples, please share it
    3. Whats now, hmmm
      During development of Display driver for ILI9341 Gordon mentioned something like "we could speed it up by using SPI.send with repeat option".
      Would it be possible to have something like a list of "interesting entrypoints". There is something like spi_sender_software in jswrap_spi_i2c.c
      This could be an additional file created during compilation of new version, and could be used similiar to boardinfo. A new processor for Web IDE could replace adresses and ....
      Hey Gordon, its you who opened Pandora's box ;-))

    Juergen

About

Avatar for JumJum @JumJum started