]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
Prepare for compiling FORB "components" for RTEMS
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 18 Apr 2011 22:27:25 +0000 (00:27 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 18 Apr 2011 22:27:25 +0000 (00:27 +0200)
On Linux, FORB modules are normal shared libraries. The RTEMS support
for shared libraries does not seem to be mature so we use static libraries
for the components. These will have to be linked manually to the final
application.

The FORB components should use FORB_MAIN macro to define their main
function (previously called forb_main).

In this commit I only convert dummy resource to this new syntax. The rest
is leaved for Petr :-)

It will be necessary to implement an equivalent of forbrun for RTEMS. My
idea is to introduce a special ELF section with pointers to FORB_MAIN
functions and these functions will be called at the end of forb_init().

build/aquosa/config.target
build/rtems/config.target
src/forb/src/forb.h
src/frsh/resources/dummy/Makefile.omk
src/frsh/resources/dummy/frm_dummy.c

index ac2d70d6c403b9f72edc01d850e1471716ba4970..973007a3d302962552ff28ec2f03fa406330c0a9 100644 (file)
@@ -22,6 +22,9 @@ USE_LEAF_MAKEFILES=n
 
 OMIT_KERNEL_PASSES=y
 
+# On Linux, FORB "components" are normal shared libraries
+forb_shared_LIBRARIES = shared_LIBRARIES
+
 ########################################
 # Setting of compiler
 ########################################
index 8845b0cf7ce1ad15574756d8f170236afca99b0c..83628af4b880d55039a46f60445abf50a97b6f63 100644 (file)
@@ -22,6 +22,9 @@ USE_LEAF_MAKEFILES=n
 
 OMIT_KERNEL_PASSES=y
 
+# On RTEMS, FORB "components" are static libraries
+forb_shared_LIBRARIES = lib_LIBRARIES
+
 ########################################
 # Setting of compiler
 ########################################
index 2e4a2c4623a79e0ee51cdf2cb98bdf7baa0bdcc4..e44d49cdd4f4e5ab64474336a658c87c949ed19b 100644 (file)
@@ -237,6 +237,23 @@ forb_daemon_ready();
 int
 forb_signal_server_ready();    
 
+/** 
+ * \def FORB_MAIN(id, orb, argc, argv)
+ *
+ * Introduce the definition of the main forb function i.e. the
+ * function which is called upon loading the FORB "component".
+ * 
+ * @param id "C" identifier of the function. On some platforms, it is
+ * used to distinguish multiple FORB_MAIN functions from each other. *
+ *
+ * Example usage: FORB_MAIN(frm_dummy, forb_orb orb, int argc, char *argv[])
+ */
+#ifdef rtems
+#define FORB_MAIN(id, orb, argc, argv) int forb_main_ ## id(orb, argc, argv)
+#else  
+#define FORB_MAIN(id, orb, argc, argv) int forb_main(orb, argc, argv)
+#endif
+
 #ifdef __cplusplus
 } /* extern "C"*/
 #endif
index b3a2b1e2646289819c4d6b9412ae2628df3a1a79..54bb309a0ef5640407fa664e38f15c8500715365 100644 (file)
@@ -2,12 +2,12 @@ default_CONFIG += CONFIG_RESOURCE_DUMMY=y
 default_CONFIG += CONFIG_RESOURCE_DUMMY_VERBOSE=y
 LOCAL_CONFIG_H = dummy_config.h
 
-shared_LIBRARIES = frm_dummy
+$(forb_shared_LIBRARIES) = frm_dummy
 frm_dummy_SOURCES = frm_dummy.c dummy_block.c
 frm_dummy_CLIENT_IDL = res_dummy_idl.idl
 frm_dummy_LIBS = frm forb contract fosa rt ulut fcb_client
 
-shared_LIBRARIES += fra_dummy
+$(forb_shared_LIBRARIES) += fra_dummy
 fra_dummy_SOURCES = fra_dummy.c dummy_block.c
 fra_dummy_LIBS = fra
 fra_dummy_CLIENT_IDL = res_dummy_idl.idl
@@ -15,4 +15,4 @@ fra_dummy_CLIENT_IDL = res_dummy_idl.idl
 include_HEADERS = res_dummy.h
 include_GEN_HEADERS = res_dummy_idl.h
 
-bin_SCRIPTS += frm_dummy
\ No newline at end of file
+bin_SCRIPTS += frm_dummy
index 441f9b10e5bea0105b7cc1fc176fd659fc1c6131..cd52d203459ba1f6689096d6519c6c3c4d6679c3 100644 (file)
@@ -180,7 +180,7 @@ usage(void)
        printf("  -l, --loglevel <number>|<domain>=<number>,...\n");
 }
 
-int forb_main(forb_orb orb, int argc, char *argv[])
+FORB_MAIN(frm_dummy, forb_orb orb, int argc, char *argv[])
 {
        int ret;
        int  opt;