Hi, There are many research interests in being able to dynamically load code in the MCU.
For example, the Contiki OS (dedicated to Wireless Sensor Networks) proposes a solution to dynamically link and relocate native code (in ELF format) in microcontrollers. http://www.sics.se/%7Eadam/dunkels06runtime.pdf One of the arguments of the author is that position independent code is not supported by MSP compilers. But this article was written 4 years ago... I think that dynamic loading of native code could be extremely simplified using PIC. If the on-board linker is simplified, it would leave more space in RAM/ROM for the real application. I have reported the bug (-fPIC silently won't work). Should I also send a feature request ? Fred 2010/10/19 JMGross <[email protected]>: > ----- Ursprüngliche Nachricht ----- > Von: Peter Bigot > Gesendet am: 19 Okt 2010 04:48:41 > >> I doubt there's any explicit support for it. Position independent code is >> mostly irrelevant in embedded systems where there won't be any dynamic >> loading. There are applications where one might replace code with overlays, >> but those can be generally be handled with fixed addresses. I believe >> binutils has support for this, though I haven't used it myself. > > Well, there IS an application where PIC is required (even if it can be solved > using non-PIC code as well): > If you need to place functions in RAM, but don't want to place them there > permanently (by putting them into the data segment and hoping they will be > there untouched ever after PUC). > A prominent example is a flashing function, which is copied from flash to ram > when needed. > > For those functions, however, I'd prefer the use of (inline) assembly, which > can be made either position-independent or explicitely written for the > intended destination. > > There is another possible usage for PIC: if you want to dynamically load code > from a library stored in external flash. Doing so using overlay mechanisms is > far more complex (if it is a collection of more or less complex > and indepentent functions) than using PIC. > My own projects, however, don't have grown so much that they won't fit into > existing flash anymore, so I never needed this so far. > > JMGross > > > > 2010/10/18 Fr=E9d=E9ric Sureau <[email protected]> > >> Hi all, >> >> Does MSPGCC support a way to produce position independent code ? >> >> The assembly generated using "-fPIC" argument seems to still be >> position dependent. >> >> Fred >> >> > > > ------------------------------------------------------------------------------ > Download new Adobe(R) Flash(R) Builder(TM) 4 > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly > Flex(R) Builder(TM)) enable the development of rich applications that run > across multiple browsers and platforms. Download your free trials today! > http://p.sf.net/sfu/adobe-dev2dev > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users
