Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Fluent Interop 1.0


  • Please log in to reply
24 replies to this topic

#21 Illishar

Illishar

    Advanced Member

  • Members
  • PipPipPip
  • 146 posts

Posted 16 January 2011 - 12:17 PM

No wait, wouldn't work. If you add the elf object file as a binary resource, in your project (would be the easiest), the start address would still be wrong. You'd have to do the relocating at runtime. (Still relocating seems easier than symbol mapping.) In your current loader, are you doing 'relocation' on your addresses? Eg. adding the offset or something.

#22 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 16 January 2011 - 12:26 PM

You'd have to do the relocating at runtime.

Or use relocatable (position-independent) code.

#23 Illishar

Illishar

    Advanced Member

  • Members
  • PipPipPip
  • 146 posts

Posted 16 January 2011 - 12:55 PM

A more throughout book for the subject: http://www.iecc.com/linker/ It wonder if the netmf doesn't already have a dynamic linker/loader somewhere.

#24 Illishar

Illishar

    Advanced Member

  • Members
  • PipPipPip
  • 146 posts

Posted 16 January 2011 - 12:57 PM

Or use relocatable (position-independent) code.


Doesn't that involve using an MMU?

#25 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 16 January 2011 - 03:05 PM

In your current loader, are you doing 'relocation' on your addresses? Eg. adding the offset or something.

Is this question directed at me? All the code I'm generating is position-independent. The instruction set makes this easy. This is one thing I like about my framework: all the work I did was really to support the "fluent compiler"; once you have your hands on a bunch of opcodes, the support you need to invoke them is trivial (like 5 lines of code or less). For self-contained code, there's no need to care about base addresses.

Having to care about addresses comes into play when your code has to call out to other code. The way I addressed this problem in my system is that, when calling your code, the interop entry point arranges to pass in, in addition to whatever user arguments are present, one additional argument which is a vector of "interesting" firmware entry points. So when code in my system needs to call out to e.g. SetPinState, it just jumps to the address found at offset 8 of this vector.

When one of my compiled routines calls another, it passes along this vector (though it may not bother if it knows that the callee makes no external calls itself). The interesting case came up when I was trying to use code generated by my system as an interrupt service handler. In this case the code is being invoked by a caller who is not under my control (the micro framework's interrupt handling routines), and so there's no way to get it to pass you this magic vector. If you are interested you can look at the comments for Fluent Interop version 1.2 if you wanted to see how I handle this.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.