4.2. eCos

4.2.1. Setting up and running EcMasterDemo

  1. Build the eCos kernel with the parameters associated to the application

    As a starting point there is a eCos configuration file (.ecc) file located at SDK/LIB/eCos/x86/.

    eCos is unable to get command line parameters for main(). The parameters for the application are build in the kernel via the configuration tool ( Arguments to main ).

    To use an other example with different parameters, the kernel has to be rebuild.

    For the EcMasterDemo example following line has to be passed to the application via the configuration tool:

    {
        (char *)"name",(char *)"-f",(char *)"perf.xml",
        (char *)" -i8254x",(char *)"1",(char *)"1",(char *)"-v",
        (char *)"3",(char *)"-t",(char *)"60000",(char *)"-perf",(char *)NULL
    }
    
  2. Compile EcMasterDemo

    As a starting point there is the Eclipse project for EcMasterDemo for eCos located at Workspace/eCos/EcMasterDemo. The following macro in Sources/OsLayer/eCos/EcOs.cpp loads the ENI file from disk:

    "MTAB_ENTRY(fat, "/", "fatfs", "/dev/idedisk1/1",  0)"
    
  3. Copy the ENI file to target

    eCos supports only the 8.3 file format. Adjust the ENI file name and the command line in the configuration tool accordingly.

  4. Configure Grub to load the application

    Adjust the Grub menu file:

    title eCos EcMasterDemo
    kernel (hd0,0)/EcMasterDemo
    boot
    
  5. Load and start the EcMasterDemo with Grub

  6. Verify that the EcMasterDemo is running successfully

    The EcMasterDemo takes some seconds to start. The following message is sent to the serial port on startup finished:

    [ 3593.654951] Master state changed from <SAFEOP> to <OP>
    

4.2.2. OS Compiler settings

Besides the general settings from Compiling the EcMasterDemo the following settings are necessary to build the example application for eCos.

Extra include paths
<InstallPath>/SDK/INC/eCos
<InstallPath>/Examples/Common/eCos
Extra source paths
<InstallPath>/Examples/Common/eCos
<InstallPath>/Sources/OsLayer/eCos/EcOs.cpp
Extra library paths to the main EtherCAT components
<InstallPath>/SDK/LIB/eCos
Extra libraries
libEcMaster.a
libemllI8254x.a
libtarget.a