- Timestamp:
-
02/02/06 23:37:17 (18 years ago)
- Author:
-
JoelSherrill
- Comment:
-
Added Starting with Hello World.
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v9
|
v10
|
|
166 | 166 | |
167 | 167 | GDB should find the source. |
| 168 | = Starting With Hello World = |
| 169 | |
| 170 | |
| 171 | Congratulations! You are a new RTEMS user and you just got the hello world example to run on either a simulator or target hardware. You are on top of the world. So you modify hello world -- wouldn't it be cool to put a sleep between some prints like this: |
| 172 | |
| 173 | {{{ |
| 174 | printf( "Hello world -- line 1\n"); |
| 175 | sleep(1); |
| 176 | printf( "Hello world -- line 2\n"); |
| 177 | }}} |
| 178 | |
| 179 | That ''sleep()'' could be any other call which blocks the caller while time passes. But when you run this program, it only prints "Hello world -- line 1" and appears to lock up. What is happening? |
| 180 | |
| 181 | The answer is simpler than you think. RTEMS is always custom configured to meet the requirements of an application. This means that the number and types of objects and device drivers available are tailored. The hello world application does not require a clock device driver and thus it is not configured. When you added the ''sleep()'', you added a call which needs the clock device driver configured in order to work. All you have to do is added this line to the configure section of the application BEFORE including confdefs.h. |
| 182 | |
| 183 | {{{ |
| 184 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
| 185 | }}} |
| 186 | |
| 187 | As you add to your program, you may have to increase the number of objects configured as well. |
168 | 188 | = Standard IO and File Issues = |
169 | 189 | |