Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/03/08 11:30
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#155431 - For user code you would...
Responding to: ???'s previous message
You let the user provide his own USERCODE.C and USERCODE.H. You provide all your stuff pre-compiled as either .OBJ or .LIB files. Your user then compiles his modules and links his USERCODE.OBJ to the OBJ/LIB that you provide into the final .HEX which gets loaded into the target MCU.

The above is the simplest and most reliable way it can all work.

Of course you could go off and devise any number of other schemes where the users code is compiled and linked independently so it can be loaded at run time (maybe even ISP by the main code module). However in these cases in order to share functions it is necessary to define specific entry points in the main module via some type of function vector table.

If you really really must do the the latter thing above it is then best if you decide the specific functions to be shared and provide a documented interface between the function table main code and the user code. This is best achieved by using assembler language to craft up the interface and fully just use registers to pass values back and forth.

This gets all very messy to try to provide any other more general purpose set of functionality in sharing across languages, compilers and even tool versions. And then you start to look how to go about how to provide for either user global data and local data variables in the user code and how the particular main code compiler provides for that and you end up with a maintenance nightmare. I say this in a general case for small resource embedded systems and particular for '51 type MCUs.

In the end the first described scheme above is the only really practical and reliable way to make this work without having to administer some severe restrictions on the way the user code works and what resources are available to it. If I was forced to have to make something more along the lines of the second scheme then I would limit the user code to ASSEMBLER ONLY and REGISTER INTERFACE and PREDEFINED CALLBACKS in the main and maybe NO DATA variables.

Michael Karas


List of 31 messages in thread
TopicAuthorDate
Info exchange between different compilers            01/01/70 00:00      
   cumbersome, but possibly possible            01/01/70 00:00      
   This is how others would do it in days gone by            01/01/70 00:00      
      all well and good            01/01/70 00:00      
   Common Method...            01/01/70 00:00      
      I totally agree            01/01/70 00:00      
      Ok lets leave aside the issue of different compile            01/01/70 00:00      
         Fundamentals            01/01/70 00:00      
            You use a Linker............            01/01/70 00:00      
         Lots of issues here            01/01/70 00:00      
            +            01/01/70 00:00      
               For user code you would...            01/01/70 00:00      
                  Also consider....            01/01/70 00:00      
                     Also consider.... yes            01/01/70 00:00      
                        Ah Ha....Save an MCU at what cost?            01/01/70 00:00      
                           Save an MCU at what cost? - too high            01/01/70 00:00      
                  For user code you would.............            01/01/70 00:00      
                     WHY??            01/01/70 00:00      
                        Maybe...            01/01/70 00:00      
                           now we are going to OS and \'loaded application\'            01/01/70 00:00      
                              More "Horse Power" ?            01/01/70 00:00      
                                 HW or OS            01/01/70 00:00      
                                    How would you rate this ...            01/01/70 00:00      
                                       OK            01/01/70 00:00      
                                    No Bees Left            01/01/70 00:00      
                                 Not the MHz it is the core            01/01/70 00:00      
                                    Ap, I'm waiting ....            01/01/70 00:00      
                                       It wasn't asked in relevance to any Mcu            01/01/70 00:00      
                                          so what is it doing here???            01/01/70 00:00      
                                             You tell me that .            01/01/70 00:00      
                                                I AM sorry, but I lost my crystal ball.            01/01/70 00:00      

Back to Subject List