eCosTM Reference Manual
Prev | Chapter 4. System start-up | Next

# System startup — cyg_user_start()

This is the normal entry point for your code. Although a default empty version is provided by eCos, this is a good place to set up your threads (see the section called Thread operations in Chapter 5).

If you are not including the ISO standard C library package then there will not be a `main()` function, so it becomes mandatory to provide this function (see the section called C library startup in Chapter 14).

To set up your own `cyg_user_start()` function, create a function by that name with the following prototype:

`void cyg_user_start`(void);

When you return control from `cyg_user_start()`, `cyg_start()` will then invoke the scheduler, and any threads you created and resumed in `cyg_user_start()` will be executed. The preferred approach is to allow the scheduler to be started automatically, rather than to start it explicitly in `cyg_user_start()`.

Caution
Remember that `cyg_user_start()` is invoked before the scheduler (and frequently the scheduler is invoked as the last step in `cyg_user_start()`), so it should not use any kernel services that require the scheduler.

> Note: If you are supplying your own definition of this function from a C++ file, make sure it has “C” linkage.

Prev | Home | Next
System startup — cyg_package_start() | Up | Native kernel C language API