8
"C" Programming Guide For Optimus S/R
This routine waits until sys_msec is changed. And sys_msec is a system variable that is
updated each 5 ms by background interrupt. If optimization is enabled, this whole
routine is truncated as it is meaningless (which is a dead-loop). To avoid this, the type
identifier "
volatile
" can be used to suppress optimization.
-c: create object but no link
-e cerr.lst: create error list file "CERR.LST"
After compilation is completed, a relocatable object file named "
program_name.REL
" is
created which can be used later by the linker to create the executable object program. As the
compiler compiles the program into assembler form during the process, an accompanying
assembler source file "
program_name.ASM
" is also created. This file helps in debugging if
necessary. If any error occurs, they will be put into the file "
CERR.LST
" for further
examination.
2.3.3 Link
If the C source programs are successfully compiled into relocatable object files, the linker
must be used to create the absolute objects and then the file can be downloaded to the target
machine's flash memory for execution. However, a linker map file must be created.
TULINK FILENAME.LNK
This map file "
FILENAME.LNK
" is used to instruct the linker to allocate absolute addresses
of code, data, constant, and so on according to the target machine environments. This is a
lengthy process as it depends on the hardware architecture. Fortunately, a sample linker
map file is provided and few steps are required to customize it for your own need, while
leaving hardware-related stuff unchanged.
From the following sample linker file, you can see that only the file names need to be
changed (underlined & boldfaced sections). If the linking is successful, an absolute object
file names "
FILE1.ABS
" is created. Besides, a file named "
FILE1.MAP
" lists all code and
variable addresses, and, error messages if there is any.
Sample Linker File
-lm -lg -ll /* parameters for TULINK, do not change */
File1.rel /* your C program name */
File2.rel /* your C program name */
......
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...