Porting EWL to an Embedded OS

EWL needs to be modified to support an embedded OS. Use the following steps to port EWL to an embedded OS.

  1. Create a copy of EWL_C\PPC_EABI\Project \EWL_C.PPCEABI.stub.mcp and EWL_C\PPC_EABI\Include \PREFIX_EPPC_STUB.h. Rename the files to reflect the name of the OS. For example, if your OS is called MyOS then rename the files to EWL_C.PPCEABI.MyOS.mcp and PREFIX_EPPC_MyOS.h. Note that it is a good practice to retain the copy of the original files.
  2. Select a particular target among the many targets present in the project.
    • In the Target Settings Preference panel, rename the Target Name to reflect the name of the OS. For example if you select the target EWL_C.PPCEABI.stub.S.UC then rename the selected target to EWL_C.PPCEABI.MyOS.S.UC.
    • In the EPPC Target Preference panel, rename the File Name to reflect the name of the OS. For example, if you select the target EWL_C.PPCEABI.stub.S.UC then rename the file name to EWL_C.PPCEABI.MyOS.S.UC.a
  3. In the C/C++ Language Preference panel of EWL_C.PPCEABI.MyOS.mcp, replace the prefix file with PREFIX_EPPC_MyOS.h.
  4. Replace the definition for PREFIX_EPPC_STUB in PREFIX_EPPC_MyOS.h with a definition to represent your OS, such as PREFIX_EPPC_MyOS.
  5. Read your OS documentation and determine whether it has support for providing time, memory allocation, and disk files.
  6. Adjust the following macros in PREFIX_EPPC_MyOS.h depending on the services available in your OS.
    • EWL_OS_DISK_FILE_SUPPORT
    • EWL_OS_ALLOC_SUPPORT
    • EWL_OS_TIME_SUPPORT
    • EWL_CLOCK_T_AVAILABLE
    • EWL_TIME_T_AVAILABLE

      The prefix file PREFIX_EPPC_MyOS.h includes the header file ansi_prefix.PPCEABI.bare.h and the following services:

    • EWL_CONSOLE_SUPPORT
    • EWL_BUFFERED_CONSOLE

      Determine if you want to send any information on the console during development. If you do not want to send debugging information to a console window on the host machine, reset _EWL_CONSOLE_SUPPORT to 0. If you are using either SMC1_UART_PPCE_24.a or SMC2_UART_PPCE_24.a to read from or write to the console window, you need to set EWL_BUFFERED_CONSOLE to 1.

  7. Duplicate and rename EWL files based on OS-specific features . The files are time.stub.c, pool_alloc.stub.c and file_io.stub.c. When you rename these files, replace stub with MyOS.
  8. Insert OS system calls into the stub routines of these files to fetch the relevant information.
  9. Remove the stub files from EWL C.PPCEABI.MyOS.mcp and insert the OS specific files, only if support is provided.
  10. In the pool_alloc_MyOS.c file replace #ifdef_No_Alloc_OS_Support with #if !_EWL_OS_ALLOC_SUPPORT.
  11. In the prefix file PREFIX_EPPC_MyOS.h, define a macro to represent your OS, such as MyOS_PPC_EABI.
  12. In EWL_C.PPCEABI.MyOS.mcp search for Generic_PPC_EABI_OS. At all instances, add an #elif_MyOS_PPC_EABI and enter your OS-specific information.
  13. Modify ExitProcess in __ppc_eabi_init.c [pp] to safely return your application to the OS. __ppc_eabi_init.c[pp] is found in the PowerPC EABI Support directory.
  14. You might need to modify the critical_regions.ppc_eabi.c and sysenv.c files.
  15. Review the other EWL components and identify __va_arg, __mem, runtime and the OS-specific modifications to be made to them.